37 * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI gc.logging.TestGCId |
36 * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI gc.logging.TestGCId |
38 */ |
37 */ |
39 |
38 |
40 import jdk.test.lib.process.OutputAnalyzer; |
39 import jdk.test.lib.process.OutputAnalyzer; |
41 import jdk.test.lib.process.ProcessTools; |
40 import jdk.test.lib.process.ProcessTools; |
|
41 import jtreg.SkippedException; |
42 import sun.hotspot.gc.GC; |
42 import sun.hotspot.gc.GC; |
43 |
43 |
44 public class TestGCId { |
44 public class TestGCId { |
45 public static void main(String[] args) throws Exception { |
45 public static void main(String[] args) throws Exception { |
46 testGCId("UseParallelGC"); |
46 boolean noneGCSupported = true; |
47 testGCId("UseG1GC"); |
47 |
48 testGCId("UseConcMarkSweepGC"); |
48 if (GC.Parallel.isSupported()) { |
49 testGCId("UseSerialGC"); |
49 noneGCSupported = false; |
|
50 testGCId("UseParallelGC"); |
|
51 } |
|
52 if (GC.G1.isSupported()) { |
|
53 noneGCSupported = false; |
|
54 testGCId("UseG1GC"); |
|
55 } |
|
56 if (GC.ConcMarkSweep.isSupported()) { |
|
57 noneGCSupported = false; |
|
58 testGCId("UseConcMarkSweepGC"); |
|
59 } |
|
60 if (GC.Serial.isSupported()) { |
|
61 noneGCSupported = false; |
|
62 testGCId("UseSerialGC"); |
|
63 } |
50 if (GC.Shenandoah.isSupported()) { |
64 if (GC.Shenandoah.isSupported()) { |
51 testGCId("UseShenandoahGC"); |
65 noneGCSupported = false; |
|
66 testGCId("UseShenandoahGC"); |
|
67 } |
|
68 |
|
69 if (noneGCSupported) { |
|
70 throw new SkippedException("Skipping test because none of Parallel/G1/ConcMarkSweep/Serial/Shenandoah is supported."); |
52 } |
71 } |
53 } |
72 } |
54 |
73 |
55 private static void verifyContainsGCIDs(OutputAnalyzer output) { |
74 private static void verifyContainsGCIDs(OutputAnalyzer output) { |
56 output.shouldMatch("\\[.*\\]\\[.*\\]\\[.*\\] GC\\(0\\) "); |
75 output.shouldMatch("\\[.*\\]\\[.*\\]\\[.*\\] GC\\(0\\) "); |