[Bug] CTest - Setting test suite delimiter hides tests if test suite name and target name are the same
Brief Issue Summary
Hi,
I have some issues when using the Test Explorer with CTest and google test.
I have tried to reduce it to an easy example.
- the top-level CMakeLists.txt:
cmake_minimum_required(VERSION 3.25)
project(TestDiscovery)
find_package(GTest REQUIRED)
include(GoogleTest)
include(CTest)
add_executable(TestSuite1 testSuite1.cpp)
target_link_libraries(TestSuite1 GTest::gtest GTest::gtest_main)
add_test(NAME TestSuite1 COMMAND TestSuite1)
gtest_discover_tests(TestSuite1)
add_executable(TestSuite2 testSuite2.cpp)
target_link_libraries(TestSuite2 GTest::gtest GTest::gtest_main)
add_test(NAME TestSuite2 COMMAND TestSuite2)
gtest_discover_tests(TestSuite2)
- the both source files:
// testSuite1.cpp
#include "gtest/gtest.h"
TEST(TestSuite1, test1){
}
// testSuite2.cpp
#include "gtest/gtest.h"
TEST(TestSuite2_, test2){
}
Without any "Test Suite Delimiter" set, the test explorer shows:
With "Test Suite Delimiter" set to \. it shows:
My issues are:
- In the first case the tests are repeated - once as an entry that runs all the tests of the target and once individually.
- In the second case there are still the entries that run all the tests of each target, but only for the second target the individual tests are listed. I think the reason is, that the target and the test suite name are the same for the first target.
Would it be possible to either show the entries that trigger all the tests of a target, the individual tests or the individual tests in a hierarchical way (that also allows to run all the tests of each test suite).
Thanks and best regards oz
CMake Tools Diagnostics
{
"os": "linux",
"vscodeVersion": "1.99.3",
"cmtVersion": "1.20.53",
"configurations": [
{
"folder": "/home/oz/Documents/TestDiscovery",
"cmakeVersion": "3.31.6",
"configured": true,
"generator": "Unix Makefiles",
"usesPresets": false,
"compilers": {
"C": "/usr/bin/gcc",
"CXX": "/usr/bin/g++"
}
}
],
"cpptoolsIntegration": {
"isReady": true,
"hasCodeModel": true,
"activeBuildType": "Debug",
"buildTypesSeen": [
"Debug"
],
"requests": [],
"responses": [],
"partialMatches": [],
"targetCount": 30,
"executablesCount": 2,
"librariesCount": 0,
"targets": []
},
"settings": [
{
"communicationMode": "automatic",
"useCMakePresets": "auto",
"configureOnOpen": true
}
]
}
Debug Log
[main] Building folder: /home/oz/Documents/TestDiscovery/build
[main] Saving open files before configure/build
[build] Starting build
[driver] Start build all
[proc] Executing command: /usr/local/bin/cmake --build /home/oz/Documents/TestDiscovery/build --config Debug --target all -j 18 --
[proc] with environment: {"CHROME_DESKTOP":"code.desktop","CLUTTER_DISABLE_MIPMAPPED_TEXT":"1","COLORTERM":"truecolor","DBUS_SESSION_BUS_ADDRESS":"unix:path=/run/user/1000/bus","DEBUGINFOD_URLS":"https://debuginfod.ubuntu.com ","DESKTOP_SESSION":"ubuntu","DISPLAY":":0","ELECTRON_NO_ATTACH_CONSOLE":"1","GDK_BACKEND":"x11","GDMSESSION":"ubuntu","GIO_LAUNCHED_DESKTOP_FILE":"/usr/share/applications/terminator.desktop","GIO_LAUNCHED_DESKTOP_FILE_PID":"3917","GJS_DEBUG_OUTPUT":"stderr","GJS_DEBUG_TOPICS":"JS ERROR;JS LOG","GNOME_DESKTOP_SESSION_ID":"this-is-deprecated","GNOME_SETUP_DISPLAY":":1","GNOME_SHELL_SESSION_MODE":"ubuntu","GSM_SKIP_SSH_AGENT_WORKAROUND":"true","GTK_MODULES":"gail:atk-bridge","HOME":"/home/oz","IM_CONFIG_PHASE":"1","INVOCATION_ID":"f7fb97f3e77c4c368a6f0865fb42a38c","JOURNAL_STREAM":"9:19423","LANG":"en_US.UTF-8","LESSCLOSE":"/usr/bin/lesspipe %s %s","LESSOPEN":"| /usr/bin/lesspipe %s","LOGNAME":"oz","LS_COLORS":"rs=0:di=01;34:ln=01;36:mh=00:pi=40;33:so=01;35:do=01;35:bd=40;33;01:cd=40;33;01:or=40;31;01:mi=00:su=37;41:sg=30;43:ca=00:tw=30;42:ow=34;42:st=37;44:ex=01;32:*.tar=01;31:*.tgz=01;31:*.arc=01;31:*.arj=01;31:*.taz=01;31:*.lha=01;31:*.lz4=01;31:*.lzh=01;31:*.lzma=01;31:*.tlz=01;31:*.txz=01;31:*.tzo=01;31:*.t7z=01;31:*.zip=01;31:*.z=01;31:*.dz=01;31:*.gz=01;31:*.lrz=01;31:*.lz=01;31:*.lzo=01;31:*.xz=01;31:*.zst=01;31:*.tzst=01;31:*.bz2=01;31:*.bz=01;31:*.tbz=01;31:*.tbz2=01;31:*.tz=01;31:*.deb=01;31:*.rpm=01;31:*.jar=01;31:*.war=01;31:*.ear=01;31:*.sar=01;31:*.rar=01;31:*.alz=01;31:*.ace=01;31:*.zoo=01;31:*.cpio=01;31:*.7z=01;31:*.rz=01;31:*.cab=01;31:*.wim=01;31:*.swm=01;31:*.dwm=01;31:*.esd=01;31:*.avif=01;35:*.jpg=01;35:*.jpeg=01;35:*.mjpg=01;35:*.mjpeg=01;35:*.gif=01;35:*.bmp=01;35:*.pbm=01;35:*.pgm=01;35:*.ppm=01;35:*.tga=01;35:*.xbm=01;35:*.xpm=01;35:*.tif=01;35:*.tiff=01;35:*.png=01;35:*.svg=01;35:*.svgz=01;35:*.mng=01;35:*.pcx=01;35:*.mov=01;35:*.mpg=01;35:*.mpeg=01;35:*.m2v=01;35:*.mkv=01;35:*.webm=01;35:*.webp=01;35:*.ogm=01;35:*.mp4=01;35:*.m4v=01;35:*.mp4v=01;35:*.vob=01;35:*.qt=01;35:*.nuv=01;35:*.wmv=01;35:*.asf=01;35:*.rm=01;35:*.rmvb=01;35:*.flc=01;35:*.avi=01;35:*.fli=01;35:*.flv=01;35:*.gl=01;35:*.dl=01;35:*.xcf=01;35:*.xwd=01;35:*.yuv=01;35:*.cgm=01;35:*.emf=01;35:*.ogv=01;35:*.ogx=01;35:*.aac=00;36:*.au=00;36:*.flac=00;36:*.m4a=00;36:*.mid=00;36:*.midi=00;36:*.mka=00;36:*.mp3=00;36:*.mpc=00;36:*.ogg=00;36:*.ra=00;36:*.wav=00;36:*.oga=00;36:*.opus=00;36:*.spx=00;36:*.xspf=00;36:*~=00;90:*#=00;90:*.bak=00;90:*.crdownload=00;90:*.dpkg-dist=00;90:*.dpkg-new=00;90:*.dpkg-old=00;90:*.dpkg-tmp=00;90:*.old=00;90:*.orig=00;90:*.part=00;90:*.rej=00;90:*.rpmnew=00;90:*.rpmorig=00;90:*.rpmsave=00;90:*.swp=00;90:*.tmp=00;90:*.ucf-dist=00;90:*.ucf-new=00;90:*.ucf-old=00;90:","MANAGERPID":"2137","MEMORY_PRESSURE_WATCH":"/sys/fs/cgroup/user.slice/user-1000.slice/[email protected]/session.slice/[email protected]/memory.pressure","MEMORY_PRESSURE_WRITE":"c29tZSAyMDAwMDAgMjAwMDAwMAA=","NVM_BIN":"/home/oz/.nvm/versions/node/v23.10.0/bin","NVM_DIR":"/home/oz/.nvm","NVM_INC":"/home/oz/.nvm/versions/node/v23.10.0/include/node","OLDPWD":"/opt/cmake/share/cmake-3.31/Modules","ORIGINAL_XDG_CURRENT_DESKTOP":"ubuntu:GNOME","PATH":"/home/oz/.nvm/versions/node/v23.10.0/bin:/home/oz/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/snap/bin:/home/oz/node_modules/.bin:/home/oz/.local/bin:/home/oz/node_modules/.bin","PWD":"/home/oz/Documents/TestDiscovery","QT_ACCESSIBILITY":"1","QT_IM_MODULE":"ibus","SESSION_MANAGER":"local/oz-laptop:@/tmp/.ICE-unix/2520,unix/oz-laptop:/tmp/.ICE-unix/2520","SHELL":"/bin/bash","SHLVL":"1","SSH_AUTH_SOCK":"/run/user/1000/keyring/ssh","SYSTEMD_EXEC_PID":"2589","TERM":"xterm-256color","TERMINATOR_DBUS_NAME":"net.tenshu.Terminator25ef4b219e3b005583550f2b0f9f990c3","TERMINATOR_DBUS_PATH":"/net/tenshu/Terminator2","TERMINATOR_UUID":"urn:uuid:f3b82b1f-d2a9-4860-89cc-8733868f786a","USER":"oz","USERNAME":"oz","VSCODE_CLI":"1","VSCODE_CODE_CACHE_PATH":"/home/oz/.config/Code/CachedData/17baf841131aa23349f217ca7c570c76ee87b957","VSCODE_CRASH_REPORTER_PROCESS_TYPE":"extensionHost","VSCODE_CWD":"/home/oz/Documents/TestDiscovery","VSCODE_ESM_ENTRYPOINT":"vs/workbench/api/node/extensionHostProcess","VSCODE_HANDLES_UNCAUGHT_ERRORS":"true","VSCODE_IPC_HOOK":"/run/user/1000/vscode-a92e4c41-1.99-main.sock","VSCODE_NLS_CONFIG":"{\"userLocale\":\"en-us\",\"osLocale\":\"en-us\",\"resolvedLanguage\":\"en\",\"defaultMessagesFile\":\"/usr/share/code/resources/app/out/nls.messages.json\",\"locale\":\"en-us\",\"availableLanguages\":{}}","VSCODE_PID":"71140","VTE_VERSION":"7600","WAYLAND_DISPLAY":"wayland-0","XAUTHORITY":"/run/user/1000/.mutter-Xwaylandauth.FPJQ42","XDG_CONFIG_DIRS":"/etc/xdg/xdg-ubuntu:/etc/xdg","XDG_CURRENT_DESKTOP":"Unity","XDG_DATA_DIRS":"/usr/share/ubuntu:/usr/share/gnome:/usr/local/share/:/usr/share/:/var/lib/snapd/desktop","XDG_MENU_PREFIX":"gnome-","XDG_RUNTIME_DIR":"/run/user/1000","XDG_SESSION_CLASS":"user","XDG_SESSION_DESKTOP":"ubuntu","XDG_SESSION_TYPE":"wayland","XMODIFIERS":"@im=ibus","_":"/usr/bin/code","ELECTRON_RUN_AS_NODE":"1","VSCODE_L10N_BUNDLE_LOCATION":"","NINJA_STATUS":"[%s/%t %p :: %e] "}
[build] [ 50%] Building CXX object CMakeFiles/TestSuite2.dir/testSuite2.cpp.o
[build] [ 25%] Building CXX object CMakeFiles/TestSuite1.dir/testSuite1.cpp.o
[build] [ 75%] Linking CXX executable TestSuite2
[build] [100%] Linking CXX executable TestSuite1
[build] [100%] Built target TestSuite2
[build] [100%] Built target TestSuite1
[driver] Build completed: 00:00:00.927
[cmakefileapi-parser] Read reply folder: /home/oz/Documents/TestDiscovery/build/.cmake/api/v1/reply
[cmakefileapi-parser] Found index files: ["cache-v2-2e9f61440438f92ed73f.json","cmakeFiles-v1-26ceb3dc9865d6c6de99.json","codemodel-v2-4188e3656f82607df2cf.json","directory-.-Debug-f5ebdc15457944623624.json","index-2025-04-16T20-00-01-0984.json","target-Continuous-Debug-665d2f7f1a400000325a.json","target-ContinuousBuild-Debug-413408126238a38027cb.json","target-ContinuousConfigure-Debug-28e5f117384a1efd6f4a.json","target-ContinuousCoverage-Debug-3cc9e4fe4efa6ab1183f.json","target-ContinuousMemCheck-Debug-7d7245deed7d9533e379.json","target-ContinuousStart-Debug-3838fd94993e443ef590.json","target-ContinuousSubmit-Debug-6ae4911f18374a88d44a.json","target-ContinuousTest-Debug-088fbe5f6777388135bb.json","target-ContinuousUpdate-Debug-2dde135b774fd6d589d3.json","target-Experimental-Debug-621bd1289e7f8b982f81.json","target-ExperimentalBuild-Debug-71e31aa4ad801b0521b4.json","target-ExperimentalConfigure-Debug-35d1f5113111f67255a3.json","target-ExperimentalCoverage-Debug-9c92e6045bc798df0a69.json","target-ExperimentalMemCheck-Debug-6bebde1c04bc78b3463f.json","target-ExperimentalStart-Debug-8377d8eae5763d7b242b.json","target-ExperimentalSubmit-Debug-cc0e88ad47d664da2817.json","target-ExperimentalTest-Debug-cf0706f4c6d1b5245700.json","target-ExperimentalUpdate-Debug-1e79502628c8ed42abfa.json","target-Nightly-Debug-61137bf641dfa1896b1f.json","target-NightlyBuild-Debug-b41e52ba369ea32b092f.json","target-NightlyConfigure-Debug-b5df6f22585782a8b460.json","target-NightlyCoverage-Debug-9867506503fbe97683ea.json","target-NightlyMemCheck-Debug-db2dd317361c3736c479.json","target-NightlyMemoryCheck-Debug-78d504cb2c5a65e38f4e.json","target-NightlyStart-Debug-f41347b1ae2bc38d6002.json","target-NightlySubmit-Debug-d5ad915e100b78e98276.json","target-NightlyTest-Debug-d7b30b3a5c959246a134.json","target-NightlyUpdate-Debug-8830602e5412005afc64.json","target-TestSuite1-Debug-cd5b160483563b5063ba.json","target-TestSuite2-Debug-4eefe0ef3949b5666167.json","toolchains-v1-de13eb4a293a7f94668f.json"]
[expand] expanded ${workspaceFolder}/build
[build] Build finished with exit code 0
[cache] Reading CMake cache file /home/oz/Documents/TestDiscovery/build/CMakeCache.txt
[cache] Parsing CMake cache string
[extension] [8678] cmake.build finished (returned 0)
Additional Information
I use GoogleTest (v. 1.14.0-1) from apt on Ubuntu 24.04.
Hi @ottmar-zittlau, thanks for reporting issue here!
Reproduced this issue on CMake Tools v1.21.16(pre-release), tests hides if test suite name and target name are the same when setting "Test Suite Delimiter" to \.
@gcampbell-msft FYI.