Skip to content

Commit f6b7167

Browse files
committed
tests/int/checkpoint: add requires criu_feature_xxx
1. A few tests use "criu check --feature" to check for a specific feature. Let's generalize it. 2. Fix "checkpoint --pre-dump and restore" test to require memory tracking (which is missing on ARM). Signed-off-by: Kir Kolyshkin <[email protected]>
1 parent 52bd9fd commit f6b7167

File tree

2 files changed

+14
-9
lines changed

2 files changed

+14
-9
lines changed

tests/integration/checkpoint.bats

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -173,6 +173,10 @@ function simple_cr() {
173173
}
174174

175175
@test "checkpoint --pre-dump and restore" {
176+
# Requires kernel dirty memory tracking (missing on ARM, see
177+
# https://github.com/checkpoint-restore/criu/issues/1729).
178+
requires criu_feature_mem_dirty_track
179+
176180
setup_pipes
177181
runc_run_with_pipes test_busybox
178182

@@ -202,10 +206,8 @@ function simple_cr() {
202206
}
203207

204208
@test "checkpoint --lazy-pages and restore" {
205-
# check if lazy-pages is supported
206-
if ! criu check --feature uffd-noncoop; then
207-
skip "this criu does not support lazy migration"
208-
fi
209+
# Requires lazy-pages support.
210+
requires criu_feature_uffd-noncoop
209211

210212
setup_pipes
211213
runc_run_with_pipes test_busybox
@@ -274,11 +276,8 @@ function simple_cr() {
274276
}
275277

276278
@test "checkpoint and restore in external network namespace" {
277-
# check if external_net_ns is supported; only with criu 3.10++
278-
if ! criu check --feature external_net_ns; then
279-
# this criu does not support external_net_ns; skip the test
280-
skip "this criu does not support external network namespaces"
281-
fi
279+
# Requires external network namespaces (criu >= 3.10).
280+
requires criu_feature_external_net_ns
282281

283282
# create a temporary name for the test network namespace
284283
tmp=$(mktemp)

tests/integration/helpers.bash

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -407,6 +407,12 @@ function requires() {
407407
skip_me=1
408408
fi
409409
;;
410+
criu_feature_*)
411+
var=${var#criu_feature_}
412+
if ! criu check --feature "$var"; then
413+
skip "requires CRIU feature ${var}"
414+
fi
415+
;;
410416
root)
411417
if [ $EUID -ne 0 ]; then
412418
skip_me=1

0 commit comments

Comments
 (0)