Skip to content

Commit a128c80

Browse files
author
Andrew Lu
committed
8315936: Parallelize gc/stress/TestStressG1Humongous.java test
Backport-of: 3f19df685c342cef212305cca630331878a24e79
1 parent 2e640b8 commit a128c80

File tree

1 file changed

+39
-10
lines changed

1 file changed

+39
-10
lines changed

test/hotspot/jtreg/gc/stress/TestStressG1Humongous.java

Lines changed: 39 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -24,14 +24,41 @@
2424
package gc.stress;
2525

2626
/*
27-
* @test TestStressG1Humongous
27+
* @test
2828
* @key stress
2929
* @summary Stress G1 by humongous allocations in situation near OOM
3030
* @requires vm.gc.G1
3131
* @requires !vm.flightRecorder
3232
* @library /test/lib
3333
* @modules java.base/jdk.internal.misc
34-
* @run driver/timeout=1300 gc.stress.TestStressG1Humongous
34+
* @run driver/timeout=180 gc.stress.TestStressG1Humongous 4 3 1.1 120
35+
*/
36+
37+
/*
38+
* @test
39+
* @requires vm.gc.G1
40+
* @requires !vm.flightRecorder
41+
* @library /test/lib
42+
* @modules java.base/jdk.internal.misc
43+
* @run driver/timeout=180 gc.stress.TestStressG1Humongous 16 5 2.1 120
44+
*/
45+
46+
/*
47+
* @test
48+
* @requires vm.gc.G1
49+
* @requires !vm.flightRecorder
50+
* @library /test/lib
51+
* @modules java.base/jdk.internal.misc
52+
* @run driver/timeout=180 gc.stress.TestStressG1Humongous 32 4 0.6 120
53+
*/
54+
55+
/*
56+
* @test
57+
* @requires vm.gc.G1
58+
* @requires !vm.flightRecorder
59+
* @library /test/lib
60+
* @modules java.base/jdk.internal.misc
61+
* @run driver/timeout=900 gc.stress.TestStressG1Humongous 1 7 0.6 600
3562
*/
3663

3764
import java.util.ArrayList;
@@ -48,17 +75,19 @@
4875
public class TestStressG1Humongous{
4976

5077
public static void main(String[] args) throws Exception {
78+
if (args.length != 4) {
79+
throw new IllegalArgumentException("Test expects 4 arguments");
80+
}
81+
5182
// Limit heap size on 32-bit platforms
5283
int heapSize = Platform.is32bit() ? 512 : 1024;
53-
// Heap size, region size, threads, humongous size, timeout
54-
run(heapSize, 4, 3, 1.1, 120);
55-
run(heapSize, 16, 5, 2.1, 120);
56-
run(heapSize, 32, 4, 0.6, 120);
57-
run(heapSize, 1, 7, 0.6, 600);
58-
}
5984

60-
private static void run(int heapSize, int regionSize, int threads, double humongousSize, int timeout)
61-
throws Exception {
85+
// Region size, threads, humongous size, and timeout passed as @run arguments
86+
int regionSize = Integer.parseInt(args[0]);
87+
int threads = Integer.parseInt(args[1]);
88+
double humongousSize = Double.parseDouble(args[2]);
89+
int timeout = Integer.parseInt(args[3]);
90+
6291
ArrayList<String> options = new ArrayList<>();
6392
Collections.addAll(options, Utils.getTestJavaOpts());
6493
Collections.addAll(options,

0 commit comments

Comments
 (0)