vscode-cmake-tools icon indicating copy to clipboard operation
vscode-cmake-tools copied to clipboard

[Bug] Run test with coverage never completes

Open phallot opened this issue 1 month ago • 14 comments

Brief Issue Summary

Hello,

I am trying to setup coverage report based on https://github.com/microsoft/vscode-cmake-tools/pull/4094.

I have created a custom target that creates the lcov.info using cmake.postRunCoverageTarget. Then I have setup the cmake.coverageInfoFiles to pick the file.

When I use "Run test with coverage", the target appears to be called correctly, and the info file found (see output below). But then almost nothing is displayed (just one file), and the test never ends. It's also impossible to cancel, requiring a restart of the editor.

This is on macOS.

Image

My settings.json:

    "cmake.postRunCoverageTarget": "generate_coverage_report",
    "cmake.coverageInfoFiles": [
        "${command:cmake.buildDirectory}/coverage/lcov.info"
    ]

generate_coverage_report:

function(generate_coverage_report)
    if(CODE_COVERAGE MATCHES ON)
        if (${CMAKE_BUILD_TYPE} STREQUAL "Debug")
            if(CMAKE_CXX_COMPILER_ID MATCHES "Clang")

                # Find llvm tools via xcode-select
                execute_process(
                    COMMAND xcode-select -p
                    OUTPUT_VARIABLE XCODE_PATH
                    OUTPUT_STRIP_TRAILING_WHITESPACE
                )

                set(XCODE_TOOLCHAIN "${XCODE_PATH}/Toolchains/XcodeDefault.xctoolchain/usr/bin")

                find_program(LLVM_PROFDATA
                    NAMES llvm-profdata
                    HINTS "${XCODE_TOOLCHAIN}"
                    REQUIRED
                )

                find_program(LLVM_COV
                    NAMES llvm-cov
                    HINTS "${XCODE_TOOLCHAIN}"
                    REQUIRED
                )

                # Get all coverage-enabled targets
                get_property(COVERAGE_TARGETS GLOBAL PROPERTY COVERAGE_TARGETS)
                if(NOT COVERAGE_TARGETS)
                    message(FATAL_ERROR "No coverage-enabled targets found. Did you call enable_code_coverage()?")
                endif()

                # Build the list of .profraw and binary paths
                set(PROFRAW_FILES "")
                set(TARGET_BINARIES "")
                foreach(TGT IN LISTS COVERAGE_TARGETS)
                    list(APPEND PROFRAW_FILES "$<TARGET_FILE:${TGT}>.profraw")
                    list(APPEND TARGET_BINARIES "$<TARGET_FILE:${TGT}>")
                endforeach()
                list(JOIN TARGET_BINARIES " " TARGET_BINARIES_JOINED)

                # Create coverage directory in workspace root
                set(COVERAGE_DIR "${CMAKE_BINARY_DIR}/coverage")
                set(PROFDATA_FILE "${COVERAGE_DIR}/coverage.profdata")
                set(LCOV_FILE "${COVERAGE_DIR}/lcov.info")
                set(HTML_DIR "${COVERAGE_DIR}/html")

                # Create custom target
                add_custom_target(generate_coverage_report
                    VERBATIM
                    COMMAND ${CMAKE_COMMAND} -E make_directory ${COVERAGE_DIR}
                    COMMAND ${CMAKE_COMMAND} -E make_directory ${HTML_DIR}
                    COMMAND ${CMAKE_COMMAND} -E echo "Merging profraw files into ${PROFDATA_FILE}..."
                    COMMAND ${LLVM_PROFDATA} merge -sparse ${PROFRAW_FILES} -o ${PROFDATA_FILE}

                    COMMAND ${CMAKE_COMMAND} -E echo "Generating LCOV report..."
                    COMMAND /bin/sh -c "${LLVM_COV} export -format=lcov -instr-profile='${PROFDATA_FILE}' ${TARGET_BINARIES_JOINED} > '${LCOV_FILE}'"
                    COMMAND ${CMAKE_COMMAND} -E echo "LCOV report generated at ${LCOV_FILE}"

                    COMMAND ${CMAKE_COMMAND} -E echo "Generating HTML coverage report..."
                    COMMAND /bin/sh -c "${LLVM_COV} show -instr-profile='${PROFDATA_FILE}' ${TARGET_BINARIES_JOINED} -format=html -output-dir='${HTML_DIR}' -Xdemangler=c++filt"
                    COMMAND ${CMAKE_COMMAND} -E echo "HTML coverage report generated at ${HTML_DIR}"

                    WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
                    COMMENT "Generating code coverage report in LCOV and HTML formats"
                )
            endif()
        endif()
    endif()
endfunction()

First couple of entries in the lcov.info file:

SF:/Users/pierre.hallot/dev/nxt/collector.collector-users/External/genesis/Code/Core/Assert.h
FNF:0
FNH:0
DA:36,12
DA:37,0
DA:48,85
DA:49,85
DA:50,85
BRF:0
BRH:0
LF:0
LH:0
end_of_record
SF:/Users/pierre.hallot/dev/nxt/collector.collector-users/External/genesis/Code/Core/BaseException.cpp
FN:13,_ZNK3nxt13BaseException4whatEv
FNDA:0,_ZNK3nxt13BaseException4whatEv
FNF:1
FNH:0
DA:13,0
DA:14,0
DA:15,0
DA:16,0
DA:17,0
DA:18,0
BRDA:14,0,0,-
BRDA:14,0,1,-
BRF:2
BRH:0
LF:6
LH:0
end_of_record
SF:/Users/pierre.hallot/dev/nxt/collector.collector-users/External/genesis/Code/Core/BaseException.h
FN:23,_ZN3nxt13BaseExceptionC2ERKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEE
FNDA:0,_ZN3nxt13BaseExceptionC2ERKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEE
FNF:1
FNH:0
DA:23,0
DA:24,0
BRF:0
BRH:0
LF:2
LH:0
end_of_record

CMake Tools Diagnostics

Doesn't appear to do anything, because the extension is stuck I assume.

Debug Log

