# HG changeset patch # User sgehwolf # Date 1563785294 -7200 # Node ID 07e998f8f816a83dbf8e25f54e5e63aef9186d1d # Parent d48ffad997b15b3f8a1b3a0e95d7cd0544133870 8228434: jdk/net/Sockets/Test.java fails after JDK-8227642 Summary: Move container constant to separate test lib class Reviewed-by: alanb diff -r d48ffad997b1 -r 07e998f8f816 test/hotspot/jtreg/TEST.ROOT --- a/test/hotspot/jtreg/TEST.ROOT Mon Jul 22 12:21:18 2019 +0200 +++ b/test/hotspot/jtreg/TEST.ROOT Mon Jul 22 10:48:14 2019 +0200 @@ -35,7 +35,9 @@ # to determine additional characteristics of the system for use with the @requires tag. # Note: compiled bootlibs code will be located in the folder 'bootClasses' requires.extraPropDefns = ../../jtreg-ext/requires/VMProps.java -requires.extraPropDefns.bootlibs = ../../lib/sun ../../lib/jdk/test/lib/Platform.java +requires.extraPropDefns.bootlibs = ../../lib/sun \ + ../../lib/jdk/test/lib/Platform.java \ + ../../lib/jdk/test/lib/Container.java requires.extraPropDefns.vmOpts = -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xbootclasspath/a:bootClasses requires.properties= \ sun.arch.data.model \ diff -r d48ffad997b1 -r 07e998f8f816 test/jdk/TEST.ROOT --- a/test/jdk/TEST.ROOT Mon Jul 22 12:21:18 2019 +0200 +++ b/test/jdk/TEST.ROOT Mon Jul 22 10:48:14 2019 +0200 @@ -37,7 +37,9 @@ # to determine additional characteristics of the system for use with the @requires tag. # Note: compiled bootlibs code will be located in the folder 'bootClasses' requires.extraPropDefns = ../jtreg-ext/requires/VMProps.java -requires.extraPropDefns.bootlibs = ../lib/sun ../lib/jdk/test/lib/Platform.java +requires.extraPropDefns.bootlibs = ../lib/sun \ + ../lib/jdk/test/lib/Platform.java \ + ../lib/jdk/test/lib/Container.java requires.extraPropDefns.vmOpts = -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xbootclasspath/a:bootClasses requires.properties= \ sun.arch.data.model \ diff -r d48ffad997b1 -r 07e998f8f816 test/jtreg-ext/requires/VMProps.java --- a/test/jtreg-ext/requires/VMProps.java Mon Jul 22 12:21:18 2019 +0200 +++ b/test/jtreg-ext/requires/VMProps.java Mon Jul 22 10:48:14 2019 +0200 @@ -46,6 +46,7 @@ import sun.hotspot.gc.GC; import sun.hotspot.WhiteBox; import jdk.test.lib.Platform; +import jdk.test.lib.Container; /** * The Class to be invoked by jtreg prior Test Suite execution to @@ -455,7 +456,7 @@ } private boolean checkDockerSupport() throws IOException, InterruptedException { - ProcessBuilder pb = new ProcessBuilder(Platform.DOCKER_COMMAND, "ps"); + ProcessBuilder pb = new ProcessBuilder(Container.ENGINE_COMMAND, "ps"); Process p = pb.start(); p.waitFor(10, TimeUnit.SECONDS); diff -r d48ffad997b1 -r 07e998f8f816 test/lib/jdk/test/lib/Container.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/lib/jdk/test/lib/Container.java Mon Jul 22 10:48:14 2019 +0200 @@ -0,0 +1,32 @@ +/* + * Copyright (c) 2019, Red Hat Inc. + * 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. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package jdk.test.lib; + +public class Container { + // 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 ENGINE_COMMAND = + System.getProperty("jdk.test.container.command", "docker"); +} diff -r d48ffad997b1 -r 07e998f8f816 test/lib/jdk/test/lib/Platform.java --- a/test/lib/jdk/test/lib/Platform.java Mon Jul 22 12:21:18 2019 +0200 +++ b/test/lib/jdk/test/lib/Platform.java Mon Jul 22 10:48:14 2019 +0200 @@ -33,12 +33,6 @@ 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"); diff -r d48ffad997b1 -r 07e998f8f816 test/lib/jdk/test/lib/containers/docker/DockerTestUtils.java --- a/test/lib/jdk/test/lib/containers/docker/DockerTestUtils.java Mon Jul 22 12:21:18 2019 +0200 +++ b/test/lib/jdk/test/lib/containers/docker/DockerTestUtils.java Mon Jul 22 10:48:14 2019 +0200 @@ -37,7 +37,7 @@ import java.util.ArrayList; import java.util.Collections; import java.util.List; -import jdk.test.lib.Platform; +import jdk.test.lib.Container; import jdk.test.lib.Utils; import jdk.test.lib.process.OutputAnalyzer; import jdk.test.lib.process.ProcessTools; @@ -112,7 +112,7 @@ */ private static boolean isDockerEngineAvailableCheck() throws Exception { try { - execute(Platform.DOCKER_COMMAND, "ps") + execute(Container.ENGINE_COMMAND, "ps") .shouldHaveExitValue(0) .shouldContain("CONTAINER") .shouldContain("IMAGE"); @@ -175,7 +175,7 @@ DockerfileConfig.getBaseImageVersion()); try { // Build the docker - execute(Platform.DOCKER_COMMAND, "build", "--no-cache", "--tag", imageName, buildDir.toString()) + execute(Container.ENGINE_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 @@ -197,7 +197,7 @@ public static List buildJavaCommand(DockerRunOptions opts) throws Exception { List cmd = new ArrayList<>(); - cmd.add(Platform.DOCKER_COMMAND); + cmd.add(Container.ENGINE_COMMAND); cmd.add("run"); if (opts.tty) cmd.add("--tty=true"); @@ -239,7 +239,7 @@ * @throws Exception */ public static void removeDockerImage(String imageNameAndTag) throws Exception { - execute(Platform.DOCKER_COMMAND, "rmi", "--force", imageNameAndTag); + execute(Container.ENGINE_COMMAND, "rmi", "--force", imageNameAndTag); }