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;...@@ -3761,6 +3761,8 @@ pub const IORING_CQE_F_BUFFER = 1 << 0;
3761pub const IORING_CQE_F_MORE = 1 << 1;3761pub const IORING_CQE_F_MORE = 1 << 1;
3762/// If set, more data to read after socket recv3762/// If set, more data to read after socket recv
3763pub const IORING_CQE_F_SOCK_NONEMPTY = 1 << 2;3763pub 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
3765/// Magic offsets for the application to mmap the data it needs3767/// Magic offsets for the application to mmap the data it needs
3766pub const IORING_OFF_SQ_RING = 0;3768pub const IORING_OFF_SQ_RING = 0;
lib/std/os/linux/io_uring.zig+4-2
...@@ -2007,7 +2007,8 @@ test "accept/connect/send/recv" {...@@ -2007,7 +2007,8 @@ test "accept/connect/send/recv" {
2007 try testing.expectEqual(linux.io_uring_cqe{2007 try testing.expectEqual(linux.io_uring_cqe{
2008 .user_data = 0xffffffff,2008 .user_data = 0xffffffff,
2009 .res = buffer_recv.len,2009 .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,
2011 }, cqe_recv);2012 }, cqe_recv);
20122013
2013 try testing.expectEqualSlices(u8, buffer_send[0..buffer_recv.len], buffer_recv[0..]);2014 try testing.expectEqualSlices(u8, buffer_send[0..buffer_recv.len], buffer_recv[0..]);
...@@ -2089,7 +2090,8 @@ test "sendmsg/recvmsg" {...@@ -2089,7 +2090,8 @@ test "sendmsg/recvmsg" {
2089 try testing.expectEqual(linux.io_uring_cqe{2090 try testing.expectEqual(linux.io_uring_cqe{
2090 .user_data = 0x22222222,2091 .user_data = 0x22222222,
2091 .res = buffer_recv.len,2092 .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,
2093 }, cqe_recvmsg);2095 }, cqe_recvmsg);
20942096
2095 try testing.expectEqualSlices(u8, buffer_send[0..buffer_recv.len], buffer_recv[0..]);2097 try testing.expectEqualSlices(u8, buffer_send[0..buffer_recv.len], buffer_recv[0..]);