mirror of
https://github.com/checkpoint-restore/criu
synced 2025-09-01 06:45:35 +00:00
zdtm: add option to run tests with criu plugins
By default, if the "CRIU_LIBS_DIR" environment variable is not set, CRIU will load all plugins installed in `/usr/lib/criu`. This may result in running the ZDTM tests with plugins for a different version of CRIU (e.g., installed from a package). This patch updates ZDTM to always set the "CRIU_LIBS_DIR" environment variable and use a local "plugins" directory. This directory contains copies of the plugin files built from source. In addition, this patch adds the `--criu-plugin` option to the `zdtm.py run` command, allowing tests to be run with specified CRIU plugins. Example: - Run test only with AMDGPU plugin ./zdtm.py run -t zdtm/static/busyloop00 --criu-plugin amdgpu - Run test only with CUDA plugin ./zdtm.py run -t zdtm/static/busyloop00 --criu-plugin cuda - Run test with both AMDGPU and CUDA plugins ./zdtm.py run -t zdtm/static/busyloop00 --criu-plugin amdgpu cuda Signed-off-by: Radostin Stoyanov <rstoyanov@fedoraproject.org>
This commit is contained in:
committed by
Andrei Vagin
parent
ad66c27a11
commit
2453ed69a2
1
test/plugins/.gitignore
vendored
Normal file
1
test/plugins/.gitignore
vendored
Normal file
@@ -0,0 +1 @@
|
|||||||
|
*.so
|
18
test/plugins/Makefile
Normal file
18
test/plugins/Makefile
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
SRC_DIR := ../../plugins
|
||||||
|
PLUGIN_TARGETS := amdgpu_plugin.so cuda_plugin.so
|
||||||
|
|
||||||
|
# Silent make rules.
|
||||||
|
Q := @
|
||||||
|
|
||||||
|
all: $(PLUGIN_TARGETS)
|
||||||
|
|
||||||
|
amdgpu_plugin.so: $(SRC_DIR)/amdgpu/amdgpu_plugin.so
|
||||||
|
$(Q) cp $< $@
|
||||||
|
|
||||||
|
cuda_plugin.so: $(SRC_DIR)/cuda/cuda_plugin.so
|
||||||
|
$(Q) cp $< $@
|
||||||
|
|
||||||
|
clean:
|
||||||
|
$(Q) $(RM) $(PLUGIN_TARGETS)
|
||||||
|
|
||||||
|
.PHONY: all clean
|
21
test/zdtm.py
21
test/zdtm.py
@@ -40,6 +40,12 @@ LIBFAULT_PATH = os.path.join(
|
|||||||
"libfault.so"
|
"libfault.so"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
# A directory that contains the CRIU plugins.
|
||||||
|
PLUGINS_DIR = os.path.join(
|
||||||
|
os.path.dirname(os.path.abspath(__file__)),
|
||||||
|
"plugins"
|
||||||
|
)
|
||||||
|
|
||||||
prev_line = None
|
prev_line = None
|
||||||
uuid = uuid.uuid4()
|
uuid = uuid.uuid4()
|
||||||
|
|
||||||
@@ -672,6 +678,12 @@ class zdtm_test:
|
|||||||
subprocess.check_call(["make", "-C", "zdtm/"])
|
subprocess.check_call(["make", "-C", "zdtm/"])
|
||||||
if 'preload_libfault' in opts and opts['preload_libfault']:
|
if 'preload_libfault' in opts and opts['preload_libfault']:
|
||||||
subprocess.check_call(["make", "-C", "libfault/"])
|
subprocess.check_call(["make", "-C", "libfault/"])
|
||||||
|
|
||||||
|
subprocess.check_call(["make", '--no-print-directory', "-C", "plugins/", "clean"])
|
||||||
|
if 'criu_plugin' in opts and opts['criu_plugin']:
|
||||||
|
for name in opts['criu_plugin']:
|
||||||
|
subprocess.check_call(["make", '--no-print-directory', "-C", "plugins/", f"{name}_plugin.so"])
|
||||||
|
|
||||||
if 'rootless' in opts and opts['rootless']:
|
if 'rootless' in opts and opts['rootless']:
|
||||||
return
|
return
|
||||||
subprocess.check_call(
|
subprocess.check_call(
|
||||||
@@ -929,7 +941,9 @@ class criu_cli:
|
|||||||
timeout=60):
|
timeout=60):
|
||||||
env = dict(
|
env = dict(
|
||||||
os.environ,
|
os.environ,
|
||||||
ASAN_OPTIONS="log_path=asan.log:disable_coredump=0:detect_leaks=0")
|
ASAN_OPTIONS="log_path=asan.log:disable_coredump=0:detect_leaks=0",
|
||||||
|
CRIU_LIBS_DIR=PLUGINS_DIR
|
||||||
|
)
|
||||||
|
|
||||||
if fault:
|
if fault:
|
||||||
print("Forcing %s fault" % fault)
|
print("Forcing %s fault" % fault)
|
||||||
@@ -2852,6 +2866,11 @@ def get_cli_args():
|
|||||||
rp.add_argument("--test-shard-count", type=int, default=0,
|
rp.add_argument("--test-shard-count", type=int, default=0,
|
||||||
help="Specify how many shards are being run (0=sharding disabled; must be the same for all shards)")
|
help="Specify how many shards are being run (0=sharding disabled; must be the same for all shards)")
|
||||||
rp.add_argument("--preload-libfault", action="store_true", help="Run criu with library preload to simulate special cases")
|
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'],
|
||||||
|
nargs='+',
|
||||||
|
default=None)
|
||||||
|
|
||||||
lp = sp.add_parser("list", help="List tests")
|
lp = sp.add_parser("list", help="List tests")
|
||||||
lp.set_defaults(action=list_tests)
|
lp.set_defaults(action=list_tests)
|
||||||
|
Reference in New Issue
Block a user