Skip to content

Commit

Permalink
Merge pull request #1391 from asomers/update-deps
Browse files Browse the repository at this point in the history
Various maintenance stuff
  • Loading branch information
asomers authored Feb 21, 2021
2 parents d0bba22 + 0450429 commit 7e6096f
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 8 deletions.
4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down
2 changes: 1 addition & 1 deletion test/sys/test_sockopt.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
16 changes: 12 additions & 4 deletions test/sys/test_uio.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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());
}
Expand All @@ -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;
Expand Down Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion test/test_poll.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
}
}
Expand Down

0 comments on commit 7e6096f

Please sign in to comment.