test_runner: fix test runner concurrency#47675
Conversation
|
CC @nodejs/performance Who can help me with creating a benchmark? I never have before |
Is this the relevant invocation? node/lib/internal/test_runner/runner.js Lines 390 to 397 in 0c5f253
If it is expected that test files are executed in parallel, then that should be covered by a test before any benchmark. Benchmarks are good for performance comparisons, but this is about a difference between design and implementation, i.e., functional correctness. |
yes
I will add a test |
|
@aduh95 In #45175, was the main motivation behind |
tniessen
left a comment
There was a problem hiding this comment.
Is the number of concurrent tests guaranteed to be at least two? I thought it depended on os.availableParallelism(), in which case it looks like this test might fail when only one or two CPU cores are assigned to the process group.
|
this fix introduced a race condition in tests outputs being reported out of order, so I fixed that as well |
| }); | ||
| } | ||
|
|
||
| test('--test multiple files', { skip: os.availableParallelism() < 3 }, async () => { |
There was a problem hiding this comment.
@cjihrig please confirm this skip makes sense
There was a problem hiding this comment.
I think it makes sense. I think you could verify by replacing the use of os.availableParallelism() in the test runner code with 1 or 2 and seeing if the test hangs.
e1dbbd2 to
bbc6eaf
Compare
|
@benjamingr @mcollina PTAL |
lib/internal/test_runner/runner.js
Outdated
| break; | ||
| } | ||
| } | ||
| #accumelateReportItem({ kind, node, comments, nesting = 0 }) { |
There was a problem hiding this comment.
The logic in this function (and even the function signature) seems like it should be part of #handleReportItem(). Is it possible to handle this there?
There was a problem hiding this comment.
handleReportItem happens only in order of reporting (using this.isClearToSend()), however, #skipReporting returns wrong values if it is called after the child process has completed but the test has not yet been reported
bbc6eaf to
17e3338
Compare
|
Landed in 8becacb...dccd25e |
PR-URL: nodejs#47675 Fixes: nodejs#47365 Fixes: nodejs#47696 Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com> Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
PR-URL: nodejs#47675 Fixes: nodejs#47365 Fixes: nodejs#47696 Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com> Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
PR-URL: nodejs#47675 Fixes: nodejs#47365 Fixes: nodejs#47696 Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com> Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
PR-URL: nodejs#47675 Fixes: nodejs#47365 Fixes: nodejs#47696 Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com> Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
PR-URL: nodejs#47675 Fixes: nodejs#47365 Fixes: nodejs#47696 Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com> Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
PR-URL: nodejs#47675 Fixes: nodejs#47365 Fixes: nodejs#47696 Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com> Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
PR-URL: nodejs#47675 Fixes: nodejs#47365 Fixes: nodejs#47696 Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com> Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
PR-URL: nodejs#47675 Fixes: nodejs#47365 Fixes: nodejs#47696 Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com> Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Fixes: #47365
Fixes: #47696
SafePromiseAllSettledReturnVoidruns sequentially before this fix :(this makes me wonder if we should add a benchmark for the test runner