--- old/test/jtreg-ext/requires/VMProps.java 2017-09-28 15:04:41.996881024 -0700 +++ new/test/jtreg-ext/requires/VMProps.java 2017-09-28 15:04:41.884881021 -0700 @@ -73,6 +73,7 @@ map.put("vm.aot", vmAOT()); // vm.cds is true if the VM is compiled with cds support. map.put("vm.cds", vmCDS()); + map.put("docker.support", dockerSupport()); vmGC(map); // vm.gc.X = true/false VMProps.dump(map); @@ -293,6 +294,33 @@ } /** + * A simple check for docker support + * + * @return true if docker is supported in a given environment + */ + protected String dockerSupport() { + boolean isSupported; + try { + isSupported = checkDockerSupport(); + } catch (Exception e) { + isSupported = false; + System.err.println("dockerSupprt() threw exception: " + e); + } + + return (isSupported) ? "true" : "false"; + } + + private boolean checkDockerSupport() throws IOException, InterruptedException { + ProcessBuilder pb = new ProcessBuilder("docker", "ps"); + Process p = pb.start(); + p.waitFor(); + + return (p.exitValue() == 0); + } + + + + /** * Dumps the map to the file if the file name is given as the property. * This functionality could be helpful to know context in the real * execution.