From 800f5de9662b2a7345e0f56dd070a11b9d4526bc Mon Sep 17 00:00:00 2001 From: Hsuan Ting Chen Date: Tue, 12 Jul 2022 15:39:23 +0800 Subject: Makefile: coverage: Fix build failure Currently, make coverage is broken due to two issues: 1. The optimization option -O0 ignores the inline specifier in firmware/2lib/2sha256_x86.c:46 and 52. This will violate the compile-time constraint "i" and cause a build failure. Fix this issue by using -Og instead of -O0. 2. The coverage_html requires ${COV_INFO}.* files which are generated in coverage_init and runtests. We need to add prerequisites to prevent potential errors while running with "-j". BUG=none BRANCH=none TEST=make clean && COV=1 make coverage -j Signed-off-by: Hsuan Ting Chen Change-Id: If1f9de1dbc56f36afead9045c1f95349a5fa156c Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/3755927 Reviewed-by: Yu-Ping Wu --- Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index b6ab96b4..afb6e911 100644 --- a/Makefile +++ b/Makefile @@ -237,7 +237,7 @@ CFLAGS += $(cflags_use_64bits) # Code coverage ifneq ($(filter-out 0,${COV}),) - COV_FLAGS = -O0 --coverage -DCOVERAGE + COV_FLAGS = -Og --coverage -DCOVERAGE CFLAGS += ${COV_FLAGS} LDFLAGS += ${COV_FLAGS} COV_INFO = ${BUILD}/coverage.info @@ -1354,7 +1354,7 @@ coverage_init: install_for_test lcov -c -i -d . -b . -o ${COV_INFO}.initial .PHONY: coverage_html -coverage_html: +coverage_html: coverage_init runtests lcov -c -d . -b . -o ${COV_INFO}.tests lcov -a ${COV_INFO}.initial -a ${COV_INFO}.tests -o ${COV_INFO}.total lcov -r ${COV_INFO}.total '/usr/*' -o ${COV_INFO}.local -- cgit v1.2.1