diff options
author | EuAndreh <eu@euandre.org> | 2023-03-24 17:20:16 -0300 |
---|---|---|
committer | EuAndreh <eu@euandre.org> | 2023-03-24 17:20:16 -0300 |
commit | f33e7df9fc896ad01bf7395cc4da119703b5208a (patch) | |
tree | 1f05281149dc89e6f8bc2f8994b4866c47c95ee2 /tests | |
parent | Makefile: Add "check-shellcheck" target (diff) | |
download | package-repository-f33e7df9fc896ad01bf7395cc4da119703b5208a.tar.gz package-repository-f33e7df9fc896ad01bf7395cc4da119703b5208a.tar.xz |
tests/vm-check.sh: Fail when "check.sh" fails
Diffstat (limited to 'tests')
-rwxr-xr-x | tests/vm-check.sh | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/tests/vm-check.sh b/tests/vm-check.sh index de78f0c..78086e7 100755 --- a/tests/vm-check.sh +++ b/tests/vm-check.sh @@ -84,10 +84,14 @@ pre_host() { sed "s|^|$(color -c blueb "$0")$SEP |" } +STATUS_F="$(mkstemp)" shutdown() { + STATUS="$(cat "$STATUS_F" || echo 1)" + rm -f "$STATUS_F" if [ "$SHUTDOWN" = true ]; then vm down "$HOST" 2>&1 | pre_host fi + exit "$STATUS" } trap shutdown EXIT @@ -100,5 +104,9 @@ trap shutdown EXIT scp tests/checks/"$TYPE".sh "$HOST":check.sh } 2>&1 | pre_host -# shellcheck disable=2029 -ssh "$HOST" sh check.sh "$REMOTE" 2>&1 | pre_guest +{ + STATUS=0 + # shellcheck disable=2029 + ssh "$HOST" sh check.sh "$REMOTE" || STATUS=$? + printf '%s' "$STATUS" > "$STATUS_F" +} 2>&1 | pre_guest |