Avoid using simple constants like 0 or 1 all over the place in unit tests #19432
Labels
A-testsuite
Area: The testsuite used to check the correctness of rustc
E-easy
Call for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue.
We should replace simple constants given to system/library calls with something more distinguishable for the ease of debugging with system/library call tracer such as
strace
.Let me emphasize that replacing them doesn't have to be perfect from the beginning. Perfectionism will not help anyone.
Example: a constant
0
hereeventually appears in the
strace
output log asbut the problem is, there are other unit tests which does
send_to(2)
of"\0"
. It's troublesome to find the source code line corresponding to the above log. If the original Rust code was written asand the other
send_to(2)
calls used"y"
,"z"
etc, we can easily find the above location from the output line which would look likeMy motivation is: I'm investigating why the unit test driver of
libstd
sometimes get stuck like this:I can probably post a (partial) fix of
#[test] fn recv_from_timeout()
inlibstd/io/net/udp.rs
later.The text was updated successfully, but these errors were encountered: