[Libguestfs] [libnbd PATCH 3/3] ci: Rework the build script to run check-valgrind properly

Martin Kletzander mkletzan at redhat.com
Wed Jun 30 15:18:21 UTC 2021


In order to run check-valgrind we need to skip the broken tests twice, so move
that code into its own functions to clean up.  After that run check-valgrind by
default.  It is still skipped on some platforms where it is not working at the
moment and it does not look like it is related to libnbd.

Also regenerate the container and cirrus files as the libnbd patches for
libvirt-ci were finally pushed to master.

Signed-off-by: Martin Kletzander <mkletzan at redhat.com>
---
 .gitlab-ci.yml                               |  3 +
 ci/build.sh                                  | 96 +++++++++++---------
 ci/cirrus/freebsd-12.vars                    |  4 +-
 ci/cirrus/freebsd-13.vars                    |  4 +-
 ci/cirrus/freebsd-current.vars               |  4 +-
 ci/cirrus/macos-11.vars                      |  5 +-
 ci/containers/centos-8.Dockerfile            |  5 +-
 ci/containers/centos-stream-8.Dockerfile     |  5 +-
 ci/containers/debian-10.Dockerfile           |  5 +-
 ci/containers/debian-sid.Dockerfile          |  5 +-
 ci/containers/fedora-33.Dockerfile           |  7 +-
 ci/containers/fedora-34.Dockerfile           |  7 +-
 ci/containers/fedora-rawhide.Dockerfile      |  7 +-
 ci/containers/opensuse-leap-152.Dockerfile   |  5 +-
 ci/containers/opensuse-tumbleweed.Dockerfile |  5 +-
 ci/containers/ubuntu-1804.Dockerfile         |  5 +-
 ci/containers/ubuntu-2004.Dockerfile         |  5 +-
 17 files changed, 98 insertions(+), 79 deletions(-)

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 99896d471475..43fba2e84cfa 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -224,6 +224,7 @@ x64-opensuse-leap-152:
     - x64-opensuse-leap-152-container
   variables:
     NAME: opensuse-leap-152
+    CHECK_VALGRIND: skip
 
 x64-opensuse-tumbleweed:
   extends: .native_build_job
@@ -231,6 +232,7 @@ x64-opensuse-tumbleweed:
     - x64-opensuse-tumbleweed-container
   variables:
     NAME: opensuse-tumbleweed
+    CHECK_VALGRIND: skip
 
 x64-ubuntu-1804:
   extends: .native_build_job
@@ -246,6 +248,7 @@ x64-ubuntu-2004:
     - x64-ubuntu-2004-container
   variables:
     NAME: ubuntu-2004
+    CHECK_VALGRIND: skip
 
 x64-freebsd-12-build:
   extends: .cirrus_build_job
diff --git a/ci/build.sh b/ci/build.sh
index 7d62a84a5d4b..2811fc4535f2 100755
--- a/ci/build.sh
+++ b/ci/build.sh
@@ -2,42 +2,7 @@
 
 set -e
 
