zdtm: check an exit code of a straced restore

Submitted by Andrey Vagin on March 7, 2018, 10:43 p.m.

Details

Message ID 20180307224307.13968-1-avagin@virtuozzo.com
State Accepted
Series "zdtm: check an exit code of a straced restore"
Commit 251dad530b68df9ef55cc2a56a4731eb3dfb7180
Headers show

Commit Message

Andrey Vagin March 7, 2018, 10:43 p.m.
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@virtuozzo.com>
---
 scripts/fake-restore.sh | 1 +
 test/zdtm.py            | 3 ++-
 2 files changed, 3 insertions(+), 1 deletion(-)

Patch hide | download patch | download mbox

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)

Comments

Andrey Vagin March 23, 2018, 12:42 a.m.
Applied

On Thu, Mar 08, 2018 at 01:43:07AM +0300, Andrei Vagin wrote:
> 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@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
>