Skip to content

Commit 4000502

Browse files
committed
arch: remove external rand dep
Instead of using "extern crate rand" for generating some u32's, use the self provided "xor_rng_u32" from "fc_util::rand". Signed-off-by: Diana Popa <[email protected]>
1 parent eee9840 commit 4000502

File tree

3 files changed

+5
-7
lines changed

3 files changed

+5
-7
lines changed

Cargo.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

arch/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,5 +13,5 @@ arch_gen = { path = "../arch_gen" }
1313
memory_model = { path = "../memory_model" }
1414

1515
[dev-dependencies]
16-
rand = ">=0.5.5"
16+
fc_util = { path = "../fc_util" }
1717
device_tree = ">=1.1.0"

arch/src/x86_64/interrupts.rs

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -84,9 +84,8 @@ pub fn set_lint(vcpu: &VcpuFd) -> Result<()> {
8484

8585
#[cfg(test)]
8686
mod tests {
87-
extern crate rand;
88-
use self::rand::Rng;
89-
87+
extern crate fc_util;
88+
use self::fc_util::rand::xor_rng_u32;
9089
use super::*;
9190
use kvm_ioctls::Kvm;
9291

@@ -111,8 +110,7 @@ mod tests {
111110

112111
#[test]
113112
fn test_apic_delivery_mode() {
114-
let mut rng = rand::thread_rng();
115-
let mut v: Vec<u32> = (0..20).map(|_| rng.gen::<u32>()).collect();
113+
let mut v: Vec<u32> = (0..20).map(|_| xor_rng_u32()).collect();
116114

117115
v.iter_mut()
118116
.for_each(|x| *x = set_apic_delivery_mode(*x, 2));

0 commit comments

Comments
 (0)