29
29
import java .util .Collections ;
30
30
import java .util .List ;
31
31
32
- import jdk . graal . compiler . core . test . SubprocessTest ;
32
+ import org . junit . Rule ;
33
33
import org .junit .Test ;
34
+ import org .junit .rules .TestName ;
34
35
36
+ import jdk .graal .compiler .core .test .SubprocessTest ;
35
37
import jdk .internal .vm .annotation .Contended ;
36
38
37
39
@ SuppressWarnings ("unused" )
@@ -51,6 +53,8 @@ public static void testSnippet() {
51
53
}
52
54
}
53
55
56
+ @ Rule public TestName currentTest = new TestName ();
57
+
54
58
public void runSubprocessTest (String ... args ) throws IOException , InterruptedException {
55
59
List <String > newArgs = new ArrayList <>();
56
60
Collections .addAll (newArgs , args );
@@ -59,23 +63,41 @@ public void runSubprocessTest(String... args) throws IOException, InterruptedExc
59
63
newArgs .remove ("-XX:+UseG1GC" );
60
64
newArgs .remove ("-XX:+UseParallelGC" );
61
65
62
- launchSubprocess (() -> {
66
+ launchSubprocess (currentTest . getMethodName (), () -> {
63
67
test ("testSnippet" );
64
68
}, newArgs .toArray (new String [0 ]));
65
69
66
70
// Test without assertions as well
67
71
newArgs .add ("-da" );
68
- launchSubprocess (() -> {
72
+ launchSubprocess (currentTest . getMethodName (), () -> {
69
73
test ("testSnippet" );
70
74
}, newArgs .toArray (new String [0 ]));
71
75
}
72
76
77
+ // Checkstyle: stop method name check
73
78
@ 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 );
79
101
}
80
102
81
103
@ Test
0 commit comments