[CRIU] [PATCH] zdtm: check an exit code of a straced restore

Andrei Vagin avagin at virtuozzo.com
Thu Mar 8 01:43:07 MSK 2018


Currently zdtm doesn't detect when restore failed, if it is executed
with strace. With this patch, fake-restore.sh creates a test file, and
zdtm is able to distinguish when restore failed.

Signed-off-by: Andrei Vagin <avagin at virtuozzo.com>
---
 scripts/fake-restore.sh | 1 +
 test/zdtm.py            | 3 ++-
 2 files changed, 3 insertions(+), 1 deletion(-)

diff --git a/scripts/fake-restore.sh b/scripts/fake-restore.sh
index e3c368614..2728fb30d 100755
--- a/scripts/fake-restore.sh
+++ b/scripts/fake-restore.sh
@@ -8,6 +8,7 @@
 # criu restore <options> --action-script $(pwd)/scripts/fake-restore.sh
 #
 if [ "$CRTOOLS_SCRIPT_ACTION" == "post-restore" ]; then
+	touch restore-succeeded
 	exit 1
 else
 	exit 0
diff --git a/test/zdtm.py b/test/zdtm.py
index 030065dde..482e1a41c 100755
--- a/test/zdtm.py
+++ b/test/zdtm.py
@@ -983,7 +983,8 @@ class criu:
 				grep_errors(os.path.join(__ddir, log))
 				if ret == 0:
 					return
-			if self.__test.blocking() or (self.__sat and action == 'restore'):
+			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):
 				raise test_fail_expected_exc(action)
 			else:
 				raise test_fail_exc("CRIU %s" % action)
-- 
2.13.6



More information about the CRIU mailing list