Skip to content

Commit

Permalink
test: add more valid results to test-trace-atomics-wait
Browse files Browse the repository at this point in the history
The two starting `Atomics.wait()` operations are not ordered,
but the test assumed a specific ordering because of the latency
that comes with spinning up a Worker thread.

Add variants of the existing potential valid results that account
for the reverse ordering.

Fixes: nodejs#35059
  • Loading branch information
addaleax committed Sep 5, 2020
1 parent 1862305 commit da7fe70
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion test/parallel/test-trace-atomics-wait.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,11 @@ const expectedTimelines = [
[Thread 0] Atomics.wait(<address> + 4, 0, inf) started
[Thread 1] Atomics.wait(<address> + 4, -1, inf) started
[Thread 0] Atomics.wait(<address> + 4, 0, inf) was woken up by another thread
[Thread 1] Atomics.wait(<address> + 4, -1, inf) was woken up by another thread`,
`${begin}
[Thread 1] Atomics.wait(<address> + 4, 0, inf) started
[Thread 0] Atomics.wait(<address> + 4, -1, inf) started
[Thread 0] Atomics.wait(<address> + 4, 0, inf) was woken up by another thread
[Thread 1] Atomics.wait(<address> + 4, -1, inf) was woken up by another thread`,
`${begin}
[Thread 0] Atomics.wait(<address> + 4, 0, inf) started
Expand All @@ -71,14 +76,20 @@ values mismatched`,
[Thread 1] Atomics.wait(<address> + 4, -1, inf) started
[Thread 0] Atomics.wait(<address> + 4, 0, inf) was woken up by another thread
[Thread 1] Atomics.wait(<address> + 4, -1, inf) did not wait because the \
values mismatched`,
`${begin}
[Thread 1] Atomics.wait(<address> + 4, 0, inf) started
[Thread 0] Atomics.wait(<address> + 4, -1, inf) started
[Thread 0] Atomics.wait(<address> + 4, 0, inf) was woken up by another thread
[Thread 1] Atomics.wait(<address> + 4, -1, inf) did not wait because the \
values mismatched`,
`${begin}
[Thread 0] Atomics.wait(<address> + 4, 0, inf) started
[Thread 0] Atomics.wait(<address> + 4, 0, inf) did not wait because the \
values mismatched
[Thread 1] Atomics.wait(<address> + 4, -1, inf) started
[Thread 1] Atomics.wait(<address> + 4, -1, inf) did not wait because the \
values mismatched`
values mismatched`,
];

assert(expectedTimelines.includes(actualTimeline));

0 comments on commit da7fe70

Please sign in to comment.