Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(25)

Unified Diff: tools/coverage.sh

Issue 23523055: add a way to get code coverage (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: borenet Created 7 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « gyp/common_conditions.gypi ('k') | tools/gcov_shim » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/coverage.sh
diff --git a/tools/coverage.sh b/tools/coverage.sh
new file mode 100755
index 0000000000000000000000000000000000000000..3e34806843f33d86d76a2dfd67a40dd1321154bb
--- /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
« no previous file with comments | « gyp/common_conditions.gypi ('k') | tools/gcov_shim » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698