Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

zdtm: Distinguish between fail and crash of dump #2376

Open
wants to merge 2 commits into
base: criu-dev
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 4 additions & 0 deletions criu/cr-dump.c
Expand Up @@ -2101,6 +2101,10 @@ static int cr_dump_finish(int ret)
close_image_dir();

if (ret || post_dump_ret) {
if (fault_injected(FI_DUMP_CRASH)) {
pr_info("fault: CRIU dump crashed!\n");
abort();
}
pr_err("Dumping FAILED.\n");
} else {
write_stats(DUMP_STATS);
Expand Down
1 change: 1 addition & 0 deletions criu/include/fault-injection.h
Expand Up @@ -20,6 +20,7 @@ enum faults {
FI_CANNOT_MAP_VDSO = 133,
FI_CORRUPT_EXTREGS = 134,
FI_DONT_USE_PAGEMAP_SCAN = 135,
FI_DUMP_CRASH = 136,
FI_MAX,
};

Expand Down
4 changes: 4 additions & 0 deletions test/jenkins/criu-fault.sh
Expand Up @@ -39,3 +39,7 @@ fi
./test/zdtm.py run -t zdtm/static/fpu03 --fault 134 -f h --norst || fail
# also check for the main thread corruption
./test/zdtm.py run -t zdtm/static/fpu00 --fault 134 -f h --norst || fail

if ./test/zdtm.py run -t zdtm/static/vfork00 --fault 136 --report report -f h ; then
fail
fi
19 changes: 15 additions & 4 deletions test/zdtm.py
Expand Up @@ -899,6 +899,10 @@ def run(action,
return cr
return cr.wait(timeout=timeout)

@staticmethod
def exit_signal(ret):
return ret < 0


class criu_rpc_process:
def wait(self):
Expand Down Expand Up @@ -1018,8 +1022,11 @@ def run(action,
else:
raise test_fail_exc('RPC for %s required' % action)
except crpc.CRIUExceptionExternal as e:
print("Fail", e)
ret = -1
if e.typ != e.resp_typ:
ret = -2
else:
print("Fail", e)
ret = -1
else:
ret = 0

Expand All @@ -1032,6 +1039,10 @@ def run(action,

return ret

@staticmethod
def exit_signal(ret):
return ret == -2


class criu:
def __init__(self, opts):
Expand Down Expand Up @@ -1233,8 +1244,8 @@ def __criu_act(self, action, opts=[], log=None, nowait=False):
return
rst_succeeded = os.access(
os.path.join(__ddir, "restore-succeeded"), os.F_OK)
if self.__test.blocking() or (self.__sat and action == 'restore' and
rst_succeeded):
if (self.__test.blocking() and not self.__criu.exit_signal(ret)) or \
(self.__sat and action == 'restore' and rst_succeeded):
raise test_fail_expected_exc(action)
else:
raise test_fail_exc("CRIU %s" % action)
Expand Down
4 changes: 4 additions & 0 deletions test/zdtm/criu_config.py
Expand Up @@ -40,3 +40,7 @@ def run(action,
if nowait:
return cr
return cr.wait()

@staticmethod
def exit_signal(ret):
return ret < 0