Commit 4bf849c
authored
Rewrite, update, and refactor sockets-related tests (WebAssembly#768)
In WebAssembly#762 I'm seeing an error related to `EADDRINUSE` which I can't
reproduce locally. Tests currently all use the same port which means
that they are required to be run serially and additionally may run into
this risk if the port happens to already be taken. I don't really know
what's going on in CI, but I wanted to nevertheless refactor these
tests.
This commit rearchitects, rewrites, and fixes sockets-related tests.
Changes here are:
* Servers now print the port they're listening to. Clients read this
port and then connect to that port. This orchestration happens through
some specially crafted bash and CMake, similar to before. All tests now
bind to port 0 to get an OS-assigned port instead of picking a port.
* All tests are now ungated, notably enabling some nonblocking I/O tests
that were previously gated.
* A number of tests are refactored or updated to be less flaky. Many
tests were failing nondeterministically locally due to how the test was
constructed and assuming certain things were ready when they may not be.
Some tests were entirely rewritten, such as
`sockets-nonblocking-multiple.c`, while others were only lightly
refactored to `poll` in a few more places.
* All tests are updated to pass in less than 100ms. Some tests before
hung for awhile as timeouts were reached for example, but this wasn't a
necessary part of the test. Other tests for nonblocking I/O had many
calls to `poll` with a number of them reaching the timeout. These are
rewritten to use a single call to `poll` with no timeout which enables
the test to progress much faster as timeouts are never reached.
Overall the intent is that the sockets-related tests are more
comprehensive now, more robust and/or less flaky, and work in more
environments.1 parent 1305fb6 commit 4bf849c
25 files changed
Lines changed: 888 additions & 861 deletions
File tree
- test
- src
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
123 | 123 | | |
124 | 124 | | |
125 | 125 | | |
126 | | - | |
| 126 | + | |
127 | 127 | | |
128 | 128 | | |
129 | 129 | | |
| |||
135 | 135 | | |
136 | 136 | | |
137 | 137 | | |
138 | | - | |
139 | 138 | | |
140 | 139 | | |
141 | 140 | | |
| |||
155 | 154 | | |
156 | 155 | | |
157 | 156 | | |
158 | | - | |
159 | | - | |
160 | | - | |
161 | | - | |
162 | | - | |
163 | | - | |
164 | 157 | | |
165 | 158 | | |
166 | 159 | | |
| |||
341 | 334 | | |
342 | 335 | | |
343 | 336 | | |
344 | | - | |
345 | | - | |
346 | | - | |
347 | | - | |
| 337 | + | |
| 338 | + | |
348 | 339 | | |
349 | 340 | | |
350 | 341 | | |
| |||
387 | 378 | | |
388 | 379 | | |
389 | 380 | | |
390 | | - | |
391 | 381 | | |
392 | 382 | | |
393 | 383 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
10 | 10 | | |
11 | 11 | | |
12 | 12 | | |
13 | | - | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
14 | 42 | | |
15 | 43 | | |
16 | 44 | | |
17 | | - | |
| 45 | + | |
18 | 46 | | |
19 | 47 | | |
20 | 48 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
115 | 115 | | |
116 | 116 | | |
117 | 117 | | |
118 | | - | |
119 | 118 | | |
120 | | - | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
121 | 132 | | |
122 | 133 | | |
123 | 134 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
26 | 26 | | |
27 | 27 | | |
28 | 28 | | |
29 | | - | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
30 | 40 | | |
31 | 41 | | |
32 | 42 | | |
33 | | - | |
| 43 | + | |
34 | 44 | | |
35 | 45 | | |
36 | 46 | | |
| |||
44 | 54 | | |
45 | 55 | | |
46 | 56 | | |
47 | | - | |
| 57 | + | |
48 | 58 | | |
49 | 59 | | |
50 | 60 | | |
51 | 61 | | |
52 | 62 | | |
53 | 63 | | |
54 | | - | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
55 | 68 | | |
56 | 69 | | |
57 | 70 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
19 | 19 | | |
20 | 20 | | |
21 | 21 | | |
22 | | - | |
23 | | - | |
24 | | - | |
25 | | - | |
26 | | - | |
27 | | - | |
28 | | - | |
29 | | - | |
30 | | - | |
31 | | - | |
32 | | - | |
33 | | - | |
34 | 22 | | |
35 | 23 | | |
36 | | - | |
37 | | - | |
38 | | - | |
| 24 | + | |
39 | 25 | | |
40 | 26 | | |
41 | 27 | | |
| |||
48 | 34 | | |
49 | 35 | | |
50 | 36 | | |
51 | | - | |
52 | | - | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
53 | 42 | | |
| 43 | + | |
54 | 44 | | |
55 | 45 | | |
56 | 46 | | |
57 | 47 | | |
58 | 48 | | |
| 49 | + | |
59 | 50 | | |
60 | 51 | | |
61 | 52 | | |
| |||
74 | 65 | | |
75 | 66 | | |
76 | 67 | | |
77 | | - | |
78 | | - | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
79 | 80 | | |
80 | 81 | | |
81 | 82 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
19 | 19 | | |
20 | 20 | | |
21 | 21 | | |
22 | | - | |
23 | | - | |
24 | | - | |
25 | | - | |
26 | | - | |
27 | | - | |
28 | | - | |
29 | | - | |
30 | | - | |
31 | | - | |
32 | | - | |
33 | | - | |
34 | | - | |
35 | 22 | | |
36 | 23 | | |
37 | | - | |
38 | | - | |
39 | | - | |
| 24 | + | |
40 | 25 | | |
41 | 26 | | |
42 | 27 | | |
43 | 28 | | |
44 | 29 | | |
45 | 30 | | |
46 | 31 | | |
47 | | - | |
48 | | - | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
49 | 36 | | |
50 | 37 | | |
51 | 38 | | |
52 | 39 | | |
53 | 40 | | |
54 | | - | |
55 | | - | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
56 | 52 | | |
57 | 53 | | |
58 | 54 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
19 | 19 | | |
20 | 20 | | |
21 | 21 | | |
22 | | - | |
23 | | - | |
24 | | - | |
25 | | - | |
26 | | - | |
27 | | - | |
28 | | - | |
29 | | - | |
30 | | - | |
31 | | - | |
32 | | - | |
33 | | - | |
34 | | - | |
35 | 22 | | |
36 | | - | |
37 | | - | |
38 | | - | |
| 23 | + | |
39 | 24 | | |
40 | 25 | | |
41 | 26 | | |
| |||
47 | 32 | | |
48 | 33 | | |
49 | 34 | | |
50 | | - | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
51 | 39 | | |
52 | 40 | | |
53 | 41 | | |
| |||
56 | 44 | | |
57 | 45 | | |
58 | 46 | | |
59 | | - | |
60 | | - | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
61 | 58 | | |
62 | 59 | | |
63 | 60 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
19 | 19 | | |
20 | 20 | | |
21 | 21 | | |
22 | | - | |
23 | | - | |
24 | | - | |
25 | | - | |
26 | | - | |
27 | | - | |
28 | | - | |
29 | | - | |
30 | | - | |
31 | | - | |
32 | | - | |
33 | | - | |
34 | | - | |
35 | 22 | | |
36 | | - | |
37 | | - | |
38 | | - | |
| 23 | + | |
39 | 24 | | |
40 | 25 | | |
41 | 26 | | |
| |||
48 | 33 | | |
49 | 34 | | |
50 | 35 | | |
51 | | - | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
52 | 40 | | |
53 | 41 | | |
54 | 42 | | |
| |||
65 | 53 | | |
66 | 54 | | |
67 | 55 | | |
68 | | - | |
69 | | - | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
70 | 67 | | |
71 | 68 | | |
72 | 69 | | |
0 commit comments