Skip to content

CARGO_LIB_CDYLIB_<name> #8193

@jeff-davis

Description

@jeff-davis

Describe the problem you are trying to solve

The integration test for my cdylib doesn't have a clean way to know where to find the library file itself. My cdylib is actually a PostgreSQL extension (essentially a plugin), so the only way to test it is by actually running PostgreSQL and loading the library. To do that, the integration test needs to know the location of the library file (e.g. ...../target/debug/libxyz.so).

Describe the solution you'd like

I want cargo to set a new environment variable, CARGO_LIB_CDYLIB_<name>, similar to CARGO_BIN_EXE_<name>, that would allow the integration test to find the library in a platform-independent way (and that works regardless of the profile used to build it).

I would like this variable always available, not just for test runs. The reason is that I also have a [[bin]] target that installs the library into PostgreSQL's lib directory (kind of like doing make install for a postgresql extension written in C), so that it can be easily installed.

Notes

Unit tests are not practical in my case, because the plugin accesses lots of Postgres APIs that require a running server.

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-environment-variablesArea: environment variablesC-feature-requestCategory: proposal for a feature. Before PR, ping rust-lang/cargo if this is not `Feature accepted`Command-testS-needs-team-inputStatus: Needs input from team on whether/how to proceed.

    Type

    No type

    Projects

    Status

    No status

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions