From 9d71f6385a400dc6d0fcd977eb384d6ae27e406e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Tue, 8 Jul 2025 22:28:49 +0200 Subject: [PATCH] package/ci: filter away empty lines wrongly marked as uncovered on MinGW. --- package/ci/appveyor-desktop-mingw.bat | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/package/ci/appveyor-desktop-mingw.bat b/package/ci/appveyor-desktop-mingw.bat index ffd7c1321..ab892e3b8 100644 --- a/package/ci/appveyor-desktop-mingw.bat +++ b/package/ci/appveyor-desktop-mingw.bat @@ -75,11 +75,17 @@ rem Coverage upload cd %APPVEYOR_BUILD_FOLDER% set GCOV=C:/mingw-w64/x86_64-7.2.0-posix-seh-rt_v5-rev1/mingw64/bin/gcov.exe rem Keep in sync with circleci.yml, appveyor-desktop.bat and PKBUILD-coverage, -rem please. The --source-dir needs to be present in order to circumvent +rem please. +rem +rem The --source-dir needs to be present in order to circumvent rem Warning: "../foo" cannot be normalized because of "..", so skip it. rem that happens with CMake before 3.21 that doesn't yet pass full paths to rem Ninja: https://github.com/mozilla/grcov/issues/1182 -grcov build -t lcov --source-dir %APPVEYOR_BUILD_FOLDER%/build --keep-only "*/src/Magnum*/*" --ignore "*/src/MagnumExternal/*" --ignore "*/Test/*" --ignore "*/build/src/*" -o coverage.info --excl-line LCOV_EXCL_LINE --excl-start LCOV_EXCL_START --excl-stop LCOV_EXCL_STOP || exit /b +rem +rem Additionally, MinGW often reports empty lines containing just } as +rem uncovered, possibly due to exception handling. Exclude them, and feel free +rem to expand the regex to catch more cases if needed. +grcov build -t lcov --source-dir %APPVEYOR_BUILD_FOLDER%/build --keep-only "*/src/Magnum*/*" --ignore "*/src/MagnumExternal/*" --ignore "*/Test/*" --ignore "*/build/src/*" -o coverage.info --excl-line "(LCOV_EXCL_LINE|^\s*}$)" --excl-start LCOV_EXCL_START --excl-stop LCOV_EXCL_STOP || exit /b rem Official docs say "not needed for public repos", in reality not using the rem token is "extremely flakey". What's best is that if the upload fails, the rem damn thing exits with a success error code, and nobody cares: