microsoft / vscode-cmake-tools

CMake integration in Visual Studio Code
https://marketplace.visualstudio.com/items?itemName=vector-of-bool.cmake-tools
MIT License
1.47k stars 454 forks source link

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

Open borjamunozf opened 2 weeks ago

borjamunozf commented 2 weeks ago

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

CMake Tools Diagnostics

No response

Debug Log

No response

Additional Information

No response

Amy-Li03 commented 2 weeks ago

Thank you for reporting this issue. We can reproduce this on our side, following is the repro video: @gcampbell-msft is this by design?

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

Also, do you have any suggestions for clients with the above issues? Image

gcampbell-msft commented 2 weeks ago

@borjamunozf To clarify, what you would like to see is for us to ask for the test that you want to launch every single time you invoke the launch.json entry?

You are correct that currently this is the design, so this is expected, however, if I'm understanding your request right, we can label this as a feature request.

Thanks

borjamunozf commented 1 week ago

@borjamunozf To clarify, what you would like to see is for us to ask for the test that you want to launch every single time you invoke the launch.json entry?

You are correct that currently this is the design, so this is expected, however, if I'm understanding your request right, we can label this as a feature request.

Thanks

Yes, or at least have a way to ask always which test to run as target