From aaac3935d2e82b281979045a390f0b7d2c79b281 Mon Sep 17 00:00:00 2001 From: Vic Yang Date: Wed, 12 Jun 2013 00:08:56 +0800 Subject: 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 Reviewed-on: https://gerrit.chromium.org/gerrit/58203 --- Makefile.rules | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) (limited to 'Makefile.rules') 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 -- cgit v1.2.1