test/hotspot/jtreg/serviceability/sa/TestUniverse.java
changeset 50525 767cdb97f103
parent 50523 7b7c75d87f9b
child 50589 e5d741569070
equal deleted inserted replaced
50524:04f4e983c2f7 50525:767cdb97f103
    34 import jdk.test.lib.process.OutputAnalyzer;
    34 import jdk.test.lib.process.OutputAnalyzer;
    35 
    35 
    36 /*
    36 /*
    37  * @test
    37  * @test
    38  * @summary Test the 'universe' command of jhsdb clhsdb.
    38  * @summary Test the 'universe' command of jhsdb clhsdb.
       
    39  * @requires vm.gc != "Z"
    39  * @bug 8190307
    40  * @bug 8190307
    40  * @library /test/lib
    41  * @library /test/lib
    41  * @build jdk.test.lib.apps.*
    42  * @build jdk.test.lib.apps.*
    42  * @build sun.hotspot.WhiteBox
    43  * @build sun.hotspot.WhiteBox
    43  * @run driver ClassFileInstaller sun.hotspot.WhiteBox sun.hotspot.WhiteBox$WhiteBoxPermission
    44  * @run driver ClassFileInstaller sun.hotspot.WhiteBox sun.hotspot.WhiteBox$WhiteBoxPermission
    44  * @run main/othervm -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xbootclasspath/a:. TestUniverse
    45  * @run main/othervm -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xbootclasspath/a:. TestUniverse withoutZ
       
    46  */
       
    47 
       
    48 /*
       
    49  * @test
       
    50  * @summary Test the 'universe' command of jhsdb clhsdb.
       
    51  * @requires vm.gc == "Z"
       
    52  * @bug 8190307
       
    53  * @library /test/lib
       
    54  * @build jdk.test.lib.apps.*
       
    55  * @build sun.hotspot.WhiteBox
       
    56  * @run driver ClassFileInstaller sun.hotspot.WhiteBox sun.hotspot.WhiteBox$WhiteBoxPermission
       
    57  * @run main/othervm -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xbootclasspath/a:. TestUniverse withZ
    45  */
    58  */
    46 
    59 
    47 public class TestUniverse {
    60 public class TestUniverse {
    48 
    61 
    49     private static void testClhsdbForUniverse(long lingeredAppPid,
    62     private static void testClhsdbForUniverse(long lingeredAppPid,
    81         try {
    94         try {
    82             p.waitFor();
    95             p.waitFor();
    83         } catch (InterruptedException ie) {
    96         } catch (InterruptedException ie) {
    84             p.destroyForcibly();
    97             p.destroyForcibly();
    85             throw new Error("Problem awaiting the child process: " + ie, ie);
    98             throw new Error("Problem awaiting the child process: " + ie, ie);
       
    99         }
       
   100         if (gc.contains("UseZGC")) {
       
   101             output.shouldContain("ZHeap");
    86         }
   102         }
    87 
   103 
    88         output.shouldHaveExitValue(0);
   104         output.shouldHaveExitValue(0);
    89         System.out.println(output.getOutput());
   105         System.out.println(output.getOutput());
    90 
   106 
   140 
   156 
   141         try {
   157         try {
   142             test("-XX:+UseG1GC");
   158             test("-XX:+UseG1GC");
   143             test("-XX:+UseParallelGC");
   159             test("-XX:+UseParallelGC");
   144             test("-XX:+UseSerialGC");
   160             test("-XX:+UseSerialGC");
   145             if (!Compiler.isGraalEnabled()) { // Graal does not support CMS
   161             if (!Compiler.isGraalEnabled()) { // Graal does not support all GCs
   146               test("-XX:+UseConcMarkSweepGC");
   162                 test("-XX:+UseConcMarkSweepGC");
       
   163                 if (args[0].equals("withZ")) {
       
   164                     test("-XX:+UseZGC");
       
   165                 }
   147             }
   166             }
   148             test("-XX:+UseEpsilonGC");
   167             test("-XX:+UseEpsilonGC");
   149         } catch (Exception e) {
   168         } catch (Exception e) {
   150             throw new Error("Test failed with " + e);
   169             throw new Error("Test failed with " + e);
   151         }
   170         }