Export llvm-cov against the Swift test executable.

The first sorted `*PackageTests` file is the Mach-O inside a .dSYM, and
the Linux executable is named `*PackageTests.xctest`, so llvm-cov was
pointed at debug info or at nothing. Paths under a `.dSYM` bundle are
skipped, and the `.xctest` file is accepted. One test expects the
Contents/MacOS executable when a dSYM is beside it; the other expects
the Linux file.

Co-authored-by: Robert C. Martin <[email protected]>
This commit is contained in:
Cursor Agent
2026-11-26 00:03:03 +00:00
co-authored by Robert C. Martin
parent 95c17c42ab
commit ccbac08c2b
3 changed files with 84 additions and 2 deletions
+1 -1
View File
@@ -104,7 +104,7 @@ Swift package:
swift test --enable-code-coverage
bin="$(dirname "$(command -v swift)")/llvm-cov"
profdata="$(find .build -path '*/codecov/default.profdata' -print -quit)"
binary="$(find .build -type f -name '*PackageTests' -print -quit)"
binary="$(find .build -type f \( -name '*PackageTests' -o -name '*PackageTests.xctest' \) ! -path '*.dSYM/*' -print -quit)"
mkdir -p target/coverage/swift
"$bin" export -format=json -instr-profile="$profdata" "$binary" \
> target/coverage/swift/llvm-cov.json