diff options
author | jmkiley <jordan.kiley@mapbox.com> | 2019-02-28 14:38:48 -0800 |
---|---|---|
committer | jmkiley <jordan.kiley@mapbox.com> | 2019-03-11 12:54:48 -0700 |
commit | e46ea37e7a355b1d1beecfae7efb81bf77c91549 (patch) | |
tree | 2f5e08db274f7d2b9f653a496494fb002774fadd | |
parent | 60ceac5efc3d77199f773f08400fe1d53d5a1b90 (diff) | |
download | qtlocation-mapboxgl-e46ea37e7a355b1d1beecfae7efb81bf77c91549.tar.gz |
[ios] Generate code coverage, print percentage
-rw-r--r-- | platform/ios/scripts/code-coverage.sh | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/platform/ios/scripts/code-coverage.sh b/platform/ios/scripts/code-coverage.sh new file mode 100644 index 0000000000..27a8a06e59 --- /dev/null +++ b/platform/ios/scripts/code-coverage.sh @@ -0,0 +1,19 @@ +#!/usr/bin/env bash + +set -e +set -o pipefail + +# Get code coverage, then convert it to JSON. +cov_result=build/ios/Logs/Test/*.xcresult/*_Test/*.xccovreport +xcrun xccov view $cov_result --json > output.json + +# Access the overall line coverage for the dynamic build. +percentage=`node -e "console.log(require('./output.json').lineCoverage)"` + +# Convert the coverage from "0.x" format to a percentage. +cov=$(printf "%.2f" $(echo "$percentage*100" | bc -l)) +echo $cov + +# Clean up files. +rm -rf build/ios/ios/Logs/Test/*.xcresult/ +rm -f output.json
\ No newline at end of file |