diff options
author | 2013-09-13 19:32:43 +0000 | |
---|---|---|
committer | 2013-09-13 19:32:43 +0000 | |
commit | 1fb04e25405d5ec75aea4a099819d6feca348ff6 (patch) | |
tree | 7b7b97caa0cfeafbc604ecc712f29ab34f4c5e1a /tools/coverage.sh | |
parent | cee9dcb8377e1f85a7a232822a894464ea6ccddc (diff) |
add a way to get code coverage
BUG=
R=borenet@google.com
Review URL: https://codereview.chromium.org/23523055
git-svn-id: http://skia.googlecode.com/svn/trunk@11261 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'tools/coverage.sh')
-rwxr-xr-x | tools/coverage.sh | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/tools/coverage.sh b/tools/coverage.sh new file mode 100755 index 0000000000..3e34806843 --- /dev/null +++ b/tools/coverage.sh @@ -0,0 +1,31 @@ +#!/bin/sh + +# Run from Skia trunk something like this: +# $ tools/coverage.sh tests +# or +# $ tools/coverage.sh gm + +set -x +set -e + +COMMAND=$@ +GCOV=$(realpath tools/gcov_shim) + +QUIET=-q + +# Build all of Skia. +./gyp_skia +ninja -C out/Coverage + +# Generate a zero-baseline so files not covered by $COMMAND will still show up in the report. +# This reads the .gcno files that are created at compile time. +lcov $QUIET --gcov-tool=$GCOV -c -b out/Coverage -d out/Coverage -o /tmp/baseline -i + +# Running the binary generates the real coverage information, the .gcda files. +out/Coverage/$COMMAND +lcov $QUIET --gcov-tool=$GCOV -c -b out/Coverage -d out/Coverage -o /tmp/coverage + +lcov $QUIET -a /tmp/baseline -a /tmp/coverage -o /tmp/merged + +genhtml $QUIET /tmp/merged -o out/Coverage/report +xdg-open out/Coverage/report/index.html |