Skip to content
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

Very hard to test shared libraries #7152

Open
jeff-davis opened this issue Jul 19, 2019 · 0 comments
Open

Very hard to test shared libraries #7152

jeff-davis opened this issue Jul 19, 2019 · 0 comments
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.

Comments

@jeff-davis
Copy link

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

@jeff-davis jeff-davis added the C-feature-request Category: proposal for a feature. Before PR, ping rust-lang/cargo if this is not `Feature accepted` label Jul 19, 2019
@epage epage added the S-needs-design Status: Needs someone to work further on the design for the feature or fix. NOT YET accepted. label Nov 1, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
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.
Projects
Status: No status
Development

No branches or pull requests

3 participants