--- old/test/hotspot/jtreg/gc/stress/systemgc/TestSystemGC.java 2017-11-06 21:03:04.071702422 +0100 +++ new/test/hotspot/jtreg/gc/stress/systemgc/TestSystemGC.java 2017-11-06 21:03:03.656689767 +0100 @@ -90,6 +90,7 @@ private long delayMS; SystemGCTask(long delayMS) { +System.err.println("SystemGCTask with delay " + delayMS); this.delayMS = delayMS; } @@ -97,12 +98,14 @@ public void run() { while (!shouldExit()) { System.gc(); - ThreadUtils.sleep(delayMS); + ThreadUtils.sleep(delayMS * 10); } } } public class TestSystemGC { + private static long endTime; + private static final int numGroups = 7; private static final int numGCsPerGroup = 4; @@ -133,8 +136,11 @@ 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 +165,8 @@ } private static void runAllPhases() { - for (int i = 0; i < 4; i++) { + int i = 0; + while (i < 4 && System.currentTimeMillis() < endTime) { SystemGCTask gcTask = (i % 2 == 1) ? createSystemGCTask(numGroups / 3) : null; ShortLivedAllocationTask shortTask = @@ -178,15 +185,18 @@ exitTask(longTask); ThreadUtils.sleep(1000); + i++; } } public static void main(String[] args) { + if (args.length > 0) { + 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(); - } } } --- old/test/hotspot/jtreg/gc/stress/systemgc/TestSystemGCWithCMS.java 2017-11-06 21:03:05.516746488 +0100 +++ new/test/hotspot/jtreg/gc/stress/systemgc/TestSystemGCWithCMS.java 2017-11-06 21:03:05.104733924 +0100 @@ -24,11 +24,12 @@ /* * @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) { --- old/test/hotspot/jtreg/gc/stress/systemgc/TestSystemGCWithG1.java 2017-11-06 21:03:06.970790827 +0100 +++ new/test/hotspot/jtreg/gc/stress/systemgc/TestSystemGCWithG1.java 2017-11-06 21:03:06.560778324 +0100 @@ -24,11 +24,12 @@ /* * @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) { --- old/test/hotspot/jtreg/gc/stress/systemgc/TestSystemGCWithParallel.java 2017-11-06 21:03:08.452836021 +0100 +++ new/test/hotspot/jtreg/gc/stress/systemgc/TestSystemGCWithParallel.java 2017-11-06 21:03:08.021822877 +0100 @@ -24,11 +24,12 @@ /* * @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) { --- old/test/hotspot/jtreg/gc/stress/systemgc/TestSystemGCWithSerial.java 2017-11-06 21:03:09.940881397 +0100 +++ new/test/hotspot/jtreg/gc/stress/systemgc/TestSystemGCWithSerial.java 2017-11-06 21:03:09.525868742 +0100 @@ -24,11 +24,12 @@ /* * @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) {