mirror of
https://github.com/checkpoint-restore/criu
synced 2025-08-31 14:25:49 +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
21
test/zdtm.py
21
test/zdtm.py
@@ -40,6 +40,12 @@ LIBFAULT_PATH = os.path.join(
|
||||
"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
|
||||
uuid = uuid.uuid4()
|
||||
|
||||
@@ -672,6 +678,12 @@ class zdtm_test:
|
||||
subprocess.check_call(["make", "-C", "zdtm/"])
|
||||
if 'preload_libfault' in opts and opts['preload_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']:
|
||||
return
|
||||
subprocess.check_call(
|
||||
@@ -929,7 +941,9 @@ class criu_cli:
|
||||
timeout=60):
|
||||
env = dict(
|
||||
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:
|
||||
print("Forcing %s fault" % fault)
|
||||
@@ -2852,6 +2866,11 @@ def get_cli_args():
|
||||
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)")
|
||||
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.set_defaults(action=list_tests)
|
||||
|
Reference in New Issue
Block a user