RFR: 8346106: Verify.checkEQ: testing utility for recursive value verification

Emanuel Peter epeter at openjdk.org
Thu Dec 12 15:57:05 UTC 2024


On Thu, 12 Dec 2024 15:42:29 GMT, Emanuel Peter <epeter at openjdk.org> wrote:

> In testing, we often generate "golden" values, and then compare the results with it. This requires comparison loops etc in every test. I would like to create a dedicated facility for this, to simplify testing in the future. This is also preparation for [JDK-8344942](https://bugs.openjdk.org/browse/JDK-8344942).
> 
> I have written code like this in various tests before, see:
> `test/hotspot/jtreg/compiler/loopopts/superword/TestAlignVectorFuzzer.java`
> `./test/hotspot/jtreg/compiler/loopopts/superword/TestMemorySegment.java`
> `test/hotspot/jtreg/compiler/loopopts/superword/TestIndependentPacksWithCyclicDependency.java`.
> 
> It is now time to make a proper facility, so I can save time when writing tests in the future.

test/hotspot/jtreg/compiler/lib/verify/Verify.java line 42:

> 40:     public static void checkEQ(Object a, Object b) {
> 41:         checkEQ(a, b, "");
> 42:     }

Note: this is the only entry point to the Utility.

test/hotspot/jtreg/testlibrary_tests/verify/examples/TestVerifyInCheckMethod.java line 75:

> 73:     public static void check(Object result) {
> 74:         Verify.checkEQ(result, GOLD);
> 75:     }

Note: this is how we might generate Templates in the future: Using the `@Check` method with `Verify.checkEQ`. It allows the template to basically return whatever it wants, and it will be verified with the interpreter run.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/22715#discussion_r1882404152
PR Review Comment: https://git.openjdk.org/jdk/pull/22715#discussion_r1882406233


More information about the hotspot-compiler-dev mailing list