microsoft / microsoft/vscode-cmake-tools

[Bug] Test Explorer does not fall back to default build for tests whose command is not a CMake target

Open
#5,094 3 comments 1 reaction 0 assignees View on GitHub
bug
Dominant language
TypeScript
Stars
1.7k
Forks
546
Avg merge
2d 16h
Merged PRs (30d)
32

Description

### Brief Issue Summary

After update to 1.24.42, I noticed the following inconvenience:

If the ctest command is not directly the executable/target, the newest version does not fall back to building all targets, as it was previously by default. This makes the feature `"cmake.buildBeforeRun": true` basically unusable in that scenario.

Specifically, the ctest command for my test is:
`"/usr/bin/bash" "-c" "path/to/mpiexec path/to/target"`

I am pretty sure this was introduced in #4881, which also discusses this potential issue, but I cannot tell whether or how it has been addressed in that discussion.

### CMake Tools Diagnostics

```shell
{
"os": "linux",
"vscodeVersion": "1.134.0",
"cmtVersion": "1.24.42",
"configurations": [
{
"folder": "/home/rjoussen/Documents/workspace/4C/main",
"cmakeVersion": "3.30.5",
"configured": true,
"generator": "Ninja",
"usesPresets": true,
"compilers": {
"C": "/usr/bin/cc",
"CXX": "/usr/bin/c++"
}
}
],
"cpptoolsIntegration": {
"isReady": false,
"hasCodeModel": false,
"activeBuildType": "",
"buildTypesSeen": [],
"requests": [],
"responses": [],
"partialMatches": [],
"targetCount": 0,
"executablesCount": 0,
"librariesCount": 0,
"targets": []
},
"settings": [
{
"communicationMode": "automatic",
"useCMakePresets": "auto",
"configureOnOpen": false
}
]
}
```

### Debug Log

