From 5813ce03073a237c3067c9e17bc49d50402b1a71 Mon Sep 17 00:00:00 2001 From: Wei Liu Date: Tue, 16 Nov 2021 11:38:28 +0000 Subject: [PATCH] arch: x86_64: drop test_apic_delivery_mode This test generates an array of random numbers and then applies the same trivial algorithm twice -- once in set_apic_delivery_mode and another time in an anonymous function. Its usefulness is limited. Drop it to remove one unsafe in code. Signed-off-by: Wei Liu --- arch/src/x86_64/interrupts.rs | 18 ------------------ 1 file changed, 18 deletions(-) diff --git a/arch/src/x86_64/interrupts.rs b/arch/src/x86_64/interrupts.rs index 7664693ef..0ada843d0 100644 --- a/arch/src/x86_64/interrupts.rs +++ b/arch/src/x86_64/interrupts.rs @@ -95,22 +95,4 @@ mod tests { let mut klapic = LapicState::default(); set_klapic_reg(&mut klapic, reg_offset, 3); } - - #[test] - fn test_apic_delivery_mode() { - let mut v: Vec = Vec::new(); - v.resize(20, 0); - - unsafe { - assert_eq!( - libc::getrandom(v.as_mut_ptr() as *mut _ as *mut libc::c_void, 80, 0), - 80 - ); - } - - v.iter_mut() - .for_each(|x| *x = set_apic_delivery_mode(*x, 2)); - let after: Vec = v.iter().map(|x| ((*x & !0x700) | ((2) << 8))).collect(); - assert_eq!(v, after); - } }