2
0
mirror of https://github.com/checkpoint-restore/criu synced 2025-08-31 22:35:33 +00:00

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 <b.sachdev1904@gmail.com>
This commit is contained in:
Bhavik Sachdev
2024-03-29 00:06:58 +05:30
committed by Andrei Vagin
parent 6feb57a840
commit a252a240c3
2 changed files with 19 additions and 4 deletions

View File

@@ -913,6 +913,10 @@ class criu_cli:
return cr return cr
return cr.wait(timeout=timeout) return cr.wait(timeout=timeout)
@staticmethod
def exit_signal(ret):
return ret < 0
class criu_rpc_process: class criu_rpc_process:
def wait(self): def wait(self):
@@ -1033,8 +1037,11 @@ class criu_rpc:
else: else:
raise test_fail_exc('RPC for %s required' % action) raise test_fail_exc('RPC for %s required' % action)
except crpc.CRIUExceptionExternal as e: except crpc.CRIUExceptionExternal as e:
print("Fail", e) if e.typ != e.resp_typ:
ret = -1 ret = -2
else:
print("Fail", e)
ret = -1
else: else:
ret = 0 ret = 0
@@ -1047,6 +1054,10 @@ class criu_rpc:
return ret return ret
@staticmethod
def exit_signal(ret):
return ret == -2
class criu: class criu:
def __init__(self, opts): def __init__(self, opts):
@@ -1251,8 +1262,8 @@ class criu:
return return
rst_succeeded = os.access( rst_succeeded = os.access(
os.path.join(__ddir, "restore-succeeded"), os.F_OK) 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 \
rst_succeeded): (self.__sat and action == 'restore' and rst_succeeded):
raise test_fail_expected_exc(action) raise test_fail_expected_exc(action)
else: else:
raise test_fail_exc("CRIU %s" % action) raise test_fail_exc("CRIU %s" % action)

View File

@@ -41,3 +41,7 @@ class criu_config:
if nowait: if nowait:
return cr return cr
return cr.wait() return cr.wait()
@staticmethod
def exit_signal(ret):
return ret < 0