[ctest] 100% tests passed, 0 tests failed out of 1
[ctest] 
[ctest] Total Test time (real) =   0.44 sec
[ctest] CTest finished with return code 0
[ctest] Building the postRunCoverageTarget 'generate_coverage_report' for project /Users/pierre.hallot/dev/nxt/collector.collector-users after the tests have run with coverage.
[main] Building folder: /Users/pierre.hallot/dev/nxt/collector.collector-users/Local/build-macOS-ninja-arm64-Debug-asan-ubsan generate_coverage_report
[main] Saving open files before configure/build
[build] Starting build
[driver] Start build generate_coverage_report
[proc] Executing command: /opt/homebrew/bin/cmake --build /Users/pierre.hallot/dev/nxt/collector.collector-users/Local/build-macOS-ninja-arm64-Debug-asan-ubsan --target generate_coverage_report --
[proc]   with environment: {"COMMAND_MODE":"unix2003","CURSOR_TRACE_ID":"10be238619554c73bc6925dbc9e1ffb3","EDITOR":"nano","HOME":"/Users/pierre.hallot","HOMEBREW_CELLAR":"/opt/homebrew/Cellar","HOMEBREW_PREFIX":"/opt/homebrew","HOMEBREW_REPOSITORY":"/opt/homebrew","INFOPATH":"/opt/homebrew/share/info:","LESS":"-R","LOGNAME":"pierre.hallot","LSCOLORS":"Gxfxcxdxbxegedabagacad","MallocNanoZone":"0","OLDPWD":"/","ORIGINAL_XDG_CURRENT_DESKTOP":"undefined","PAGER":"less","PATH":"/Users/pierre.hallot/.codeium/windsurf/bin:/Users/pierre.hallot/bin:/opt/homebrew/opt/conan@1/bin:/opt/homebrew/lib:/opt/homebrew/include:/opt/homebrew/bin:/opt/homebrew/sbin:/usr/local/bin:/System/Cryptexes/App/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/local/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/appleinternal/bin:/Library/Apple/usr/bin:/Applications/Wireshark.app/Contents/MacOS:/Users/pierre.hallot/.cargo/bin","PWD":"/","SHELL":"/bin/zsh","SHLVL":"0","SSH_AUTH_SOCK":"/private/tmp/com.apple.launchd.5yiQ3TbtAx/Listeners","STARSHIP_SESSION_KEY":"1362248259222946","STARSHIP_SHELL":"zsh","TMPDIR":"/var/folders/fj/j82mb9qd5m37qdj1nnyh86lm0000gp/T/","USER":"pierre.hallot","VSCODE_CODE_CACHE_PATH":"/Users/pierre.hallot/Library/Application Support/Cursor/CachedData/ba90f2f88e4911312761abab9492c42442117cf0","VSCODE_CRASH_REPORTER_PROCESS_TYPE":"extensionHost","VSCODE_CWD":"/","VSCODE_ESM_ENTRYPOINT":"vs/workbench/api/node/extensionHostProcess","VSCODE_HANDLES_UNCAUGHT_ERRORS":"true","VSCODE_IPC_HOOK":"/Users/pierre.hallot/Library/Application Support/Cursor/2.0.-main.sock","VSCODE_NLS_CONFIG":"{\"userLocale\":\"en-gb\",\"osLocale\":\"en-gb\",\"resolvedLanguage\":\"en\",\"defaultMessagesFile\":\"/Applications/Cursor.app/Contents/Resources/app/out/nls.messages.json\",\"locale\":\"en-gb\",\"availableLanguages\":{}}","VSCODE_PID":"87596","VSCODE_PROCESS_TITLE":"extension-host  [4-10]","XPC_FLAGS":"0x0","XPC_SERVICE_NAME":"application.com.todesktop.230313mzl4w4u92.276951797.276951803","ZSH":"/Users/pierre.hallot/.oh-my-zsh","_":"/Applications/Cursor.app/Contents/MacOS/Cursor","__CFBundleIdentifier":"com.todesktop.230313mzl4w4u92","__CF_USER_TEXT_ENCODING":"0x1F6:0x0:0x2","ELECTRON_RUN_AS_NODE":"1","APPLICATION_INSIGHTS_NO_DIAGNOSTIC_CHANNEL":"1","APPLICATIONINSIGHTS_CONFIGURATION_CONTENT":"{}","VSCODE_L10N_BUNDLE_LOCATION":""}
[build] [1/1] Generating code coverage report in LCOV and HTML formats
[build] Merging profraw files into /Users/pierre.hallot/dev/nxt/collector.collector-users/Local/build-macOS-ninja-arm64-Debug-asan-ubsan/coverage/coverage.profdata...
[build] Generating LCOV report...
[build] warning: 23 functions have mismatched data
[build] LCOV report generated at /Users/pierre.hallot/dev/nxt/collector.collector-users/Local/build-macOS-ninja-arm64-Debug-asan-ubsan/coverage/lcov.info
[build] Generating HTML coverage report...
[build] warning: 23 functions have mismatched data
[build] HTML coverage report generated at /Users/pierre.hallot/dev/nxt/collector.collector-users/Local/build-macOS-ninja-arm64-Debug-asan-ubsan/coverage/html
[driver] Build completed: 00:00:00.260
[cmakefileapi-parser] Read reply folder: /Users/pierre.hallot/dev/nxt/collector.collector-users/Local/build-macOS-ninja-arm64-Debug-asan-ubsan/.cmake/api/v1/reply
[cmakefileapi-parser] Found index files: ["cache-v2-f5a945f12241c9f36654.json","cmakeFiles-v1-863c59a6f695088cf9d4.json","codemodel-v2-faf5ec7131fba7b3a23d.json","directory-.-Debug-f5ebdc15457944623624.json","directory-External.genesis-Debug-27409d07c1441c0b33f7.json","directory-External.genesis.Code-Debug-d2896b24f0a85ba53aa0.json","directory-External.genesis.Code.Backend-Debug-4687674ed0672535f14d.json","directory-External.genesis.Code.Commands-Debug-18fa146bfd5d4236fcca.json","directory-External.genesis.Code.Core-Debug-4acf04a5f9b995ee782a.json","directory-External.genesis.Code.Database-Debug-52eec417b7d2da11baa0.json","directory-External.genesis.Code.DatabaseCommandQueue-Debug-e1ad965457dcbc85f610.json","directory-External.genesis.Code.DynamicConfig-Debug-2d7c20a773eb9500bece.json","directory-External.genesis.Code.ETW-Debug-3874f7127211b7de3c61.json","directory-External.genesis.Code.ErrorReporting-Debug-83e8b583a378bfd24c6b.json","directory-External.genesis.Code.I18N-Debug-fbeea277ac795a358f5a.json","directory-External.genesis.Code.IPC-Debug-1fae3d781cec508a7bab.json","directory-External.genesis.Code.IpcMonitor-Debug-edf3f36cb0645ee742fe.json","directory-External.genesis.Code.Metaprogramming-Debug-09bc34e4b39253d812c9.json","directory-External.genesis.Code.ModuleConfig-Debug-921c4944010778f72b37.json","directory-External.genesis.Code.Network-Debug-dcd90178b8313381102b.json","directory-External.genesis.Code.NotificationsDispatcher-Debug-c99f6e1f480e70951055.json","directory-External.genesis.Code.PersistentIpcQueue-Debug-6c284baf6e3a6c3ba359.json","directory-External.genesis.Code.Platform-Debug-438e3b5a4483aa1571d8.json","directory-External.genesis.Code.ProductInfo-Debug-92860c91b1fa3a9ce6b5.json","directory-External.genesis.Code.Security-Debug-626670a50dd4f9b0f946.json","directory-External.genesis.Code.Security.HttpAuthHeader-Debug-1c4ac4ede22bf558893d.json","directory-External.genesis.Code.Services-Debug-4d26037102ab78e26752.json","directory-External.genesis.Code.Settings-Debug-7c5d785a190f4bf45ef0.json","directory-External.genesis.Code.ShareableConfig-Debug-2de814beb709872dee0f.json","directory-External.genesis.Code.SpecialUsersSid-Debug-6c54a59ba2ac77716099.json","directory-External.genesis.Code.TaskScheduler-Debug-5892cbb23a9b7b17bc4b.json","directory-External.genesis.Code.Telemetry-Debug-c946810f154ed11ae341.json","directory-External.genesis.Code.Timer-Debug-06debcf42788ec581d71.json","directory-External.genesis.Code.Top-Debug-b918accc06c41a8cbc13.json","directory-External.genesis.Code.WorkingSetManager-Debug-c2de51b23890f5c77b9a.json","directory-External.genesis.External-Debug-f2b49c0102450b1a41f2.json","directory-External.genesis.External.crypto-Debug-a5c9ff1b738dd4080a49.json","directory-External.genesis.Test-Debug-0cefb86d4b707e8a4028.json","directory-External.genesis.Test.AssertsInterceptor-Debug-cd78ee46c5891cee8d6d.json","directory-External.genesis.Test.UnitTests-Debug-ddb0a237cddbe1fd1884.json","directory-External.genesis.Test.UnitTests.DatabaseCommandQueue-Debug-4b85117eb81e70b9eb6d.json","directory-External.genesis.Test.UnitTests.DatabaseCommandQueue.Mocks-Debug-ea80f84e46b61f0c684f.json","directory-External.genesis.Test.UnitTests.PersistentIpcQueue-Debug-ff70789615df35093853.json","directory-External.genesis.Test.UnitTests.PersistentIpcQueue.Mocks-Debug-ee975c88c99d49f18def.json","directory-External.genesis.Test.UnitTests.Top-Debug-47d5142d0f6814fb53d8.json","directory-External.genesis.Test.UnitTests.Top.Mocks-Debug-e986daadca002bae3dec.json","directory-External.genesis.Test.UnitTests.WorkingSetManager-Debug-d2e3f40aa294e7c0651a.json","directory-External.genesis.Test.UnitTests.WorkingSetManager.Mocks-Debug-943b5d24f1fdd3c129c7.json","directory-Src-Debug-390034882170fb1d3f43.json","directory-Src.Apps-Debug-fa99ef6f8cd4b34ca69b.json","directory-Src.Apps.nxtusers-Debug-30819f80a5932d6b0745.json","directory-Src.Libs-Debug-c1e5e9417679bbbfe6e3.json","directory-Src.Libs.Anonymizer-Debug-0d2d7e34e87f2b3cf05e.json","directory-Src.Libs.Config-Debug-641c469437e5a7ef66a4.json","directory-Src.Libs.DataProviders-Debug-81f9c21969dd557211a3.json","directory-Src.Libs.DataProviders.LocalAdmins-Debug-a87f15375f7c7f43d580.json","directory-Src.Libs.DataProviders.SystemApis-Debug-32359c2cf91b150cc7fa.json","directory-Src.Libs.DataProviders.Users-Debug-31e63eb785eb691596ce.json","directory-Src.Libs.DataProviders.Users.UserData-Debug-a8d00e16bef4a6fe6208.json","directory-Src.Libs.DataProviders.Users.UsersActivity-Debug-48126b5abd2bd8559891.json","directory-Src.Libs.Protobufs-Debug-2bc77cd84eed40b139e1.json","directory-Src.Libs.Users-Debug-b115748912271886965a.json","directory-Src.Libs.UsersData-Debug-5786ac8c82c41dbef5a6.json","directory-Test-Debug-3fc60f65c6de5401f5db.json","directory-Test.Anonymizer-Debug-d19e0df11159a37f6434.json","directory-Test.Config-Debug-af2e986af058dee66ecf.json","directory-Test.DataProviders-Debug-f19210b43d70d2c45426.json","directory-Test.DataProviders.LocalAdmins-Debug-2e27d3a610784d5cec37.json","directory-Test.DataProviders.SystemApis-Debug-f45419bee0e0c83c993e.json","directory-Test.DataProviders.SystemApis.Mocks-Debug-f3ff7f111434589a3567.json","directory-Test.DataProviders.UserData-Debug-15292ad39675d5da753d.json","directory-Test.DataProviders.UserData.Mocks-Debug-d55f7a5e09fcacb00ccd.json","directory-Test.DataProviders.UsersActivity-Debug-7693d93c75558eb568a8.json","directory-Test.Users-Debug-78ef10ffaf31bea94d4c.json","directory-Test.Users.Mocks-Debug-a3f545a3d37c3207c69d.json","directory-Test.UsersData-Debug-310c01fb8d47c4ac04ae.json","directory-Test.UsersData.Mocks-Debug-e08cf7375f0e752d4292.json","directory-Test.nxtusers-Debug-21358382d2b910951cb8.json","index-2025-11-20T09-55-27-0947.json","target-Anonymizer-Debug-6ec1cd4f7d4342b8e4ab.json","target-Anonymizer.Tests-Debug-b063fe1110287742f0a8.json","target-AssertsInterceptor-Debug-7ff80b8b064b59b30abd.json","target-Backend-Debug-ee67d5ab26e2c9b8fb35.json","target-Commands-Debug-698d3f0e5653f753f1c6.json","target-Config.Users-Debug-7dfd925bbec721f675aa.json","target-Config.Users.Tests-Debug-a1253e2719f25a8a966f.json","target-Continuous-Debug-c97652324ac250555a88.json","target-ContinuousBuild-Debug-7894122f14ddf627d6d8.json","target-ContinuousConfigure-Debug-404d503256d7e9bec70a.json","target-ContinuousCoverage-Debug-13d64aa825abb05336ee.json","target-ContinuousMemCheck-Debug-c3a5a6fd7746f8a19e59.json","target-ContinuousStart-Debug-3b0473917efce0eecbcd.json","target-ContinuousSubmit-Debug-a5fe223a35e5f617096f.json","target-ContinuousTest-Debug-a2507df854c6298e45bd.json","target-ContinuousUpdate-Debug-f70eca3ebd188608343b.json","target-Core-Debug-6ce2375dd5842a6e5761.json","target-Core.State-Debug-9619e5e21f1014367e55.json","target-DataProviders.LocalAdmins-Debug-7117dbdf5f3759e17a27.json","target-DataProviders.LocalAdmins.Tests-Debug-a03d0f3c100c3d928716.json","target-DataProviders.SystemApis-Debug-6519600f7fe8742b6f80.json","target-DataProviders.SystemApis.Mocks-Debug-f415175f98dce05a036a.json","target-DataProviders.SystemApis.Tests-Debug-073ba51f1ef5b242b020.json","target-DataProviders.UserData-Debug-30276f87493099eec6a5.json","target-DataProviders.UserData.Mocks-Debug-70d72c9fcdecbb100de2.json","target-DataProviders.UserData.Tests-Debug-141255fde8d416604ee3.json","target-DataProviders.UsersActivity-Debug-16851e9ad4af6c9911da.json","target-DataProviders.UsersActivity.Tests-Debug-5ad92c1f41bf407be4a1.json","target-Database-Debug-b04033328aca05908917.json","target-DatabaseCommandQueue-Debug-d4763dce913e1595fbf9.json","target-DatabaseCommandQueue.Mocks-Debug-d32b6533f0af9296bd16.json","target-DynamicConfigClient-Debug-a26c8a07c9eb528e7a19.json","target-ErrorReporting-Debug-f24e96fdd38085dff1a8.json","target-Experimental-Debug-e06b19ef462b809dca2e.json","target-ExperimentalBuild-Debug-691789cb6d85cd2f4cc7.json","target-ExperimentalConfigure-Debug-bb176416a3dd33b881bf.json","target-ExperimentalCoverage-Debug-0d65b1cbaa032236fde9.json","target-ExperimentalMemCheck-Debug-fa66cc679562813f40cf.json","target-ExperimentalStart-Debug-acf1f62cb2d9b312ce0c.json","target-ExperimentalSubmit-Debug-175f93c6b018b696c28f.json","target-ExperimentalTest-Debug-fb12f3bad8bebc0a24cd.json","target-ExperimentalUpdate-Debug-96b832b60511114d0763.json","target-External.crypto-Debug-9f2873275de1b26c1d38.json","target-IPC-Debug-226e8281525238cf10ee.json","target-IpcMonitor-Debug-45e8f65c981640ab024f.json","target-Metaprogramming-Debug-b3d9f8d7917dce93ae1f.json","target-ModuleConfig-Debug-df62e6ed55bb486a6667.json","target-Network-Debug-8b2fcf363cb58f4a14c7.json","target-Nightly-Debug-f8380c4c162bfa867ed7.json","target-NightlyBuild-Debug-554ac3a9a6959bcd85b1.json","target-NightlyConfigure-Debug-9aed65544215130dc0be.json","target-NightlyCoverage-Debug-3af95450c7a8ac32ad5a.json","target-NightlyMemCheck-Debug-edf377fcb7bd3fd8de40.json","target-NightlyMemoryCheck-Debug-107a5b5d48dc3e614728.json","target-NightlyStart-Debug-b05f79822857d192b383.json","target-NightlySubmit-Debug-46b90f3f95dfa9ce9f36.json","target-NightlyTest-Debug-a7f9a891504431f6e11e.json","target-NightlyUpdate-Debug-4f048b7e8aee7fcecb18.json","target-NotificationsDispatcher-Debug-ea867d9be63e878d727a.json","target-PersistentIpcQueue-Debug-e02fe0440f05e3b7a248.json","target-PersistentIpcQueue.Mocks-Debug-bd13c0a24a66ad33cdab.json","target-Platform-Debug-b259453a4e69e0db65c8.json","target-ProductInfo-Debug-9c04fb232fbc0d4471fd.json","target-Protobufs.Users-Debug-73ec71cce99ff008eb9f.json","target-Protocol.Protobuf-Debug-e071cb7472950f7b6a16.json","target-Security-Debug-5bd72a428ec1b7144e47.json","target-Security.HttpAuthHeader-Debug-3ca6b1ccdcaa46b78018.json","target-Services-Debug-bfc24f0b693f62ae522d.json","target-Settings-Debug-d1e947156a1eae341645.json","target-ShareableConfig-Debug-345de3349be7572db949.json","target-SpecialUsersSid-Debug-47109420948851a444ca.json","target-TaskScheduler-Debug-14312bdd1c0e85e1b47b.json","target-Telemetry-Debug-e48f53199391febd1ce7.json","target-Timer-Debug-7f3daae190aac29fc8cd.json","target-Top-Debug-2a09835dd0f12134265f.json","target-Top.Mocks-Debug-dd25642551cef2c0efb9.json","target-Users-Debug-22d3e4ee1f292e87e9fb.json","target-Users.Mocks-Debug-4c554f2b28f6e67e717e.json","target-Users.Tests-Debug-4033e0ea4f2faa5efe0f.json","target-UsersData-Debug-5dce6670ba3c3524189c.json","target-UsersData.Mocks-Debug-47bfd76d21b09d70fea3.json","target-UsersData.Tests-Debug-3e24caefa387a0fe7294.json","target-WorkingSetManager-Debug-95a19c49b333134ccee5.json","target-WorkingSetManager.Mocks-Debug-652495eba126c71e6537.json","target-generate_coverage_report-Debug-42ca6a8e43e9b06342c4.json","target-i18n-Debug-05d49d6626910a53e5c4.json","target-nxtusers-Debug-f3d1ba6341e8eaa294d5.json","target-nxtusers.Tests.Integration-Debug-1ee24e7ddfbb02a0de72.json","toolchains-v1-4ea388537f3cc68093fb.json"]
[extension] Not updating the configuration provider because "C_Cpp.intelliSenseEngine" is set to "Disabled"
[build] Build finished with exit code 0
[extension] [2727] cmake.buildDirectory started
[extension] [2727] cmake.buildDirectory finished (returned "/Users/pierre.hallot/dev/nxt/collector.collector-users/Local/build-macOS-ninja-arm64-Debug-asan-ubsan")
[expand] expanded ${command:cmake.buildDirectory}/coverage/lcov.info

Additional Information

PS: So far I haven't managed to find a way to only generate the coverage for only the test targets being run, and not all of them. Is there a way to pass that information to my generate_coverage_report?

phallot avatar Nov 20 '25 10:11 phallot

CC @TSonono Since you implemented the feature. Thank you. :)

phallot avatar Nov 20 '25 10:11 phallot

Hi @phallot , thank you for reporting this issue. We tried to reproduce this issue but encountered an error. In order for us to investigate this further, could you please provide a sample project to us that can reproduce this issue? Thanks.

yanghhhhhhh avatar Nov 21 '25 08:11 yanghhhhhhh

Hello:

I can make a reproduceable case:

https://github.com/LXYan2333/vscode-cmake-kits-coverage-bug-reproduce

System environment is:

$ cat /etc/os-release 
PRETTY_NAME="Debian GNU/Linux 13 (trixie)"
NAME="Debian GNU/Linux"
VERSION_ID="13"
VERSION="13 (trixie)"
VERSION_CODENAME=trixie
DEBIAN_VERSION_FULL=13.2
ID=debian
HOME_URL="https://www.debian.org/"
SUPPORT_URL="https://www.debian.org/support"
BUG_REPORT_URL="https://bugs.debian.org/"
$ gcc --version
gcc (Debian 14.2.0-19) 14.2.0
Copyright (C) 2024 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
$ lcov --version
lcov: LCOV version 2.0-1
$ cmake --version
cmake version 3.31.6

