From 3d261c0ccee12b145dbfc354e810323d40acae89 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=C2=A0Miros=C5=82aw?= Date: Tue, 27 Jun 2023 20:24:52 +0200 Subject: [PATCH] test/jenkins: test --no-resume-on-error MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Michał Mirosław --- test/jenkins/criu-stop.sh | 1 + test/zdtm.py | 25 +++++++++++++++++++------ 2 files changed, 20 insertions(+), 6 deletions(-) diff --git a/test/jenkins/criu-stop.sh b/test/jenkins/criu-stop.sh index 64da2ee8af..a3c86f79fa 100644 --- a/test/jenkins/criu-stop.sh +++ b/test/jenkins/criu-stop.sh @@ -5,3 +5,4 @@ set -e source `dirname $0`/criu-lib.sh prep ./test/zdtm.py run -t zdtm/transition/fork --stop --iter 3 || fail +./test/zdtm.py run -t zdtm/static/sigtrap --stop-on-error || fail diff --git a/test/zdtm.py b/test/zdtm.py index c6e852dc1a..d0812ef4fb 100755 --- a/test/zdtm.py +++ b/test/zdtm.py @@ -1048,6 +1048,7 @@ def __init__(self, opts): self.__user = bool(opts['user']) self.__rootless = bool(opts['rootless']) self.__leave_stopped = bool(opts['stop']) + self.__stop_on_error = bool(opts['stop_on_error']) self.__stream = bool(opts['stream']) self.__show_stats = bool(opts['show_stats']) self.__lazy_pages_p = None @@ -1383,6 +1384,8 @@ def dump(self, action, opts=[]): if self.__leave_stopped: a_opts += ['--leave-stopped'] + if self.__stop_on_error: + a_opts += ['--no-resume-on-error'] if self.__empty_ns: a_opts += ['--empty-ns', 'net'] if self.__pre_dump_mode: @@ -1392,9 +1395,16 @@ def dump(self, action, opts=[]): if self.__lazy_migrate and action == "dump": a_opts += ["--lazy-pages", "--port", "12345"] + self.__tls nowait = True - self.__dump_process = self.__criu_act(action, - opts=a_opts + opts, - nowait=nowait) + try: + self.__dump_process = self.__criu_act(action, + opts=a_opts + opts, + nowait=nowait) + except test_fail_expected_exc: + if self.__stop_on_error: + pstree_check_stopped(self.__test.getpid(), "--no-resume-on-error") + pstree_signal(self.__test.getpid(), signal.SIGKILL) + raise + if self.__stream: ret = self.wait_for_criu_image_streamer() if ret: @@ -1881,10 +1891,10 @@ def is_thread_stopped(status): return True -def pstree_check_stopped(root_pid): +def pstree_check_stopped(root_pid, test_flag="--leave_stopped"): for pid in pstree_each_pid(root_pid): if not is_proc_stopped(pid): - raise test_fail_exc("CRIU --leave-stopped %s" % pid) + raise test_fail_exc("CRIU %s %s" % (test_flag, pid)) def pstree_signal(root_pid, signal): @@ -2067,7 +2077,7 @@ def run_test(self, name, desc, flavor): 'dedup', 'sbs', 'freezecg', 'user', 'dry_run', 'noauto_dedup', 'remote_lazy_pages', 'show_stats', 'lazy_migrate', 'stream', 'tls', 'criu_bin', 'crit_bin', 'pre_dump_mode', 'mntns_compat_mode', - 'rootless') + 'rootless', 'stop_on_error') arg = repr((name, desc, flavor, {d: self.__opts[d] for d in nd})) if self.__use_log: @@ -2689,6 +2699,9 @@ def get_cli_args(): rp.add_argument("--stop", help="Check that --leave-stopped option stops ps tree.", action='store_true') + rp.add_argument("--stop-on-error", + help="Check that --no-resume-on-error stops ps tree on dump error.", + action='store_true') rp.add_argument("--iters", help="Do CR cycle several times before check (n[:pause])") rp.add_argument("--fault", help="Test fault injection")