Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 #!/bin/sh | |
| 2 # Copyright 2013 Google Inc. | |
|
mtklein_C
2016/09/16 19:21:43
:/
hal.canary
2016/09/20 18:19:01
It's based on a copy of a file from 2013.
Done.
| |
| 3 # | |
| 4 # Use of this source code is governed by a BSD-style license that can be | |
| 5 # found in the LICENSE file. | |
| 6 | |
| 7 # Run something like this: | |
| 8 # $ bin/coverage dm --src tests | |
| 9 # or | |
| 10 # $ bin/coverage dm --src gm skp | |
| 11 | |
| 12 set -x | |
| 13 set -e | |
| 14 | |
| 15 cd "$(dirname "$0")/.." | |
| 16 | |
| 17 EXECUTABLE="$1" | |
|
mtklein_C
2016/09/16 19:21:43
What's the deal with all the quoting? Is $1 or $@
hal.canary
2016/09/20 18:19:01
It's always good habit in shell scripting.
mtklein
2016/09/20 22:38:53
I'm not sure that that's true. If the simple opti
| |
| 18 shift | |
| 19 GCOV=$(realpath tools/gcov_shim) | |
| 20 | |
| 21 QUIET=-q | |
| 22 | |
| 23 DIR="$(mktemp -d "${TMPDIR:-/tmp}/skia_coverage_XXXXXXXXXX")" | |
|
mtklein_C
2016/09/16 19:21:43
Why not out/Coverage or somewhere else that lets y
hal.canary
2016/09/20 18:19:01
I had issues with caching while testing. It's fi
| |
| 24 | |
| 25 # Build $EXECUTABLE | |
| 26 bin/sync | |
|
mtklein_C
2016/09/16 19:21:43
Are you sure you want this here? Syncing deps can
hal.canary
2016/09/20 18:19:01
Suprising how?
Not syncing deps before building c
mtklein
2016/09/20 22:38:53
It seems like an odd, but perhaps harmless, thing
| |
| 27 bin/fetch-gn | |
| 28 gn gen \ | |
| 29 --args='cc="gcc -fprofile-arcs " cxx="g++ -fprofile-arcs" extra_cflags="-ftes t-coverage"' \ | |
|
mtklein_C
2016/09/16 19:21:43
We used to use --coverage. What's different here?
hal.canary
2016/09/20 18:19:01
not sure why I changed. `--coverage` works.
Done
| |
| 30 "$DIR"/build | |
| 31 ninja -C "$DIR"/build "$EXECUTABLE" | |
| 32 | |
| 33 # Generate a zero-baseline so files not covered by $EXECUTABLE $@ will | |
| 34 # still show up in the report. This reads the .gcno files that are | |
| 35 # created at compile time. | |
| 36 lcov $QUIET --gcov-tool=$GCOV -c -b "$DIR"/build -d "$DIR"/build -o "$DIR"/basel ine -i | |
| 37 | |
| 38 # Running the binary generates the real coverage information, the .gcda files. | |
| 39 "$DIR"/build/"$EXECUTABLE" "$@" | |
| 40 | |
| 41 lcov $QUIET --gcov-tool=$GCOV -c -b "$DIR"/build -d "$DIR"/build -o "$DIR"/cover age | |
| 42 | |
| 43 lcov $QUIET -a "$DIR"/baseline -a "$DIR"/coverage -o "$DIR"/merged | |
| 44 | |
| 45 genhtml $QUIET "$DIR"/merged --legend -o "$DIR"/coverage_report --ignore-errors source | |
| 46 | |
| 47 xdg-open "$DIR"/coverage_report/index.html | |
| OLD | NEW |