Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .cirrus.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
freebsd_instance:
image: freebsd-13-2-release-amd64
image: freebsd-14-3-release-amd64-ufs

env:
RUST_BACKTRACE: full
Expand All @@ -9,6 +9,7 @@ task:
setup_script:
- fetch https://sh.rustup.rs -o rustup.sh
- sh rustup.sh -y --profile minimal
- kldload cc_newreno # For the tcp_congestion test
cargo_cache:
folder: $HOME/.cargo/registry
build_script:
Expand Down
28 changes: 17 additions & 11 deletions tests/socket.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1769,23 +1769,29 @@ fn tcp_congestion() {
"expected {origin_tcp_ca:?} but get {cur_tcp_ca:?}"
);
let cur_tcp_ca = cur_tcp_ca.splitn(2, |num| *num == 0).next().unwrap();
const OPTIONS: [&[u8]; 2] = [
b"cubic",
const OPTIONS: [&str; 2] = [
"cubic",
#[cfg(target_os = "linux")]
b"reno",
"reno",
#[cfg(target_os = "freebsd")]
b"newreno",
"newreno",
];
// Set a new tcp ca
#[cfg(target_os = "linux")]
let new_tcp_ca = if cur_tcp_ca == OPTIONS[0] {
OPTIONS[1]
let new_tcp_ca = if cur_tcp_ca == OPTIONS[0].as_bytes() {
OPTIONS[1].as_bytes()
} else {
OPTIONS[0]
OPTIONS[0].as_bytes()
};
#[cfg(target_os = "freebsd")]
let new_tcp_ca = OPTIONS[1];
socket.set_tcp_congestion(new_tcp_ca).unwrap();
if let Err(e) = socket.set_tcp_congestion(new_tcp_ca) {
if e.raw_os_error() == Some(libc::ESRCH) {
panic!(
"Could not set the {:?} CC protocol. Is the kernel module loaded?",
OPTIONS[1]
);
} else {
panic!("set_tcp_congestion: {e}");
}
}
// Check if new tcp ca is successfully set
let cur_tcp_ca = socket.tcp_congestion().unwrap();
assert_eq!(
Expand Down