From 4bfaf6e6c854fe4b9f9b1595b93f8490605cd4e8 Mon Sep 17 00:00:00 2001 From: Bhavik Sachdev Date: Fri, 29 Mar 2024 00:06:58 +0530 Subject: [PATCH] zdtm: Distinguish between fail and crash of dump Adds a exit_signal static method to criu_cli, criu_config and criu_rpc used to detect a crash. Fixes: #350 Signed-off-by: Bhavik Sachdev --- test/zdtm.py | 17 ++++++++++++++--- test/zdtm/criu_config.py | 4 ++++ 2 files changed, 18 insertions(+), 3 deletions(-) diff --git a/test/zdtm.py b/test/zdtm.py index 7a7cdfd3b6..faafb16413 100755 --- a/test/zdtm.py +++ b/test/zdtm.py @@ -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): @@ -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 @@ -1032,6 +1039,10 @@ def run(action, return ret + @staticmethod + def exit_signal(ret): + return ret == -2 + class criu: def __init__(self, opts): @@ -1233,7 +1244,7 @@ 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 + 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: diff --git a/test/zdtm/criu_config.py b/test/zdtm/criu_config.py index 487becfb4b..f39418d7d5 100644 --- a/test/zdtm/criu_config.py +++ b/test/zdtm/criu_config.py @@ -40,3 +40,7 @@ def run(action, if nowait: return cr return cr.wait() + + @staticmethod + def exit_signal(ret): + return ret < 0