diff options
-rwxr-xr-x | tests/vm-check.sh | 34 |
1 files changed, 19 insertions, 15 deletions
diff --git a/tests/vm-check.sh b/tests/vm-check.sh index 327aa6d..e6b4af4 100755 --- a/tests/vm-check.sh +++ b/tests/vm-check.sh @@ -77,11 +77,11 @@ eval "$(assert-arg -- "${REMOTE:-}" '-r REMOTE')" SEP="$(color -c blacki ':')" pre_guest() { - sed "s|^|$(color -c green "$HOST")$SEP$(color -c yellow "$TYPE")$SEP |" + sed -u "s|^|$(color -c green "$HOST")$SEP$(color -c yellow "$TYPE")$SEP |" } pre_host() { - sed "s|^|$(color -c blueb "$0")$SEP |" + sed -u "s|^|$(color -c blueb "$0")$SEP |" } STATUS_F="$(mkstemp)" @@ -96,17 +96,21 @@ shutdown() { trap shutdown EXIT { - if [ "$SHUTDOWN" = true ]; then - vm down "$HOST" - fi - vm up "$HOST" - untill -m5 -n5 ssh "$HOST" uptime - scp tests/checks/"$TYPE".sh "$HOST":check.sh -} 2>&1 | pre_host -{ - STATUS=0 - # shellcheck disable=2029 - ssh "$HOST" sh check.sh "$@" "$REMOTE" || STATUS=$? - printf '%s' "$STATUS" > "$STATUS_F" -} 2>&1 | pre_guest + { + if [ "$SHUTDOWN" = true ]; then + vm down "$HOST" + fi + vm up "$HOST" + untill -m5 -n5 ssh "$HOST" uptime + scp tests/checks/"$TYPE".sh "$HOST":check.sh + } 2>&1 | pre_host + + { + STATUS=0 + # shellcheck disable=2029 + ssh "$HOST" sh check.sh "$@" "$REMOTE" || STATUS=$? + printf '%s' "$STATUS" > "$STATUS_F" + } 2>&1 | pre_guest + +} | ts -s '%.s' |