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: #35059

PR-URL: #35066
Reviewed-By: Richard Lau <riclau@uk.ibm.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
  • Loading branch information
addaleax authored and ruyadorno committed Sep 17, 2020
1 parent fb89be6 commit 25f93f3
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 25f93f3

Please sign in to comment.