]> git.lizzy.rs Git - rust.git/blobdiff - src/tools/miri/tests/pass-dep/page_size.rs
Rollup merge of #106148 - chenyukang:yukang/fix-105061-unused, r=lcnr
[rust.git] / src / tools / miri / tests / pass-dep / page_size.rs
index cdcabf3333814cc2939e94d4d07704c7bf7659bb..fb060317538d38d266905c976c9309ff3c6ac8c4 100644 (file)
@@ -3,4 +3,17 @@ fn main() {
 
     // 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);
+    // Most architectures have 4k pages by default
+    #[cfg(not(any(
+        target_arch = "wasm32",
+        target_arch = "wasm64",
+        all(target_arch = "aarch64", target_vendor = "apple")
+    )))]
+    assert!(page_size == 4 * 1024, "non-4k default page size: {}", page_size);
+    // ... except aarch64-apple with 16k
+    #[cfg(all(target_arch = "aarch64", target_vendor = "apple"))]
+    assert!(page_size == 16 * 1024, "aarch64 apple reports non-16k page size: {}", page_size);
+    // ... and wasm with 64k
+    #[cfg(any(target_arch = "wasm32", target_arch = "wasm64"))]
+    assert!(page_size == 64 * 1024, "wasm reports non-64k page size: {}", page_size);
 }