Very hard to test shared libraries
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 15.5k
- Forks
- 3k
- Avg merge
- 23h 30m
- Merged PRs (30d)
- 51
Description
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
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the cargo test entry point and the shared-library/plugin scenario described in the issue. Define how the library is built without being loaded into the test executable and how tests receive its path; done should support automated tests for plugins with unresolved host-provided symbols.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- build-system, testing
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100