Rollup merge of #137967 - mustartt:fix-aix-test-hangs, r=workingjubilee

[AIX] Fix hangs during testing

Fixes all current test hangs experienced during CI runs.
1. ipv6 link-local (the loopback device) gets assigned an automatic zone id of 1, causing the assert to fail and hang in `library/std/src/net/udp/tests.rs`
2. Const alloc does not fail gracefully
3. Debuginfo test has problem with gdb auto load safe path
This commit is contained in:
Jakub Beránek
2025-03-11 13:30:50 +01:00
committed by GitHub
7 changed files with 29 additions and 7 deletions

View File

@@ -31,3 +31,14 @@ pub fn tsa<A: ToSocketAddrs>(a: A) -> Result<Vec<SocketAddr>, String> {
Err(e) => Err(e.to_string()),
}
}
pub fn compare_ignore_zoneid(a: &SocketAddr, b: &SocketAddr) -> bool {
match (a, b) {
(SocketAddr::V6(a), SocketAddr::V6(b)) => {
a.ip().segments() == b.ip().segments()
&& a.flowinfo() == b.flowinfo()
&& a.port() == b.port()
}
_ => a == b,
}
}

View File

@@ -1,4 +1,4 @@
use crate::net::test::{next_test_ip4, next_test_ip6};
use crate::net::test::{compare_ignore_zoneid, next_test_ip4, next_test_ip6};
use crate::net::*;
use crate::sync::mpsc::channel;
use crate::thread;
@@ -46,7 +46,7 @@ fn socket_smoke_test_ip4() {
let (nread, src) = t!(server.recv_from(&mut buf));
assert_eq!(nread, 1);
assert_eq!(buf[0], 99);
assert_eq!(src, client_ip);
assert_eq!(compare_ignore_zoneid(&src, &client_ip), true);
rx2.recv().unwrap();
})
}
@@ -78,7 +78,9 @@ fn udp_clone_smoke() {
let _t = thread::spawn(move || {
let mut buf = [0, 0];
assert_eq!(sock2.recv_from(&mut buf).unwrap(), (1, addr1));
let res = sock2.recv_from(&mut buf).unwrap();
assert_eq!(res.0, 1);
assert_eq!(compare_ignore_zoneid(&res.1, &addr1), true);
assert_eq!(buf[0], 1);
t!(sock2.send_to(&[2], &addr1));
});
@@ -94,7 +96,9 @@ fn udp_clone_smoke() {
});
tx1.send(()).unwrap();
let mut buf = [0, 0];
assert_eq!(sock1.recv_from(&mut buf).unwrap(), (1, addr2));
let res = sock1.recv_from(&mut buf).unwrap();
assert_eq!(res.0, 1);
assert_eq!(compare_ignore_zoneid(&res.1, &addr2), true);
rx2.recv().unwrap();
})
}