summaryrefslogtreecommitdiff
path: root/Makefile.rules
diff options
context:
space:
mode:
authorVic Yang <victoryang@chromium.org>2013-06-12 00:08:56 +0800
committerChromeBot <chrome-bot@google.com>2013-06-16 20:14:01 -0700
commitaaac3935d2e82b281979045a390f0b7d2c79b281 (patch)
tree8eafe931dd051f04ad85f7a270c6aafdd628deb0 /Makefile.rules
parent7402388c587e03181559f859f797f27c840c32ab (diff)
downloadchrome-ec-aaac3935d2e82b281979045a390f0b7d2c79b281.tar.gz
Make target for test coverage report generation
By 'make coverage', lcov is used to generate test coverage report in HTML format stored in coverage_rpt folder. BUG=chrome-os-partner:19235 TEST=Generate a report. BRANCH=None Change-Id: I44142eaaeb897cf09179764781120370920144cd Signed-off-by: Vic Yang <victoryang@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/58203
Diffstat (limited to 'Makefile.rules')
-rw-r--r--Makefile.rules20
1 files changed, 19 insertions, 1 deletions
diff --git a/Makefile.rules b/Makefile.rules
index 4def77851c..93fe9eb7bc 100644
--- a/Makefile.rules
+++ b/Makefile.rules
@@ -84,7 +84,7 @@ $(host-test-targets): host-%:
@set -e ; \
echo " BUILD host - build/host/$*" ; \
$(MAKE) --no-print-directory BOARD=host PROJECT=$* \
- V=$(V) out=build/host/$* TEST_BUILD=y EMU_BUILD=y \
+ V=$(V) out=build/host/$* TEST_BUILD=y EMU_BUILD=y $(TEST_FLAG) \
CROSS_COMPILE= build/host/$*/$*.exe
$(run-test-targets): run-%: host-%
@@ -93,6 +93,24 @@ $(run-test-targets): run-%: host-%
hosttests: $(host-test-targets)
runtests: $(run-test-targets)
+cov-test-targets=$(foreach t,$(test-list-host),build/host/$(t).info)
+bldversion=$(shell (./util/getversion.sh ; echo VERSION) | $(CPP) -P)
+
+# lcov fails when multiple instances run at the same time.
+# We need to run them sequentially by using flock
+cmd_lcov=flock .lcov_lock -c "lcov -q -o $@ -c -d build/host/$*"
+cmd_report_cov=genhtml -q -o build/host/coverage_rpt -t \
+ "EC Unittest "$(bldversion) $^
+
+build/host/%.info: run-%
+ $(call quiet,lcov,COV )
+
+coverage: TEST_FLAG=TEST_COVERAGE=y
+coverage: $(cov-test-targets)
+ $(call quiet,report_cov,REPORT )
+
+.PHONY: coverage
+
$(out)/firmware_image.lds: common/firmware_image.lds.S
$(call quiet,lds,LDS )
$(out)/%.lds: core/$(CORE)/ec.lds.S