]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
Allow py.test system test to skip itself
authorPetr Špaček <pspacek@isc.org>
Tue, 22 Jun 2021 14:11:26 +0000 (16:11 +0200)
committerMichal Nowak <mnowak@isc.org>
Fri, 8 Apr 2022 07:20:55 +0000 (09:20 +0200)
Enable use of shortcuts like pytest.importorskip and other tricks
which can cause test to skip itself.

(cherry picked from commit b8829c801f876b58e0ac1ce354e6790ef8de4532)

In addition to b8829c801f876b58e0ac1ce354e6790ef8de4532,
"R:$systest:SKIPPED" is not being printed when pytests are skipped
because that leads to two `R:` lines - SKIPPED and PASS/FAIL which is
determined later based on other conditions (core files identified,
assertion failures, shell test result, ...) - which is wrong and
testsummary.sh rightfully stumbles on it:

    I:Found 106 test results, but 105 tests were run

bin/tests/system/run.sh

index 6451f3f45c09e75efeac82bbbb1ac58de2d07275..cef1e2ee53f6ce09864b4787643f1e8aea3441a1 100755 (executable)
@@ -236,17 +236,19 @@ if [ $status -eq 0 ]; then
             rm -f "$systest/$test.status"
             if start_servers; then
                 run=$((run+1))
-                rm -f "$systest/$test.status"
                 test_status=0
                 (cd "$systest" && "$PYTEST" -v "$test" "$@" || echo "$?" > "$test.status") | SYSTESTDIR="$systest" cat_d
                 if [ -f "$systest/$test.status" ]; then
-                    echo_i "FAILED"
-                    test_status=$(cat "$systest/$test.status")
+                    if [ "$(cat "$systest/$test.status")" != "5" ]; then
+                        test_status=$(cat "$systest/$test.status")
+                    fi
                 fi
                 status=$((status+test_status))
                 stop_servers || status=1
             else
                 status=1
+            fi
+            if [ $status -ne 0 ]; then
                 break
             fi
         done