diff --git a/.github/codecov.yml b/.github/codecov.yml new file mode 100644 index 00000000000..2edfd847b00 --- /dev/null +++ b/.github/codecov.yml @@ -0,0 +1,10 @@ +coverage: + status: + project: + default: + if_ci_failed: ignore + patch: + default: + target: 60% # Require 80% patch coverage + threshold: 1% # Allow up to 1% below target + if_ci_failed: ignore diff --git a/.github/workflows/unit_integration_test.yaml b/.github/workflows/unit_integration_test.yaml index 53758a0a87b..d37ba5654f9 100644 --- a/.github/workflows/unit_integration_test.yaml +++ b/.github/workflows/unit_integration_test.yaml @@ -33,9 +33,11 @@ jobs: strategy: matrix: - type: [main, clang, mbedtls, rotating_device_id, icd] + type: [icd] env: BUILD_TYPE: ${{ matrix.type }} + CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} + CC_SLUG: SiliconLabsSoftware/matter_sdk runs-on: ubuntu-latest @@ -66,19 +68,23 @@ jobs: # TODO: If rotating_device_id is ever removed/combined, we have to cover boringssl otherwise run: | case $BUILD_TYPE in - "main") GN_ARGS='chip_build_all_platform_tests=true';; - "clang") GN_ARGS='is_clang=true chip_build_all_platform_tests=true';; - "mbedtls") GN_ARGS='chip_crypto="mbedtls" chip_build_all_platform_tests=true';; - "rotating_device_id") GN_ARGS='chip_crypto="boringssl" chip_enable_rotating_device_id=true chip_build_all_platform_tests=true';; "icd") GN_ARGS='chip_enable_icd_server=true chip_enable_icd_lit=true chip_build_all_platform_tests=true';; *) ;; esac - scripts/build/gn_gen.sh --args="$GN_ARGS" + scripts/build/gn_gen.sh --args="$GN_ARGS use_coverage=true is_debug=true" - name: Run Build run: scripts/run_in_build_env.sh "ninja -C out/$BUILD_TYPE" - name: Run Tests run: scripts/tests/gn_tests.sh + - name: Run Build Coverage + run: scripts/build_coverage.sh --code=all --yaml --xml + - name: Upload coverage reports to Codecov with GitHub Action + uses: codecov/codecov-action@v5 + with: + token: ${{ secrets.CODECOV_TOKEN }} + slug: senthilku/matter_sdk + verbose: true # TODO Log Upload https://github.com/project-chip/connectedhomeip/issues/2227 # TODO https://github.com/project-chip/connectedhomeip/issues/1512 # - name: Run Code Coverage diff --git a/scripts/build_coverage.sh b/scripts/build_coverage.sh index 5e55e59ebb7..79b2d95baa4 100755 --- a/scripts/build_coverage.sh +++ b/scripts/build_coverage.sh @@ -38,6 +38,13 @@ _install_lcov() { _install_lcov +_install_gcovr() { + if ! gcovr --version >/dev/null 2>&1; then + echo "gcovr not installed. Installing..." + pip3 install gcovr==8.3 + fi +} + # Get absolute path from a relative and normalize (e.g "foo/bar/../baz" -> "/path/to/foo/baz") _abspath() { python3 -c "import os.path; print(os.path.abspath('$@'))" @@ -58,6 +65,8 @@ TEST_TARGETS=(check) ENABLE_YAML=false ENABLE_PYTHON=false +GENERATE_XML=false + help() { echo "Usage: $file_name [--output_root=] [--code=] [Test options" echo @@ -119,6 +128,9 @@ for i in "$@"; do ENABLE_PYTHON=true shift ;; + --xml) + GENERATE_XML=true + ;; -q | --quiet) QUIET_FLAG=("--quiet") shift @@ -282,8 +294,28 @@ genhtml "$COVERAGE_ROOT/lcov_final.info" \ --prefix "$CHIP_ROOT/src" \ "${QUIET_FLAG[@]}" -cp "$CHIP_ROOT/integrations/appengine/webapp_config.yaml" \ - "$COVERAGE_ROOT/webapp_config.yaml" +if [ "$GENERATE_XML" == true ]; then + _install_gcovr + + gcovr --exclude=zzz_generated/ \ + --exclude=third_party/ \ + --include=src/ \ + --gcov-ignore-parse-errors \ + --merge-mode-functions=merge-use-line-min \ + --xml="$COVERAGE_ROOT"/coverage.xml + + XML_INDEX=$(_abspath "$COVERAGE_ROOT/coverage.xml") + if [ -f "$XML_INDEX" ]; then + echo + echo "============================================================" + echo "Coverage report successfully generated:" + echo " file://$XML_INDEX" + echo "============================================================" + else + echo "WARNING: Coverage XML index was not found at expected path:" + echo " $XML_INDEX" + fi +fi HTML_INDEX=$(_abspath "$COVERAGE_ROOT/html/index.html") if [ -f "$HTML_INDEX" ]; then @@ -296,3 +328,6 @@ else echo "WARNING: Coverage HTML index was not found at expected path:" echo " $HTML_INDEX" fi + +cp "$CHIP_ROOT/integrations/appengine/webapp_config.yaml" \ + "$COVERAGE_ROOT/webapp_config.yaml" diff --git a/src/platform/silabs/wifi/icd/WifiSleepManager.cpp b/src/platform/silabs/wifi/icd/WifiSleepManager.cpp index c41048effa7..efe52651d3e 100644 --- a/src/platform/silabs/wifi/icd/WifiSleepManager.cpp +++ b/src/platform/silabs/wifi/icd/WifiSleepManager.cpp @@ -57,6 +57,9 @@ CHIP_ERROR WifiSleepManager::RequestHighPerformance(bool triggerTransition) CHIP_ERROR WifiSleepManager::RemoveHighPerformanceRequest() { + // TEMP: coverage marker + ChipLogProgress(DeviceLayer, ">>> RemoveHighPerformanceRequest called <<<"); + VerifyOrReturnError(mHighPerformanceRequestCounter > 0, CHIP_NO_ERROR, ChipLogError(DeviceLayer, "Wi-Fi configuration already in low power mode"));