From 69d599ddbdfe47b9b9ea6994fe2aba24e09ec9b7 Mon Sep 17 00:00:00 2001 From: Kir Kolyshkin Date: Sun, 19 Apr 2020 17:14:51 -0700 Subject: [PATCH] tests/checkpoint.bats: fix $? checks runc in this file is actually a function that does `run runc ...`, and `run` sets variable `$status` as the exit code, so `$status` is what should be checked. If calling runc directly (as in `__runc ...`), then $? is legit. While at it, remove an obsoleted comment, and an unneeded `ret=$?` assignment (check `$?` directly). Signed-off-by: Kir Kolyshkin --- tests/integration/checkpoint.bats | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/tests/integration/checkpoint.bats b/tests/integration/checkpoint.bats index 6c11d083e..4c5c6a038 100644 --- a/tests/integration/checkpoint.bats +++ b/tests/integration/checkpoint.bats @@ -29,11 +29,8 @@ function teardown() { for i in `seq 2`; do # checkpoint the running container runc --criu "$CRIU" checkpoint --work-path ./work-dir test_busybox - ret=$? - # if you are having problems getting criu to work uncomment the following dump: - #cat /run/opencontainer/containers/test_busybox/criu.work/dump.log cat ./work-dir/dump.log | grep -B 5 Error || true - [ "$ret" -eq 0 ] + [ "$status" -eq 0 ] # after checkpoint busybox is no longer running runc state test_busybox @@ -216,8 +213,7 @@ function teardown() { # Killing the CRIU on the checkpoint side will let the container # continue to run if the migration failed at some point. __runc --criu "$CRIU" restore -d --work-path ./image-dir --image-path ./image-dir --lazy-pages test_busybox_restore <&60 >&51 2>&51 - ret=$? - [ $ret -eq 0 ] + [ $? -eq 0 ] run grep -B 5 Error ./work-dir/dump.log -q [ "$status" -eq 1 ] @@ -269,11 +265,10 @@ function teardown() { # checkpoint the running container; this automatically tells CRIU to # handle the network namespace defined in config.json as an external runc --criu "$CRIU" checkpoint --work-path ./work-dir test_busybox - ret=$? # if you are having problems getting criu to work uncomment the following dump: #cat /run/opencontainer/containers/test_busybox/criu.work/dump.log cat ./work-dir/dump.log | grep -B 5 Error || true - [ "$ret" -eq 0 ] + [ "$status" -eq 0 ] # after checkpoint busybox is no longer running runc state test_busybox