```shell
[ctest] Test program '/usr/bin/bash' is not a known CMake executable target; skipping from build.
[proc] Executing command: /usr/local/bin/ctest -C DEBUG --output-on-failure -j24 -R ^sohex8fbar_cooks_nl_l
[proc] with environment: {"CHROME_DESKTOP":"code.desktop","CLUTTER_DISABLE_MIPMAPPED_TEXT":"1","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","FC_FONTATIONS":"1","FONTCONFIG_FILE":"/etc/fonts/fonts.conf","FONTCONFIG_PATH":"/etc/fonts","GDK_BACKEND":"x11","GDK_PIXBUF_MODULEDIR":"/snap/code/258/usr/lib/x86_64-linux-gnu/gdk-pixbuf-2.0/2.10.0/loaders","GDK_PIXBUF_MODULE_FILE":"/home/rjoussen/snap/code/common/.cache/gdk-pixbuf-loaders.cache","GDMSESSION":"ubuntu","GIO_LAUNCHED_DESKTOP_FILE":"/var/lib/snapd/desktop/applications/code_code.desktop","GIO_LAUNCHED_DESKTOP_FILE_PID":"3380469","GIO_MODULE_DIR":"/home/rjoussen/snap/code/common/.cache/gio-modules","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","GSETTINGS_SCHEMA_DIR":"/home/rjoussen/snap/code/258/.local/share/glib-2.0/schemas","GSM_SKIP_SSH_AGENT_WORKAROUND":"true","GTK_EXE_PREFIX":"/snap/code/258/usr","GTK_IM_MODULE_FILE":"/home/rjoussen/snap/code/common/.cache/immodules/immodules.cache","GTK_MODULES":"gail:atk-bridge","GTK_PATH":"/snap/code/258/usr/lib/x86_64-linux-gnu/gtk-3.0","HOME":"/home/rjoussen","IM_CONFIG_CHECK_ENV":"1","IM_CONFIG_PHASE":"1","INVOCATION_ID":"8fd7c4f9c2784fe6bfc188f235ec9ec6","JOURNAL_STREAM":"9:34889","LANG":"en_US.UTF-8","LESSCLOSE":"/usr/bin/lesspipe %s %s","LESSOPEN":"| /usr/bin/lesspipe %s","LOCPATH":"/snap/code/258/usr/lib/locale","LOGNAME":"rjoussen","MANAGERPID":"4034","MEMORY_PRESSURE_WATCH":"/sys/fs/cgroup/user.slice/user-1000.slice/user@1000.service/session.slice/org.gnome.Shell@wayland.service/memory.pressure","MEMORY_PRESSURE_WRITE":"c29tZSAyMDAwMDAgMjAwMDAwMAA=","PATH":"/home/rjoussen/.pixi/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/snap/bin","PWD":"/home/rjoussen","PYTHONPATH":"/home/rjoussen/Programs/gmsh-4.15.0-Linux64-sdk/lib:","QT_ACCESSIBILITY":"1","QT_IM_MODULE":"ibus","SESSION_MANAGER":"local/sam-lagrange:@/tmp/.ICE-unix/4270,unix/sam-lagrange:/tmp/.ICE-unix/4270","SHELL":"/bin/bash","SHLVL":"0","SNAP":"/snap/code/258","SNAP_ARCH":"amd64","SNAP_COMMON":"/var/snap/code/common","SNAP_CONTEXT":"Pqfcy7Ix-5yUHoE0Zo_nkYxKM-eyXsvn5LkkfUljIQMNn709nhms","SNAP_COOKIE":"Pqfcy7Ix-5yUHoE0Zo_nkYxKM-eyXsvn5LkkfUljIQMNn709nhms","SNAP_DATA":"/var/snap/code/258","SNAP_EUID":"1000","SNAP_INSTANCE_NAME":"code","SNAP_LAUNCHER_ARCH_TRIPLET":"x86_64-linux-gnu","SNAP_LIBRARY_PATH":"/var/lib/snapd/lib/gl:/var/lib/snapd/lib/gl32","SNAP_NAME":"code","SNAP_REAL_HOME":"/home/rjoussen","SNAP_REVISION":"258","SNAP_UID":"1000","SNAP_USER_COMMON":"/home/rjoussen/snap/code/common","SNAP_USER_DATA":"/home/rjoussen/snap/code/258","SNAP_VERSION":"110a328e","SSH_AUTH_SOCK":"/run/user/1000/keyring/ssh","SYSTEMD_EXEC_PID":"4314","USER":"rjoussen","USERNAME":"rjoussen","VSCODE_CLI":"1","VSCODE_CODE_CACHE_PATH":"/home/rjoussen/.config/Code/CachedData/110a328ea54b42367b803ec53ee0bf52ef26b419","VSCODE_CRASH_REPORTER_PROCESS_TYPE":"extensionHost","VSCODE_CWD":"/home/rjoussen","VSCODE_ESM_ENTRYPOINT":"vs/workbench/api/node/extensionHostProcess","VSCODE_HANDLES_UNCAUGHT_ERRORS":"true","VSCODE_IPC_HOOK":"/run/user/1000/vscode-e9d117b3-1.13-main.sock","VSCODE_NLS_CONFIG":"{\"userLocale\":\"en-us\",\"osLocale\":\"en-us\",\"resolvedLanguage\":\"en\",\"defaultMessagesFile\":\"/snap/code/258/usr/share/code/resources/app/out/nls.messages.json\",\"locale\":\"en-us\",\"availableLanguages\":{}}","VSCODE_PID":"3380518","WAYLAND_DISPLAY":"wayland-0","XAUTHORITY":"/run/user/1000/.mutter-Xwaylandauth.4762T3","XDG_CONFIG_DIRS":"/etc/xdg/xdg-ubuntu:/etc/xdg","XDG_CONFIG_DIRS_VSCODE_SNAP_ORIG":"/etc/xdg/xdg-ubuntu:/etc/xdg","XDG_CURRENT_DESKTOP":"ubuntu:GNOME","XDG_DATA_DIRS":"/home/rjoussen/snap/code/258/.local/share:/home/rjoussen/snap/code/258:/snap/code/258/usr/share:/usr/share/ubuntu:/usr/share/gnome:/usr/local/share/:/usr/share/:/var/lib/snapd/desktop","XDG_DATA_DIRS_VSCODE_SNAP_ORIG":"/usr/share/ubuntu:/usr/share/gnome:/usr/local/share/:/usr/share/:/var/lib/snapd/desktop","XDG_DATA_HOME":"/home/rjoussen/snap/code/258/.local/share","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","_":"/snap/code/258/usr/share/code/code","ELECTRON_RUN_AS_NODE":"1","DEBUG":"release","APPLICATION_INSIGHTS_NO_STATSBEAT":"true","MXC_BIN_DIR":"/snap/code/258/usr/share/code/resources/app/node_modules.asar.unpacked/@microsoft/mxc-sdk/bin","COPILOT_CLI_ENABLED_FEATURE_FLAGS":"SHELL_SPAWN_BACKEND","COPILOT_OTEL_FILE_EXPORTER_PATH":"/dev/null","VSCODE_DOTNET_INSTALL_TOOL_ORIGINAL_HOME":"/home/rjoussen","VSCODE_L10N_BUNDLE_LOCATION":"","VSCODE_CMAKE_TOOLS":"1","CCACHE_BASEDIR":"/home/rjoussen/Documents/workspace/4C/main/..","CCACHE_NOHASHDIR":"true"}
```

### Additional Information

_No response_

Contributor guide

Open the contributing guide

Research direction

Start with the Test Explorer handling for ctest commands and the cmake.buildBeforeRun setting, using the logged command with /usr/bin/bash as the reproduction. Read the discussion in #4881 for the behavior introduced there. Done means tests whose command is not a CMake target fall back to the default build before running.

Written by the indexing model from the issue text.

Assessment

Tech stack
cmake, typescript
Domain
build-system, testing-qa
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
66/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.