I would like to compile a binary which runs a certain subset of tests. When I run the following, it works:
ubuntu@ubuntu-xenial:/ox$ cargo test hash::vec
Finished dev [unoptimized + debuginfo] target(s) in 0.11 secs
Running target/debug/deps/ox-824a031ff1732165
running 9 tests
test hash::vec::test_hash_entry::test_get_offset_tombstone ... ok
test hash::vec::test_hash_entry::test_get_offset_value ... ok
test hash::vec::test_hash_table::test_delete ... ok
test hash::vec::test_hash_table::test_delete_and_set ... ok
test hash::vec::test_hash_table::test_get_from_hash ... ok
test hash::vec::test_hash_table::test_get_non_existant_from_hash ... ok
test hash::vec::test_hash_table::test_override ... ok
test hash::vec::test_hash_table::test_grow_hash ... ok
test hash::vec::test_hash_table::test_set_after_filled_with_tombstones ... ok
test result: ok. 9 passed; 0 failed; 0 ignored; 0 measured; 8 filtered out
However, when I try to run target/debug/deps/ox-824a031ff1732165
, it runs all my tests, not just the 9 specified in hash::vec.
I've tried to run cargo rustc --test hash::vec
but I get error: no test target named
hash::vec.
cargo rustc -- --testworks, but creates a binary that runs all tests. If I try
cargo rustc -- --test hash::vec`, I get:
Compiling ox v0.1.0 (file:///ox)
error: multiple input filenames provided
error: Could not compile `ox`.
cargo rustc -h
says that you can pass NAME with the --test
flag (--test NAME Build only the specified test target
). So, I'm wondering what "NAME" is and how to pass it in so I get a binary that only runs the specified 9 tests in hash::vec. Any help would be appreciated!
Aucun commentaire:
Enregistrer un commentaire