]> git.ipfire.org Git - thirdparty/dracut-ng.git/commitdiff
test: fail test if server has terminated
authorBenjamin Drung <benjamin.drung@canonical.com>
Mon, 18 Nov 2024 20:50:03 +0000 (21:50 +0100)
committerLaszlo <laszlo.gombos@gmail.com>
Mon, 18 Nov 2024 21:54:49 +0000 (16:54 -0500)
The server might shutdown on error. When waiting for the server to
startup, check if the server QEMU process has vanished and abort the
test in that case.

test/test-functions

index 4cf9691c5583b6da00b737c91839dfd6ab0a32c8..67b5befcddc247e4ff6d7ad65f6bc993aef8b00a 100644 (file)
@@ -66,9 +66,16 @@ test_dracut() {
 # Wait for the server QEMU has been started up.
 # It should print "Serving" in the server.log in that case.
 wait_for_server_startup() {
+    local server_pid
+    server_pid=$(cat "$TESTDIR"/server.pid)
+
     while ! grep -q Serving "$TESTDIR"/server.log; do
         echo "Waiting for the server to startup"
         tail "$TESTDIR"/server.log
+        if ! test -f "/proc/$server_pid/status"; then
+            echo "Error: Server QEMU process $server_pid is gone. Please check $TESTDIR/server.log for failures." >&2
+            return 1
+        fi
         sleep 1
     done
 }