]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
test: show the subtest name together with the failing code
authorFrantisek Sumsal <frantisek@sumsal.cz>
Sat, 24 Jun 2023 18:43:26 +0000 (20:43 +0200)
committerFrantisek Sumsal <frantisek@sumsal.cz>
Sat, 24 Jun 2023 18:44:33 +0000 (20:44 +0200)
To make debugging slightly easier.

test/units/test-control.sh

index 017f6410c9f49e6750f46eb4b299938ee9285339..b8a57cb6eab9db7d5fe3ed4b8e0438c25c0050cf 100644 (file)
@@ -89,7 +89,12 @@ run_subtests_with_signals() {
         : "--- $subtest BEGIN ---"
         "./$subtest" &
         _CHILD_PID=$!
-        _wait_harder "$_CHILD_PID" && _PASSED_TESTS+=("$subtest") || return 1
+        if ! _wait_harder "$_CHILD_PID"; then
+            echo "Subtest $subtest failed"
+            return 1
+        fi
+
+        _PASSED_TESTS+=("$subtest")
         : "--- $subtest END ---"
     done
 
@@ -113,7 +118,12 @@ run_subtests() {
         fi
 
         : "--- $subtest BEGIN ---"
-        "./$subtest" && _PASSED_TESTS+=("$subtest") || return 1
+        if ! "./$subtest"; then
+            echo "Subtest $subtest failed"
+            return 1
+        fi
+
+        _PASSED_TESTS+=("$subtest")
         : "--- $subtest END ---"
     done