The net tests currently use this logic to pick unique ports for each test. However, that logic fails when tests are executed by nextest as then, each test runs in its own process, so they all end up using the same port.
Running std tests in nextest is quite useful for Miri to get a list of all failed tests, not just the first failed test. I am not sure if there's other good reasons to run std tests in nextest, or how one would even do that (I did it via this).
I wonder why ports are assigned this way. Couldn't the tests instead use port 0 (so that the OS picks a fresh port) and then call local_addr() to figure out which port was actually used, and use that for connect?
Cc @the8472
The
nettests currently use this logic to pick unique ports for each test. However, that logic fails when tests are executed by nextest as then, each test runs in its own process, so they all end up using the same port.Running std tests in nextest is quite useful for Miri to get a list of all failed tests, not just the first failed test. I am not sure if there's other good reasons to run std tests in nextest, or how one would even do that (I did it via this).
I wonder why ports are assigned this way. Couldn't the tests instead use port 0 (so that the OS picks a fresh port) and then call
local_addr()to figure out which port was actually used, and use that forconnect?Cc @the8472