Very hard to test shared libraries #7152
Labels
C-feature-request
Category: proposal for a feature. Before PR, ping rust-lang/cargo if this is not `Feature accepted`
Command-test
S-needs-design
Status: Needs someone to work further on the design for the feature or fix. NOT YET accepted.
Describe the problem you are trying to solve
I am developing the crate https://github.com/jeff-davis/postgres-extension.rs, and I would like to have automated tests.
However, running
cargo test
always fails because it tries to load the shared library into the test executable. But the shared library is a plugin for another program, and it will never work as a part of the test executable, and it fails immediately because there are unresolved symbols. Plugins normally do have unresolved symbols that aren't resolved until it's loaded into the host program.Describe the solution you'd like
I'd like to have some support from
cargo test
that can build the shared library and then run the tests without actually trying to load the shared library into the test executable. The test executable is not the host program, so it can't actually run the plugin and it will fail anyway.I would also need cargo to pass the path to the built shared library to the tests so I can load it into the host program.
It would also be helpful to have setup/teardown test functions, but not strictly required.
Notes
The text was updated successfully, but these errors were encountered: