blob: 8fe75c5cd5e62b510e3cfe8bce7381d07d581622 [file] [log] [blame]
mtklein@google.com1fb04e22013-09-13 19:32:43 +00001#!/bin/sh
2
3# Run from Skia trunk something like this:
4# $ tools/coverage.sh tests
5# or
6# $ tools/coverage.sh gm
7
8set -x
9set -e
10
11COMMAND=$@
12GCOV=$(realpath tools/gcov_shim)
13
14QUIET=-q
15
16# Build all of Skia.
17./gyp_skia
18ninja -C out/Coverage
19
20# Generate a zero-baseline so files not covered by $COMMAND will still show up in the report.
21# This reads the .gcno files that are created at compile time.
22lcov $QUIET --gcov-tool=$GCOV -c -b out/Coverage -d out/Coverage -o /tmp/baseline -i
23
24# Running the binary generates the real coverage information, the .gcda files.
25out/Coverage/$COMMAND
26lcov $QUIET --gcov-tool=$GCOV -c -b out/Coverage -d out/Coverage -o /tmp/coverage
27
28lcov $QUIET -a /tmp/baseline -a /tmp/coverage -o /tmp/merged
29
commit-bot@chromium.orga1a097e2013-11-14 16:53:22 +000030genhtml $QUIET /tmp/merged --legend -o out/Coverage/report
mtklein@google.com1fb04e22013-09-13 19:32:43 +000031xdg-open out/Coverage/report/index.html