With make
:
make test
With cargo
:
cargo build -p tarantool-module-test-runner
cargo test
When running cargo test
some of the steps would be as you would expect:
- Unit tests and integration tests defined with
#[test]
macro - Doc tests - code in documentation
But also it would execute our custom test runner which main fn is defined in tests/run.rs
.
Then the steps would be the following:
- Test runner starts
tarantool
withrun_tests.lua
script as an argument run_tests.lua
script does some initialization and loadstarantool-module-test-runner
built as a dynamic library- Then
run_tests.lua
calls the main function of this module, which effectively isstart
intests/src/lib.rs
start
creates test spaces and callsrun_tests
run_tests
collects tests defined withlinkme::distributed_slice
macro fromtarantool
librun_tests
collects tests that are explicitely added there by full pathrun_tests
feeds all tests to Rust default console test runner and collects result- result is reported through all the chain to the top and the process exits with appropriate exit code
All this is done as integration tests expect to be run from inside a tarantool
instance.
Just add a test with #[test]
macro.
You shouldn't use any tarantool
symbols or symbols dependent on them in this case.
Use linkme::distributed_slice
macro to add tests. See tarantool::test
module docs for examples.
Insert the test directly by path into run_tests
fn in tests/src/lib.rs