Auto merge of #2408 - RalfJung:deps, r=oli-obk
make test-cargo-miri only about cargo Move the things that actually test dependency behavior into the regular test suite, now that we can do that. :)
This commit is contained in:
commit
46d309f424
108
test-cargo-miri/Cargo.lock
generated
108
test-cargo-miri/Cargo.lock
generated
@ -2,6 +2,12 @@
|
|||||||
# It is not intended for manual editing.
|
# It is not intended for manual editing.
|
||||||
version = 3
|
version = 3
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "byteorder"
|
||||||
|
version = "0.5.3"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "0fc10e8cc6b2580fda3f36eb6dc5316657f812a3df879a44a66fc9f0fdbc4855"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "byteorder"
|
name = "byteorder"
|
||||||
version = "1.4.3"
|
version = "1.4.3"
|
||||||
@ -12,7 +18,8 @@ checksum = "14c189c53d098945499cdfa7ecc63567cf3886b3332b312a5b4585d8d3a6a610"
|
|||||||
name = "cargo-miri-test"
|
name = "cargo-miri-test"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"byteorder",
|
"byteorder 0.5.3",
|
||||||
|
"byteorder 1.4.3",
|
||||||
"cdylib",
|
"cdylib",
|
||||||
"exported_symbol",
|
"exported_symbol",
|
||||||
"issue_1567",
|
"issue_1567",
|
||||||
@ -20,8 +27,6 @@ dependencies = [
|
|||||||
"issue_1705",
|
"issue_1705",
|
||||||
"issue_1760",
|
"issue_1760",
|
||||||
"issue_rust_86261",
|
"issue_rust_86261",
|
||||||
"page_size",
|
|
||||||
"rand",
|
|
||||||
"serde_derive",
|
"serde_derive",
|
||||||
]
|
]
|
||||||
|
|
||||||
@ -29,15 +34,9 @@ dependencies = [
|
|||||||
name = "cdylib"
|
name = "cdylib"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"byteorder",
|
"byteorder 1.4.3",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "cfg-if"
|
|
||||||
version = "1.0.0"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd"
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "exported_symbol"
|
name = "exported_symbol"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
@ -49,17 +48,6 @@ dependencies = [
|
|||||||
name = "exported_symbol_dep"
|
name = "exported_symbol_dep"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "getrandom"
|
|
||||||
version = "0.2.7"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "4eb1a864a501629691edf6c15a593b7a51eebaa1e8468e9ddc623de7c9b58ec6"
|
|
||||||
dependencies = [
|
|
||||||
"cfg-if",
|
|
||||||
"libc",
|
|
||||||
"wasi",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "hermit-abi"
|
name = "hermit-abi"
|
||||||
version = "0.1.19"
|
version = "0.1.19"
|
||||||
@ -73,7 +61,7 @@ dependencies = [
|
|||||||
name = "issue_1567"
|
name = "issue_1567"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"byteorder",
|
"byteorder 1.4.3",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@ -84,7 +72,7 @@ version = "0.1.0"
|
|||||||
name = "issue_1705"
|
name = "issue_1705"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"byteorder",
|
"byteorder 1.4.3",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@ -111,22 +99,6 @@ dependencies = [
|
|||||||
"libc",
|
"libc",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "page_size"
|
|
||||||
version = "0.4.2"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "eebde548fbbf1ea81a99b128872779c437752fb99f217c45245e1a61dcd9edcd"
|
|
||||||
dependencies = [
|
|
||||||
"libc",
|
|
||||||
"winapi",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "ppv-lite86"
|
|
||||||
version = "0.2.16"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "eb9f9e6e233e5c4a35559a617bf40a4ec447db2e84c20b55a6f83167b7e57872"
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "proc-macro2"
|
name = "proc-macro2"
|
||||||
version = "1.0.40"
|
version = "1.0.40"
|
||||||
@ -145,36 +117,6 @@ dependencies = [
|
|||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "rand"
|
|
||||||
version = "0.8.5"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "34af8d1a0e25924bc5b7c43c079c942339d8f0a8b57c39049bef581b46327404"
|
|
||||||
dependencies = [
|
|
||||||
"libc",
|
|
||||||
"rand_chacha",
|
|
||||||
"rand_core",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "rand_chacha"
|
|
||||||
version = "0.3.1"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "e6c10a63a0fa32252be49d21e7709d4d4baf8d231c2dbce1eaa8141b9b127d88"
|
|
||||||
dependencies = [
|
|
||||||
"ppv-lite86",
|
|
||||||
"rand_core",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "rand_core"
|
|
||||||
version = "0.6.3"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "d34f1408f55294453790c48b2f1ebbb1c5b4b7563eb1f418bcfcfdbb06ebb4e7"
|
|
||||||
dependencies = [
|
|
||||||
"getrandom",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "serde_derive"
|
name = "serde_derive"
|
||||||
version = "1.0.137"
|
version = "1.0.137"
|
||||||
@ -209,31 +151,3 @@ name = "unicode-ident"
|
|||||||
version = "1.0.1"
|
version = "1.0.1"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "5bd2fe26506023ed7b5e1e315add59d6f584c621d037f9368fea9cfb988f368c"
|
checksum = "5bd2fe26506023ed7b5e1e315add59d6f584c621d037f9368fea9cfb988f368c"
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "wasi"
|
|
||||||
version = "0.11.0+wasi-snapshot-preview1"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423"
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "winapi"
|
|
||||||
version = "0.3.9"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419"
|
|
||||||
dependencies = [
|
|
||||||
"winapi-i686-pc-windows-gnu",
|
|
||||||
"winapi-x86_64-pc-windows-gnu",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "winapi-i686-pc-windows-gnu"
|
|
||||||
version = "0.4.0"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6"
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "winapi-x86_64-pc-windows-gnu"
|
|
||||||
version = "0.4.0"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f"
|
|
||||||
|
@ -18,9 +18,8 @@ issue_1760 = { path = "issue-1760" }
|
|||||||
issue_rust_86261 = { path = "issue-rust-86261" }
|
issue_rust_86261 = { path = "issue-rust-86261" }
|
||||||
|
|
||||||
[dev-dependencies]
|
[dev-dependencies]
|
||||||
rand = { version = "0.8", features = ["small_rng"] }
|
byteorder_2 = { package = "byteorder", version = "0.5" } # to test dev-dependencies behave as expected, with renaming
|
||||||
serde_derive = "1.0" # not actually used, but exercises some unique code path (`--extern` .so file)
|
serde_derive = "1.0" # not actually used, but exercises some unique code path (`--extern` .so file)
|
||||||
page_size = "0.4.1"
|
|
||||||
|
|
||||||
[lib]
|
[lib]
|
||||||
test = false # test that this is respected (will show in the output)
|
test = false # test that this is respected (will show in the output)
|
||||||
|
@ -9,4 +9,4 @@ edition = "2018"
|
|||||||
crate-type = ["cdylib"]
|
crate-type = ["cdylib"]
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
byteorder = "1.0"
|
byteorder = "1.0" # to test dependencies of sub-crates
|
||||||
|
@ -134,7 +134,7 @@ def test_cargo_miri_test():
|
|||||||
env={'MIRIFLAGS': "-Zmiri-permissive-provenance -Zmiri-disable-isolation"},
|
env={'MIRIFLAGS': "-Zmiri-permissive-provenance -Zmiri-disable-isolation"},
|
||||||
)
|
)
|
||||||
test("`cargo miri test` (with filter)",
|
test("`cargo miri test` (with filter)",
|
||||||
cargo_miri("test") + ["--", "--format=pretty", "le1"],
|
cargo_miri("test") + ["--", "--format=pretty", "pl"],
|
||||||
filter_ref, "test.stderr-empty.ref",
|
filter_ref, "test.stderr-empty.ref",
|
||||||
)
|
)
|
||||||
test("`cargo miri test` (test target)",
|
test("`cargo miri test` (test target)",
|
||||||
|
@ -45,17 +45,12 @@ fn main() {
|
|||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod test {
|
mod test {
|
||||||
use rand::{Rng, SeedableRng};
|
use byteorder_2::{BigEndian, ByteOrder};
|
||||||
|
|
||||||
// Make sure in-crate tests with dev-dependencies work
|
// Make sure in-crate tests with dev-dependencies work
|
||||||
#[test]
|
#[test]
|
||||||
fn rng() {
|
fn dev_dependency() {
|
||||||
let mut rng = rand::rngs::StdRng::seed_from_u64(0xcafebeef);
|
let _n = <BigEndian as ByteOrder>::read_u64(&[1, 2, 3, 4, 5, 6, 7, 8]);
|
||||||
let x: u32 = rng.gen();
|
|
||||||
let y: usize = rng.gen();
|
|
||||||
let z: u128 = rng.gen();
|
|
||||||
assert_ne!(x as usize, y);
|
|
||||||
assert_ne!(y as u128, z);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
|
|
||||||
running 2 tests
|
running 2 tests
|
||||||
|
test test::dev_dependency ... ok
|
||||||
test test::exported_symbol ... ok
|
test test::exported_symbol ... ok
|
||||||
test test::rng ... ok
|
|
||||||
|
|
||||||
test result: ok. 2 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out
|
test result: ok. 2 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out
|
||||||
|
|
||||||
|
@ -5,7 +5,7 @@ test result: ok. 2 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out
|
|||||||
|
|
||||||
imported main
|
imported main
|
||||||
|
|
||||||
running 8 tests
|
running 6 tests
|
||||||
..i.....
|
...i..
|
||||||
test result: ok. 7 passed; 0 failed; 1 ignored; 0 measured; 0 filtered out
|
test result: ok. 5 passed; 0 failed; 1 ignored; 0 measured; 0 filtered out
|
||||||
|
|
||||||
|
@ -5,9 +5,9 @@ test result: ok. 2 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out
|
|||||||
|
|
||||||
imported main
|
imported main
|
||||||
|
|
||||||
running 8 tests
|
running 6 tests
|
||||||
..i.....
|
...i..
|
||||||
test result: ok. 7 passed; 0 failed; 1 ignored; 0 measured; 0 filtered out
|
test result: ok. 5 passed; 0 failed; 1 ignored; 0 measured; 0 filtered out
|
||||||
|
|
||||||
|
|
||||||
running 4 tests
|
running 4 tests
|
||||||
|
@ -6,7 +6,7 @@ test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 2 filtered out
|
|||||||
imported main
|
imported main
|
||||||
|
|
||||||
running 1 test
|
running 1 test
|
||||||
test simple1 ... ok
|
test simple ... ok
|
||||||
|
|
||||||
test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 7 filtered out
|
test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 5 filtered out
|
||||||
|
|
||||||
|
@ -6,9 +6,9 @@ test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 2 filtered out
|
|||||||
imported main
|
imported main
|
||||||
|
|
||||||
running 1 test
|
running 1 test
|
||||||
test simple1 ... ok
|
test simple ... ok
|
||||||
|
|
||||||
test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 7 filtered out
|
test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 5 filtered out
|
||||||
|
|
||||||
|
|
||||||
running 0 tests
|
running 0 tests
|
||||||
|
@ -1,13 +1,11 @@
|
|||||||
|
|
||||||
running 8 tests
|
running 6 tests
|
||||||
test cargo_env ... ok
|
test cargo_env ... ok
|
||||||
|
test deps ... ok
|
||||||
test do_panic - should panic ... ok
|
test do_panic - should panic ... ok
|
||||||
test does_not_work_on_miri ... ignored
|
test does_not_work_on_miri ... ignored
|
||||||
test entropy_rng ... ok
|
|
||||||
test fail_index_check - should panic ... ok
|
test fail_index_check - should panic ... ok
|
||||||
test page_size ... ok
|
test simple ... ok
|
||||||
test simple1 ... ok
|
|
||||||
test simple2 ... ok
|
|
||||||
|
|
||||||
test result: ok. 7 passed; 0 failed; 1 ignored; 0 measured; 0 filtered out
|
test result: ok. 5 passed; 0 failed; 1 ignored; 0 measured; 0 filtered out
|
||||||
|
|
||||||
|
@ -1,39 +1,30 @@
|
|||||||
use rand::{rngs::SmallRng, Rng, SeedableRng};
|
|
||||||
|
|
||||||
// Having more than 1 test does seem to make a difference
|
|
||||||
// (i.e., this calls ptr::swap which having just one test does not).
|
|
||||||
#[test]
|
#[test]
|
||||||
fn simple1() {
|
fn simple() {
|
||||||
assert_eq!(4, 4);
|
assert_eq!(4, 4);
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
|
||||||
fn simple2() {
|
|
||||||
assert_ne!(42, 24);
|
|
||||||
}
|
|
||||||
|
|
||||||
// A test that won't work on miri (tests disabling tests).
|
// A test that won't work on miri (tests disabling tests).
|
||||||
#[test]
|
#[test]
|
||||||
#[cfg_attr(miri, ignore)]
|
#[cfg_attr(miri, ignore)]
|
||||||
fn does_not_work_on_miri() {
|
fn does_not_work_on_miri() {
|
||||||
let x = 0u8;
|
// Only do this where inline assembly is stable.
|
||||||
assert!(&x as *const _ as usize % 4 < 4);
|
#[cfg(any(target_arch = "x86", target_arch = "x86_64"))]
|
||||||
|
unsafe {
|
||||||
|
std::arch::asm!("foo");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Make sure integration tests can access dev-dependencies
|
// Make sure integration tests can access both dependencies and dev-dependencies
|
||||||
#[test]
|
#[test]
|
||||||
fn entropy_rng() {
|
fn deps() {
|
||||||
// Try seeding with "real" entropy.
|
{
|
||||||
let mut rng = SmallRng::from_entropy();
|
use byteorder::{BigEndian, ByteOrder};
|
||||||
let _val = rng.gen::<i32>();
|
let _n = <BigEndian as ByteOrder>::read_u64(&[1, 2, 3, 4, 5, 6, 7, 8]);
|
||||||
let _val = rng.gen::<isize>();
|
}
|
||||||
let _val = rng.gen::<i128>();
|
{
|
||||||
|
use byteorder_2::{BigEndian, ByteOrder};
|
||||||
// Also try per-thread RNG.
|
let _n = <BigEndian as ByteOrder>::read_u64(&[1, 2, 3, 4, 5, 6, 7, 8]);
|
||||||
let mut rng = rand::thread_rng();
|
}
|
||||||
let _val = rng.gen::<i32>();
|
|
||||||
let _val = rng.gen::<isize>();
|
|
||||||
let _val = rng.gen::<i128>();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
@ -49,17 +40,10 @@ fn do_panic() // In large, friendly letters :)
|
|||||||
panic!("Explicit panic from test!");
|
panic!("Explicit panic from test!");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// A different way of raising a panic
|
||||||
#[test]
|
#[test]
|
||||||
#[allow(unconditional_panic)]
|
#[allow(unconditional_panic)]
|
||||||
#[should_panic(expected = "the len is 0 but the index is 42")]
|
#[should_panic(expected = "the len is 0 but the index is 42")]
|
||||||
fn fail_index_check() {
|
fn fail_index_check() {
|
||||||
[][42]
|
[][42]
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
|
||||||
fn page_size() {
|
|
||||||
let page_size = page_size::get();
|
|
||||||
|
|
||||||
// In particular, this checks that it is not 0.
|
|
||||||
assert!(page_size.is_power_of_two(), "page size not a power of two: {}", page_size);
|
|
||||||
}
|
|
||||||
|
11
test_dependencies/Cargo.lock
generated
11
test_dependencies/Cargo.lock
generated
@ -107,6 +107,7 @@ dependencies = [
|
|||||||
"getrandom 0.1.16",
|
"getrandom 0.1.16",
|
||||||
"getrandom 0.2.7",
|
"getrandom 0.2.7",
|
||||||
"libc",
|
"libc",
|
||||||
|
"page_size",
|
||||||
"rand",
|
"rand",
|
||||||
"tokio",
|
"tokio",
|
||||||
]
|
]
|
||||||
@ -127,6 +128,16 @@ version = "1.13.0"
|
|||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "18a6dbe30758c9f83eb00cbea4ac95966305f5a7772f3f42ebfc7fc7eddbd8e1"
|
checksum = "18a6dbe30758c9f83eb00cbea4ac95966305f5a7772f3f42ebfc7fc7eddbd8e1"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "page_size"
|
||||||
|
version = "0.4.2"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "eebde548fbbf1ea81a99b128872779c437752fb99f217c45245e1a61dcd9edcd"
|
||||||
|
dependencies = [
|
||||||
|
"libc",
|
||||||
|
"winapi",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "parking_lot"
|
name = "parking_lot"
|
||||||
version = "0.12.1"
|
version = "0.12.1"
|
||||||
|
@ -11,6 +11,7 @@ edition = "2021"
|
|||||||
# all dependencies (and their transitive ones) listed here can be used in `tests/`.
|
# all dependencies (and their transitive ones) listed here can be used in `tests/`.
|
||||||
tokio = { version = "1.0", features = ["full"] }
|
tokio = { version = "1.0", features = ["full"] }
|
||||||
libc = "0.2"
|
libc = "0.2"
|
||||||
|
page_size = "0.4.1"
|
||||||
|
|
||||||
getrandom_1 = { package = "getrandom", version = "0.1" }
|
getrandom_1 = { package = "getrandom", version = "0.1" }
|
||||||
getrandom_2 = { package = "getrandom", version = "0.2" }
|
getrandom_2 = { package = "getrandom", version = "0.2" }
|
||||||
|
6
tests/pass/crates/page_size.rs
Normal file
6
tests/pass/crates/page_size.rs
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
fn main() {
|
||||||
|
let page_size = page_size::get();
|
||||||
|
|
||||||
|
// In particular, this checks that it is not 0.
|
||||||
|
assert!(page_size.is_power_of_two(), "page size not a power of two: {}", page_size);
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user