Hello!
I would like to build the executable of my unittest programm, but unlike ‘fpm test’ it should not start running them immediately.
Some context: I use Visual Studio Code as IDE and for running and debugging the code I have the following launch and task configurations:
"version": "0.2.0",
"configurations": [
{
"name": "run project",
"type": "cppdbg",
"request": "launch",
"program": "${workspaceFolder}\\build\\gfortran_821022990192F960\\app\\my_project.exe",
"args": [""],
"stopAtEntry": false,
"cwd": "${workspaceFolder}",
"miDebuggerPath": "gdb.exe",
"preLaunchTask": "fpm_build"
},
{
"name": "test project",
"type": "cppdbg",
"request": "launch",
"program": "${workspaceFolder}\\build\\gfortran_821022990192F960\\test\\check.exe",
"args": ["-v"],
"stopAtEntry": false,
"cwd": "${workspaceFolder}",
"miDebuggerPath": "gdb.exe",
"preLaunchTask": "fpm_test"
},
]
}
{
"version": "2.0.0",
"tasks": [
{
"label": "set_compiler",
"type": "shell",
"command": "set FPM_FC=gfortran"
},{
"label": "fpm_build",
"dependsOn":["set_compiler"],
"type": "shell",
"command": "fpm build"
},{
"label": "fpm_test",
"dependsOn":["set_compiler"],
"type": "shell",
"command": "fpm test"
}
]
}
With this setup I can build the normal program and then debug it. However the ‘test project’ launch task will first build the check programm, then run it (as part for fpm test command) and the run it again (this time with actual debugging enabled). This will result in running the tests twice and if any test throws an exception I won’t be able to debug the test cases (since the actual launch won’t happen due to the failing preLaunchTask).
Ideally I would like to just build the test programm with my preLaunchTask. So do some command flags/fpm configuration exist, that would achieve this? If not, do you know of any other workaround?
Greetings
Tavi007