I have two cmake unit-test to check url and json helper classes, declared in the CMakeLists.txt of my project like following:
########################################
# CMakeLists.txt - Tests #
########################################
add_executable(urltest test/url.cpp)
add_test(NAME URLTest COMMAND urltest)
add_executable(jsontest test/json.cpp)
add_test(NAME JSONTest COMMAND jsontest )
I get visually the test units in the testing view of VSCode, and I can run perfectly the both in release mode: Execute the unit tests in release mode
Now if I want debugging it with the other button I have to select a launch configuration, what requires to create manually one launch configuration for each unit test: Execute the unit tests in debug mode
My current launch.json file require so one configuration for each unit test, it's impossible to maintain:
{ // launch.json
"version": "0.2.0",
"configurations": [
{
"name": "CTest-urltest",
"type": "lldb",
"request": "launch",
"program": "${workspaceFolder}/build/urltest",
"args": [],
"initCommands": ["breakpoint set -n main -N entry"],
"exitCommands": ["breakpoint delete entry"],
"cwd": "${workspaceFolder}"
},
{
"name": "CTest-jsontest",
"type": "lldb",
"request": "launch",
"program": "${workspaceFolder}/build/jsontest",
"args": [],
"initCommands": ["breakpoint set -n main -N entry"],
"exitCommands": ["breakpoint delete entry"],
"cwd": "${workspaceFolder}"
}
]
}
I guess the problem is only the program
attribute, How can we map the program clicked on the testing view of VSCode to an unique launch configuration? something like following for example:
{ // launch.json
"version": "0.2.0",
"configurations": [
{
"name": "CTest",
"type": "lldb",
"request": "launch",
"program": "${workspaceFolder}/build/${command: testing.currentPath}",
"args": [],
"initCommands": ["breakpoint set -n main -N entry"],
"exitCommands": ["breakpoint delete entry"],
"cwd": "${workspaceFolder}"
}
]
}
Makefile
s and shell commands? You mean that I must concoct some magic incantation in the form of a convoluted JSON configuration file, to get basic functionality right? That's a darn shame, isn't it? After readingmake
s man page, as lengthy as it is, with plenty of examples, it's always pretty straightofrward for me to simply pushF5
in emacs, and get everything built. – Ritch