tests/int: fix some checks

Apparently, bash with set -e deliberately ignores non-zero return codes
from ! cmd, unless this is the last command. The workaround is to either
use "! cmd || false', "or run ! cmd". Choose the latter, and require
bash-core 1.5.0 (since this is when "run !" was added), replacing the
older check.

Alas I only learned this recently from the bash-core documentation.

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
This commit is contained in:
Kir Kolyshkin
2023-04-05 15:15:07 -07:00
parent 9dbb9f90b9
commit 9b71787be0
3 changed files with 8 additions and 12 deletions
+4 -4
View File
@@ -355,7 +355,7 @@ function simple_cr() {
runc checkpoint --work-path ./work-dir test_busybox
grep -B 5 Error ./work-dir/dump.log || true
[ "$status" -eq 0 ]
! test -f ./work-dir/"$tmplog1"
run ! test -f ./work-dir/"$tmplog1"
test -f ./work-dir/"$tmplog2"
# after checkpoint busybox is no longer running
@@ -366,7 +366,7 @@ function simple_cr() {
runc restore -d --work-path ./work-dir --console-socket "$CONSOLE_SOCKET" test_busybox
grep -B 5 Error ./work-dir/restore.log || true
[ "$status" -eq 0 ]
! test -f ./work-dir/"$tmplog1"
run ! test -f ./work-dir/"$tmplog1"
test -f ./work-dir/"$tmplog2"
# busybox should be back up and running
@@ -434,7 +434,7 @@ function simple_cr() {
[ "$status" -eq 0 ]
testcontainer test_busybox checkpointed
# Check that the cgroup is gone.
! test -d "$orig_path"
run ! test -d "$orig_path"
# Restore into a different cgroup.
set_cgroups_path # Changes the path.
@@ -445,7 +445,7 @@ function simple_cr() {
testcontainer test_busybox running
# Check that the old cgroup path doesn't exist.
! test -d "$orig_path"
run ! test -d "$orig_path"
# Check that the new path exists.
local new_path