Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions tests/integration/checkpoint.bats
Original file line number Diff line number Diff line change
Expand Up @@ -495,6 +495,18 @@ function simple_cr() {
local pid
pid=$(cat "pid")
grep -q "${REL_CGROUPS_PATH}$" "/proc/$pid/cgroup"

# Check that cgroupns is there. The check is more complicated for v1
# so we only do it for v2. This requires a CRIU fix from
# https://github.com/checkpoint-restore/criu/pull/3139, which is
# expected to be released in CRIU 4.3.
if [ -v CGROUP_V2 ] && criu_version_ge 4.3; then
echo "orig_path = $orig_path"
echo " new_path = $new_path"
runc exec test_busybox cat /proc/self/cgroup
[ "$status" -eq 0 ]
[ "$output" = "0::/" ] # Means own cgroupns
fi
}

@test "checkpoint/restore and exec" {
Expand Down
8 changes: 8 additions & 0 deletions tests/integration/helpers.bash
Original file line number Diff line number Diff line change
Expand Up @@ -491,6 +491,14 @@ function have_criu() {
run ! grep -q '^criu-3\.17-[123]\.el9' <<<"$ver"
}

# Check if criu version is at least $1 (e.g. "4.3").
function criu_version_ge() {
local ver
ver=$(criu --version | sed -n 's/^Version: //p')
[ -n "$ver" ] || return 1
[ "$(printf '%s\n%s\n' "$1" "$ver" | sort -V | head -n1)" = "$1" ]
}

# 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() {
Expand Down