1
0
mirror of https://github.com/pgbackrest/pgbackrest.git synced 2024-12-12 10:04:14 +02:00
pgbackrest/test/Dockerfile
David Steele 6f562fba60 Migrate coverage testing to C and remove dependency on lcov.
lcov does not seem to be very well maintained and is often not compatible with the version of gcc it ships with until a few months after a new distro is released. In any case, lcov is that not useful for us because it generates reports on all coverage while we are mainly interested in missing coverage during development.

Instead use the JSON output generated by gcov to generate our minimal coverage report and metrics for the documentation.

There are some slight differences in the metrics. The difference in the common module was due to a bug in the old code -- build/common was being added into common as well as being reported separately. The source of the two additional branches in the backup module is unknown but almost certainly down to how exclusions are processed with regular expressions. Since there is additional coverage rather than coverage missing this seems fine.

Since this was pretty much a rewrite it was also a good time to migrate to C.
2024-05-31 14:52:07 +10:00

39 lines
1.7 KiB
Docker

# export PGB=pgbackrest;export PGB_IMAGE=$PGB/test:u22-main;PGB_REPO=~/Documents/Code/$PGB
# docker build --squash -f $PGB_REPO/test/Dockerfile -t $PGB_IMAGE .
# docker run --privileged -itd --name $PGB-test -h $PGB-test -v $PGB_REPO:/home/vagrant/$PGB $PGB_IMAGE
#
# When running test.pl --code-format permissions may get munged. Run this from the pgbackrest/test path to fix them:
# find .. | grep "\.[ch]$" | xargs xattr -rc && find .. | grep "\.[ch]$" | xargs chmod -x
FROM ubuntu:jammy
# Install packages
RUN apt-get update
RUN DEBIAN_FRONTEND=noninteractive apt-get install --no-install-recommends -y \
sudo vim htop jq rsync sysstat curl \
libdbd-pg-perl libxml-checker-perl libyaml-perl \
devscripts build-essential lintian git cloc txt2man debhelper libssl-dev zlib1g-dev libperl-dev libxml2-dev liblz4-dev \
liblz4-tool libpq-dev autoconf-archive zstd libzstd-dev bzip2 libbz2-dev pkg-config libyaml-dev libc6-dbg wget meson \
ccache valgrind tzdata uncrustify libssh2-1-dev
# Install Docker
RUN groupadd -g5000 docker
RUN curl -fsSL https://get.docker.com | sh
# Create vagrant user
RUN adduser --ingroup=docker -uid=5000 --disabled-password --gecos \"\" vagrant
# Mark git path as safe
RUN sudo -u vagrant git config --global --add safe.directory /home/vagrant/pgbackrest
# Configure sudo
RUN echo '%docker ALL=(ALL) NOPASSWD: ALL' >> /etc/sudoers
# Mount tmpfs at /home/vagrant/test for faster testing
RUN sudo -u vagrant mkdir -m 770 /home/vagrant/test
RUN echo 'tmpfs /home/vagrant/test tmpfs size=4096M 0 1' >> /etc/fstab
USER vagrant
WORKDIR /home/vagrant
ENTRYPOINT sudo rm -f /var/run/docker.pid && sudo mount -a && sudo dockerd