summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Makefile3
-rw-r--r--Makefile.rules15
2 files changed, 16 insertions, 2 deletions
diff --git a/Makefile b/Makefile
index aa2037e347..fbc59c42df 100644
--- a/Makefile
+++ b/Makefile
@@ -50,6 +50,8 @@ EMPTY=
ifdef CTS_MODULE
# CTS builds need different directories per board per suite.
out?=build/$(BOARD)/cts_$(CTS_MODULE)
+else ifdef TEST_COVERAGE
+out?=build/coverage/initial-$(BOARD)
else
out?=build/$(BOARD)
endif
@@ -377,6 +379,7 @@ def_all_deps+=ro
endif
all_deps?=$(def_all_deps)
all: $(all_deps)
+compile-only: $(ro-objs) $(rw-objs)
ro: override BLD:=RO
ro: $(libsharedobjs_elf-y) $(out)/RO/$(PROJECT).RO.flat
diff --git a/Makefile.rules b/Makefile.rules
index 9916fba5ba..bcddfbbd66 100644
--- a/Makefile.rules
+++ b/Makefile.rules
@@ -389,15 +389,22 @@ $(foreach b, $(cts_boards), \
) \
)
+cov-boards=lazor volteer
cov-test-targets=$(foreach t,$(cov-test-list-host),build/coverage/$(t).info)
+cov-test-targets+=$(foreach t,$(cov-boards),build/coverage/initial-$(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 /tmp/ec-lcov-lock -c "lcov -q -o $@ -c -d build/coverage/$*"
+cmd_lcov=flock /tmp/ec-lcov-lock -c "lcov --gcov-tool \
+ $(CURDIR)/util/llvm-gcov.sh -q -o $@ -c -d build/coverage/$* -t $* \
+ --exclude '*/ec/test/*' --exclude '*/ec/include/tests/*'"
+cmd_lcov-initial=flock /tmp/ec-lcov-lock -c "lcov --gcov-tool \
+ $(CURDIR)/util/llvm-gcov.sh -q -o $@ -c -d build/coverage/initial-$* \
+ -i -t $* --exclude '*/ec/test/*' --exclude '*/ec/include/tests/*'"
cmd_merge_cov=lcov -o build/coverage/lcov.info $(foreach info,$^,-a ${info})
cmd_report_cov=genhtml -q -o build/coverage/coverage_rpt -t \
- "EC Unittest "$(bldversion) $^
+ "EC Unittest "$(bldversion) -s $^
# Unless V is set to 0 we always want the 'size:' target to report its output,
# there is no point in generating a short form command trace when calculating
@@ -433,6 +440,10 @@ cmd_stats= \
printf "%-10s: %6d\n" $$board $$size; \
done
+.DELETE_ON_ERROR: build/coverage/initial-%.info build/coverage/%.info
+build/coverage/initial-%.info:
+ $(MAKE) TEST_COVERAGE=y BOARD=$* compile-only
+ $(call quiet,lcov-initial,COV )
build/coverage/%.info: run-coverage-%
$(call quiet,lcov,COV )