-
-
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
Bazel, Runfiles, and C++ TestMate - how to use properly? #417
Comments
Is there perhaps a way for me to run gdb via a gdbwrapper (kind of like the execution wrapper?). That would give me the flexibility in solving the problem. AFAIK, VSCode Json doesn't support a way of dynamically trimming the cwd path. |
could you give me a simple bazel repo which contains some tests and I can compile and run it on macos? |
Hi @matepek, I've finally gotten around to creating an example for you. Hope this works for you, as I haven't tested on a mac. Unzip this file: Go into the root of that workspace. From the internal readme: SETUP:
RECREATING:I'm going to assume you have bazelisk in your path.
It fails for two reasons:
|
Gonna check, thanks |
Hello,
|
Whoops, I had one bad assumption in there that would make it work for me, but not you. Try this one, it should work. |
Le me summarise the problem. |
Not 100% sure if the issue is not finding a dynamic library or some other configuration file. I haven't looked under the ROS2 hood much There are two key issues. The one you noted, where finding the right path is tricky. The second is that while the test target name is More background information in case it helps, but not related to your question. I'm not sure how much you know about bazel:
Hope this information is helpful! |
We have an approach now for debugging through the launch.json.
The pre launch task builds the This works great for the "Run and Debug" side bar. But, is there a way to specify these params so that they work through TestMate? I believe this would create a seamless experience for bazel developers if there were a way to specify these. Thanks! PS. I don't think this will be a complete solution, I need to think through the scenario some more. But, I think this will help me get one step further. |
I'm a bit tired maybe that's why I don't get your comment yet. I will re-read it later.. Meanwhile, have your checked this? |
Let me dig into that. I didn't realize the configTemplate was possible, but that might be what I need to get things working. |
This is more of a question right now than it is a feature request, though it may be that as well after some discussion.
I am using bazel to build our company's software. I also love C++ Testmate and have used it while developing. We have figured out how to use C++ TestMate with bazel using an execution wrapper. Here is the code for setting that up:
This enables us to discover tests and run tests from C++ TestMate with no issue. It also allows us to use the debugger for some tests, but not all.
The subset of test that do not work require that the *.runfiles folder (listed in pattern above) be the cwd. This seems to be a bazel requirement. Two examples of paths:
bazel-bin/component1/test/component1_test.runfiles/repo/component1/test/component1_test
or
bazel-bin/component2/subcomponent2/test/subcomponent2_test.runfiles/repo/component2/subcomponent2/test/subcomponent2_test
Note in the above two examples the number of directories between the *.runfiles folder and test is variable.
When running via 'bazel test', it automatically sets the cwd properly. But, I can't use that when trying to debug via C++ TestMate (or can I somehow?) I'd much rather use the VSCode IDE, so I'm hopign there is a way to do this.
I think (and I could be wrong here) a good solution would be to make the cwd in advance executables be the *.runfiles folder. However, I don't believe this is possible. Can I call a bash command to tweak the cwd string (assuming I make it the executable folder?).
For just straight running tests and discovery, I did do this logic in the execution wrapper and it just works. Unfortunately, I don't know how to do it for the debugging case.
Any thoughts/help would be appreciated! Thanks!
The text was updated successfully, but these errors were encountered: