8190703: TestSystemGCWith* infrequently times out on SPARC
Give the test a timeout after which it ends on its own. Reviewed-by: shade, sjohanss
This commit is contained in:
parent
10a1edcc22
commit
d7b2fafd3d
test/hotspot/jtreg/gc/stress/systemgc
@ -103,6 +103,8 @@ class SystemGCTask extends Exitable implements Runnable {
|
||||
}
|
||||
|
||||
public class TestSystemGC {
|
||||
private static long endTime;
|
||||
|
||||
private static final int numGroups = 7;
|
||||
private static final int numGCsPerGroup = 4;
|
||||
|
||||
@ -133,8 +135,11 @@ public class TestSystemGC {
|
||||
|
||||
for (int i = 0; i < numGroups; i++) {
|
||||
for (int j = 0; j < numGCsPerGroup; j++) {
|
||||
System.gc();
|
||||
ThreadUtils.sleep(getDelayMS(i));
|
||||
System.gc();
|
||||
if (System.currentTimeMillis() >= endTime) {
|
||||
return;
|
||||
}
|
||||
ThreadUtils.sleep(getDelayMS(i));
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -159,7 +164,7 @@ public class TestSystemGC {
|
||||
}
|
||||
|
||||
private static void runAllPhases() {
|
||||
for (int i = 0; i < 4; i++) {
|
||||
for (int i = 0; i < 4 && System.currentTimeMillis() < endTime; i++) {
|
||||
SystemGCTask gcTask =
|
||||
(i % 2 == 1) ? createSystemGCTask(numGroups / 3) : null;
|
||||
ShortLivedAllocationTask shortTask =
|
||||
@ -181,12 +186,15 @@ public class TestSystemGC {
|
||||
}
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
public static void main(String[] args) throws Exception {
|
||||
if (args.length == 0) {
|
||||
throw new IllegalArgumentException("Must specify timeout in seconds as first argument");
|
||||
}
|
||||
int timeout = Integer.parseInt(args[0]) * 1000;
|
||||
System.out.println("Running with timeout of " + timeout + "ms");
|
||||
endTime = System.currentTimeMillis() + timeout;
|
||||
// First allocate the long lived objects and then run all phases.
|
||||
populateLongLived();
|
||||
runAllPhases();
|
||||
if (args.length > 0 && args[0].equals("long")) {
|
||||
runAllPhases();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -24,14 +24,15 @@
|
||||
|
||||
/*
|
||||
* @test TestSystemGCWithCMS
|
||||
* @bug 8190703
|
||||
* @key gc
|
||||
* @key stress
|
||||
* @requires vm.gc.ConcMarkSweep
|
||||
* @summary Stress the CMS GC full GC by allocating objects of different lifetimes concurrently with System.gc().
|
||||
* @run main/othervm/timeout=300 -Xlog:gc*=info -Xmx512m -XX:+UseConcMarkSweepGC TestSystemGCWithCMS
|
||||
* @run main/othervm/timeout=300 -Xlog:gc*=info -Xmx512m -XX:+UseConcMarkSweepGC TestSystemGCWithCMS 270
|
||||
*/
|
||||
public class TestSystemGCWithCMS {
|
||||
public static void main(String[] args) {
|
||||
public static void main(String[] args) throws Exception {
|
||||
TestSystemGC.main(args);
|
||||
}
|
||||
}
|
||||
|
@ -24,14 +24,15 @@
|
||||
|
||||
/*
|
||||
* @test TestSystemGCWithG1
|
||||
* @bug 8190703
|
||||
* @key gc
|
||||
* @key stress
|
||||
* @requires vm.gc.G1
|
||||
* @summary Stress the G1 GC full GC by allocating objects of different lifetimes concurrently with System.gc().
|
||||
* @run main/othervm/timeout=300 -Xlog:gc*=info -Xmx512m -XX:+UseG1GC TestSystemGCWithG1
|
||||
* @run main/othervm/timeout=300 -Xlog:gc*=info -Xmx512m -XX:+UseG1GC TestSystemGCWithG1 270
|
||||
*/
|
||||
public class TestSystemGCWithG1 {
|
||||
public static void main(String[] args) {
|
||||
public static void main(String[] args) throws Exception {
|
||||
TestSystemGC.main(args);
|
||||
}
|
||||
}
|
||||
|
@ -24,14 +24,15 @@
|
||||
|
||||
/*
|
||||
* @test TestSystemGCWithParallel
|
||||
* @bug 8190703
|
||||
* @key gc
|
||||
* @key stress
|
||||
* @requires vm.gc.Parallel
|
||||
* @summary Stress the Parallel GC full GC by allocating objects of different lifetimes concurrently with System.gc().
|
||||
* @run main/othervm/timeout=300 -Xlog:gc*=info -Xmx512m -XX:+UseParallelGC TestSystemGCWithParallel
|
||||
* @run main/othervm/timeout=300 -Xlog:gc=info -Xmx512m -XX:+UseParallelGC TestSystemGCWithParallel 270
|
||||
*/
|
||||
public class TestSystemGCWithParallel {
|
||||
public static void main(String[] args) {
|
||||
public static void main(String[] args) throws Exception {
|
||||
TestSystemGC.main(args);
|
||||
}
|
||||
}
|
||||
|
@ -24,14 +24,15 @@
|
||||
|
||||
/*
|
||||
* @test TestSystemGCWithSerial
|
||||
* @bug 8190703
|
||||
* @key gc
|
||||
* @key stress
|
||||
* @requires vm.gc.Serial
|
||||
* @summary Stress the Serial GC full GC by allocating objects of different lifetimes concurrently with System.gc().
|
||||
* @run main/othervm/timeout=300 -Xlog:gc*=info -Xmx512m -XX:+UseSerialGC TestSystemGCWithSerial
|
||||
* @run main/othervm/timeout=300 -Xlog:gc*=info -Xmx512m -XX:+UseSerialGC TestSystemGCWithSerial 270
|
||||
*/
|
||||
public class TestSystemGCWithSerial {
|
||||
public static void main(String[] args) {
|
||||
public static void main(String[] args) throws Exception {
|
||||
TestSystemGC.main(args);
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user