Skip to content
This repository was archived by the owner on Feb 6, 2023. It is now read-only.

Commit 4f92ed1

Browse files
* Added code coverage.
1 parent 248d53a commit 4f92ed1

2 files changed

Lines changed: 50 additions & 0 deletions

File tree

File renamed without changes.

Tools/xcode-coverage-report

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
#!/bin/bash
2+
function printHelp() {
3+
cat <<HELP
4+
Usage: xcode-coverage-report [ -h ] | [ <build-directory> ]
5+
6+
Reads Xcode coverage data and outputs it in a format suitable for phabit ingestion.
7+
HELP
8+
}
9+
10+
build_dir=""
11+
while (( $# > 0 ))
12+
do
13+
if [[ $1 == -h ]]
14+
then
15+
printHelp
16+
exit 0
17+
fi
18+
if (( ${#build_dir} != 0 ))
19+
then
20+
echo ">>> Error: Build directory already set: '$build_dir'. Scanning '$1'." 1>&2
21+
exit 1
22+
fi
23+
build_dir="$1"
24+
shift
25+
done
26+
27+
if (( ${#build_dir} == 0 ))
28+
then
29+
if [ -e "./Build" ]
30+
then
31+
build_dir="./Build"
32+
else
33+
build_dir=".build"
34+
fi
35+
fi
36+
37+
test_run=$(echo ./Build/Logs/Test/**/**/*.xccovarchive)
38+
if (( $(echo "$test_run" | wc -l) != 1 ))
39+
then
40+
echo ">>> Error: can't find xccovarchive file: '$test_run'." 1>&2
41+
exit 1
42+
fi
43+
44+
while IFS= read -r file
45+
do
46+
echo "File: \"$file\""
47+
xcrun xccov view \
48+
--file "$file" \
49+
"$test_run"
50+
done < <(xcrun xccov view --file-list "$test_run")

0 commit comments

Comments
 (0)