RFR: 8293940: Some tests for virtual threads take too long
Alan Bateman
alanb at openjdk.org
Thu Sep 29 18:24:50 UTC 2022
This is a test only change to split the execution of some of the larger tests for virtual threads and reduce the execution time of a few others.
The tests StructuredTaskScopeTest, ThreadFockTest and ThreadPerTaskExecutorTest contain a lot of tests and run with thread factories for both platform and virtual threads. These tests are changed to run twice, one with the thread factory for platform threads, the other for virtual threads. This allows the tests to run concurrently. A number of sleeps/delays in these tests are adjusted. StructuredTaskScopeTest goes from ~50s to two runs of ~15s. ThreadFockTest goes from 39s to two runs of 15s, ThreadPerTaskExecutorTest goes from 21s to two runs of 8.5. There is more that could be done but these tests are likely to change a bit the APIs evolve so it may not be worth doing now.
ThreadAPI also contains a lot of tests. A number of tests sleep to give time for a virtual thread to park or block. These sleeps are replaced with a poll of the thread state. A number of other tests are changed to use shorter sleeps. There are a few cleanups that include introducing a number of data providers and using a STPE for delayed actions. Its execution time goes from ~31s to ~12s.
CloseTest has two tests that sleep 1s and they are run with a data provider that produces six inputs so the sleep time adds up. These lengthy delays aren't needed for testing
Finally, some of the stress changes have been changed. The two runs of PingPong are changed so they are in separate @test descriptions and the iteration count on a few tests has been reduced for release builds - the iteration count for debug builds is not changed.
-------------
Commit messages:
- Update
- Merge
- Update
- Initial changes
Changes: https://git.openjdk.org/jdk/pull/10463/files
Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=10463&range=00
Issue: https://bugs.openjdk.org/browse/JDK-8293940
Stats: 459 lines in 11 files changed: 162 ins; 96 del; 201 mod
Patch: https://git.openjdk.org/jdk/pull/10463.diff
Fetch: git fetch https://git.openjdk.org/jdk pull/10463/head:pull/10463
PR: https://git.openjdk.org/jdk/pull/10463
More information about the core-libs-dev
mailing list