RFR: 8346106: Verify.checkEQ: testing utility for recursive value verification
Emanuel Peter
epeter at openjdk.org
Wed Dec 18 10:18:39 UTC 2024
On Wed, 18 Dec 2024 07:27:50 GMT, theoweidmannoracle <duke at openjdk.org> wrote:
>> 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.
>
> Maybe this note could be added to the documentation comment?
I could. But it is also the only public method, so it is already given that way. And who knows: we might add more public methods, and then we could forget to remove that comment. I'd rather not add it.
>> 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.
>
> Could we go even further and annotate this directly at the test method? For example:
>
>
> @Test
> @Arguments(setup = "setup")
> @VerifyResult(expected = GOLD)
> public static Object test(int[] a, float b) {
> for (int i = 0; i < a.length; i++) {
> a[i] = (int)(a[i] * b);
> }
> // Since we have more than one value, we wrap them in an Object[].
> return new Object[] {a, b};
> }
We totally could. That would be a separate RFE to the IR framework. We have already filed similar RFEs.
[JDK-8310533](https://bugs.openjdk.org/browse/JDK-8310533) [IR Framework] Add possibility to automatically verify that a test method always returns the same result
Adding this verify method could be the building block for that.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/22715#discussion_r1889976253
PR Review Comment: https://git.openjdk.org/jdk/pull/22715#discussion_r1889978830
More information about the hotspot-compiler-dev
mailing list