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

cargo test panics on crates with dependency on redis_module #89

Open
matobet opened this issue Jun 22, 2020 · 1 comment
Open

cargo test panics on crates with dependency on redis_module #89

matobet opened this issue Jun 22, 2020 · 1 comment

Comments

@matobet
Copy link
Contributor

matobet commented Jun 22, 2020

It appears that just the presence of #[macro_use] extern crate redis_module causes the resulting binary produced by cargo test to panic. I had the intention to write some integration tests for my Redis module in Rust and have them run by cargo test but this essentially prevents any testing whatsoever.

Steps to reproduce

Create a new library project

$ cargo new --lib mod_test

Tests pass

$ cd mod_test
$ cargo test
...

running 1 test
test tests::it_works ... ok

test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out

   Doc-tests mod_test

running 0 tests

test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out

Add dependency on redis_module and crate import to src/lib.rs.

$ cat Cargo.toml
[package]
name = "mod_test"
version = "0.1.0"
authors = ["Martin Betak <matobet@gmail.com>"]
edition = "2018"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
redis-module = "0.9"
$ cat src/lib.rs
#[macro_use] extern crate redis_module;

#[cfg(test)]
mod tests {
    #[test]
    fn it_works() {
        assert_eq!(2 + 2, 4);
    }
}

Tests panic

    Finished test [unoptimized + debuginfo] target(s) in 0.13s
     Running target/debug/deps/mod_test-278b37354b464b59
thread panicked while processing panic. aborting.
error: test failed, to rerun pass '--lib'

Caused by:
  process didn't exit successfully: `/home/matobet/projects/rust/mod_test/target/debug/deps/mod_test-278b37354b464b59` (signal: 4, SIGILL: illegal instruction)
@matobet
Copy link
Contributor Author

matobet commented Jun 22, 2020

Ok, it turns out that this is related to #62 and adding

[dev-dependencies]
redis_module = { version = "0.9", features = ["test"] }

Fixed the problem.

I guess this could be a bit better documented. Leaving the issue open for now, at least to improve documentation in this matter.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant