diff --git a/tests/by-util/test_cat.rs b/tests/by-util/test_cat.rs index 67722daa2..4bb673b95 100644 --- a/tests/by-util/test_cat.rs +++ b/tests/by-util/test_cat.rs @@ -347,7 +347,13 @@ fn test_squeeze_blank_before_numbering() { #[cfg(unix)] fn test_dev_random() { let mut buf = [0; 2048]; - let mut proc = new_ucmd!().args(&["/dev/random"]).run_no_wait(); + #[cfg(target_os = "linux")] + const DEV_RANDOM: &str = "/dev/urandom"; + + #[cfg(not(target_os = "linux"))] + const DEV_RANDOM: &str = "/dev/random"; + + let mut proc = new_ucmd!().args(&[DEV_RANDOM]).run_no_wait(); let mut proc_stdout = proc.stdout.take().unwrap(); proc_stdout.read_exact(&mut buf).unwrap();