From 7aebf804fe0050d4a48aab591b55f026e8dcc4c4 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Beno=C3=AEt=20Ganne?= Date: Wed, 18 Dec 2024 17:38:23 +0100 Subject: [PATCH] build: fix coverage for various lcov versions MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Starting with lcov version 2, we need to add some errors filtering. Unfortunately, those filters are not available with lcov version 1. Type: fix Fixes: 66fcfb845b8e588901b4f663435e9e1b30499467 Change-Id: Ic8f4c55be89dcc59370b5a69ed8e8f39c5647ec8 Signed-off-by: Benoît Ganne --- test/Makefile | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/test/Makefile b/test/Makefile index e26bf7f5a0f..de3a3ca2a52 100644 --- a/test/Makefile +++ b/test/Makefile @@ -399,16 +399,22 @@ COV_REM_HST_UNUSED_FEAT= "*/plugins/ping/*" "*/plugins/unittest/mpcap_node.c" "* "*/vppinfra/pcap.c" "*/vppinfra/pcap_funcs.h" endif +LCOV_VERSION=$(shell lcov --version | sed -E 's/^lcov: LCOV version ([0-9]+)[.].*/\1/') +LCOV_IGNORE_ERRORS= +ifeq ($(LCOV_VERSION),2) +LCOV_IGNORE_ERRORS=--ignore-errors unused,empty,mismatch,gcov +endif + .PHONY: cov-post cov-post: wipe-cov $(BUILD_COV_DIR) - @lcov --ignore-errors unused,empty,mismatch,gcov --capture \ + @lcov $(LCOV_IGNORE_ERRORS) --capture \ --directory $(VPP_BUILD_DIR) \ --output-file $(BUILD_COV_DIR)/coverage$(HS_TEST).info @test -z "$(EXTERN_COV_DIR)" || \ - lcov --ignore-errors unused,empty,mismatch,gcov --capture \ + lcov $(LCOV_IGNORE_ERRORS) --capture \ --directory $(EXTERN_COV_DIR) \ --output-file $(BUILD_COV_DIR)/extern-coverage$(HS_TEST).info - @lcov --ignore-errors unused,empty,mismatch,gcov --remove $(BUILD_COV_DIR)/coverage$(HS_TEST).info \ + @lcov $(LCOV_IGNORE_ERRORS) --remove $(BUILD_COV_DIR)/coverage$(HS_TEST).info \ $(COV_REM_NOT_CODE) \ $(COV_REM_DRIVERS) \ $(COV_REM_TODO_NO_TEST) \ -- 2.16.6