]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
test: add missing operators
authorFrantisek Sumsal <frantisek@sumsal.cz>
Mon, 18 Dec 2023 17:02:41 +0000 (18:02 +0100)
committerYu Watanabe <watanabe.yu+github@gmail.com>
Tue, 19 Dec 2023 02:47:17 +0000 (11:47 +0900)
Without them only the last expression's return value is honored, causing
unexpected CI fails:

[   26.006721] testsuite-04.sh[1191]: + for _ in {0..9}
[   26.007672] testsuite-04.sh[1191]: + setterm --term linux --dump --file /tmp/console.dump
[   26.008871] testsuite-04.sh[1233]: + SYSTEMD_COLORS=256
[   26.009606] testsuite-04.sh[1233]: + /usr/lib/systemd/systemd-bsod
[   26.063296] systemd[1]: session-1.scope: Deactivated successfully.
[   26.124789] testsuite-04.sh[1191]: + grep -aq 'Press any key to exit' /tmp/console.dump
[   26.131509] testsuite-04.sh[1191]: + grep -aq 'Root emergency message' /tmp/console.dump
[   26.137882] testsuite-04.sh[1191]: + grep -aq 'The current boot has failed' /tmp/console.dump
[   26.141650] testsuite-04.sh[1191]: + return 0
[   26.144816] testsuite-04.sh[1191]: + grep -aq 'Scan the QR code' /tmp/console.dump
[   26.153591] testsuite-04.sh[1191]: + at_exit
[   26.154744] testsuite-04.sh[1191]: + local EC=1
[   26.155697] testsuite-04.sh[1191]: + [[ 1 -ne 0 ]]
[   26.156787] testsuite-04.sh[1191]: + [[ -e /tmp/console.dump ]]
[   26.157799] testsuite-04.sh[1191]: + cat /tmp/console.dump
[   26.158858] testsuite-04.sh[1244]:    The current boot has failed!
[   26.159858] testsuite-04.sh[1244]:    Root emergency message

I'm genuinely impressed that this worked at all.

test/units/testsuite-04.bsod.sh

index 1de446bc124f1e1e86d72a8ad2881fd84675af6e..1d4ad7ec6a21a48761b8ab93c90d05af068d6edc 100755 (executable)
@@ -35,9 +35,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 "Press any key to exit" /tmp/console.dump
-            grep -aq "$expected_message" /tmp/console.dump
-            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 "The current boot has failed" /tmp/console.dump; then
 
             return 0
         fi