--- old/test/jtreg-ext/requires/VMProps.java 2019-07-17 14:12:23.444659154 +0200 +++ new/test/jtreg-ext/requires/VMProps.java 2019-07-17 14:12:23.161658623 +0200 @@ -455,7 +455,7 @@ } private boolean checkDockerSupport() throws IOException, InterruptedException { - ProcessBuilder pb = new ProcessBuilder("docker", "ps"); + ProcessBuilder pb = new ProcessBuilder(Platform.DOCKER_COMMAND, "ps"); Process p = pb.start(); p.waitFor(10, TimeUnit.SECONDS); --- old/test/lib/jdk/test/lib/Platform.java 2019-07-17 14:12:24.272660707 +0200 +++ new/test/lib/jdk/test/lib/Platform.java 2019-07-17 14:12:23.928660062 +0200 @@ -33,6 +33,12 @@ import java.security.PrivilegedExceptionAction; public class Platform { + // Use this property to specify docker location on your system. + // E.g.: "/usr/local/bin/docker". We define this constant here so + // that it can be used in VMProps as well which checks docker support + // via this command + public static final String DOCKER_COMMAND = + System.getProperty("jdk.test.docker.command", "docker"); public static final String vmName = privilegedGetProperty("java.vm.name"); public static final String vmInfo = privilegedGetProperty("java.vm.info"); private static final String osVersion = privilegedGetProperty("os.version"); --- old/test/lib/jdk/test/lib/containers/cgroup/MetricsTester.java 2019-07-17 14:12:25.084662230 +0200 +++ new/test/lib/jdk/test/lib/containers/cgroup/MetricsTester.java 2019-07-17 14:12:24.766661634 +0200 @@ -531,16 +531,20 @@ long newUsage = metrics.getCpuUsage(); long[] newPerCpu = metrics.getPerCpuUsage(); - if (newSysVal <= startSysVal) { + // system/user CPU usage counters may be slowly increasing. + // allow for equal values for a pass + if (newSysVal < startSysVal) { fail(SubSystem.CPU, "getCpuSystemUsage", newSysVal, startSysVal); } - if (newUserVal <= startUserVal) { + // system/user CPU usage counters may be slowly increasing. + // allow for equal values for a pass + if (newUserVal < startUserVal) { fail(SubSystem.CPU, "getCpuUserUsage", newUserVal, startUserVal); } if (newUsage <= startUsage) { - fail(SubSystem.CPU, "getCpuUserUsage", newUsage, startUsage); + fail(SubSystem.CPU, "getCpuUsage", newUsage, startUsage); } boolean success = false; --- old/test/lib/jdk/test/lib/containers/docker/DockerTestUtils.java 2019-07-17 14:12:25.882663727 +0200 +++ new/test/lib/jdk/test/lib/containers/docker/DockerTestUtils.java 2019-07-17 14:12:25.566663135 +0200 @@ -37,6 +37,8 @@ import java.util.ArrayList; import java.util.Collections; import java.util.List; +import java.util.Map; +import jdk.test.lib.Platform; import jdk.test.lib.Utils; import jdk.test.lib.process.OutputAnalyzer; import jdk.test.lib.process.ProcessTools; @@ -54,11 +56,6 @@ // diagnostic information. private static final int MAX_LINES_TO_COPY_FOR_CHILD_STDOUT = 100; - // Use this property to specify docker location on your system. - // E.g.: "/usr/local/bin/docker". - private static final String DOCKER_COMMAND = - System.getProperty("jdk.test.docker.command", "docker"); - // Set this property to true to retain image after test. By default // images are removed after test execution completes. // Retaining the image can be useful for diagnostics and image inspection. @@ -116,7 +113,7 @@ */ private static boolean isDockerEngineAvailableCheck() throws Exception { try { - execute(DOCKER_COMMAND, "ps") + execute(Platform.DOCKER_COMMAND, "ps") .shouldHaveExitValue(0) .shouldContain("CONTAINER") .shouldContain("IMAGE"); @@ -179,9 +176,8 @@ DockerfileConfig.getBaseImageVersion()); try { // Build the docker - execute(DOCKER_COMMAND, "build", "--no-cache", "--tag", imageName, buildDir.toString()) - .shouldHaveExitValue(0) - .shouldContain("Successfully built"); + execute(Platform.DOCKER_COMMAND, "build", "--no-cache", "--tag", imageName, buildDir.toString()) + .shouldHaveExitValue(0); } catch (Exception e) { // If docker image building fails there is a good chance it happens due to environment and/or // configuration other than product failure. Throw jtreg skipped exception in such case @@ -202,7 +198,7 @@ public static List buildJavaCommand(DockerRunOptions opts) throws Exception { List cmd = new ArrayList<>(); - cmd.add(DOCKER_COMMAND); + cmd.add(Platform.DOCKER_COMMAND); cmd.add("run"); if (opts.tty) cmd.add("--tty=true"); @@ -244,7 +240,7 @@ * @throws Exception */ public static void removeDockerImage(String imageNameAndTag) throws Exception { - execute(DOCKER_COMMAND, "rmi", "--force", imageNameAndTag); + execute(Platform.DOCKER_COMMAND, "rmi", "--force", imageNameAndTag); }