From 3ca5673f78a3b360d7dbf9af0aeba00e7564b2c7 Mon Sep 17 00:00:00 2001 From: Kir Kolyshkin Date: Wed, 27 Jul 2022 16:20:02 -0700 Subject: [PATCH] CI: workaround CentOS Stream 9 criu issue Older criu builds fail to work properly on CentOS Stream 9 due to changes in glibc's rseq. Skip criu tests if an older criu version is found. Fixes: https://github.com/opencontainers/runc/issues/3532 Cherry picked from commit 4fd4af5b1c6f0a03f36276afb74d42968c3de265. Signed-off-by: Kir Kolyshkin --- libcontainer/integration/checkpoint_test.go | 7 +++++++ tests/integration/helpers.bash | 15 +++++++++++---- 2 files changed, 18 insertions(+), 4 deletions(-) diff --git a/libcontainer/integration/checkpoint_test.go b/libcontainer/integration/checkpoint_test.go index c86ec8a0c..170204f0d 100644 --- a/libcontainer/integration/checkpoint_test.go +++ b/libcontainer/integration/checkpoint_test.go @@ -6,6 +6,7 @@ import ( "os" "os/exec" "path/filepath" + "regexp" "strings" "testing" @@ -61,6 +62,12 @@ func testCheckpoint(t *testing.T, userns bool) { t.Skipf("criu binary not found: %v", err) } + // Workaround for https://github.com/opencontainers/runc/issues/3532. + out, err := exec.Command("rpm", "-q", "criu").CombinedOutput() + if err == nil && regexp.MustCompile(`^criu-3\.17-[123]\.el9`).Match(out) { + t.Skip("Test requires criu >= 3.17-4 on CentOS Stream 9.") + } + config := newTemplateConfig(t, &tParam{userns: userns}) factory, err := libcontainer.New(t.TempDir()) ok(t, err) diff --git a/tests/integration/helpers.bash b/tests/integration/helpers.bash index b6d2e244c..ea68bfc86 100644 --- a/tests/integration/helpers.bash +++ b/tests/integration/helpers.bash @@ -23,9 +23,6 @@ SECCOMP_AGENT="${INTEGRATION_ROOT}/../../contrib/cmd/seccompagent/seccompagent" # shellcheck disable=SC2034 TESTDATA="${INTEGRATION_ROOT}/testdata" -# Whether we have criu binary. -command -v criu &>/dev/null && HAVE_CRIU=yes - # Kernel version KERNEL_VERSION="$(uname -r)" KERNEL_MAJOR="${KERNEL_VERSION%%.*}" @@ -343,6 +340,16 @@ function rootless_cgroup() { [[ "$ROOTLESS_FEATURES" == *"cgroup"* || -n "$RUNC_USE_SYSTEMD" ]] } +# Check if criu is available and working. +function have_criu() { + command -v criu &>/dev/null || return 1 + + # Workaround for https://github.com/opencontainers/runc/issues/3532. + local ver + ver=$(rpm -q criu 2>/dev/null || true) + ! grep -q '^criu-3\.17-[123]\.el9' <<<"$ver" +} + # Allows a test to specify what things it requires. If the environment can't # support it, the test is skipped with a message. function requires() { @@ -350,7 +357,7 @@ function requires() { local skip_me case $var in criu) - if [ -n "$HAVE_CRIU" ]; then + if ! have_criu; then skip_me=1 fi ;;