From 6a66b87e12b15089f5526c72e757274d2cd5cc16 Mon Sep 17 00:00:00 2001 From: Andrey Vagin Date: Thu, 8 Mar 2018 01:43:07 +0300 Subject: [PATCH] zdtm: check an exit code of a straced restore 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 --- 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 --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 b25de3a3a..d61e71105 100755 --- a/test/zdtm.py +++ b/test/zdtm.py @@ -959,7 +959,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)