1
0
mirror of https://passt.top/passt synced 2024-07-01 23:42:41 +00:00

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>
This commit is contained in:
David Gibson 2022-05-12 12:42:50 +10:00 committed by Stefano Brivio
parent c638129a9e
commit 3e0641f91f
2 changed files with 6 additions and 6 deletions

View File

@ -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%% *}"

View File

@ -1,4 +1,4 @@
#!/bin/sh
#!/bin/sh -e
#
# SPDX-License-Identifier: AGPL-3.0-or-later
#