Skip to content

Commit f5d59ec

Browse files
rst0gitavagin
authored andcommitted
zdtm: add inventory test plugins
This patch adds two test plugins to verify that CRIU plugins listed in the inventory image are enabled, while those that are not listed can be disabled. Signed-off-by: Radostin Stoyanov <[email protected]>
1 parent 18f7207 commit f5d59ec

File tree

5 files changed

+51
-2
lines changed

5 files changed

+51
-2
lines changed

scripts/ci/run-ci-tests.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -362,5 +362,6 @@ make -C plugins/amdgpu/ test_topology_remap
362362
./test/zdtm.py run -t zdtm/static/maps00 -t zdtm/static/maps02 --criu-plugin cuda
363363
./test/zdtm.py run -t zdtm/static/maps00 -t zdtm/static/maps02 --criu-plugin amdgpu
364364
./test/zdtm.py run -t zdtm/static/maps00 -t zdtm/static/maps02 --criu-plugin amdgpu cuda
365+
./test/zdtm.py run -t zdtm/static/busyloop00 --criu-plugin inventory_test_enabled inventory_test_disabled
365366

366367
./test/zdtm.py run -t zdtm/static/sigpending -t zdtm/static/pthread00 --mocked-cuda-checkpoint --fault 138

test/plugins/Makefile

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,13 @@
11
SRC_DIR := ../../plugins
2-
PLUGIN_TARGETS := amdgpu_plugin.so cuda_plugin.so
2+
PLUGIN_TARGETS := inventory_test_enabled_plugin.so inventory_test_disabled_plugin.so amdgpu_plugin.so cuda_plugin.so
3+
4+
ARCH := x86
5+
6+
PLUGIN_INCLUDE := -iquote../../include
7+
PLUGIN_INCLUDE += -iquote../../criu/include
8+
PLUGIN_INCLUDE += -iquote../../criu/arch/$(ARCH)/include/
9+
PLUGIN_INCLUDE += -iquote../../
10+
PLUGIN_CFLAGS := -g -Wall -Werror -shared -nostartfiles -fPIC
311

412
# Silent make rules.
513
Q := @
@@ -12,6 +20,12 @@ amdgpu_plugin.so: $(SRC_DIR)/amdgpu/amdgpu_plugin.so
1220
cuda_plugin.so: $(SRC_DIR)/cuda/cuda_plugin.so
1321
$(Q) cp $< $@
1422

23+
inventory_test_enabled_plugin.so: inventory_test_enabled_plugin.c
24+
$(Q) $(CC) $(PLUGIN_CFLAGS) $< -o $@ $(PLUGIN_INCLUDE)
25+
26+
inventory_test_disabled_plugin.so: inventory_test_disabled_plugin.c
27+
$(Q) $(CC) $(PLUGIN_CFLAGS) $< -o $@ $(PLUGIN_INCLUDE)
28+
1529
clean:
1630
$(Q) $(RM) $(PLUGIN_TARGETS)
1731

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
#include "criu-plugin.h"
2+
#include "image.h"
3+
4+
int inventory_test_disabled_plugin_init(int stage)
5+
{
6+
if (stage == CR_PLUGIN_STAGE__RESTORE)
7+
return check_and_remove_inventory_plugin(CR_PLUGIN_DESC.name, strlen(CR_PLUGIN_DESC.name));
8+
9+
return 0;
10+
}
11+
12+
void inventory_test_disabled_plugin_fini(int stage, int ret)
13+
{
14+
return;
15+
}
16+
17+
CR_PLUGIN_REGISTER("inventory_test_disabled_plugin", inventory_test_disabled_plugin_init, inventory_test_disabled_plugin_fini)
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
#include "criu-plugin.h"
2+
#include "image.h"
3+
4+
int inventory_test_enabled_plugin_init(int stage)
5+
{
6+
if (stage == CR_PLUGIN_STAGE__RESTORE)
7+
return !check_and_remove_inventory_plugin(CR_PLUGIN_DESC.name, strlen(CR_PLUGIN_DESC.name));
8+
9+
return add_inventory_plugin(CR_PLUGIN_DESC.name);
10+
}
11+
12+
void inventory_test_enabled_plugin_fini(int stage, int ret)
13+
{
14+
return;
15+
}
16+
17+
CR_PLUGIN_REGISTER("inventory_test_enabled_plugin", inventory_test_enabled_plugin_init, inventory_test_enabled_plugin_fini)

test/zdtm.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2877,7 +2877,7 @@ def get_cli_args():
28772877
rp.add_argument("--preload-libfault", action="store_true", help="Run criu with library preload to simulate special cases")
28782878
rp.add_argument("--criu-plugin",
28792879
help="Run tests with CRIU plugin",
2880-
choices=['amdgpu', 'cuda'],
2880+
choices=['amdgpu', 'cuda', 'inventory_test_enabled', 'inventory_test_disabled'],
28812881
nargs='+',
28822882
default=None)
28832883
rp.add_argument("--mocked-cuda-checkpoint",

0 commit comments

Comments
 (0)