< prev index next >

test/hotspot/jtreg/runtime/logging/SafepointCleanupTest.java

Print this page
rev 54612 : Checkpoint latest preliminary review patches for full OpenJDK review; merge with 8222295.patch.

@@ -1,7 +1,7 @@
 /*
- * Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2016, 2019, 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
  * under the terms of the GNU General Public License version 2 only, as
  * published by the Free Software Foundation.

@@ -27,16 +27,21 @@
  * @summary safepoint+cleanup=info should have output from the code
  * @library /test/lib
  * @modules java.base/jdk.internal.misc
  *          java.management
  * @run driver SafepointCleanupTest
+ * @run driver SafepointCleanupTest -XX:+AsyncDeflateIdleMonitors
  */
 
 import jdk.test.lib.process.OutputAnalyzer;
 import jdk.test.lib.process.ProcessTools;
 
 public class SafepointCleanupTest {
+    static final String ASYNC_DISABLE_OPTION = "-XX:-AsyncDeflateIdleMonitors";
+    static final String ASYNC_ENABLE_OPTION = "-XX:+AsyncDeflateIdleMonitors";
+    static final String UNLOCK_DIAG_OPTION = "-XX:+UnlockDiagnosticVMOptions";
+
     static void analyzeOutputOn(ProcessBuilder pb) throws Exception {
         OutputAnalyzer output = new OutputAnalyzer(pb.start());
         output.shouldContain("[safepoint,cleanup]");
         output.shouldContain("safepoint cleanup tasks");
         output.shouldContain("deflating global idle monitors");

@@ -52,23 +57,44 @@
         output.shouldNotContain("[safepoint,cleanup]");
         output.shouldHaveExitValue(0);
     }
 
     public static void main(String[] args) throws Exception {
+        String async_option;
+        if (args.length == 0) {
+            // By default test deflating idle monitors at a safepoint.
+            async_option = ASYNC_DISABLE_OPTION;
+        } else {
+            async_option = args[0];
+        }
+        if (!async_option.equals(ASYNC_DISABLE_OPTION) &&
+            !async_option.equals(ASYNC_ENABLE_OPTION)) {
+            throw new RuntimeException("Unknown async_option value: '"
+                                       + async_option + "'");
+        }
+
         ProcessBuilder pb = ProcessTools.createJavaProcessBuilder("-Xlog:safepoint+cleanup=info",
+                                                                  UNLOCK_DIAG_OPTION,
+                                                                  async_option,
                                                                   InnerClass.class.getName());
         analyzeOutputOn(pb);
 
         pb = ProcessTools.createJavaProcessBuilder("-XX:+TraceSafepointCleanupTime",
+                                                   UNLOCK_DIAG_OPTION,
+                                                   async_option,
                                                    InnerClass.class.getName());
         analyzeOutputOn(pb);
 
         pb = ProcessTools.createJavaProcessBuilder("-Xlog:safepoint+cleanup=off",
+                                                   UNLOCK_DIAG_OPTION,
+                                                   async_option,
                                                    InnerClass.class.getName());
         analyzeOutputOff(pb);
 
         pb = ProcessTools.createJavaProcessBuilder("-XX:-TraceSafepointCleanupTime",
+                                                   UNLOCK_DIAG_OPTION,
+                                                   async_option,
                                                    InnerClass.class.getName());
         analyzeOutputOff(pb);
     }
 
     public static class InnerClass {
< prev index next >