test/hotspot/jtreg/gc/logging/TestGCId.java
changeset 52925 9c18c9d839d3
parent 47216 71c04702a3d5
child 53523 4c5184c56dc2
--- a/test/hotspot/jtreg/gc/logging/TestGCId.java	Mon Dec 10 17:34:49 2018 +0300
+++ b/test/hotspot/jtreg/gc/logging/TestGCId.java	Mon Dec 10 15:47:44 2018 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2018, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -30,10 +30,14 @@
  * @library /test/lib
  * @modules java.base/jdk.internal.misc
  *          java.management
+ * @build sun.hotspot.WhiteBox
+ * @run driver ClassFileInstaller sun.hotspot.WhiteBox sun.hotspot.WhiteBox$WhiteBoxPermission
+ * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI TestGCId
  */
 
 import jdk.test.lib.process.OutputAnalyzer;
 import jdk.test.lib.process.ProcessTools;
+import sun.hotspot.gc.GC;
 
 public class TestGCId {
   public static void main(String[] args) throws Exception {
@@ -41,6 +45,9 @@
     testGCId("UseG1GC");
     testGCId("UseConcMarkSweepGC");
     testGCId("UseSerialGC");
+    if (GC.Shenandoah.isSupported()) {
+        testGCId("UseShenandoahGC");
+    }
   }
 
   private static void verifyContainsGCIDs(OutputAnalyzer output) {
@@ -51,7 +58,7 @@
 
   private static void testGCId(String gcFlag) throws Exception {
     ProcessBuilder pb_default =
-      ProcessTools.createJavaProcessBuilder("-XX:+" + gcFlag, "-Xlog:gc", "-Xmx10M", GCTest.class.getName());
+      ProcessTools.createJavaProcessBuilder("-XX:+UnlockExperimentalVMOptions", "-XX:+" + gcFlag, "-Xlog:gc", "-Xmx10M", GCTest.class.getName());
     verifyContainsGCIDs(new OutputAnalyzer(pb_default.start()));
   }