Skip to content

Commit

Permalink
merge branch 'pr-3539'
Browse files Browse the repository at this point in the history
Kir Kolyshkin (1):
  CI: workaround CentOS Stream 9 criu issue

LGTMs: AkihiroSuda cyphar
Closes #3539
  • Loading branch information
cyphar committed Jul 28, 2022
2 parents c0d44ea + 4fd4af5 commit 6f8cb8b
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 4 deletions.
7 changes: 7 additions & 0 deletions libcontainer/integration/checkpoint_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import (
"os"
"os/exec"
"path/filepath"
"regexp"
"strings"
"testing"

Expand Down Expand Up @@ -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})
stateDir := t.TempDir()

Expand Down
15 changes: 11 additions & 4 deletions tests/integration/helpers.bash
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,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%%.*}"
Expand Down Expand Up @@ -345,14 +342,24 @@ function rootless_cgroup() {
[[ "$ROOTLESS_FEATURES" == *"cgroup"* || -v 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() {
for var in "$@"; do
local skip_me
case $var in
criu)
if [ ! -v HAVE_CRIU ]; then
if ! have_criu; then
skip_me=1
fi
;;
Expand Down

0 comments on commit 6f8cb8b

Please sign in to comment.