diff options
author | Paul Fagerburg <pfagerburg@google.com> | 2020-05-05 20:00:54 -0600 |
---|---|---|
committer | Commit Bot <commit-bot@chromium.org> | 2020-05-11 19:32:40 +0000 |
commit | bc8a9391e7ab32f8ace80e831d28b684737ca499 (patch) | |
tree | 57ad2f0c38d30c0f50d341eafe864a3f7790a5bf /util | |
parent | 12c3acd63fd8d73d8254afb48dc72f1deae10142 (diff) | |
download | chrome-ec-bc8a9391e7ab32f8ace80e831d28b684737ca499.tar.gz |
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 <pfagerburg@chromium.org>
Change-Id: I8575013551ce1dba3fd249cd933a3cf6d110db8d
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2186853
Reviewed-by: Jack Rosenthal <jrosenth@chromium.org>
Diffstat (limited to 'util')
-rwxr-xr-x | util/run_host_test | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/util/run_host_test b/util/run_host_test index 337e941b75..57b197b6e7 100755 --- a/util/run_host_test +++ b/util/run_host_test @@ -81,8 +81,14 @@ def run_test(path, timeout=10): if proc.poll(): return TestResult.UNEXPECTED_TERMINATION, output_log finally: + # Check if the process has exited. If not, send it a SIGTERM, wait for it + # to exit, and if it times out, kill the process directly. if not proc.poll(): - proc.kill() + try: + proc.terminate() + proc.wait(timeout) + except subprocess.TimeoutExpired: + proc.kill() def host_test(test_name): |