From bc8a9391e7ab32f8ace80e831d28b684737ca499 Mon Sep 17 00:00:00 2001 From: Paul Fagerburg Date: Tue, 5 May 2020 20:00:54 -0600 Subject: ec: fix `make coverage` code coverage reporting Fixed problems that were preventing us from building the unit tests with code coverage testing via `make coverage`. * Changed test_util so that programs will cleanly exit on SIGTERM. * Changed run_host_test to wait for the child process to exit, and only proc.kill() if it times out, so the child process will generate code coverage output files on exit. * Changed Makefile.toolchain to use the --coverage flag for both compile and link. * Changed build.mk and Makefile.rules to exclude certain tests from code coverage because they were causing failures either during the individual stage of code coverage, or generating the overall report. BUG=b:143065231 BRANCH=none TEST=`make coverage` produces results Signed-off-by: Paul Fagerburg Change-Id: I8575013551ce1dba3fd249cd933a3cf6d110db8d Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2186853 Reviewed-by: Jack Rosenthal --- test/build.mk | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'test/build.mk') diff --git a/test/build.mk b/test/build.mk index 0cc3f964da..850b48c4cf 100644 --- a/test/build.mk +++ b/test/build.mk @@ -95,6 +95,21 @@ test-list-host += x25519 test-list-host += stillness_detector endif +# Build up the list of coverage test targets based on test-list-host, but +# with some tests excluded because they cause code coverage to fail. + +# is_enabled_error is a shell script that does not produce coverage results +cov-dont-test = is_enabled_error +# static_if_error is a shell script that does not produce coverage results +cov-dont-test += static_if_error +# fpsensor: genhtml looks for build/host/fpsensor/cryptoc/util.c +cov-dont-test += fpsensor +# fpsensor_crypto: genhtml looks for build/host/fpsensor_crypto/cryptoc/util.c +cov-dont-test += fpsensor_crypto +# fpsensor_state: genhtml looks for build/host/fpsensor_state/cryptoc/util.c +cov-dont-test += fpsensor_state +cov-test-list-host = $(filter-out $(cov-dont-test), $(test-list-host)) + accel_cal-y=accel_cal.o aes-y=aes.o base32-y=base32.o -- cgit v1.2.1