2
0
mirror of https://github.com/checkpoint-restore/criu synced 2025-08-31 06:15:24 +00:00

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 <rstoyanov@fedoraproject.org>
This commit is contained in:
Radostin Stoyanov
2024-10-14 13:36:22 +01:00
committed by Andrei Vagin
parent 5335b35f72
commit 5ca4400699
5 changed files with 51 additions and 2 deletions

View File

@@ -362,5 +362,6 @@ make -C plugins/amdgpu/ test_topology_remap
./test/zdtm.py run -t zdtm/static/maps00 -t zdtm/static/maps02 --criu-plugin cuda
./test/zdtm.py run -t zdtm/static/maps00 -t zdtm/static/maps02 --criu-plugin amdgpu
./test/zdtm.py run -t zdtm/static/maps00 -t zdtm/static/maps02 --criu-plugin amdgpu cuda
./test/zdtm.py run -t zdtm/static/busyloop00 --criu-plugin inventory_test_enabled inventory_test_disabled
./test/zdtm.py run -t zdtm/static/sigpending -t zdtm/static/pthread00 --mocked-cuda-checkpoint --fault 138

View File

@@ -1,5 +1,13 @@
SRC_DIR := ../../plugins
PLUGIN_TARGETS := amdgpu_plugin.so cuda_plugin.so
PLUGIN_TARGETS := inventory_test_enabled_plugin.so inventory_test_disabled_plugin.so amdgpu_plugin.so cuda_plugin.so
ARCH := x86
PLUGIN_INCLUDE := -iquote../../include
PLUGIN_INCLUDE += -iquote../../criu/include
PLUGIN_INCLUDE += -iquote../../criu/arch/$(ARCH)/include/
PLUGIN_INCLUDE += -iquote../../
PLUGIN_CFLAGS := -g -Wall -Werror -shared -nostartfiles -fPIC
# Silent make rules.
Q := @
@@ -12,6 +20,12 @@ amdgpu_plugin.so: $(SRC_DIR)/amdgpu/amdgpu_plugin.so
cuda_plugin.so: $(SRC_DIR)/cuda/cuda_plugin.so
$(Q) cp $< $@
inventory_test_enabled_plugin.so: inventory_test_enabled_plugin.c
$(Q) $(CC) $(PLUGIN_CFLAGS) $< -o $@ $(PLUGIN_INCLUDE)
inventory_test_disabled_plugin.so: inventory_test_disabled_plugin.c
$(Q) $(CC) $(PLUGIN_CFLAGS) $< -o $@ $(PLUGIN_INCLUDE)
clean:
$(Q) $(RM) $(PLUGIN_TARGETS)

View File

@@ -0,0 +1,17 @@
#include "criu-plugin.h"
#include "image.h"
int inventory_test_disabled_plugin_init(int stage)
{
if (stage == CR_PLUGIN_STAGE__RESTORE)
return check_and_remove_inventory_plugin(CR_PLUGIN_DESC.name, strlen(CR_PLUGIN_DESC.name));
return 0;
}
void inventory_test_disabled_plugin_fini(int stage, int ret)
{
return;
}
CR_PLUGIN_REGISTER("inventory_test_disabled_plugin", inventory_test_disabled_plugin_init, inventory_test_disabled_plugin_fini)

View File

@@ -0,0 +1,17 @@
#include "criu-plugin.h"
#include "image.h"
int inventory_test_enabled_plugin_init(int stage)
{
if (stage == CR_PLUGIN_STAGE__RESTORE)
return !check_and_remove_inventory_plugin(CR_PLUGIN_DESC.name, strlen(CR_PLUGIN_DESC.name));
return add_inventory_plugin(CR_PLUGIN_DESC.name);
}
void inventory_test_enabled_plugin_fini(int stage, int ret)
{
return;
}
CR_PLUGIN_REGISTER("inventory_test_enabled_plugin", inventory_test_enabled_plugin_init, inventory_test_enabled_plugin_fini)

View File

@@ -2877,7 +2877,7 @@ def get_cli_args():
rp.add_argument("--preload-libfault", action="store_true", help="Run criu with library preload to simulate special cases")
rp.add_argument("--criu-plugin",
help="Run tests with CRIU plugin",
choices=['amdgpu', 'cuda'],
choices=['amdgpu', 'cuda', 'inventory_test_enabled', 'inventory_test_disabled'],
nargs='+',
default=None)
rp.add_argument("--mocked-cuda-checkpoint",