author | lkorinth |
Wed, 13 Nov 2019 11:37:29 +0100 | |
changeset 59053 | ba6c248cae19 |
parent 57767 | b3e44e1b135d |
permissions | -rw-r--r-- |
39704 | 1 |
/* |
53523
4c5184c56dc2
8214799: Add package declaration to each JTREG test case in the gc folder
lkorinth
parents:
52925
diff
changeset
|
2 |
* Copyright (c) 2015, 2019, Oracle and/or its affiliates. All rights reserved. |
39704 | 3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 |
* |
|
5 |
* This code is free software; you can redistribute it and/or modify it |
|
6 |
* under the terms of the GNU General Public License version 2 only, as |
|
7 |
* published by the Free Software Foundation. |
|
8 |
* |
|
9 |
* This code is distributed in the hope that it will be useful, but WITHOUT |
|
10 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
11 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
|
12 |
* version 2 for more details (a copy is included in the LICENSE file that |
|
13 |
* accompanied this code). |
|
14 |
* |
|
15 |
* You should have received a copy of the GNU General Public License version |
|
16 |
* 2 along with this work; if not, write to the Free Software Foundation, |
|
17 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
|
18 |
* |
|
19 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
|
20 |
* or visit www.oracle.com if you need additional information or have any |
|
21 |
* questions. |
|
22 |
*/ |
|
23 |
||
53523
4c5184c56dc2
8214799: Add package declaration to each JTREG test case in the gc folder
lkorinth
parents:
52925
diff
changeset
|
24 |
package gc.ergonomics; |
4c5184c56dc2
8214799: Add package declaration to each JTREG test case in the gc folder
lkorinth
parents:
52925
diff
changeset
|
25 |
|
39704 | 26 |
/* |
27 |
* @test TestInitialGCThreadLogging |
|
28 |
* @bug 8157240 |
|
29 |
* @summary Check trace logging of initial GC threads. |
|
30 |
* @key gc |
|
31 |
* @modules java.base/jdk.internal.misc |
|
40631
ed82623d7831
8157957: ClassNotFoundException: jdk.test.lib.JDKToolFinder
ctornqvi
parents:
39704
diff
changeset
|
32 |
* @library /test/lib |
52925
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
47216
diff
changeset
|
33 |
* @build sun.hotspot.WhiteBox |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
47216
diff
changeset
|
34 |
* @run driver ClassFileInstaller sun.hotspot.WhiteBox sun.hotspot.WhiteBox$WhiteBoxPermission |
53523
4c5184c56dc2
8214799: Add package declaration to each JTREG test case in the gc folder
lkorinth
parents:
52925
diff
changeset
|
35 |
* @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI gc.ergonomics.TestInitialGCThreadLogging |
39704 | 36 |
*/ |
37 |
||
40631
ed82623d7831
8157957: ClassNotFoundException: jdk.test.lib.JDKToolFinder
ctornqvi
parents:
39704
diff
changeset
|
38 |
import jdk.test.lib.process.ProcessTools; |
ed82623d7831
8157957: ClassNotFoundException: jdk.test.lib.JDKToolFinder
ctornqvi
parents:
39704
diff
changeset
|
39 |
import jdk.test.lib.process.OutputAnalyzer; |
54638
9b8926bf85c1
8220813: update hotspot tier1_gc tests depending on GC to use @requires vm.gc.X
lmesnik
parents:
53523
diff
changeset
|
40 |
import jtreg.SkippedException; |
52925
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
47216
diff
changeset
|
41 |
import sun.hotspot.gc.GC; |
39704 | 42 |
|
43 |
public class TestInitialGCThreadLogging { |
|
44 |
public static void main(String[] args) throws Exception { |
|
54638
9b8926bf85c1
8220813: update hotspot tier1_gc tests depending on GC to use @requires vm.gc.X
lmesnik
parents:
53523
diff
changeset
|
45 |
boolean noneGCSupported = true; |
39704 | 46 |
|
54638
9b8926bf85c1
8220813: update hotspot tier1_gc tests depending on GC to use @requires vm.gc.X
lmesnik
parents:
53523
diff
changeset
|
47 |
if (GC.G1.isSupported()) { |
9b8926bf85c1
8220813: update hotspot tier1_gc tests depending on GC to use @requires vm.gc.X
lmesnik
parents:
53523
diff
changeset
|
48 |
noneGCSupported = false; |
9b8926bf85c1
8220813: update hotspot tier1_gc tests depending on GC to use @requires vm.gc.X
lmesnik
parents:
53523
diff
changeset
|
49 |
testInitialGCThreadLogging("UseG1GC", "GC Thread"); |
9b8926bf85c1
8220813: update hotspot tier1_gc tests depending on GC to use @requires vm.gc.X
lmesnik
parents:
53523
diff
changeset
|
50 |
} |
39704 | 51 |
|
54638
9b8926bf85c1
8220813: update hotspot tier1_gc tests depending on GC to use @requires vm.gc.X
lmesnik
parents:
53523
diff
changeset
|
52 |
if (GC.Parallel.isSupported()) { |
9b8926bf85c1
8220813: update hotspot tier1_gc tests depending on GC to use @requires vm.gc.X
lmesnik
parents:
53523
diff
changeset
|
53 |
noneGCSupported = false; |
57767
b3e44e1b135d
8224659: Parallel GC: Use WorkGang (1: PCRefProcTask)
lkorinth
parents:
54638
diff
changeset
|
54 |
testInitialGCThreadLogging("UseParallelGC", "GC Thread"); |
54638
9b8926bf85c1
8220813: update hotspot tier1_gc tests depending on GC to use @requires vm.gc.X
lmesnik
parents:
53523
diff
changeset
|
55 |
} |
52925
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
47216
diff
changeset
|
56 |
|
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
47216
diff
changeset
|
57 |
if (GC.Shenandoah.isSupported()) { |
54638
9b8926bf85c1
8220813: update hotspot tier1_gc tests depending on GC to use @requires vm.gc.X
lmesnik
parents:
53523
diff
changeset
|
58 |
noneGCSupported = false; |
9b8926bf85c1
8220813: update hotspot tier1_gc tests depending on GC to use @requires vm.gc.X
lmesnik
parents:
53523
diff
changeset
|
59 |
testInitialGCThreadLogging("UseShenandoahGC", "Shenandoah GC Thread"); |
9b8926bf85c1
8220813: update hotspot tier1_gc tests depending on GC to use @requires vm.gc.X
lmesnik
parents:
53523
diff
changeset
|
60 |
} |
9b8926bf85c1
8220813: update hotspot tier1_gc tests depending on GC to use @requires vm.gc.X
lmesnik
parents:
53523
diff
changeset
|
61 |
|
9b8926bf85c1
8220813: update hotspot tier1_gc tests depending on GC to use @requires vm.gc.X
lmesnik
parents:
53523
diff
changeset
|
62 |
if (noneGCSupported) { |
59053
ba6c248cae19
8232365: Implementation for JEP 363: Remove the Concurrent Mark Sweep (CMS) Garbage Collector
lkorinth
parents:
57767
diff
changeset
|
63 |
throw new SkippedException("Skipping test because none of G1/Parallel/Shenandoah is supported."); |
52925
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
47216
diff
changeset
|
64 |
} |
39704 | 65 |
} |
66 |
||
67 |
private static void verifyDynamicNumberOfGCThreads(OutputAnalyzer output, String threadName) { |
|
68 |
output.shouldHaveExitValue(0); // test should run succesfully |
|
69 |
output.shouldContain(threadName); |
|
70 |
} |
|
71 |
||
72 |
private static void testInitialGCThreadLogging(String gcFlag, String threadName) throws Exception { |
|
73 |
// UseDynamicNumberOfGCThreads and TraceDynamicGCThreads enabled |
|
52925
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
47216
diff
changeset
|
74 |
String[] baseArgs = {"-XX:+UnlockExperimentalVMOptions", "-XX:+" + gcFlag, "-Xmx10M", "-XX:+UseDynamicNumberOfGCThreads", "-Xlog:gc+task=trace", "-version"}; |
39704 | 75 |
|
76 |
// Base test with gc and +UseDynamicNumberOfGCThreads: |
|
77 |
ProcessBuilder pb_enabled = ProcessTools.createJavaProcessBuilder(baseArgs); |
|
78 |
verifyDynamicNumberOfGCThreads(new OutputAnalyzer(pb_enabled.start()), threadName); |
|
79 |
} |
|
80 |
} |