forked from mqzkim/mapper
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update coverage for xccov (lyft#137)
* Update coverage for xccov * Add python script instead of jq
- Loading branch information
Showing
5 changed files
with
29 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -18,7 +18,6 @@ | |
.LSOverride | ||
build/ | ||
Carthage/Build | ||
coverage.txt | ||
DerivedData | ||
Icon | ||
run-tests | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,19 @@ | ||
#!/bin/bash | ||
|
||
set -e | ||
set -o pipefail | ||
set -u | ||
|
||
coverage_dir="$1" | ||
profdata=$(find "$coverage_dir" -name "*.profdata" | head -1) | ||
executable=$(find "$coverage_dir" -type f -name "Mapper" | head -1) | ||
xcrun llvm-cov show -instr-profile "$profdata" "$executable" > "coverage.txt" | ||
profdata="$(find "$coverage_dir" -name "*.xccovreport")" | ||
|
||
result="$(xcrun xccov view \ | ||
--only-targets \ | ||
--json \ | ||
"$profdata" \ | ||
| python Resources/get-coverage.py Mapper.framework)" | ||
|
||
if [ "$result" -ne "1" ]; then | ||
echo "Coverage is $result, should be 1" | ||
exit 1 | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
from __future__ import print_function | ||
import json | ||
import sys | ||
|
||
module = sys.argv[1] | ||
coverage = json.load(sys.stdin) | ||
for blob in coverage: | ||
if blob["name"] == module: | ||
print(blob["lineCoverage"]) | ||
sys.exit(0) | ||
|
||
print("Module '{}' not found in '{}'".format(module, json.dumps(coverage)), | ||
file=sys.stderr) | ||
sys.exit(1) |