Skip to content

Commit

Permalink
test/jenkins: test --no-resume-on-error
Browse files Browse the repository at this point in the history
Signed-off-by: Michał Mirosław <emmir@google.com>
  • Loading branch information
osctobe committed Aug 28, 2023
1 parent 6d3b74e commit 40f34f5
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 6 deletions.
1 change: 1 addition & 0 deletions test/jenkins/criu-stop.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
25 changes: 19 additions & 6 deletions test/zdtm.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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:
Expand All @@ -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:
Expand Down Expand Up @@ -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):
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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")
Expand Down

0 comments on commit 40f34f5

Please sign in to comment.