build: fix broken HST gcov build 89/42189/7
authorAdrian Villin <[email protected]>
Thu, 6 Feb 2025 13:22:17 +0000 (14:22 +0100)
committerDave Wallace <[email protected]>
Wed, 12 Feb 2025 20:42:42 +0000 (20:42 +0000)
- also added a "NO_COLOR" option for HS tests
- http coverage is not generated for now

Type: make

Change-Id: Ib58672ae6035fda01efee933ebf35a1dd48e8afa
Signed-off-by: Adrian Villin <[email protected]>
.gitignore
Makefile
extras/hs-test/Makefile
extras/hs-test/hs_test.sh
test/Makefile

index 8d5b846..9d2ecd8 100644 (file)
@@ -16,7 +16,7 @@
 /build-root/*.tar.xz
 /build-root/*.changes
 /build-root/rpmbuild/
-/build-root/test-coverage/
+/build-root/test-coverage*/
 /build-root/test/
 /build-config.mk
 /build/external/*.tar.gz
index 70a2fe6..1f873fa 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -297,7 +297,7 @@ help:
        @echo " build                - build debug binaries"
        @echo " build-release        - build release binaries"
        @echo " build-coverity       - build coverity artifacts"
-       @echo " build-vpp-gcov           - build gcov vpp only"
+       @echo " build-gcov               - build gcov vpp only"
        @echo " rebuild              - wipe and build debug binaries"
        @echo " rebuild-release      - wipe and build release binaries"
        @echo " run                  - run debug binary"
@@ -452,7 +452,7 @@ endif
 install-deps: install-dep
 
 define make
-       @$(MAKE) -C $(BR) PLATFORM=$(PLATFORM) TAG=$(1) $(2)
+       @$(MAKE) -C $(BR) CC=$(CC) PLATFORM=$(PLATFORM) TAG=$(1) $(2)
 endef
 
 $(BR)/scripts/.version:
@@ -507,9 +507,10 @@ rebuild: wipe build
 build-release: $(BR)/.deps.ok
        $(call make,$(PLATFORM),$(addsuffix -install,$(TARGETS)))
 
-.PHONY: build-vpp-gcov
-build-vpp-gcov:
-       $(call test,vpp_gcov)
+.PHONY: build-gcov
+build-gcov: $(BR)/.deps.ok
+       $(eval CC=gcc)
+       $(call make,vpp_gcov,$(addsuffix -install,$(TARGETS)))
 
 .PHONY: wipe-release
 wipe-release: test-wipe $(BR)/.deps.ok
@@ -559,9 +560,13 @@ test-cov:
        $(call test,vpp_gcov,cov)
 
 .PHONY: test-cov-hs
-test-cov-hs:
-       @$(MAKE) -C extras/hs-test build-cov
-       @$(MAKE) -C extras/hs-test test-cov
+test-cov-hs: build-gcov
+       @$(MAKE) -C extras/hs-test test-cov \
+       VPP_BUILD_DIR=$(BR)/build-vpp_gcov-native/vpp
+
+.PHONY: test-cov-post-standalone
+test-cov-post-standalone:
+       $(MAKE) -C test cov-post VPP_BUILD_DIR=$(BR)/build-vpp_gcov-native/vpp
 
 .PHONY: test-cov-both
 test-cov-both:
index 6b2a047..c6f8c39 100644 (file)
@@ -57,6 +57,10 @@ ifeq ($(ARCH),)
 ARCH=$(shell dpkg --print-architecture)
 endif
 
+ifeq ($(NO_COLOR),)
+VERBOSE=false
+endif
+
 FORCE_BUILD?=true
 
 .PHONY: help
@@ -91,6 +95,7 @@ help:
        @echo " REPEAT=[n]               - repeat tests up to N times or until a failure occurs"
        @echo " CPU0=[true|false]        - use cpu0"
        @echo " DRYRUN=[true|false]      - set up containers but don't run tests"
+       @echo " NO_COLOR=[true|false]    - disables colorful Docker and Ginkgo output"
 
 .PHONY: list-tests
 list-tests:
@@ -107,13 +112,13 @@ build-vpp-debug:
 
 .PHONY: build-vpp-gcov
 build-vpp-gcov:
-       @$(MAKE) -C ../.. build-vpp-gcov
+       @$(MAKE) -C ../.. build-gcov
 
 .build.ok: build
        @touch .build.ok
 
-.build.cov.ok: build-vpp-gcov
-       @touch .build.cov.ok
+.build.cov.ok: build-cov
+       @touch .build.ok
 
 .build_debug.ok: build-debug
        @touch .build.ok
@@ -124,7 +129,7 @@ test: .deps.ok .build.ok
        @bash ./hs_test.sh --persist=$(PERSIST) --verbose=$(VERBOSE) \
                --unconfigure=$(UNCONFIGURE) --debug=$(DEBUG) --test=$(TEST) --cpus=$(CPUS) \
                --vppsrc=$(VPPSRC) --parallel=$(PARALLEL) --repeat=$(REPEAT) --cpu0=$(CPU0) \
-               --dryrun=$(DRYRUN) --skip=$(SKIP); \
+               --dryrun=$(DRYRUN) --skip=$(SKIP) --no_color=$(NO_COLOR); \
                ./script/compress.sh $$?
 
 .PHONY: test-debug
@@ -133,16 +138,21 @@ test-debug: .deps.ok .build_debug.ok
        @bash ./hs_test.sh --persist=$(PERSIST) --verbose=$(VERBOSE) \
                --unconfigure=$(UNCONFIGURE) --debug=$(DEBUG) --test=$(TEST) --cpus=$(CPUS) \
                --vppsrc=$(VPPSRC) --parallel=$(PARALLEL) --repeat=$(REPEAT) --debug_build=true \
-               --cpu0=$(CPU0) --dryrun=$(DRYRUN) --skip=$(SKIP); \
+               --cpu0=$(CPU0) --dryrun=$(DRYRUN) --skip=$(SKIP) --no_color=$(NO_COLOR); \
                ./script/compress.sh $$?
 
+.PHONY: wipe-lcov
+wipe-lcov:
+       @lcov --zerocounters --directory $(WS_ROOT)/build-root/build-vpp_gcov-native/vpp
+
 .PHONY: test-cov
-test-leak: FORCE_BUILD=false
-test-cov: .deps.ok .build.cov.ok
+test-cov: FORCE_BUILD=false
+test-cov: .deps.ok .build.cov.ok wipe-lcov
        @bash ./hs_test.sh --persist=$(PERSIST) --verbose=$(VERBOSE) \
                --unconfigure=$(UNCONFIGURE) --debug=$(DEBUG) --test=$(TEST-HS) --cpus=$(CPUS) \
-               --vppsrc=$(VPPSRC) --cpu0=$(CPU0) --dryrun=$(DRYRUN) --skip=$(SKIP); \
+               --vppsrc=$(VPPSRC) --cpu0=$(CPU0) --dryrun=$(DRYRUN) --skip=$(SKIP) --no_color=$(NO_COLOR); \
                ./script/compress.sh $$?
+       $(MAKE) -C ../.. test-cov-post-standalone HS_TEST=1
 
 .PHONY: test-leak
 test-leak: .deps.ok .build_debug.ok
index bcada2c..f333b60 100644 (file)
@@ -14,6 +14,7 @@ ginkgo_args=
 tc_names=()
 skip_names=()
 dryrun=
+no_color=
 
 for i in "$@"
 do
@@ -96,6 +97,12 @@ case "${i}" in
             leak_check_set=1
         fi
         ;;
+    --no_color=*)
+        no_color="${i#*=}"
+        if [ "$no_color" = "true" ]; then
+            ginkgo_args="$ginkgo_args --no-color"
+        fi
+        ;;
 esac
 done
 
index 79feba9..1d22832 100644 (file)
@@ -389,23 +389,20 @@ COV_REM_TODO_NO_TEST="*/vpp-api/client/*" "*/plugins/prom/*" \
                                         "*/vnet/ethernet/ethernet_format_fns.h" \
                                         "*/plugins/ikev2/ikev2_format.c" "*/vnet/bier/bier_types.c"
 
-COV_REM_ALT_TEST="*/plugins/hs_apps/*" "*/plugins/http/*.h"
-
 .PHONY: cov-post
 cov-post: wipe-cov $(BUILD_COV_DIR)
-       @lcov --ignore-errors --capture \
+       @lcov --ignore-errors unused,empty,mismatch,gcov --capture \
                --directory $(VPP_BUILD_DIR) \
                --output-file $(BUILD_COV_DIR)/coverage$(HS_TEST).info
        @test -z "$(EXTERN_COV_DIR)" || \
-               lcov --ignore-errors --capture \
+               lcov --ignore-errors unused,empty,mismatch,gcov --capture \
                --directory $(EXTERN_COV_DIR) \
                --output-file $(BUILD_COV_DIR)/extern-coverage$(HS_TEST).info
-       @lcov --ignore-errors --remove $(BUILD_COV_DIR)/coverage$(HS_TEST).info \
+       @lcov --ignore-errors unused,empty,mismatch,gcov --remove $(BUILD_COV_DIR)/coverage$(HS_TEST).info \
                $(COV_REM_NOT_CODE) \
                $(COV_REM_DRIVERS)  \
                $(COV_REM_TODO_NO_TEST) \
                $(COV_REM_UNUSED_FEAT) \
-               $(COV_REM_ALT_TEST) \
                -o $(BUILD_COV_DIR)/coverage-filtered$(HS_TEST).info
        @genhtml $(BUILD_COV_DIR)/coverage-filtered$(HS_TEST).info \
                --output-directory $(BUILD_COV_DIR)/html