diff --git a/UA2F/CMakeLists.txt b/UA2F/CMakeLists.txt index 72b07a969..df6f891b6 100644 --- a/UA2F/CMakeLists.txt +++ b/UA2F/CMakeLists.txt @@ -7,7 +7,8 @@ cmake_policy(SET CMP0135 NEW) OPTION(UA2F_BUILD_TESTS "Build tests" OFF) -if(DEFINED ENV{CI} AND UA2F_BUILD_TESTS AND NOT DEFINED UA2F_ENABLE_COVERAGE) +if(DEFINED ENV{CI}) + # In CI, always enable coverage for all builds set(UA2F_ENABLE_COVERAGE ON CACHE BOOL "Enable code coverage (auto-enabled in CI)" FORCE) message(STATUS "Auto-enabling coverage in CI environment") else() @@ -223,68 +224,13 @@ if (UA2F_BUILD_TESTS) # Add coverage target if (UA2F_ENABLE_COVERAGE) - find_program(LCOV_PATH lcov) - find_program(GENHTML_PATH genhtml) - - if(LCOV_PATH AND GENHTML_PATH) - add_custom_target(coverage - COMMAND ${LCOV_PATH} --directory . --zerocounters - COMMAND ${CMAKE_CURRENT_BINARY_DIR}/ua2f_test - COMMAND ${LCOV_PATH} --directory . --capture --output-file coverage.info --ignore-errors mismatch - COMMAND ${LCOV_PATH} --remove coverage.info '/usr/*' '${CMAKE_CURRENT_BINARY_DIR}/_deps/*' '*/test/*' --output-file coverage_filtered.info --ignore-errors mismatch - COMMAND ${GENHTML_PATH} coverage_filtered.info --output-directory coverage_html --ignore-errors mismatch - COMMAND echo "Coverage report generated in coverage_html/index.html" - WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} - COMMENT "Generating code coverage report" - DEPENDS ua2f_test - ) - - add_custom_target(coverage-integration - COMMAND ${LCOV_PATH} --directory . --zerocounters - COMMAND echo "Run integration tests manually, then use 'make coverage-collect'" - WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} - COMMENT "Preparing for integration test coverage" - ) - - add_custom_target(coverage-collect - COMMAND ${LCOV_PATH} --directory . --capture --output-file coverage_integration.info --ignore-errors mismatch - COMMAND ${LCOV_PATH} --remove coverage_integration.info '/usr/*' '*/test/*' --output-file coverage_integration_filtered.info --ignore-errors mismatch,unused - COMMAND ${GENHTML_PATH} coverage_integration_filtered.info --output-directory coverage_integration_html --ignore-errors mismatch - COMMAND echo "Integration test coverage report generated in coverage_integration_html/index.html" - WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} - COMMENT "Collecting integration test coverage data" - ) - - add_custom_target(coverage-combined - COMMAND ${LCOV_PATH} --directory . --zerocounters - COMMAND ${CMAKE_CURRENT_BINARY_DIR}/ua2f_test - COMMAND ${LCOV_PATH} --directory . --capture --output-file coverage_unit.info --ignore-errors mismatch - COMMAND echo "Unit tests coverage collected. Run integration tests now..." - COMMAND echo "After integration tests, coverage data will be merged automatically" - WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} - COMMENT "Generating combined coverage report (unit + integration)" - DEPENDS ua2f_test - ) - - add_custom_target(coverage-merge - COMMAND ${LCOV_PATH} --directory . --capture --output-file coverage_after_integration.info --ignore-errors mismatch - COMMAND ${LCOV_PATH} --add-tracefile coverage_unit.info --add-tracefile coverage_after_integration.info --output-file coverage_combined.info --ignore-errors mismatch || ${LCOV_PATH} --directory . --capture --output-file coverage_combined.info --ignore-errors mismatch - COMMAND ${LCOV_PATH} --remove coverage_combined.info '/usr/*' '*/test/*' --output-file coverage_combined_filtered.info --ignore-errors mismatch,unused - COMMAND ${GENHTML_PATH} coverage_combined_filtered.info --output-directory coverage_combined_html --ignore-errors mismatch - COMMAND echo "Combined coverage report generated in coverage_combined_html/index.html" - WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} - COMMENT "Merging unit and integration test coverage" - ) - - add_custom_target(coverage-clean - COMMAND ${LCOV_PATH} --directory . --zerocounters - COMMAND find . -name "*.gcda" -delete - WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} - COMMENT "Cleaning coverage data" - ) - else() - message(WARNING "lcov and genhtml are required for coverage reports") - endif() + add_custom_target(coverage + COMMAND echo "Running unit tests to generate coverage data" + COMMAND ${CMAKE_CURRENT_BINARY_DIR}/ua2f_test + COMMENT "Generating code coverage data" + DEPENDS ua2f_test + WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} + ) endif() include(GoogleTest) @@ -292,3 +238,18 @@ if (UA2F_BUILD_TESTS) else () message(STATUS "Tests are disabled.") endif () + +# Coverage targets for integration testing (independent of unit tests) +if (UA2F_ENABLE_COVERAGE) + add_custom_target(coverage-integration + COMMAND find . -name "*.gcda" -delete + COMMENT "Reset coverage counters for integration tests" + WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} + ) + + add_custom_target(coverage-clean + COMMAND find . -name "*.gcda" -delete + WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} + COMMENT "Cleaning coverage data" + ) +endif() diff --git a/UA2F/codecov.yml b/UA2F/codecov.yml new file mode 100644 index 000000000..004199e19 --- /dev/null +++ b/UA2F/codecov.yml @@ -0,0 +1,37 @@ +coverage: + status: + project: + default: + target: auto + threshold: 30% + informational: true + patch: + default: + target: auto + threshold: 30% + informational: true + +flags: + unittests: + paths: + - src/ + unittests-standalone: + paths: + - src/ + integration: + paths: + - src/ + +flag_management: + default_rules: + carryforward: true + statuses: + - type: project + target: auto + - type: patch + target: auto + +comment: + layout: "reach,diff,flags,files,footer" + behavior: default + require_changes: false \ No newline at end of file diff --git a/nginx/Makefile b/nginx/Makefile index a96dd0b70..e93acd1b6 100644 --- a/nginx/Makefile +++ b/nginx/Makefile @@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=nginx PKG_VERSION:=1.26.1 -PKG_RELEASE:=1 +PKG_RELEASE:=2 PKG_SOURCE:=nginx-$(PKG_VERSION).tar.gz PKG_SOURCE_URL:=https://nginx.org/download/ @@ -18,7 +18,7 @@ PKG_HASH:=f9187468ff2eb159260bfd53867c25ff8e334726237acf227b9e870e53d3e36b PKG_MAINTAINER:=Thomas Heil \ Christian Marangi PKG_LICENSE:=2-clause BSD-like license -PKG_CPE_ID:=cpe:/a:nginx:nginx +PKG_CPE_ID:=cpe:/a:f5:nginx_open_source PKG_FIXUP:=autoreconf PKG_BUILD_PARALLEL:=1 @@ -213,7 +213,7 @@ endef define Download/nginx-mod-geoip2 SOURCE_DATE:=2020-01-22 - VERSION:=1cabd8a1f68ea3998f94e9f3504431970f848fbf + SOURCE_VERSION:=1cabd8a1f68ea3998f94e9f3504431970f848fbf URL:=https://github.com/leev/ngx_http_geoip2_module.git MIRROR_HASH:=f3d2a1af5c34812b5a34453457ba6a4d8093c92085aa7f76c46a1c4185c9735c PROTO:=git @@ -248,7 +248,7 @@ endef define Download/nginx-mod-headers-more SOURCE_DATE:=2022-07-17 - VERSION:=bea1be3bbf6af28f6aa8cf0c01c07ee1637e2bd0 + SOURCE_VERSION:=bea1be3bbf6af28f6aa8cf0c01c07ee1637e2bd0 URL:=https://github.com/openresty/headers-more-nginx-module.git MIRROR_HASH:=569abadc137b5b52bdcc33b00aa21f6d266cb84fb891795da2c4e101c4898abe PROTO:=git @@ -256,7 +256,7 @@ endef define Download/nginx-mod-brotli SOURCE_DATE:=2020-04-23 - VERSION:=25f86f0bac1101b6512135eac5f93c49c63609e3 + SOURCE_VERSION:=25f86f0bac1101b6512135eac5f93c49c63609e3 URL:=https://github.com/google/ngx_brotli.git MIRROR_HASH:=680c56be79e7327cb8df271646119333d2f6965a3472bc7043721625fa4488f5 PROTO:=git @@ -264,7 +264,7 @@ endef define Download/nginx-mod-rtmp SOURCE_DATE:=2018-12-07 - VERSION:=f0ea62342a4eca504b311cd5df910d026c3ea4cf + SOURCE_VERSION:=f0ea62342a4eca504b311cd5df910d026c3ea4cf URL:=https://github.com/ut0mt8/nginx-rtmp-module.git MIRROR_HASH:=9c98d886ae4ea3708bb0bca55f8df803418a407e0ffc6df56341bd76ad39cba8 PROTO:=git @@ -272,7 +272,7 @@ endef define Download/nginx-mod-ts SOURCE_DATE:=2017-12-04 - VERSION:=ef2f874d95cc75747eb625a292524a702aefb0fd + SOURCE_VERSION:=ef2f874d95cc75747eb625a292524a702aefb0fd URL:=https://github.com/arut/nginx-ts-module.git MIRROR_HASH:=3f144d4615a4aaa1215435cd06ae4054ea12206d5b38306321420f7acc62aca8 PROTO:=git @@ -280,7 +280,7 @@ endef define Download/nginx-mod-naxsi SOURCE_DATE:=2022-09-14 - VERSION:=d714f1636ea49a9a9f4f06dba14aee003e970834 + SOURCE_VERSION:=d714f1636ea49a9a9f4f06dba14aee003e970834 URL:=https://github.com/nbs-system/naxsi.git MIRROR_HASH:=b0cef5fbf842f283eb5f0686ddd1afcd07d83abd7027c8cfb3e84a2223a34797 PROTO:=git @@ -288,7 +288,7 @@ endef define Download/nginx-mod-lua SOURCE_DATE:=2023-08-19 - VERSION:=c89469e920713d17d703a5f3736c9335edac22bf + SOURCE_VERSION:=c89469e920713d17d703a5f3736c9335edac22bf URL:=https://github.com/openresty/lua-nginx-module.git MIRROR_HASH:=c3bdf1b23f0a63991b5dcbd1f8ee150e6f893b43278e8600e4e0bb42a6572db4 PROTO:=git @@ -296,7 +296,7 @@ endef define Download/nginx-mod-lua-resty-core SOURCE_DATE:=2023-09-09 - VERSION:=2e2b2adaa61719972fe4275fa4c3585daa0dcd84 + SOURCE_VERSION:=2e2b2adaa61719972fe4275fa4c3585daa0dcd84 URL:=https://github.com/openresty/lua-resty-core.git MIRROR_HASH:=c5f3df92fd72eac5b54497c039aca0f0d9ea1d87223f1e3a54365ba565991874 PROTO:=git @@ -304,7 +304,7 @@ endef define Download/nginx-mod-lua-resty-lrucache SOURCE_DATE:=2023-08-06 - VERSION:=52f5d00403c8b7aa8a4d4f3779681976b10a18c1 + SOURCE_VERSION:=52f5d00403c8b7aa8a4d4f3779681976b10a18c1 URL:=https://github.com/openresty/lua-resty-lrucache.git MIRROR_HASH:=0833e0114948af4edb216c5c34b3f1919f534b298f4fa29739544f7c9bb8a08d PROTO:=git @@ -312,7 +312,7 @@ endef define Download/nginx-mod-dav-ext SOURCE_DATE:=2018-12-17 - VERSION:=f5e30888a256136d9c550bf1ada77d6ea78a48af + SOURCE_VERSION:=f5e30888a256136d9c550bf1ada77d6ea78a48af URL:=https://github.com/arut/nginx-dav-ext-module.git MIRROR_HASH:=c574e60ffab5f6e5d8bea18aab0799c19cd9a84f3d819b787e9af4f0e7867b52 PROTO:=git @@ -320,7 +320,7 @@ endef define Download/nginx-mod-ubus SOURCE_DATE:=2020-09-06 - VERSION:=b2d7260dcb428b2fb65540edb28d7538602b4a26 + SOURCE_VERSION:=b2d7260dcb428b2fb65540edb28d7538602b4a26 URL:=https://github.com/Ansuel/nginx-ubus-module.git MIRROR_HASH:=515bb9d355ad80916f594046a45c190a68fb6554d6795a54ca15cab8bdd12fda PROTO:=git @@ -328,9 +328,9 @@ endef define Download/nginx-mod-njs SOURCE_DATE:=2024-10-03 - VERSION:=c5a29a7af8894ee1ec44ebda71ef0ea1f2a31af6 + SOURCE_VERSION:=c5a29a7af8894ee1ec44ebda71ef0ea1f2a31af6 URL:=https://github.com/nginx/njs.git - MIRROR_HASH:=69bc424d4bfd8b7a0a70feeb4787ff8b503ac893fb730f07f3244e35fde876e4 + MIRROR_HASH:=6c94ec6b1c119e0c7a85ec395a4987a8a61739e1f9256ce6d92a16804c5d4637 PROTO:=git endef @@ -338,7 +338,7 @@ define Module/Download define Download/nginx-mod-$(1) += SUBDIR:=nginx-mod-$(1) - FILE:=nginx-mod-$(1)-$$$$(subst -,.,$$$$(SOURCE_DATE))~$$$$(call version_abbrev,$$$$(VERSION)).tar.zst + FILE:=nginx-mod-$(1)-$$$$(subst -,.,$$$$(SOURCE_DATE))~$$$$(call version_abbrev,$$$$(SOURCE_VERSION)).tar.zst endef endef $(foreach m,$(PKG_MOD_EXTRA),$(eval $(call Module/Download,$(m))))