test page_size via test dependency support

and move crate tests to their own folders
This commit is contained in:
Ralf Jung 2022-07-21 08:14:41 -04:00
parent 8fa1542878
commit b1b368c30e
6 changed files with 18 additions and 0 deletions

View File

@ -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"

View File

@ -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" }

View 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);
}