How to build integration test as cdylib?

I have a library, which compiles to cdylib (lib_mylib.so) and being loaded by the app as plugin.
I want to test the library functions by the additional test cdylib (lib_test_mylib.so). But only approach I come to β€” is making a workspace with separate crate of test_mylib, that has integration test, that runs the app.

Is there a way to build lib_test_mylib.so as integration test step?


My crate structure:

lib.rs should build (*.so)
and run_test.rs should install *.so to app and run the app.

Currntly run_test.rs fails, as it can not find *.so of integration test.

1 Like

Well, it seems, like you still need a separate crate to do so.
I've finished with a following test organization:

workspace_directory
β”œβ”€β”€ Cargo.toml
β”œβ”€β”€ README.md
β”œβ€”β€” my_lib
β”œ   β”œβ€”β€” src
β”‚      └── lib.rs
└── test
    β”œβ”€β”€ Cargo.toml
    β”œβ”€β”€ src
    β”‚   └── lib.rs
    └── tests
        └── integration_test.rs

here the test crate: GitHub - Levitanus/reaper-test: Makes testing reaper extension easy

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.