-
-
Notifications
You must be signed in to change notification settings - Fork 52
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Is it possible to call cmake build before run? #127
Comments
It works the other way around. You build your binary and the extension detects it and re-run it. For building from vscode: check this. Here is my tasks.json for example:
|
OK. Thanks. |
In case somebody find their way here: https://github.com/matepek/vscode-catch2-test-adapter/blob/master/documents/support.md |
@xgdgsc I found a way to run tests automatically. Install the extension Trigger Task on Save and configure it to trigger a task with the label, let's say, "Build tests" when files are saved. You can choose which files with patterns ( Then create a task in {
"label": "Build tests",
"type": "shell",
"presentation": {
"echo": false,
"reveal": "always",
"focus": false,
"panel": "shared",
"showReuseMessage": false,
"clear": true
},
"command": "make tests", //shell/terminal command to build tests
"problemMatcher": []
} And make sure to have autorun from the Test Explorer enabled like matepek mentioned. Hope it is useful. |
I am looking for a way to first build the tests, if a source file has changed, and then run the tests. Ideally this sequence taking place by hitting the "Run Tests" icon. In the TestMate version 4.3.5 I don't see the option "Enable Autorun". Any suggestions? |
Just in case this helps, I have it setup to build my tests with cmake before running tests in the UI. My "testMate.cpp.test.advancedExecutables": [
{
...
"runTask": {
"before": [
"build tests",
],
},
},
], And {
"label": "build tests",
"type": "cmake",
"command": "build",
"group": "build",
"targets": [
"test/all"
]
}, |
So, I like this and tried it, but ran into an issue. If you mess up your build, you might miss something important. For me what would happen is my test would attempt to build, fail, the old exec would still be there and the test would run it. Likewise, you can't clean the old execs, because the test explorer won't see them anymore. For me, it would attempt to build automatically when I clicked test, fail build, then report a success or fail (whatever my last correctly built test was). If I didn't look to see in my output that it failed, it could be easy to miss. Mate responded to my question about this that it wasn't intended to run like that and it was probably better to run the tests when the exec changes. This way, a failed build won't run a test at all. For me, this changes my flow to build tests in order to run them, instead of clicking test to build then run. It's a small difference but important. |
Is your feature request related to a problem? Please describe.
Currently when I change code and want to test and click run. It runs the old binary.
Describe the solution you'd like
Call cmake build first before run.
The text was updated successfully, but these errors were encountered: