Skip to content

Commit

Permalink
Ensure all tests use unique IP ports (#2196)
Browse files Browse the repository at this point in the history
  • Loading branch information
asomers authored Dec 3, 2023
1 parent db5353c commit cb56e89
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion src/sys/socket/addr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2272,7 +2272,7 @@ mod tests {

#[test]
fn ip() {
let s = "127.0.0.1:8080";
let s = "127.0.0.1:8082";
let ip = SockaddrIn::from_str(s).unwrap().ip();
assert_eq!("127.0.0.1", format!("{ip}"));
}
Expand Down
8 changes: 4 additions & 4 deletions test/sys/test_socket.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ pub fn test_timestamping() {
};
use std::io::{IoSlice, IoSliceMut};

let sock_addr = SockaddrIn::from_str("127.0.0.1:6790").unwrap();
let sock_addr = SockaddrIn::from_str("127.0.0.1:6797").unwrap();

let ssock = socket(
AddressFamily::Inet,
Expand Down Expand Up @@ -434,7 +434,7 @@ mod recvfrom {

#[test]
pub fn udp() {
let std_sa = SocketAddrV4::from_str("127.0.0.1:6789").unwrap();
let std_sa = SocketAddrV4::from_str("127.0.0.1:6795").unwrap();
let sock_addr = SockaddrIn::from(std_sa);
let rsock = socket(
AddressFamily::Inet,
Expand Down Expand Up @@ -793,10 +793,10 @@ mod recvfrom {
#[test]
pub fn udp_inet6() {
let addr = std::net::Ipv6Addr::from_str("::1").unwrap();
let rport = 6789;
let rport = 6796;
let rstd_sa = SocketAddrV6::new(addr, rport, 0, 0);
let raddr = SockaddrIn6::from(rstd_sa);
let sport = 6790;
let sport = 6798;
let sstd_sa = SocketAddrV6::new(addr, sport, 0, 0);
let saddr = SockaddrIn6::from(sstd_sa);
let rsock = socket(
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 @@ -110,7 +110,7 @@ fn test_so_tcp_maxseg() {
use std::net::SocketAddrV4;
use std::str::FromStr;

let std_sa = SocketAddrV4::from_str("127.0.0.1:4001").unwrap();
let std_sa = SocketAddrV4::from_str("127.0.0.1:4003").unwrap();
let sock_addr = SockaddrIn::from(std_sa);

let rsock = socket(
Expand Down

0 comments on commit cb56e89

Please sign in to comment.