]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
test: do not lose logs of late failures in TEST-02-UNITTESTS
authorLuca Boccassi <luca.boccassi@microsoft.com>
Mon, 21 Jun 2021 11:34:07 +0000 (12:34 +0100)
committerLuca Boccassi <luca.boccassi@microsoft.com>
Mon, 21 Jun 2021 18:47:38 +0000 (19:47 +0100)
Due to set -e, if the wait() fails (eg: because of an assert in the
waited task), report_result() never runs and logs are lost

test/units/testsuite-02.sh

index da02304a32a2577e711c83c7bdc69e304b0ab860..bf9a65972f039e399a6459b9675fca965c2dafc9 100755 (executable)
@@ -78,10 +78,12 @@ done
 
 # Wait for remaining running tasks
 for key in "${!running[@]}"; do
-    wait ${running[$key]}
-    ec=$?
+    wait ${running[$key]} && ec=0 || ec=$?
     report_result "$key" $ec
     unset running["$key"]
 done
 
+# Test logs are sometimes lost, as the system shuts down immediately after
+journalctl --sync
+
 exit 0