[CRIU] [PATCH] zdtm: check that a command completes successfully after a fault
Andrey Vagin
avagin at openvz.org
Mon Feb 29 15:48:34 PST 2016
From: Andrew Vagin <avagin at virtuozzo.com>
I suggest to inject a fault and than try to execute the same command
again without a fault to check that it will complete successfully.
Signed-off-by: Andrew Vagin <avagin at virtuozzo.com>
---
test/zdtm.py | 32 +++++++++++++++++++++++++-------
1 file changed, 25 insertions(+), 7 deletions(-)
diff --git a/test/zdtm.py b/test/zdtm.py
index 1ace919..ea0728c 100755
--- a/test/zdtm.py
+++ b/test/zdtm.py
@@ -656,13 +656,31 @@ class criu_cli:
preexec = self.__user and self.set_user_id or None
- ret = self.__criu(action, s_args, self.__fault, strace, preexec)
- grep_errors(os.path.join(self.__ddir(), log))
- if ret != 0:
- if self.__fault or self.__test.blocking() or (self.__sat and action == 'restore'):
- raise test_fail_expected_exc(action)
- else:
- raise test_fail_exc("CRIU %s" % action)
+ faults = [ self.__fault ]
+ # try again after the first failed case
+ if self.__fault:
+ faults.append(None)
+ for fault in faults:
+ __ddir = self.__ddir()
+
+ ret = self.__criu(action, s_args, fault, strace, preexec)
+ grep_errors(os.path.join(__ddir, log))
+ if ret != 0:
+ if fault:
+ try_run_hook(self.__test, ["--fault", action])
+ if action == "dump":
+ __ddir_fail = __ddir + ".fail"
+ os.rename(__ddir, __ddir + ".fail")
+ os.mkdir(__ddir)
+ os.chmod(__ddir, 0777)
+ else:
+ os.rename(os.path.join(__ddir, log), os.path.join(__ddir, log + ".fail"))
+ continue
+ if self.__test.blocking() or (self.__sat and action == 'restore'):
+ raise test_fail_expected_exc(action)
+ else:
+ raise test_fail_exc("CRIU %s" % action)
+ break
def dump(self, action, opts = []):
self.__iter += 1
--
2.5.0
More information about the CRIU
mailing list