aboutsummaryrefslogtreecommitdiff
path: root/tests/vm-check.sh
diff options
context:
space:
mode:
authorEuAndreh <eu@euandre.org>2023-03-22 15:00:17 -0300
committerEuAndreh <eu@euandre.org>2023-03-22 15:18:40 -0300
commit3d7380572f1f4cfb6dd19baad459f352ec3e5db5 (patch)
treeb9fe2b4d0ecfdb23a99b54b4b26b71dfcb38313c /tests/vm-check.sh
parenttests/vm-check.sh: Still shutdown if "check.sh" fails when -x is given (diff)
downloadpackage-repository-3d7380572f1f4cfb6dd19baad459f352ec3e5db5.tar.gz
package-repository-3d7380572f1f4cfb6dd19baad459f352ec3e5db5.tar.xz
tests/vm-check.sh: Add markers of what is running where
Diffstat (limited to '')
-rwxr-xr-xtests/vm-check.sh25
1 files changed, 17 insertions, 8 deletions
diff --git a/tests/vm-check.sh b/tests/vm-check.sh
index ddae0e2..9390acb 100755
--- a/tests/vm-check.sh
+++ b/tests/vm-check.sh
@@ -75,19 +75,28 @@ eval "$(assert-arg -- "${HOST:-}" '-H HOST')"
eval "$(assert-arg -- "${REMOTE:-}" '-r REMOTE')"
+SEP="$(color -c blacki ':')"
+pre_guest() {
+ sed "s|^|$(color -c green "$HOST")$SEP$(color -c yellow "$TYPE")$SEP |"
+}
-if [ "$SHUTDOWN" = true ]; then
- vm down "$HOST"
-fi
+pre_host() {
+ sed "s|^|$(color -c blueb "$0")$SEP |"
+}
shutdown() {
if [ "$SHUTDOWN" = true ]; then
- vm down "$HOST"
+ vm down "$HOST" 2>&1 | pre_host
fi
}
trap shutdown EXIT
-vm up "$HOST"
-untill -m5 -n5 ssh "$HOST" uptime
-scp tests/checks/"$TYPE".sh "$HOST":check.sh
-ssh "$HOST" sh check.sh "$REMOTE"
+{
+ 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
+ssh "$HOST" sh check.sh "$REMOTE" 2>&1 | pre_guest