]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
test: wait for the "latest" systemd-bsod message
authorFrantisek Sumsal <frantisek@sumsal.cz>
Mon, 6 Nov 2023 19:00:09 +0000 (20:00 +0100)
committerLuca Boccassi <luca.boccassi@gmail.com>
Mon, 6 Nov 2023 21:01:24 +0000 (21:01 +0000)
Let's wait for the "latest" message systemd-bsod prints to the console
to appear, otherwise we might be too fast and take a console snapshot
before it contains all the information:

[   44.237788] testsuite-04.sh[1744]: + setterm --term linux --dump --file /tmp/console.dump
[   44.246089] systemd-bsod[1858]: QR code could not be printed, ignoring: Operation not supported
[   44.305692] testsuite-04.sh[1744]: + grep -aq 'The current boot has failed' /tmp/console.dump
[   44.308047] testsuite-04.sh[1744]: + grep -aq 'Service emergency message' /tmp/console.dump
[   44.311200] testsuite-04.sh[1744]: + grep -aq 'Press any key to exit' /tmp/console.dump
[   44.314359] testsuite-04.sh[1744]: + at_exit
[   44.315087] testsuite-04.sh[1744]: + local EC=1
[   44.315945] testsuite-04.sh[1744]: + [[ 1 -ne 0 ]]
[   44.316647] testsuite-04.sh[1744]: + [[ -e /tmp/console.dump ]]
[   44.318305] testsuite-04.sh[1744]: + cat /tmp/console.dump
[   44.319320] testsuite-04.sh[1871]:    The current boot has failed!
[   44.319970] testsuite-04.sh[1871]:    Service emergency message

test/units/testsuite-04.bsod.sh

index 6abdd272cec23eeab75c104df234c1b5b21d5aeb..774707d476b6953145d077f1a95801b1adb6b546 100755 (executable)
@@ -32,9 +32,9 @@ vcs_dump_and_check() {
     # so try it a couple of times
     for _ in {0..9}; do
         setterm --term linux --dump --file /tmp/console.dump
-        if grep -aq "The current boot has failed" /tmp/console.dump; then
+        if grep -aq "Press any key to exit" /tmp/console.dump
             grep -aq "$expected_message" /tmp/console.dump
-            grep -aq "Press any key to exit" /tmp/console.dump
+            grep -aq "The current boot has failed" /tmp/console.dump; then
 
             return 0
         fi