test/jtreg-ext/requires/VMProps.java
branchdatagramsocketimpl-branch
changeset 58678 9cf78a70fa4f
parent 54538 ef331769d4ab
child 58679 9c3209ff7550
equal deleted inserted replaced
58677:13588c901957 58678:9cf78a70fa4f
    44 import sun.hotspot.code.Compiler;
    44 import sun.hotspot.code.Compiler;
    45 import sun.hotspot.cpuinfo.CPUInfo;
    45 import sun.hotspot.cpuinfo.CPUInfo;
    46 import sun.hotspot.gc.GC;
    46 import sun.hotspot.gc.GC;
    47 import sun.hotspot.WhiteBox;
    47 import sun.hotspot.WhiteBox;
    48 import jdk.test.lib.Platform;
    48 import jdk.test.lib.Platform;
       
    49 import jdk.test.lib.Container;
    49 
    50 
    50 /**
    51 /**
    51  * The Class to be invoked by jtreg prior Test Suite execution to
    52  * The Class to be invoked by jtreg prior Test Suite execution to
    52  * collect information about VM.
    53  * collect information about VM.
    53  * Do not use any APIs that may not be available in all target VMs.
    54  * Do not use any APIs that may not be available in all target VMs.
   232     /**
   233     /**
   233      * @return true if VM supports JVMCI and false otherwise
   234      * @return true if VM supports JVMCI and false otherwise
   234      */
   235      */
   235     protected String vmJvmci() {
   236     protected String vmJvmci() {
   236         // builds with jvmci have this flag
   237         // builds with jvmci have this flag
   237         return "" + (WB.getBooleanVMFlag("EnableJVMCI") != null);
   238         if (WB.getBooleanVMFlag("EnableJVMCI") == null) {
       
   239             return "false";
       
   240         }
       
   241 
       
   242         switch (GC.selected()) {
       
   243             case Serial:
       
   244             case Parallel:
       
   245             case G1:
       
   246                 // These GCs are supported with JVMCI
       
   247                 return "true";
       
   248             default:
       
   249                 break;
       
   250         }
       
   251 
       
   252         // Every other GC is not supported
       
   253         return "false";
   238     }
   254     }
   239 
   255 
   240     /**
   256     /**
   241      * @return true if VM runs in emulated-client mode and false otherwise.
   257      * @return true if VM runs in emulated-client mode and false otherwise.
   242      */
   258      */
   287      *
   303      *
   288      * @param map - property-value pairs
   304      * @param map - property-value pairs
   289      */
   305      */
   290     protected void vmOptFinalFlags(SafeMap map) {
   306     protected void vmOptFinalFlags(SafeMap map) {
   291         vmOptFinalFlag(map, "ClassUnloading");
   307         vmOptFinalFlag(map, "ClassUnloading");
       
   308         vmOptFinalFlag(map, "ClassUnloadingWithConcurrentMark");
   292         vmOptFinalFlag(map, "UseCompressedOops");
   309         vmOptFinalFlag(map, "UseCompressedOops");
   293         vmOptFinalFlag(map, "EnableJVMCI");
   310         vmOptFinalFlag(map, "EnableJVMCI");
   294         vmOptFinalFlag(map, "EliminateAllocations");
   311         vmOptFinalFlag(map, "EliminateAllocations");
   295     }
   312     }
   296 
   313 
   353         if (Platform.isWindows()) {
   370         if (Platform.isWindows()) {
   354             jaotc = bin.resolve("jaotc.exe");
   371             jaotc = bin.resolve("jaotc.exe");
   355         } else {
   372         } else {
   356             jaotc = bin.resolve("jaotc");
   373             jaotc = bin.resolve("jaotc");
   357         }
   374         }
   358         return "" + Files.exists(jaotc);
   375 
       
   376         if (!Files.exists(jaotc)) {
       
   377             // No jaotc => no AOT
       
   378             return "false";
       
   379         }
       
   380 
       
   381         switch (GC.selected()) {
       
   382             case Serial:
       
   383             case Parallel:
       
   384             case G1:
       
   385                 // These GCs are supported with AOT
       
   386                 return "true";
       
   387             default:
       
   388                 break;
       
   389         }
       
   390 
       
   391         // Every other GC is not supported
       
   392         return "false";
   359     }
   393     }
   360 
   394 
   361     /*
   395     /*
   362      * @return true if there is at least one loaded AOT'ed library.
   396      * @return true if there is at least one loaded AOT'ed library.
   363      */
   397      */
   453 
   487 
   454         return "" + isSupported;
   488         return "" + isSupported;
   455     }
   489     }
   456 
   490 
   457     private boolean checkDockerSupport() throws IOException, InterruptedException {
   491     private boolean checkDockerSupport() throws IOException, InterruptedException {
   458         ProcessBuilder pb = new ProcessBuilder("docker", "ps");
   492         ProcessBuilder pb = new ProcessBuilder(Container.ENGINE_COMMAND, "ps");
   459         Process p = pb.start();
   493         Process p = pb.start();
   460         p.waitFor(10, TimeUnit.SECONDS);
   494         p.waitFor(10, TimeUnit.SECONDS);
   461 
   495 
   462         return (p.exitValue() == 0);
   496         return (p.exitValue() == 0);
   463     }
   497     }