Skip to content

Commit 28a89b3

Browse files
committed
hack/test-example.sh: print more debug info with diagnose()
Signed-off-by: Akihiro Suda <[email protected]>
1 parent be066ef commit 28a89b3

File tree

1 file changed

+12
-4
lines changed

1 file changed

+12
-4
lines changed

hack/test-example.sh

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -60,14 +60,22 @@ if limactl ls -q | grep -q "$NAME"; then
6060
exit 1
6161
fi
6262

63+
function diagnose() {
64+
NAME="$1"
65+
set -x +e
66+
tail "$HOME/.lima/${NAME}"/*.log
67+
limactl shell "$NAME" systemctl status
68+
limactl shell "$NAME" systemctl
69+
limactl shell "$NAME" sudo cat /var/log/cloud-init-output.log
70+
set +x -e
71+
}
72+
6373
INFO "Starting \"$NAME\" from \"$FILE\""
6474
trap 'limactl delete -f $NAME' EXIT
6575
set -x
6676
if ! limactl start --tty=false "$FILE"; then
6777
ERROR "Failed to start \"$NAME\""
68-
tail "$HOME/.lima/${NAME}"/*.log
69-
limactl shell "$NAME" systemctl status || true
70-
limactl shell "$NAME" cat /var/log/cloud-init-output.log || true
78+
diagnose "$NAME"
7179
exit 1
7280
fi
7381

@@ -93,7 +101,7 @@ if [[ -n ${CHECKS["systemd"]} ]]; then
93101
set -x
94102
if ! limactl shell "$NAME" systemctl is-system-running --wait; then
95103
ERROR '"systemctl is-system-running" failed'
96-
limactl shell "$NAME" systemctl
104+
diagnose "$NAME"
97105
if [[ -z ${CHECKS["systemd-strict"]} ]]; then
98106
INFO 'Ignoring "systemctl is-system-running" failure'
99107
else

0 commit comments

Comments
 (0)