Skip to content

Commit 95d9ade

Browse files
authored
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
2 parents bb2324a + 2a7ad95 commit 95d9ade

7 files changed

+29
-7
lines changed

library/std/src/net/test.rs

+11
Original file line numberDiff line numberDiff line change
@@ -31,3 +31,14 @@ pub fn tsa<A: ToSocketAddrs>(a: A) -> Result<Vec<SocketAddr>, String> {
3131
Err(e) => Err(e.to_string()),
3232
}
3333
}
34+
35+
pub fn compare_ignore_zoneid(a: &SocketAddr, b: &SocketAddr) -> bool {
36+
match (a, b) {
37+
(SocketAddr::V6(a), SocketAddr::V6(b)) => {
38+
a.ip().segments() == b.ip().segments()
39+
&& a.flowinfo() == b.flowinfo()
40+
&& a.port() == b.port()
41+
}
42+
_ => a == b,
43+
}
44+
}

library/std/src/net/udp/tests.rs

+8-4
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
use crate::net::test::{next_test_ip4, next_test_ip6};
1+
use crate::net::test::{compare_ignore_zoneid, next_test_ip4, next_test_ip6};
22
use crate::net::*;
33
use crate::sync::mpsc::channel;
44
use crate::thread;
@@ -46,7 +46,7 @@ fn socket_smoke_test_ip4() {
4646
let (nread, src) = t!(server.recv_from(&mut buf));
4747
assert_eq!(nread, 1);
4848
assert_eq!(buf[0], 99);
49-
assert_eq!(src, client_ip);
49+
assert_eq!(compare_ignore_zoneid(&src, &client_ip), true);
5050
rx2.recv().unwrap();
5151
})
5252
}
@@ -78,7 +78,9 @@ fn udp_clone_smoke() {
7878

7979
let _t = thread::spawn(move || {
8080
let mut buf = [0, 0];
81-
assert_eq!(sock2.recv_from(&mut buf).unwrap(), (1, addr1));
81+
let res = sock2.recv_from(&mut buf).unwrap();
82+
assert_eq!(res.0, 1);
83+
assert_eq!(compare_ignore_zoneid(&res.1, &addr1), true);
8284
assert_eq!(buf[0], 1);
8385
t!(sock2.send_to(&[2], &addr1));
8486
});
@@ -94,7 +96,9 @@ fn udp_clone_smoke() {
9496
});
9597
tx1.send(()).unwrap();
9698
let mut buf = [0, 0];
97-
assert_eq!(sock1.recv_from(&mut buf).unwrap(), (1, addr2));
99+
let res = sock1.recv_from(&mut buf).unwrap();
100+
assert_eq!(res.0, 1);
101+
assert_eq!(compare_ignore_zoneid(&res.1, &addr2), true);
98102
rx2.recv().unwrap();
99103
})
100104
}

tests/debuginfo/pretty-huge-vec.rs

+1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
//@ ignore-windows-gnu: #128981
22
//@ ignore-android: FIXME(#10381)
3+
//@ ignore-aix: FIXME(#137965)
34
//@ compile-flags:-g
45

56
// === GDB TESTS ===================================================================================

tests/ui/consts/large_const_alloc.rs

+3
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@
22
// on 32bit and 16bit platforms it is plausible that the maximum allocation size will succeed
33
// FIXME (#135952) In some cases on AArch64 Linux the diagnostic does not trigger
44
//@ ignore-aarch64-unknown-linux-gnu
5+
// AIX will allow the allocation to go through, and get SIGKILL when zero initializing
6+
// the overcommitted page.
7+
//@ ignore-aix
58

69
const FOO: () = {
710
// 128 TiB, unlikely anyone has that much RAM

tests/ui/consts/large_const_alloc.stderr

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
error[E0080]: evaluation of constant value failed
2-
--> $DIR/large_const_alloc.rs:8:13
2+
--> $DIR/large_const_alloc.rs:11:13
33
|
44
LL | let x = [0_u8; (1 << 47) - 1];
55
| ^^^^^^^^^^^^^^^^^^^^^ tried to allocate more memory than available to compiler
66

77
error[E0080]: could not evaluate static initializer
8-
--> $DIR/large_const_alloc.rs:13:13
8+
--> $DIR/large_const_alloc.rs:16:13
99
|
1010
LL | let x = [0_u8; (1 << 47) - 1];
1111
| ^^^^^^^^^^^^^^^^^^^^^ tried to allocate more memory than available to compiler

tests/ui/consts/promoted_running_out_of_memory_issue-130687.rs

+3
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@
55
//@ only-64bit
66
// FIXME (#135952) In some cases on AArch64 Linux the diagnostic does not trigger
77
//@ ignore-aarch64-unknown-linux-gnu
8+
// AIX will allow the allocation to go through, and get SIGKILL when zero initializing
9+
// the overcommitted page.
10+
//@ ignore-aix
811

912
pub struct Data([u8; (1 << 47) - 1]);
1013
const _: &'static Data = &Data([0; (1 << 47) - 1]);

tests/ui/consts/promoted_running_out_of_memory_issue-130687.stderr

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

0 commit comments

Comments
 (0)