Skip to content

Commit 55986ae

Browse files
nan-muThomasdezeeuw
authored andcommitted
Add a test for busy_poll
1 parent ff34a69 commit 55986ae

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

tests/socket.rs

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1827,3 +1827,16 @@ fn set_priority() {
18271827
assert!(socket.priority().unwrap() == i);
18281828
}
18291829
}
1830+
1831+
#[cfg(all(feature = "all", target_os = "linux"))]
1832+
#[test]
1833+
fn set_busy_poll() {
1834+
let socket = Socket::new(Domain::UNIX, Type::DGRAM, None).unwrap();
1835+
assert!(socket.busy_poll().unwrap() == 0);
1836+
1837+
// test busy poll values 0 .. 6; values above 6 require additional priviledges
1838+
for i in (0..=6).rev() {
1839+
socket.set_busy_poll(i).unwrap();
1840+
assert!(socket.busy_poll().unwrap() == i);
1841+
}
1842+
}

0 commit comments

Comments
 (0)