aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBryan Lewandowski <bryanlew@google.com>2016-04-05 10:34:30 -0700
committerBryan Lewandowski <bryanlew@google.com>2016-04-06 17:55:31 +0000
commitc0c256c4358a2f9b885f2fa895aebc488283f978 (patch)
tree0e4f70fba867b27a227d99a774893de8b72cd3b9
parente2d68d4c17eab35f04c131f9651086b956b97088 (diff)
downloadlibweave-c0c256c4358a2f9b885f2fa895aebc488283f978.tar.gz
Add "make coverage" target to build code coverage.
Change-Id: I8b00004e9ea5954ee7117cdaaaa2969090762570 Reviewed-on: https://weave-review.googlesource.com/3126 Reviewed-by: Mike Frysinger <vapier@google.com>
-rw-r--r--tests.mk18
1 files changed, 17 insertions, 1 deletions
diff --git a/tests.mk b/tests.mk
index c7db877..35557d7 100644
--- a/tests.mk
+++ b/tests.mk
@@ -65,5 +65,21 @@ export-test : out/$(BUILD_MODE)/libweave_exports_testrunner
testall : test export-test
-.PHONY : test export-test testall
+###
+# coverage
+# This runs coverage against unit tests, invoke with "make coverage".
+# Output "homepage" is out/$(BUILD_MODE)/coverage_html/index.html
+# Running a mode other than Debug will result in incorrect coverage data.
+# https://gcc.gnu.org/onlinedocs/gcc/Gcov-and-Optimization.html
+
+coverage: CFLAGS+=--coverage
+
+run_coverage: test
+ lcov --capture --directory out/$(BUILD_MODE) --output-file out/$(BUILD_MODE)/coverage.info
+ lcov -b . --remove out/$(BUILD_MODE)/coverage.info "*third_party*" "/usr/include/*" "*/include/weave/test/*" "*/src/test/*" "*/include/weave/provider/test/*" -o out/$(BUILD_MODE)/coverage_filtered.info
+ genhtml out/$(BUILD_MODE)/coverage_filtered.info --output-directory out/$(BUILD_MODE)/coverage_html
+
+coverage: run_coverage
+
+.PHONY : coverage run_coverage test export-test testall