zig icon indicating copy to clipboard operation
zig copied to clipboard

io_uring unit tests hard code a port to listen on, which is very naughty

Open andrewrk opened this issue 2 years ago • 0 comments

https://github.com/ziglang/zig/blob/962299157840979ba659d478785f5ed0759d5401/lib/std/os/linux/io_uring.zig#L2027

https://github.com/ziglang/zig/blob/962299157840979ba659d478785f5ed0759d5401/lib/std/os/linux/io_uring.zig#L2519

https://github.com/ziglang/zig/blob/962299157840979ba659d478785f5ed0759d5401/lib/std/os/linux/io_uring.zig#L3239

You can't just grab some arbitrary port and start using it in unit tests. That port could be used by the system causing the unit tests to fail with EADDRINUSE. Or... it could be used by the very same unit tests, in another process, which is the situation happening now, in #14647. Unit tests must bind to port 0, letting the operating system assign a port, and then use that port for testing.

I will now disable all of these tests that hard code a port number.

andrewrk avatar Mar 14 '23 06:03 andrewrk