diff options
author | David Gibson <david@gibson.dropbear.id.au> | 2022-05-12 12:42:50 +1000 |
---|---|---|
committer | Stefano Brivio <sbrivio@redhat.com> | 2022-05-19 15:24:15 +0200 |
commit | 3e0641f91f7296dca67224babc221f3a161224e1 (patch) | |
tree | f4337a32150a9c0e8219c55601e2bb3a61ebe80d | |
parent | c638129a9e803388a37d95c4c411047571556109 (diff) | |
download | passt-3e0641f91f7296dca67224babc221f3a161224e1.tar passt-3e0641f91f7296dca67224babc221f3a161224e1.tar.gz passt-3e0641f91f7296dca67224babc221f3a161224e1.tar.bz2 passt-3e0641f91f7296dca67224babc221f3a161224e1.tar.lz passt-3e0641f91f7296dca67224babc221f3a161224e1.tar.xz passt-3e0641f91f7296dca67224babc221f3a161224e1.tar.zst passt-3e0641f91f7296dca67224babc221f3a161224e1.zip |
tests: Don't ignore errors during script
Most commands issued during the testing scripts aren't explicitly checked
for errors. Therefore, if they fail, the shell will just keep on
executing. This makes it difficult to figure out where things started
going wrong if things fall over.
Run the whole script with the set -e mode so that it will exit in the case
of any (unchecked) failing command. To make this work we do need to add
explicit checks / fallbacks for some commands which we expect to fail.
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
[sbrivio: use sh -e instead of setting -e later, so that we don't miss
anything before set -e is issued]
Signed-off-by: Stefano Brivio <sbrivio@redhat.com>
-rwxr-xr-x | test/lib/test | 10 | ||||
-rwxr-xr-x | test/run | 2 |
2 files changed, 6 insertions, 6 deletions
diff --git a/test/lib/test b/test/lib/test index 93c86e8..2cfec9a 100755 --- a/test/lib/test +++ b/test/lib/test @@ -153,7 +153,7 @@ test_one_line() { "htools") pane_run HOST 'which '"${__arg}"' >/dev/null || echo skip' pane_wait HOST - [ "$(pane_parse HOST)" = "skip" ] && TEST_ONE_skip=1 + [ "$(pane_parse HOST)" = "skip" ] && TEST_ONE_skip=1 || true ;; "passt") pane_run PASST "${__arg}" @@ -194,17 +194,17 @@ test_one_line() { "gtools") pane_run GUEST 'which '"${__arg}"' >/dev/null || echo skip' pane_wait GUEST - [ "$(pane_parse GUEST)" = "skip" ] && TEST_ONE_skip=1 + [ "$(pane_parse GUEST)" = "skip" ] && TEST_ONE_skip=1 || true ;; "g1tools") pane_run GUEST_1 'which '"${__arg}"' >/dev/null || echo skip' pane_wait GUEST_1 - [ "$(pane_parse GUEST_1)" = "skip" ] && TEST_ONE_skip=1 + [ "$(pane_parse GUEST_1)" = "skip" ] && TEST_ONE_skip=1 || true ;; "g2tools") pane_run GUEST_2 'which '"${__arg}"' >/dev/null || echo skip' pane_wait GUEST_2 - [ "$(pane_parse GUEST_2)" = "skip" ] && TEST_ONE_skip=1 + [ "$(pane_parse GUEST_2)" = "skip" ] && TEST_ONE_skip=1 || true ;; "guest2") pane_run GUEST_2 "${__arg}" @@ -249,7 +249,7 @@ test_one_line() { "nstools") pane_run NS 'which '"${__arg}"' >/dev/null || echo skip' pane_wait NS - [ "$(pane_parse NS)" = "skip" ] && TEST_ONE_skip=1 + [ "$(pane_parse NS)" = "skip" ] && TEST_ONE_skip=1 || true ;; "gout") __varname="${__arg%% *}" @@ -1,4 +1,4 @@ -#!/bin/sh +#!/bin/sh -e # # SPDX-License-Identifier: AGPL-3.0-or-later # |