microsoft / microsoft/vscode-cmake-tools

Launch debug unit test with program cmake.launchTargetPath always run the same test

Open
#4,147 3 comments 0 reactions 0 assignees View on GitHub
enhancement Feature: debug/launch more votes needed
Dominant language
TypeScript
Stars
1.7k
Forks
546
Avg merge
2d 16h
Merged PRs (30d)
32

Description

### Brief Issue Summary

Hello. Probably this is by design, but given that we cant run the tests from side panel using cmake.testProgram (#3505) its 'the only way to support launch and debug a unit test.

Current config

```
{
"version": "0.2.0",
"configurations": [
{
"name": "(gdb) Launch Debug UnitTest",
"type": "cppdbg",
"request": "launch",
"program": "${command:cmake.launchTargetPath}",
"cwd": "${workspaceFolder}",
"stopAtEntry": true,
"externalConsole": false,
"logging": {
"trace": false
},
"environment": [
{
"name": "LD_LIBRARY_PATH",
"value": "whateverasdasd"
}
],
"MIMode": "gdb",
"setupCommands": [
{
"text": "-gdb-set auto-load safe-path /opt/",
"description": "enable safe path",
"ignoreFailures": false
}
]
},
],
"inputs": [
{
"id": "whateverSysPath",
"type": "command",
"command": "shellCommand.execute",
"args": {
"command": "ls -d -1 /opt/whatever/*/*",
"useSingleResult": true
}
},
]
}
```

We would like to get the list of available target unit test to run always we run this config. However, it only prompt the user once and then all subsequent executions run the same test, it does not even ask which target / unit test you would like to select.

The workaround is to go the side panel and click on the edit button...

Is there any way to force select or don't save the launch target path?

![Image](https://github.com/user-attachments/assets/2f013009-7600-4d72-85d5-20011d9451e4)

### CMake Tools Diagnostics

_No response_

### Debug Log

_No response_

### Additional Information

_No response_

Contributor guide

Open the contributing guide

Research direction

Start by tracing how the CMake Tools configuration handles the ${command:cmake.launchTargetPath} variable and how the side-panel test target selection works. Compare this with the reported cmake.testProgram limitation and determine whether launch target selection can be made repeatable. Done means each launch can select an available unit-test target instead of reusing the previously selected one.

Written by the indexing model from the issue text.

Assessment

Tech stack
cmake, typescript, vscode
Domain
developer-experience, testing-qa, tooling
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.