[crac] RFR: 8364931: [CRaC] Stabilize recompiler tests

Radim Vansa rvansa at openjdk.org
Fri Aug 8 12:11:30 UTC 2025


On Wed, 6 Aug 2025 15:32:01 GMT, Timofei Pushkin <tpushkin at openjdk.org> wrote:

> Stabilizes recompiler tests:
> - `NaturalDecompilationTest` now ensures the method is not enqueued for another compilation before proceeding with the test.
> - In `RecompilationFlagsTest` recompilation waiting period of a predefined length is replaced with waiting for the methods to get enqueued and dequeued to/from the compilation queue.

test/jdk/jdk/crac/recompiler/NaturalDecompilationTest.java line 147:

> 145:             @Override
> 146:             public void afterRestore(Context<? extends Resource> context) {
> 147:                 assertFalse(

Please break this into two `assertFalse` statements for clarity.

test/jdk/jdk/crac/recompiler/NaturalDecompilationTest.java line 163:

> 161:         // Utils.waitForCondition() invokes its supplier argument one more time
> 162:         // after it returns true. For our conditions that is unacceptable.
> 163:         final var result = new Object() { boolean value = false; };

TBH I would use `AtomicBoolean` for a mutable bool wrapper but YMMV.

test/jdk/jdk/crac/recompiler/RecompilationFlagsTest.java line 164:

> 162:             recompilerThread.join();
> 163:         } else {
> 164:             System.out.println("Recompiler thread not set");

You could assert that the thread is present or not based on the test parameters.

-------------

PR Review Comment: https://git.openjdk.org/crac/pull/259#discussion_r2262741275
PR Review Comment: https://git.openjdk.org/crac/pull/259#discussion_r2262753881
PR Review Comment: https://git.openjdk.org/crac/pull/259#discussion_r2262787566


More information about the crac-dev mailing list