authorgravatar for jacobly@ziglang.orgJacob Young <jacobly@ziglang.org> 2022-10-01 20:40:18-04:00
committergravatar for git@vexu.euVeikka Tuominen <git@vexu.eu> 2022-10-13 14:58:06+02:00
logf5f28e0d2c49d5c62914edf0bff8f1941eef721f
tree3f078b5f56537ef7e261213f1d722da785ce78a7
parent0eb3b8fa44f6dcafad8671695688d13ba8daba9a

io_uring: ignore SOCK_NONEMPTY for reproducible tests

Fixes #12670

2 files changed, 6 insertions(+), 2 deletions(-)

lib/std/os/linux.zig+2
......@@ -3761,6 +3761,8 @@ pub const IORING_CQE_F_BUFFER = 1 << 0;
37613761pub const IORING_CQE_F_MORE = 1 << 1;
37623762/// If set, more data to read after socket recv
37633763pub const IORING_CQE_F_SOCK_NONEMPTY = 1 << 2;
3764/// Set for notification CQEs. Can be used to distinct them from sends.
3765pub const IORING_CQE_F_NOTIF = 1 << 3;
37643766
37653767/// Magic offsets for the application to mmap the data it needs
37663768pub const IORING_OFF_SQ_RING = 0;
lib/std/os/linux/io_uring.zig+4-2
......@@ -2007,7 +2007,8 @@ test "accept/connect/send/recv" {
20072007 try testing.expectEqual(linux.io_uring_cqe{
20082008 .user_data = 0xffffffff,
20092009 .res = buffer_recv.len,
2010 .flags = 0,
2010 // ignore IORING_CQE_F_SOCK_NONEMPTY since it is only set on some systems
2011 .flags = cqe_recv.flags & linux.IORING_CQE_F_SOCK_NONEMPTY,
20112012 }, cqe_recv);
20122013
20132014 try testing.expectEqualSlices(u8, buffer_send[0..buffer_recv.len], buffer_recv[0..]);
......@@ -2089,7 +2090,8 @@ test "sendmsg/recvmsg" {
20892090 try testing.expectEqual(linux.io_uring_cqe{
20902091 .user_data = 0x22222222,
20912092 .res = buffer_recv.len,
2092 .flags = 0,
2093 // ignore IORING_CQE_F_SOCK_NONEMPTY since it is set non-deterministically
2094 .flags = cqe_recvmsg.flags & linux.IORING_CQE_F_SOCK_NONEMPTY,
20932095 }, cqe_recvmsg);
20942096
20952097 try testing.expectEqualSlices(u8, buffer_send[0..buffer_recv.len], buffer_recv[0..]);