Skip to content

Commit d124467

Browse files
beriberikixclaude
andcommitted
Count tests correctly under --parallel, and drop attach/detach from CI
The no-tests-ran guard fired on every CI run while the suite was green locally. swift test reports differently depending on --parallel and neither format is a superset of the other: serially it prints "Executed N tests" plus a "Test Case ... passed" line per test, in parallel it prints neither and emits only "[n/total] Testing Suite/name" progress lines. CI passes --parallel; local runs here did not. So the counter saw nothing, reported 0, and the guard I added to catch a suite that runs no tests instead blocked a suite running 418 of them. The guard was right to be loud — it was the count feeding it that was wrong. It now tries the serial summary, then the parallel progress denominator, then per-case lines, and both real log formats resolve to 418. The completion-scripts job also asserted that generated completions list attach and detach, which were removed in the previous commit for being commands that only ever threw. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01CmKz41eeUtZesAswErwocH
1 parent e484a4b commit d124467

2 files changed

Lines changed: 24 additions & 7 deletions

File tree

.github/actions/run-test-suite/action.yml

Lines changed: 21 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -333,17 +333,32 @@ runs:
333333
334334
# Count what actually ran, from the test output. Never estimate: an
335335
# invented number is what let a suite that executed nothing look healthy.
336-
# Prefer XCTest's own summary line. Counting "Test Case ... passed|failed"
337-
# lines under-reports badly with --parallel, which emits a line for failures
338-
# but not for passes: a run of 422 tests with 35 failures was reported as
339-
# "35 executed". Take the largest "Executed N tests" figure, which is the
340-
# per-target totals followed by the overall total.
336+
# swift test reports differently depending on --parallel, and neither format
337+
# is a superset of the other:
338+
#
339+
# serial: "Executed 418 tests, with 0 failures ..." plus a
340+
# "Test Case '-[...]' passed" line per test
341+
# parallel: neither of those. Progress only: "[418/418] Testing Suite/name"
342+
#
343+
# Counting "Test Case" lines under --parallel reported a 422-test run with 35
344+
# failures as "35 executed" (only failures get a line). Reading only the
345+
# "Executed N" summary reported 0 under --parallel, which tripped the
346+
# no-tests-ran guard below on every CI run while the suite was green locally.
347+
#
348+
# Try each shape, most authoritative first.
341349
TESTS_RUN=$(grep -oE "Executed [0-9]+ test" "$TEST_LOG" \
342350
| grep -oE "[0-9]+" | sort -n | tail -1 || true)
343351
TESTS_RUN=${TESTS_RUN:-0}
344352
345353
if [ "$TESTS_RUN" -eq 0 ]; then
346-
# No summary line (very old output format): fall back to counting cases.
354+
# Parallel progress lines: take the denominator of "[n/total] Testing ...".
355+
TESTS_RUN=$(grep -oE "^\[[0-9]+/[0-9]+\] Testing " "$TEST_LOG" \
356+
| grep -oE "/[0-9]+\]" | grep -oE "[0-9]+" | sort -n | tail -1 || true)
357+
TESTS_RUN=${TESTS_RUN:-0}
358+
fi
359+
360+
if [ "$TESTS_RUN" -eq 0 ]; then
361+
# Last resort for older output formats.
347362
TESTS_RUN=$(grep -cE "^Test Case .* (passed|failed)" "$TEST_LOG" 2>/dev/null || true)
348363
TESTS_RUN=${TESTS_RUN:-0}
349364
fi

.github/workflows/ci.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -275,7 +275,9 @@ jobs:
275275
echo "Verifying completion script content..."
276276
277277
# Expected commands that should be in completion scripts
278-
EXPECTED_COMMANDS=("help" "list" "bind" "unbind" "attach" "detach" "daemon" "install-system-extension" "diagnose" "completion")
278+
# attach/detach were removed: usbipd is the USB/IP server, and both only ever
279+
# threw operationNotSupported while appearing in help and completions.
280+
EXPECTED_COMMANDS=("help" "list" "bind" "unbind" "daemon" "install-system-extension" "diagnose" "completion")
279281
280282
for cmd in "${EXPECTED_COMMANDS[@]}"; do
281283
echo "Checking for command: $cmd"

0 commit comments

Comments
 (0)