-main() {
-    MAKE="${MAKE-make -j $(getconf _NPROCESSORS_ONLN)}"
-
-    autoreconf -if
-
-    CONFIG_ARGS="\
---enable-gcc-warnings \
---enable-fuse \
---enable-ocaml \
---enable-python \
---enable-golang \
---with-gnutls \
---with-libxml2 \
-"
-
-    if test "$GOLANG" != "skip"
-    then
-       CONFIG_ARGS="$CONFIG_ARGS --enable-golang"
-    fi
-
-    ./configure $CONFIGURE_OPTS $CONFIG_ARGS
-
-    $MAKE
-
-    if test -n "$CROSS"
-    then
-        echo "Possibly run tests with an emulator in the future"
-        return 0
-    fi
-
-    if test "$(uname)" != "Linux"
-    then
-        echo "Tests are temporarily skipped on non-Linux platforms"
-        return 0
-    fi
-
+skip_tests() {
     # Add a way to run all the tests, even the skipped ones, with an environment
     # variable, so that it can be set fora branch or fork in GitLab.
     if test "$SKIPPED_TESTS" != "force"
@@ -79,12 +44,9 @@ main() {
             done
         done
     fi
+}
 
-    # We do not want the check to cause complete failure as we need to clean up
-    # the skipped test cases
-    failed=0
-    $MAKE check || failed=1
-
+restore_tests() {
     find . -name '*_skipped_test' -print | while read test_case_bckup
     do
         test_case="${test_case_bckup%_skipped_test}"
@@ -93,13 +55,57 @@ main() {
         rm -f "${test_case}"
         mv -f "${test_case_bckup}" "${test_case}"
     done
+}
+
+run_checks() {
+    skip_tests
+    failed=0
+    ${MAKE} "$@" || failed=1
+    restore_tests
+    return $failed
+}
+
+main() {
+    MAKE="${MAKE-make -j $(getconf _NPROCESSORS_ONLN)}"
+
+    autoreconf -if
+
+    CONFIG_ARGS="\
+--enable-gcc-warnings \
+--enable-fuse \
+--enable-ocaml \
+--enable-python \
+--enable-golang \
+--with-gnutls \
+--with-libxml2 \
+"
+
+    if test "$GOLANG" != "skip"
+    then
+       CONFIG_ARGS="$CONFIG_ARGS --enable-golang"
+    fi
+
+    ./configure $CONFIGURE_OPTS $CONFIG_ARGS
+
+    $MAKE
+
+    if test -n "$CROSS"
+    then
+        echo "Possibly run tests with an emulator in the future"
+        return 0
+    fi
+
+    if test "$(uname)" != "Linux"
+    then
+        echo "Tests are temporarily skipped on non-Linux platforms"
+        return 0
+    fi
 
-    # Now it is safe to fail
-    test "$failed" -eq 0
+    run_checks check
 
-    if test "$CHECK_VALGRIND" = "force"
+    if test "$CHECK_VALGRIND" != "skip"
     then
-        $MAKE check-valgrind
+        run_checks check-valgrind
     fi
 
     if test "$DIST" != "skip"
diff --git a/ci/cirrus/freebsd-12.vars b/ci/cirrus/freebsd-12.vars
index cb5c83f06c0f..28f7cc2bea45 100644
--- a/ci/cirrus/freebsd-12.vars
+++ b/ci/cirrus/freebsd-12.vars
@@ -2,7 +2,7 @@
 #
 #  $ lcitool variables freebsd-12 libnbd
 #
-# https://gitlab.com/libvirt/libvirt-ci/-/commit/7f787787a85647c3045ebfa6634966b4b96d5d99
+# https://gitlab.com/libvirt/libvirt-ci/-/commit/4a5cf5007ce3bb5e330b9f3361c5931b072ebe28
 
 PACKAGING_COMMAND='pkg'
 CCACHE='/usr/local/bin/ccache'
@@ -10,4 +10,4 @@ MAKE='/usr/local/bin/gmake'
 NINJA='/usr/local/bin/ninja'
 PYTHON='/usr/local/bin/python3'
 PIP3='/usr/local/bin/pip-3.7'
-PKGS='autoconf automake bash-completion ca_root_nss ccache diffutils fusefs-libs3 git glib gmake gnutls go gsed jq libev libtool libxml2 nbd-server nbdkit ocaml ocaml-findlib p5-Pod-Simple perl5 pkgconf py37-flake8 python3 qemu'
+PKGS='autoconf automake bash-completion ca_root_nss ccache diffutils fusefs-libs3 git glib gmake gnutls go gsed jq libev libtool libxml2 nbd-server nbdkit ocaml ocaml-findlib p5-Pod-Simple perl5 pkgconf py37-flake8 python3 qemu valgrind'
diff --git a/ci/cirrus/freebsd-13.vars b/ci/cirrus/freebsd-13.vars
index 41019e318f99..e577fa5197b8 100644
--- a/ci/cirrus/freebsd-13.vars
+++ b/ci/cirrus/freebsd-13.vars
@@ -2,7 +2,7 @@
 #
 #  $ lcitool variables freebsd-13 libnbd
 #
-# https://gitlab.com/libvirt/libvirt-ci/-/commit/7f787787a85647c3045ebfa6634966b4b96d5d99
+# https://gitlab.com/libvirt/libvirt-ci/-/commit/4a5cf5007ce3bb5e330b9f3361c5931b072ebe28
 
 PACKAGING_COMMAND='pkg'
 CCACHE='/usr/local/bin/ccache'
@@ -10,4 +10,4 @@ MAKE='/usr/local/bin/gmake'
 NINJA='/usr/local/bin/ninja'
 PYTHON='/usr/local/bin/python3'
 PIP3='/usr/local/bin/pip-3.7'
-PKGS='autoconf automake bash-completion ca_root_nss ccache diffutils fusefs-libs3 git glib gmake gnutls go gsed jq libev libtool libxml2 nbd-server nbdkit ocaml ocaml-findlib p5-Pod-Simple perl5 pkgconf py37-flake8 python3 qemu'
+PKGS='autoconf automake bash-completion ca_root_nss ccache diffutils fusefs-libs3 git glib gmake gnutls go gsed jq libev libtool libxml2 nbd-server nbdkit ocaml ocaml-findlib p5-Pod-Simple perl5 pkgconf py37-flake8 python3 qemu valgrind'
diff --git a/ci/cirrus/freebsd-current.vars b/ci/cirrus/freebsd-current.vars
index fe2bf0b7d607..01aceca0aaa3 100644
--- a/ci/cirrus/freebsd-current.vars
+++ b/ci/cirrus/freebsd-current.vars
@@ -2,7 +2,7 @@
 #
 #  $ lcitool variables freebsd-current libnbd
 #
-# https://gitlab.com/libvirt/libvirt-ci/-/commit/7f787787a85647c3045ebfa6634966b4b96d5d99
+# https://gitlab.com/libvirt/libvirt-ci/-/commit/4a5cf5007ce3bb5e330b9f3361c5931b072ebe28
 
 PACKAGING_COMMAND='pkg'
 CCACHE='/usr/local/bin/ccache'
@@ -10,4 +10,4 @@ MAKE='/usr/local/bin/gmake'
 NINJA='/usr/local/bin/ninja'
 PYTHON='/usr/local/bin/python3'
 PIP3='/usr/local/bin/pip-3.7'
-PKGS='autoconf automake bash-completion ca_root_nss ccache diffutils fusefs-libs3 git glib gmake gnutls go gsed jq libev libtool libxml2 nbd-server nbdkit ocaml ocaml-findlib p5-Pod-Simple perl5 pkgconf py37-flake8 python3 qemu'
+PKGS='autoconf automake bash-completion ca_root_nss ccache diffutils fusefs-libs3 git glib gmake gnutls go gsed jq libev libtool libxml2 nbd-server nbdkit ocaml ocaml-findlib p5-Pod-Simple perl5 pkgconf py37-flake8 python3 qemu valgrind'
diff --git a/ci/cirrus/macos-11.vars b/ci/cirrus/macos-11.vars
index a33ed5fa7254..0824e81d78ba 100644
--- a/ci/cirrus/macos-11.vars
+++ b/ci/cirrus/macos-11.vars
@@ -2,7 +2,7 @@
 #
 #  $ lcitool variables macos-11 libnbd
 #
-# https://gitlab.com/libvirt/libvirt-ci/-/commit/7f787787a85647c3045ebfa6634966b4b96d5d99
+# https://gitlab.com/libvirt/libvirt-ci/-/commit/4a5cf5007ce3bb5e330b9f3361c5931b072ebe28
 
 PACKAGING_COMMAND='brew'
 CCACHE='/usr/local/bin/ccache'
@@ -10,5 +10,4 @@ MAKE='/usr/local/bin/gmake'
 NINJA='/usr/local/bin/ninja'
 PYTHON='/usr/local/bin/python3'
 PIP3='/usr/local/bin/pip3'
-PKGS='autoconf automake bash-completion ccache cpanminus diffutils flake8 git glib gnu-sed gnutls golang jq libev libtool libxml2 make ocaml ocaml-findlib perl pkg-config python3 qemu'
-CPAN_PKGS='Pod::Simple'
+PKGS='autoconf automake bash-completion ccache diffutils flake8 git glib gnu-sed gnutls golang jq libev libtool libxml2 make ocaml ocaml-findlib perl pkg-config python3 qemu valgrind'
diff --git a/ci/containers/centos-8.Dockerfile b/ci/containers/centos-8.Dockerfile
index 650713990edc..03c917f51d6c 100644
--- a/ci/containers/centos-8.Dockerfile
+++ b/ci/containers/centos-8.Dockerfile
@@ -2,7 +2,7 @@
 #
 #  $ lcitool dockerfile centos-8 libnbd
 #
-# https://gitlab.com/libvirt/libvirt-ci/-/commit/7f787787a85647c3045ebfa6634966b4b96d5d99
+# https://gitlab.com/libvirt/libvirt-ci/-/commit/4a5cf5007ce3bb5e330b9f3361c5931b072ebe28
 
 FROM docker.io/library/centos:8
 
@@ -49,7 +49,8 @@ RUN dnf update -y && \
         qemu-img \
         qemu-kvm \
         sed \
-        util-linux && \
+        util-linux \
+        valgrind && \
     dnf autoremove -y && \
     dnf clean all -y && \
     rpm -qa | sort > /packages.txt && \
diff --git a/ci/containers/centos-stream-8.Dockerfile b/ci/containers/centos-stream-8.Dockerfile
index 6bb5d19e90fe..2b124a35f633 100644
--- a/ci/containers/centos-stream-8.Dockerfile
+++ b/ci/containers/centos-stream-8.Dockerfile
@@ -2,7 +2,7 @@
 #
 #  $ lcitool dockerfile centos-stream-8 libnbd
 #
-# https://gitlab.com/libvirt/libvirt-ci/-/commit/7f787787a85647c3045ebfa6634966b4b96d5d99
+# https://gitlab.com/libvirt/libvirt-ci/-/commit/4a5cf5007ce3bb5e330b9f3361c5931b072ebe28
 
 FROM quay.io/centos/centos:stream8
 
@@ -49,7 +49,8 @@ RUN dnf update -y && \
         qemu-img \
         qemu-kvm \
         sed \
-        util-linux && \
+        util-linux \
+        valgrind && \
     dnf autoremove -y && \
     dnf clean all -y && \
     rpm -qa | sort > /packages.txt && \
diff --git a/ci/containers/debian-10.Dockerfile b/ci/containers/debian-10.Dockerfile
index 0b140b15e0bb..bb6abf99fb04 100644
--- a/ci/containers/debian-10.Dockerfile
+++ b/ci/containers/debian-10.Dockerfile
@@ -2,7 +2,7 @@
 #
 #  $ lcitool dockerfile debian-10 libnbd
 #
-# https://gitlab.com/libvirt/libvirt-ci/-/commit/7f787787a85647c3045ebfa6634966b4b96d5d99
+# https://gitlab.com/libvirt/libvirt-ci/-/commit/4a5cf5007ce3bb5e330b9f3361c5931b072ebe28
 
 FROM docker.io/library/debian:10-slim
 
@@ -49,7 +49,8 @@ RUN export DEBIAN_FRONTEND=noninteractive && \
             python3-dev \
             qemu \
             qemu-utils \
-            sed && \
+            sed \
+            valgrind && \
     eatmydata apt-get autoremove -y && \
     eatmydata apt-get autoclean -y && \
     sed -Ei 's,^# (en_US\.UTF-8 .*)$,\1,' /etc/locale.gen && \
diff --git a/ci/containers/debian-sid.Dockerfile b/ci/containers/debian-sid.Dockerfile
index 29111f99d86a..81f76a19f47c 100644
--- a/ci/containers/debian-sid.Dockerfile
+++ b/ci/containers/debian-sid.Dockerfile
@@ -2,7 +2,7 @@
 #
 #  $ lcitool dockerfile debian-sid libnbd
 #
-# https://gitlab.com/libvirt/libvirt-ci/-/commit/7f787787a85647c3045ebfa6634966b4b96d5d99
+# https://gitlab.com/libvirt/libvirt-ci/-/commit/4a5cf5007ce3bb5e330b9f3361c5931b072ebe28
 
 FROM docker.io/library/debian:sid-slim
 
@@ -49,7 +49,8 @@ RUN export DEBIAN_FRONTEND=noninteractive && \
             python3-dev \
             qemu \
             qemu-utils \
-            sed && \
+            sed \
+            valgrind && \
     eatmydata apt-get autoremove -y && \
     eatmydata apt-get autoclean -y && \
     sed -Ei 's,^# (en_US\.UTF-8 .*)$,\1,' /etc/locale.gen && \
diff --git a/ci/containers/fedora-33.Dockerfile b/ci/containers/fedora-33.Dockerfile
index c6b434f268ea..207f4a070301 100644
--- a/ci/containers/fedora-33.Dockerfile
+++ b/ci/containers/fedora-33.Dockerfile
@@ -2,7 +2,7 @@
 #
 #  $ lcitool dockerfile fedora-33 libnbd
 #
-# https://gitlab.com/libvirt/libvirt-ci/-/commit/7f787787a85647c3045ebfa6634966b4b96d5d99
+# https://gitlab.com/libvirt/libvirt-ci/-/commit/4a5cf5007ce3bb5e330b9f3361c5931b072ebe28
 
 FROM registry.fedoraproject.org/fedora:33
 
@@ -53,10 +53,11 @@ exec "$@"' > /usr/bin/nosync && \
         pkgconfig \
         python3-devel \
         python3-flake8 \
-        qemu \
         qemu-img \
+        qemu-kvm \
         sed \
-        util-linux && \
+        util-linux \
+        valgrind && \
     nosync dnf autoremove -y && \
     nosync dnf clean all -y && \
     rpm -qa | sort > /packages.txt && \
diff --git a/ci/containers/fedora-34.Dockerfile b/ci/containers/fedora-34.Dockerfile
index f6cbbfef7c8e..47569ff00f5e 100644
--- a/ci/containers/fedora-34.Dockerfile
+++ b/ci/containers/fedora-34.Dockerfile
@@ -2,7 +2,7 @@
 #
 #  $ lcitool dockerfile fedora-34 libnbd
 #
-# https://gitlab.com/libvirt/libvirt-ci/-/commit/7f787787a85647c3045ebfa6634966b4b96d5d99
+# https://gitlab.com/libvirt/libvirt-ci/-/commit/4a5cf5007ce3bb5e330b9f3361c5931b072ebe28
 
 FROM registry.fedoraproject.org/fedora:34
 
@@ -53,10 +53,11 @@ exec "$@"' > /usr/bin/nosync && \
         pkgconfig \
         python3-devel \
         python3-flake8 \
-        qemu \
         qemu-img \
+        qemu-kvm \
         sed \
-        util-linux && \
+        util-linux \
+        valgrind && \
     nosync dnf autoremove -y && \
     nosync dnf clean all -y && \
     rpm -qa | sort > /packages.txt && \
diff --git a/ci/containers/fedora-rawhide.Dockerfile b/ci/containers/fedora-rawhide.Dockerfile
index 20d40fb0838c..8fbaa20d3822 100644
--- a/ci/containers/fedora-rawhide.Dockerfile
+++ b/ci/containers/fedora-rawhide.Dockerfile
@@ -2,7 +2,7 @@
 #
 #  $ lcitool dockerfile fedora-rawhide libnbd
 #
-# https://gitlab.com/libvirt/libvirt-ci/-/commit/7f787787a85647c3045ebfa6634966b4b96d5d99
+# https://gitlab.com/libvirt/libvirt-ci/-/commit/4a5cf5007ce3bb5e330b9f3361c5931b072ebe28
 
 FROM registry.fedoraproject.org/fedora:rawhide
 
@@ -54,10 +54,11 @@ exec "$@"' > /usr/bin/nosync && \
         pkgconfig \
         python3-devel \
         python3-flake8 \
-        qemu \
         qemu-img \
+        qemu-kvm \
         sed \
-        util-linux && \
+        util-linux \
+        valgrind && \
     nosync dnf autoremove -y && \
     nosync dnf clean all -y && \
     rpm -qa | sort > /packages.txt && \
diff --git a/ci/containers/opensuse-leap-152.Dockerfile b/ci/containers/opensuse-leap-152.Dockerfile
index 7b4fed8b0872..42bdc314b387 100644
--- a/ci/containers/opensuse-leap-152.Dockerfile
+++ b/ci/containers/opensuse-leap-152.Dockerfile
@@ -2,7 +2,7 @@
 #
 #  $ lcitool dockerfile opensuse-leap-152 libnbd
 #
-# https://gitlab.com/libvirt/libvirt-ci/-/commit/7f787787a85647c3045ebfa6634966b4b96d5d99
+# https://gitlab.com/libvirt/libvirt-ci/-/commit/4a5cf5007ce3bb5e330b9f3361c5931b072ebe28
 
 FROM registry.opensuse.org/opensuse/leap:15.2
 
@@ -45,7 +45,8 @@ RUN zypper update -y && \
            qemu \
            qemu-tools \
            sed \
-           util-linux && \
+           util-linux \
+           valgrind && \
     zypper clean --all && \
     rpm -qa | sort > /packages.txt && \
     mkdir -p /usr/libexec/ccache-wrappers && \
diff --git a/ci/containers/opensuse-tumbleweed.Dockerfile b/ci/containers/opensuse-tumbleweed.Dockerfile
index fa5b3f32edbc..3e226d3abc53 100644
--- a/ci/containers/opensuse-tumbleweed.Dockerfile
+++ b/ci/containers/opensuse-tumbleweed.Dockerfile
@@ -2,7 +2,7 @@
 #
 #  $ lcitool dockerfile opensuse-tumbleweed libnbd
 #
-# https://gitlab.com/libvirt/libvirt-ci/-/commit/7f787787a85647c3045ebfa6634966b4b96d5d99
+# https://gitlab.com/libvirt/libvirt-ci/-/commit/4a5cf5007ce3bb5e330b9f3361c5931b072ebe28
 
 FROM registry.opensuse.org/opensuse/tumbleweed:latest
 
@@ -46,7 +46,8 @@ RUN zypper update -y && \
            qemu \
            qemu-tools \
            sed \
-           util-linux && \
+           util-linux \
+           valgrind && \
     zypper clean --all && \
     rpm -qa | sort > /packages.txt && \
     mkdir -p /usr/libexec/ccache-wrappers && \
diff --git a/ci/containers/ubuntu-1804.Dockerfile b/ci/containers/ubuntu-1804.Dockerfile
index 8be863e8b951..3598b01ddcaf 100644
--- a/ci/containers/ubuntu-1804.Dockerfile
+++ b/ci/containers/ubuntu-1804.Dockerfile
@@ -2,7 +2,7 @@
 #
 #  $ lcitool dockerfile ubuntu-1804 libnbd
 #
-# https://gitlab.com/libvirt/libvirt-ci/-/commit/7f787787a85647c3045ebfa6634966b4b96d5d99
+# https://gitlab.com/libvirt/libvirt-ci/-/commit/4a5cf5007ce3bb5e330b9f3361c5931b072ebe28
 
 FROM docker.io/library/ubuntu:18.04
 
@@ -46,7 +46,8 @@ RUN export DEBIAN_FRONTEND=noninteractive && \
             python3-dev \
             qemu \
             qemu-utils \
-            sed && \
+            sed \
+            valgrind && \
     eatmydata apt-get autoremove -y && \
     eatmydata apt-get autoclean -y && \
     sed -Ei 's,^# (en_US\.UTF-8 .*)$,\1,' /etc/locale.gen && \
diff --git a/ci/containers/ubuntu-2004.Dockerfile b/ci/containers/ubuntu-2004.Dockerfile
index 8f192ca1a603..93edb848df86 100644
--- a/ci/containers/ubuntu-2004.Dockerfile
+++ b/ci/containers/ubuntu-2004.Dockerfile
@@ -2,7 +2,7 @@
 #
 #  $ lcitool dockerfile ubuntu-2004 libnbd
 #
-# https://gitlab.com/libvirt/libvirt-ci/-/commit/7f787787a85647c3045ebfa6634966b4b96d5d99
+# https://gitlab.com/libvirt/libvirt-ci/-/commit/4a5cf5007ce3bb5e330b9f3361c5931b072ebe28
 
 FROM docker.io/library/ubuntu:20.04
 
@@ -49,7 +49,8 @@ RUN export DEBIAN_FRONTEND=noninteractive && \
             python3-dev \
             qemu \
             qemu-utils \
-            sed && \
+            sed \
+            valgrind && \
     eatmydata apt-get autoremove -y && \
     eatmydata apt-get autoclean -y && \
     sed -Ei 's,^# (en_US\.UTF-8 .*)$,\1,' /etc/locale.gen && \
-- 
2.32.0




More information about the Libguestfs mailing list