Fix test hangs on AIX

This commit is contained in:
Henry Jiang 2025-03-03 15:40:23 -05:00
parent 81d8edc200
commit 2a7ad952a7
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()), 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::net::*;
use crate::sync::mpsc::channel; use crate::sync::mpsc::channel;
use crate::thread; use crate::thread;
@ -46,7 +46,7 @@ fn socket_smoke_test_ip4() {
let (nread, src) = t!(server.recv_from(&mut buf)); let (nread, src) = t!(server.recv_from(&mut buf));
assert_eq!(nread, 1); assert_eq!(nread, 1);
assert_eq!(buf[0], 99); assert_eq!(buf[0], 99);
assert_eq!(src, client_ip); assert_eq!(compare_ignore_zoneid(&src, &client_ip), true);
rx2.recv().unwrap(); rx2.recv().unwrap();
}) })
} }
@ -78,7 +78,9 @@ fn udp_clone_smoke() {
let _t = thread::spawn(move || { let _t = thread::spawn(move || {
let mut buf = [0, 0]; 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); assert_eq!(buf[0], 1);
t!(sock2.send_to(&[2], &addr1)); t!(sock2.send_to(&[2], &addr1));
}); });
@ -94,7 +96,9 @@ fn udp_clone_smoke() {
}); });
tx1.send(()).unwrap(); tx1.send(()).unwrap();
let mut buf = [0, 0]; 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(); rx2.recv().unwrap();
}) })
} }

View File

@ -1,5 +1,6 @@
//@ ignore-windows-gnu: #128981 //@ ignore-windows-gnu: #128981
//@ ignore-android: FIXME(#10381) //@ ignore-android: FIXME(#10381)
//@ ignore-aix: FIXME(#137965)
//@ compile-flags:-g //@ compile-flags:-g
// === GDB TESTS =================================================================================== // === GDB TESTS ===================================================================================

View File

@ -2,6 +2,9 @@
// on 32bit and 16bit platforms it is plausible that the maximum allocation size will succeed // on 32bit and 16bit platforms it is plausible that the maximum allocation size will succeed
// FIXME (#135952) In some cases on AArch64 Linux the diagnostic does not trigger // FIXME (#135952) In some cases on AArch64 Linux the diagnostic does not trigger
//@ ignore-aarch64-unknown-linux-gnu //@ ignore-aarch64-unknown-linux-gnu
// AIX will allow the allocation to go through, and get SIGKILL when zero initializing
// the overcommitted page.
//@ ignore-aix
const FOO: () = { const FOO: () = {
// 128 TiB, unlikely anyone has that much RAM // 128 TiB, unlikely anyone has that much RAM

View File

@ -1,11 +1,11 @@
error[E0080]: evaluation of constant value failed error[E0080]: evaluation of constant value failed
--> $DIR/large_const_alloc.rs:8:13 --> $DIR/large_const_alloc.rs:11:13
| |
LL | let x = [0_u8; (1 << 47) - 1]; LL | let x = [0_u8; (1 << 47) - 1];
| ^^^^^^^^^^^^^^^^^^^^^ tried to allocate more memory than available to compiler | ^^^^^^^^^^^^^^^^^^^^^ tried to allocate more memory than available to compiler
error[E0080]: could not evaluate static initializer error[E0080]: could not evaluate static initializer
--> $DIR/large_const_alloc.rs:13:13 --> $DIR/large_const_alloc.rs:16:13
| |
LL | let x = [0_u8; (1 << 47) - 1]; LL | let x = [0_u8; (1 << 47) - 1];
| ^^^^^^^^^^^^^^^^^^^^^ tried to allocate more memory than available to compiler | ^^^^^^^^^^^^^^^^^^^^^ tried to allocate more memory than available to compiler

View File

@ -5,6 +5,9 @@
//@ only-64bit //@ only-64bit
// FIXME (#135952) In some cases on AArch64 Linux the diagnostic does not trigger // FIXME (#135952) In some cases on AArch64 Linux the diagnostic does not trigger
//@ ignore-aarch64-unknown-linux-gnu //@ ignore-aarch64-unknown-linux-gnu
// AIX will allow the allocation to go through, and get SIGKILL when zero initializing
// the overcommitted page.
//@ ignore-aix
pub struct Data([u8; (1 << 47) - 1]); pub struct Data([u8; (1 << 47) - 1]);
const _: &'static Data = &Data([0; (1 << 47) - 1]); const _: &'static Data = &Data([0; (1 << 47) - 1]);

View File

@ -1,5 +1,5 @@
error[E0080]: evaluation of constant value failed error[E0080]: evaluation of constant value failed
--> $DIR/promoted_running_out_of_memory_issue-130687.rs:10:32 --> $DIR/promoted_running_out_of_memory_issue-130687.rs:13:32
| |
LL | const _: &'static Data = &Data([0; (1 << 47) - 1]); LL | const _: &'static Data = &Data([0; (1 << 47) - 1]);
| ^^^^^^^^^^^^^^^^^^ tried to allocate more memory than available to compiler | ^^^^^^^^^^^^^^^^^^ tried to allocate more memory than available to compiler