[new feature] add a `Cargo test` debug configuration
See original GitHub issueWhile it’s somehow possible to work this around, there should be a simple option to run cargo test
in a debugging session.
The way I currently do it is:
- run
cargo test
in a shell - take note of the (random) executable name generated by
cargo
in thetarget
directory - create a new
debug
profile using the executable above rather than the default executable name
This is error prone as you have to remember to change the debug profile when the test executable name changes (otherwise gdb will load a binary which is out of sync with the source code)
The way it should be is:
- create a new
cargo test
profile - choose the project in the created profile
- profit!
This may actually require changes in Cargo to set/get the temp il
Issue Analytics
- State:
- Created 5 years ago
- Reactions:2
- Comments:42 (35 by maintainers)
Top Results From Across the Web
cargo test - The Cargo Book
Compile and execute unit, integration, and documentation tests. The test filtering argument TESTNAME and all the arguments following the two dashes ( --...
Read more >Run a Cargo command - Rust - JetBrains Marketplace
Go to Run | Edit Configurations. · To create a new configuration, click · After saving the configuration, select it in the configuration...
Read more >Testing - The Rust Programming Language
At its simplest, a test in Rust is a function that's annotated with the test attribute. Let's make a new project with Cargo...
Read more >Can tests be built in release mode using Cargo?
cargo test --release exists, but it is slightly different than just enabling optimizations. For example, debug assertions become disabled.
Read more >Testing & Debugging Rust Code - Firefox Source Docs - Mozilla
If a Mozilla crate has “normal” Rust tests (i.e. #[test] functions that run with cargo test ), you can add the crate's name...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Solution 1) works (needs some Json parsing)
@mickaelistria good find. I think there is a solution for us which requires no changes in Cargo.
@gbutler69 if we want to attempt to implement a profile, think there is a solution there: In the link to https://github.com/rust-lang/cargo/issues/1924 @mickaelistria provided:
We can run this as the preliminary build step, parse the output (this is the bit we need implementation for), somehow filter the list to match the correct executable and then feed the result to
gdb
in the usual way.Nevertheless, I will give hacking
cargo-test
a go just to see how hard it is.