CMake suite maintained and supported by Kitware (kitware.com/cmake).

vscode version:

版本: 1.106.2
提交: 1e3c50d64110be466c0b4a45222e81d2c9352888
日期: 2025-11-19T16:56:50.023Z
Electron: 37.7.0
ElectronBuildId: 12781156
Chromium: 138.0.7204.251
Node.js: 22.20.0
V8: 13.8.258.32-electron.0
OS: Linux x64 6.12.57+deb13-amd64

cmake tools plugin version:

1.21.36

LXYan2333 avatar Nov 25 '25 10:11 LXYan2333

I clone this project and run it on my laptop, and it stuck at

https://github.com/microsoft/vscode-cmake-tools/blob/16d7126a3215241da5110980504a68d68f241a4f/src/coverage.ts#L66

and eventually stuck at the while loop in arthurmco/demangler-js

https://github.com/arthurmco/demangler-js/blob/b88b2f0b102ed0f0bb99c0870a893e077fd02bc7/src/itanium-abi.js#L96

debugger shows the declaration.name is:

"_ZN12_GLOBAL__N_128gtest_suite_PrimeTableTest2_24ReturnsFalseForNonPrimesI18OnTheFlyPrimeTableE8TestBodyEv"

it seems like a bug in arthurmco/demangler-js

LXYan2333 avatar Nov 25 '25 14:11 LXYan2333

Hi @phallot

The logs are indicating that you have gotten so far that the handleCoverageInfoFiles() is being invoked, so my guess is that your coverage info file is resulting in that code hanging. I unfortunately don't have the time to investigate it now.

PS: So far I haven't managed to find a way to only generate the coverage for only the test targets being run, and not all of them. Is there a way to pass that information to my generate_coverage_report?

This is not something that I added support for unfortunately. It's definitely a good idea if it's possible to do it in a user friendly way.

TSonono avatar Nov 25 '25 15:11 TSonono

I clone this project and run it on my laptop, and it stuck at

vscode-cmake-tools/src/coverage.ts

Line 66 in 16d7126 const demangledName = demangle(declaration.name);

debugger shows the declaration.name is:

"_ZN12_GLOBAL__N_128gtest_suite_PrimeTableTest2_24ReturnsFalseForNonPrimesI18OnTheFlyPrimeTableE8TestBodyEv"

So perhaps its the demangling library not being able to handle some names? I wans't the one who added the demangling, but it was definitely a good idea. If you remove the demangling, would things run OK?

TSonono avatar Nov 25 '25 15:11 TSonono

I clone this project and run it on my laptop, and it stuck at vscode-cmake-tools/src/coverage.ts Line 66 in 16d7126 const demangledName = demangle(declaration.name); debugger shows the declaration.name is:

"_ZN12_GLOBAL__N_128gtest_suite_PrimeTableTest2_24ReturnsFalseForNonPrimesI18OnTheFlyPrimeTableE8TestBodyEv"

So perhaps its the demangling library not being able to handle some names? I wans't the one who added the demangling, but it was definitely a good idea. If you remove the demangling, would things run OK?

yes, I change the line 66 to:

const demangledName: string = declaration.name;

and it works.

Image

LXYan2333 avatar Nov 25 '25 15:11 LXYan2333

@rjaegers , who added the demangling, could perhaps chime in?

TSonono avatar Nov 26 '25 08:11 TSonono

Hi there 👋🏻, thanks for the mention @TSonono.

I indeed added the demangling, I'll take a look. So far I have forked the demangling library and added a test with the mangled name mentioned here. Thanks so far for the analysis. The test indeed hangs for this input.

rjaegers avatar Nov 26 '25 08:11 rjaegers

@LXYan2333 Thank you for your reply. We tried to check this issue in this sample project. When first running "Run test with coverage", it showed "No tests were found". It took a long time to run the test coverage, eventually reporting the error "RangeError: Invalid array length". Then, running "Run test with coverage" again, it showed the test run completed and passed. Please refer to this video. Thank you.

https://github.com/user-attachments/assets/9bcb3419-51a9-4bc2-b465-1737f045c7a5

FYI: @gcampbell-msft

yanghhhhhhh avatar Nov 26 '25 09:11 yanghhhhhhh

I have opened a pull request on the arthurmco/demangler-js repository to fix the issue. And include support for quite some missing functionality in the demangler.

rjaegers avatar Nov 26 '25 14:11 rjaegers

I get the same problem.

vex87 avatar Dec 03 '25 11:12 vex87

Thanks for the comment. If there is progress on this issue, we will update here. Thanks!

yanghhhhhhh avatar Dec 04 '25 01:12 yanghhhhhhh

I suggest merging in a fix where the demangling is disabled until the bug in the library used to do the demangling is resolved.

TSonono avatar Dec 09 '25 13:12 TSonono

@TSonono Thank you for your suggestion. We will update you if there is any progress on this issue. Thank you.

yanghhhhhhh avatar Dec 11 '25 02:12 yanghhhhhhh