RFR: 8358600: Template-Framework Library: Template for TestFramework test class [v2]

Manuel Hässig mhaessig at openjdk.org
Thu Jun 5 11:34:51 UTC 2025


On Thu, 5 Jun 2025 06:16:47 GMT, Emanuel Peter <epeter at openjdk.org> wrote:

>> We might want to write many IR/TestFramework tests, and so I would like to integrate a Template that generates the class, and the user has to only generate a list of tests.
>> 
>> This is a first extension for https://github.com/openjdk/jdk/pull/24217. I had already prototyped it earlier and plan to use it in multiple tests https://github.com/openjdk/jdk/pull/23418 (see `IRTestClass.java`).
>> 
>> https://github.com/openjdk/jdk/blob/dc640cbd8fb8ec76920a7ab52dfe7955ed1d77f2/test/hotspot/jtreg/compiler/lib/template_framework/library/TestFrameworkClass.java#L36-L45
>
> Emanuel Peter has updated the pull request incrementally with one additional commit since the last revision:
> 
>   streamline API to a single render method

Thank you for your continued work on the Template Framework. This seems like good start to the template library. While it already looks good, I have a few small questions :)

Thank you for your continued work on the Template Framework. This seems like good start to the template library. While it already looks good, I have a few small questions :)

test/hotspot/jtreg/compiler/lib/template_framework/library/TestFrameworkClass.java line 76:

> 74:     public static String render(final String packageName,
> 75:                                 final String className,
> 76:                                 final List<String> imports,

To eliminate duplicate imports this could also be a `Set`.

test/hotspot/jtreg/testlibrary_tests/template_framework/examples/TestWithTestFrameworkClass.java line 135:

> 133:         ));
> 134: 
> 135:         // Create a test for each operator..

Suggestion:

        // Create a test for each operator.

Tiny nit :)

test/hotspot/jtreg/testlibrary_tests/template_framework/examples/TestWithTestFrameworkClass.java line 145:

> 143:             // List of imports. Duplicates are permitted.
> 144:             List.of("compiler.lib.generators.*",
> 145:                     "compiler.lib.ir_framework.*",

Suggestion:


This should not be needed since its imported by default in `TestFrameworkClass`. Or is this a deliberate duplication?

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

PR Review: https://git.openjdk.org/jdk/pull/25643#pullrequestreview-2899874579
PR Review: https://git.openjdk.org/jdk/pull/25643#pullrequestreview-2899929556
PR Review Comment: https://git.openjdk.org/jdk/pull/25643#discussion_r2128593841
PR Review Comment: https://git.openjdk.org/jdk/pull/25643#discussion_r2128586200
PR Review Comment: https://git.openjdk.org/jdk/pull/25643#discussion_r2128588949


More information about the hotspot-compiler-dev mailing list