diff options
-rw-r--r-- | Cargo.toml | 4 | ||||
-rw-r--r-- | test/sys/test_sockopt.rs | 2 | ||||
-rw-r--r-- | test/sys/test_uio.rs | 16 | ||||
-rw-r--r-- | test/test_poll.rs | 2 |
4 files changed, 16 insertions, 8 deletions
@@ -41,8 +41,8 @@ cc = "1" [dev-dependencies] bytes = "0.4.8" lazy_static = "1.2" -rand = "0.6" -tempfile = "3.0.5" +rand = "0.8" +tempfile = "3.2.0" semver = "0.9.0" [target.'cfg(any(target_os = "android", target_os = "linux"))'.dev-dependencies] diff --git a/test/sys/test_sockopt.rs b/test/sys/test_sockopt.rs index 56065931..d151cf55 100644 --- a/test/sys/test_sockopt.rs +++ b/test/sys/test_sockopt.rs @@ -20,7 +20,7 @@ fn is_so_mark_functional() { fn test_so_buf() { let fd = socket(AddressFamily::Inet, SockType::Datagram, SockFlag::empty(), SockProtocol::Udp) .unwrap(); - let bufsize: usize = thread_rng().gen_range(4096, 131_072); + let bufsize: usize = thread_rng().gen_range(4096..131_072); setsockopt(fd, sockopt::SndBuf, &bufsize).unwrap(); let actual = getsockopt(fd, sockopt::SndBuf).unwrap(); assert!(actual >= bufsize); diff --git a/test/sys/test_uio.rs b/test/sys/test_uio.rs index 8d22bf17..aede530a 100644 --- a/test/sys/test_uio.rs +++ b/test/sys/test_uio.rs @@ -14,7 +14,11 @@ use tempfile::tempdir; fn test_writev() { let mut to_write = Vec::with_capacity(16 * 128); for _ in 0..16 { - let s: String = thread_rng().sample_iter(&Alphanumeric).take(128).collect(); + let s: String = thread_rng() + .sample_iter(&Alphanumeric) + .map(char::from) + .take(128) + .collect(); let b = s.as_bytes(); to_write.extend(b.iter().cloned()); } @@ -23,7 +27,7 @@ fn test_writev() { let mut consumed = 0; while consumed < to_write.len() { let left = to_write.len() - consumed; - let slice_len = if left <= 64 { left } else { thread_rng().gen_range(64, cmp::min(256, left)) }; + let slice_len = if left <= 64 { left } else { thread_rng().gen_range(64..cmp::min(256, left)) }; let b = &to_write[consumed..consumed+slice_len]; iovecs.push(IoVec::from_slice(b)); consumed += slice_len; @@ -57,13 +61,17 @@ fn test_writev() { #[test] #[cfg(not(target_os = "redox"))] fn test_readv() { - let s:String = thread_rng().sample_iter(&Alphanumeric).take(128).collect(); + let s:String = thread_rng() + .sample_iter(&Alphanumeric) + .map(char::from) + .take(128) + .collect(); let to_write = s.as_bytes().to_vec(); let mut storage = Vec::new(); let mut allocated = 0; while allocated < to_write.len() { let left = to_write.len() - allocated; - let vec_len = if left <= 64 { left } else { thread_rng().gen_range(64, cmp::min(256, left)) }; + let vec_len = if left <= 64 { left } else { thread_rng().gen_range(64..cmp::min(256, left)) }; let v: Vec<u8> = iter::repeat(0u8).take(vec_len).collect(); storage.push(v); allocated += vec_len; diff --git a/test/test_poll.rs b/test/test_poll.rs index a5e2d254..acfaad8b 100644 --- a/test/test_poll.rs +++ b/test/test_poll.rs @@ -11,7 +11,7 @@ macro_rules! loop_while_eintr { match $poll_expr { Ok(nfds) => break nfds, Err(Error::Sys(Errno::EINTR)) => (), - Err(e) => panic!(e) + Err(e) => panic!("{}", e) } } } |