From 7bab24720cbd3e9176f5dba00ba003c2861bb583 Mon Sep 17 00:00:00 2001 From: Joe Richey Date: Tue, 11 Jun 2024 17:38:06 -0700 Subject: [PATCH] Test RDRAND on x86/x86_64 Signed-off-by: Joe Richey --- src/lib.rs | 3 +++ src/rdrand.rs | 5 +++++ 2 files changed, 8 insertions(+) diff --git a/src/lib.rs b/src/lib.rs index e8b8d671..0c981869 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -411,3 +411,6 @@ pub fn getrandom_uninit(dest: &mut [MaybeUninit]) -> Result<&mut [u8], Error not(all(target_family = "wasm", target_os = "unknown", feature = "custom")) ))] pub(crate) mod tests; +// TODO: Remove this hack when rdrand is part of the public API +#[cfg(all(test, any(target_arch = "x86_64", target_arch = "x86")))] +mod rdrand; diff --git a/src/rdrand.rs b/src/rdrand.rs index f4c593bd..8cccccb6 100644 --- a/src/rdrand.rs +++ b/src/rdrand.rs @@ -121,3 +121,8 @@ unsafe fn rdrand_exact(dest: &mut [MaybeUninit]) -> Option<()> { } Some(()) } + +#[cfg(test)] +mod tests { + crate::tests::define_tests!(super::getrandom_inner); +}