Skip to content

Commit e2a660b

Browse files
tkrodriguezdougxc
authored andcommitted
Properly run each HumongousReferenceObjectTest test individually in separate invocation
1 parent be12157 commit e2a660b

File tree

1 file changed

+30
-8
lines changed

1 file changed

+30
-8
lines changed

compiler/src/jdk.graal.compiler.test/src/jdk/graal/compiler/hotspot/test/HumongousReferenceObjectTest.java

+30-8
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,11 @@
2929
import java.util.Collections;
3030
import java.util.List;
3131

32-
import jdk.graal.compiler.core.test.SubprocessTest;
32+
import org.junit.Rule;
3333
import org.junit.Test;
34+
import org.junit.rules.TestName;
3435

36+
import jdk.graal.compiler.core.test.SubprocessTest;
3537
import jdk.internal.vm.annotation.Contended;
3638

3739
@SuppressWarnings("unused")
@@ -51,6 +53,8 @@ public static void testSnippet() {
5153
}
5254
}
5355

56+
@Rule public TestName currentTest = new TestName();
57+
5458
public void runSubprocessTest(String... args) throws IOException, InterruptedException {
5559
List<String> newArgs = new ArrayList<>();
5660
Collections.addAll(newArgs, args);
@@ -59,23 +63,41 @@ public void runSubprocessTest(String... args) throws IOException, InterruptedExc
5963
newArgs.remove("-XX:+UseG1GC");
6064
newArgs.remove("-XX:+UseParallelGC");
6165

62-
launchSubprocess(() -> {
66+
launchSubprocess(currentTest.getMethodName(), () -> {
6367
test("testSnippet");
6468
}, newArgs.toArray(new String[0]));
6569

6670
// Test without assertions as well
6771
newArgs.add("-da");
68-
launchSubprocess(() -> {
72+
launchSubprocess(currentTest.getMethodName(), () -> {
6973
test("testSnippet");
7074
}, newArgs.toArray(new String[0]));
7175
}
7276

77+
// Checkstyle: stop method name check
7378
@Test
74-
public void testG1() throws IOException, InterruptedException {
75-
String[] sizes = {"-XX:G1HeapRegionSize=1M", "-XX:G1HeapRegionSize=2M", "-XX:G1HeapRegionSize=4M", "-XX:G1HeapRegionSize=8M"};
76-
for (String size : sizes) {
77-
runSubprocessTest("-XX:+UseG1GC", "-XX:+EnableContended", "-XX:-RestrictContended", "-Xmx128m", "-XX:ContendedPaddingWidth=8192", size);
78-
}
79+
public void testG1_1M() throws IOException, InterruptedException {
80+
testG1("-XX:G1HeapRegionSize=1M");
81+
}
82+
83+
@Test
84+
public void testG1_2M() throws IOException, InterruptedException {
85+
testG1("-XX:G1HeapRegionSize=2M");
86+
}
87+
88+
@Test
89+
public void testG1_4M() throws IOException, InterruptedException {
90+
testG1("-XX:G1HeapRegionSize=4M");
91+
}
92+
93+
@Test
94+
public void testG1_8M() throws IOException, InterruptedException {
95+
testG1("-XX:G1HeapRegionSize=9M");
96+
}
97+
// Checkstyle: resume method name check
98+
99+
public void testG1(String size) throws IOException, InterruptedException {
100+
runSubprocessTest("-XX:+UseG1GC", "-XX:+EnableContended", "-XX:-RestrictContended", "-Xmx128m", "-XX:ContendedPaddingWidth=8192", size);
79101
}
80102

81103
@Test

0 commit comments

Comments
 (0)