Auto merge of #2420 - RalfJung:num_cpus, r=RalfJung

move num_cpus test from test-cargo-miri to crate test
This commit is contained in:
bors 2022-07-23 00:57:07 +00:00
commit b9aad98a3b
7 changed files with 14 additions and 30 deletions

View File

@ -48,15 +48,6 @@ dependencies = [
name = "exported_symbol_dep"
version = "0.1.0"
[[package]]
name = "hermit-abi"
version = "0.1.19"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "62b467343b94ba476dcb2500d242dadbb39557df889310ac77c5d99100aaac33"
dependencies = [
"libc",
]
[[package]]
name = "issue_1567"
version = "0.1.0"
@ -83,22 +74,6 @@ version = "0.1.0"
name = "issue_rust_86261"
version = "0.1.0"
[[package]]
name = "libc"
version = "0.2.126"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "349d5a591cd28b49e1d1037471617a32ddcda5731b99419008085f72d5a53836"
[[package]]
name = "num_cpus"
version = "1.13.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "19e64526ebdee182341572e50e9ad03965aa510cd94427a4549448f285e957a1"
dependencies = [
"hermit-abi",
"libc",
]
[[package]]
name = "proc-macro2"
version = "1.0.40"
@ -132,7 +107,7 @@ dependencies = [
name = "subcrate"
version = "0.1.0"
dependencies = [
"num_cpus",
"byteorder 1.4.3",
]
[[package]]

View File

@ -18,4 +18,4 @@ path = "test.rs"
harness = false
[dev-dependencies]
num_cpus = "1.10.1"
byteorder = "1.0"

View File

@ -1,5 +1,7 @@
use std::env;
use byteorder::{ByteOrder, LittleEndian};
fn main() {
println!("subcrate testing");
@ -11,6 +13,6 @@ fn main() {
let crate_dir = crate_dir.to_string_lossy().replace("\\", "/");
assert_eq!(env_dir, crate_dir);
// Make sure we can call `num_cpus`.
num_cpus::get();
// Make sure we can call dev-dependencies.
let _n = <LittleEndian as ByteOrder>::read_u32(&[1, 2, 3, 4]);
}

View File

@ -107,6 +107,7 @@ dependencies = [
"getrandom 0.1.16",
"getrandom 0.2.7",
"libc",
"num_cpus",
"page_size",
"rand",
"tokio",

View File

@ -12,6 +12,7 @@ edition = "2021"
tokio = { version = "1.0", features = ["full"] }
libc = "0.2"
page_size = "0.4.1"
num_cpus = "1.10.1"
getrandom_1 = { package = "getrandom", version = "0.1" }
getrandom_2 = { package = "getrandom", version = "0.2" }

View File

@ -0,0 +1,5 @@
//@compile-flags: -Zmiri-disable-isolation
fn main() {
assert_eq!(num_cpus::get(), 1);
}

View File

@ -1,6 +1,6 @@
use rand::{rngs::SmallRng, Rng, SeedableRng};
// mac-os `getrandom_1` does some pointer shenanigans
//@compile-flags: -Zmiri-permissive-provenance
use rand::{rngs::SmallRng, Rng, SeedableRng};
fn main() {
// Test `getrandom` directly (in multiple different versions).