Skip to content

Commit

Permalink
Add tools/run_tests/run_lcov.sh
Browse files Browse the repository at this point in the history
This is a tool for collecting coverage reports from our tests and
combining them with the open-source tool 'lcov'.
  • Loading branch information
ctiller committed Jan 13, 2015
1 parent 9fef05c commit 934baa3
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 0 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,5 @@ deps
libs
objs
*.pyc
*.gcno

9 changes: 9 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,15 @@ CPPFLAGS_msan = -O1 -fsanitize=memory -fno-omit-frame-pointer
LDFLAGS_msan = -fsanitize=memory
DEFINES_msan = NDEBUG

VALID_CONFIG_gcov = 1
CC_gcov = gcc
CXX_gcov = g++
LD_gcov = gcc
LDXX_gcov = g++
CPPFLAGS_gcov = -O0 -fprofile-arcs -ftest-coverage
LDFLAGS_gcov = -fprofile-arcs -ftest-coverage
DEFINES_gcov = NDEBUG

# General settings.
# You may want to change these depending on your system.

Expand Down
18 changes: 18 additions & 0 deletions tools/run_tests/run_lcov.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#!/bin/bash

set -ex

out=`realpath ${1:-coverage}`

root=`realpath $(dirname $0)/../..`
tmp=`mktemp`
cd $root
tools/run_tests/run_tests.py -c gcov
lcov --capture --directory . --output-file $tmp
genhtml $tmp --output-directory $out
rm $tmp
if which xdg-open > /dev/null
then
xdg-open file://$out/index.html
fi

1 change: 1 addition & 0 deletions tools/run_tests/run_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ def run_command(self, binary):
'tsan': SimpleConfig('tsan'),
'msan': SimpleConfig('msan'),
'asan': SimpleConfig('asan'),
'gcov': SimpleConfig('gcov'),
'valgrind': ValgrindConfig('dbg'),
}

Expand Down

0 comments on commit 934baa3

Please sign in to comment.