From 3abb39ef09cd872c5b209b28bd46732aaf896535 Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Wed, 29 Mar 2023 08:32:12 -0300 Subject: tests/vm-check.sh: Timestamp each output via ts(1) --- tests/vm-check.sh | 34 +++++++++++++++++++--------------- 1 file changed, 19 insertions(+), 15 deletions(-) (limited to 'tests') 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' -- cgit v1.2.3