Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

8324641: [IR Framework] Add Setup method to provide custom arguments and set fields #17557

Closed
wants to merge 38 commits into from
Closed
Changes from 2 commits
Commits
Show all changes
38 commits
Select commit Hold shift + click to select a range
f8845ec
8324641
eme64 Jan 24, 2024
42205ee
example is working
eme64 Jan 24, 2024
3eb7c18
Arguments values works again as well
eme64 Jan 24, 2024
62d907b
remove printFixedRandomArguments
eme64 Jan 24, 2024
8f6fe27
Adjusted all @Arguments with value
eme64 Jan 24, 2024
f0c6cd8
improve some comments
eme64 Jan 24, 2024
2a57e52
improve formatting and comments
eme64 Jan 25, 2024
d4d15d8
index -> invocationCounter
eme64 Jan 25, 2024
461405d
SetupExample.java
eme64 Jan 25, 2024
08670a5
make invocationCounter optional for Setup method
eme64 Jan 29, 2024
b725b29
fix trailing whitespaces
eme64 Jan 29, 2024
13c6621
update readme
eme64 Jan 29, 2024
b367647
add SetupInfo class
eme64 Jan 29, 2024
1f8f57a
fix up some tests
eme64 Jan 29, 2024
24eb09d
fix add and comma
eme64 Feb 1, 2024
1237c02
for Review by Christian
eme64 Feb 5, 2024
852e6e1
more for Christian
eme64 Feb 5, 2024
66c3ef7
setup string not list, for Christian
eme64 Feb 5, 2024
fddcdfe
made ArgumentsProvider an interface
eme64 Feb 5, 2024
8ff7dfa
fix more comments
eme64 Feb 5, 2024
e9d0106
Apply suggestions from code review
eme64 Feb 6, 2024
164665f
fix whitespace from last commit
eme64 Feb 6, 2024
12c9a45
Apply suggestions from code review
eme64 Feb 6, 2024
a1dda56
Apply suggestions from code review
eme64 Feb 6, 2024
3206074
rename BaseTestExample -> NormalTestExample
eme64 Feb 6, 2024
af5e7dc
add paragraph for Christian
eme64 Feb 6, 2024
b37b748
wip more tests
eme64 Feb 6, 2024
6efd271
wip: more tests
eme64 Feb 7, 2024
252815e
wip: more tests and fixes
eme64 Feb 7, 2024
d10fba5
wip: test fields and invocationCounter
eme64 Feb 7, 2024
4a8f96b
wip: throw tests, array tests, random tests
eme64 Feb 7, 2024
1f84ef5
improved and simplified examples
eme64 Feb 7, 2024
33029f6
remove tabs
eme64 Feb 7, 2024
f03f3b8
Apply suggestions from code review
eme64 Feb 8, 2024
47b8d25
more for Christian
eme64 Feb 8, 2024
617e40a
fix whitespace
eme64 Feb 8, 2024
b62b7ef
Merge branch 'master' into JDK-8324641
eme64 Feb 8, 2024
1f7872a
Merge branch 'master' into JDK-8324641
eme64 Feb 8, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion test/hotspot/jtreg/compiler/lib/ir_framework/README.md
Original file line number Diff line number Diff line change
@@ -34,7 +34,7 @@ There are various ways how to set up and run a test within the `main()` method o
The framework offers various annotations and flags to control how your test code should be invoked and being checked. This section gives an overview over all these features.

### 2.1 Different Tests
There are two ways a test can be formulated, depending on how much control is needed over the test invocation.
There are two ways a test can be written, depending on how much control is needed over the test invocation.

#### Normal Test
The normal and simplest form of testing provides a single `@Test` annotated method which the framework invokes directly as part of the testing. The test method either has no arguments, or they must be specified with an `@Arguments` annotation.
7 changes: 4 additions & 3 deletions test/hotspot/jtreg/compiler/lib/ir_framework/Setup.java
Original file line number Diff line number Diff line change
@@ -28,11 +28,12 @@

/**
* This annotation is used to identify Setup methods. These can be used to compute arbitrary arguments for a test
* method (see {@link Test}), as well as to set field values. A test method can use a setup method, by specifying it in a
* {@link Arguments} annotation. A setup method can optionally take a {@link SetupInfo} as an argument. The
* method (see {@link Test}), as well as to set field values. A test method can use a setup method, by specifying
* it in a {@link Arguments} annotation. A setup method can optionally take a {@link SetupInfo} as an argument. The
* arguments for the test methods are returned as a new object array.
*
* Examples on how to use test methods can be found in {@link ir_framework.examples.SetupExample} and also as part of the internal testing in the package {@link ir_framework.tests}.
* Examples on how to use test methods can be found in {@link ir_framework.examples.SetupExample} and also as part of the
* internal testing in the package {@link ir_framework.tests}.
*
* @see Arguments
* @see Setup
Original file line number Diff line number Diff line change
@@ -58,7 +58,7 @@ interface ArgumentsProvider {
*/
class ArgumentsProviderBuilder {
public static ArgumentsProvider build(Method method,
HashMap<String, Method> setupMethodMap) {
HashMap<String, Method> setupMethodMap) {
Arguments argumentsAnnotation = method.getAnnotation(Arguments.class);
if (argumentsAnnotation == null) {
return new DefaultArgumentsProvider();
@@ -67,7 +67,7 @@ public static ArgumentsProvider build(Method method,
Argument[] values = argumentsAnnotation.values();
String setupMethodName = argumentsAnnotation.setup();

if (setupMethodName.length() > 0) {
if (!setupMethodName.isEmpty()) {
TestFormat.check(values.length == 0,
"@Arguments: Can only specify \"setup\" or \"values\" but not both in " + method);
TestFormat.check(setupMethodMap.containsKey(setupMethodName),