diff --git a/make/RunTests.gmk b/make/RunTests.gmk index aee0c6696c6..732b8775d89 100644 --- a/make/RunTests.gmk +++ b/make/RunTests.gmk @@ -782,8 +782,6 @@ define SetupRunJtregTestBody # Make it possible to specify the JIB_DATA_DIR for tests using the # JIB Artifact resolver $1_JTREG_BASIC_OPTIONS += -e:JIB_DATA_DIR - # Some tests needs to find a boot JDK using the JDK8_HOME variable. - $1_JTREG_BASIC_OPTIONS += -e:JDK8_HOME=$$(BOOT_JDK) # If running on Windows, propagate the _NT_SYMBOL_PATH to enable # symbol lookup in hserr files ifeq ($$(call isTargetOs, windows), true) diff --git a/test/jdk/jdk/internal/jrtfs/remote/Main.java b/test/jdk/jdk/internal/jrtfs/remote/Main.java deleted file mode 100644 index 7242fa2e14c..00000000000 --- a/test/jdk/jdk/internal/jrtfs/remote/Main.java +++ /dev/null @@ -1,81 +0,0 @@ -/* - * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved. - * 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. - */ - -import java.io.IOException; -import java.net.URI; -import java.net.URL; -import java.net.URLClassLoader; -import java.nio.file.FileSystem; -import java.nio.file.FileSystems; -import java.nio.file.Files; -import java.nio.file.Path; -import java.nio.file.Paths; -import java.util.Collections; -import java.util.stream.Stream; - -/** - * Basic jrt file system functionality testing - * - */ -public class Main { - - public static void main(String[] args) throws Exception { - String javaHome = args[0]; - FileSystem fs = null; - boolean isInstalled = false; - if (args.length == 2) { - fs = createFsByInstalledProvider(); - isInstalled = true; - } else { - fs = createFsWithURLClassloader(javaHome); - } - - Path mods = fs.getPath("/modules"); - try (Stream stream = Files.walk(mods)) { - stream.forEach(path -> { - path.getFileName(); - }); - } finally { - try { - fs.close(); - } catch (UnsupportedOperationException e) { - if (!isInstalled) { - throw new RuntimeException( - "UnsupportedOperationException is thrown unexpectedly"); - } - } - } - } - - private static FileSystem createFsWithURLClassloader(String javaHome) throws IOException{ - URL url = Paths.get(javaHome, "lib", "jrt-fs.jar").toUri().toURL(); - URLClassLoader loader = new URLClassLoader(new URL[] { url }); - return FileSystems.newFileSystem(URI.create("jrt:/"), - Collections.emptyMap(), - loader); - } - - private static FileSystem createFsByInstalledProvider() throws IOException { - return FileSystems.getFileSystem(URI.create("jrt:/")); - } -} diff --git a/test/jdk/jdk/internal/jrtfs/remote/RemoteRuntimeImageTest.java b/test/jdk/jdk/internal/jrtfs/remote/RemoteRuntimeImageTest.java deleted file mode 100644 index 19bc703d5ad..00000000000 --- a/test/jdk/jdk/internal/jrtfs/remote/RemoteRuntimeImageTest.java +++ /dev/null @@ -1,119 +0,0 @@ -/* - * Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. - * 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. - */ - -/* - * @test - * @bug 8141609 8154403 - * @summary Verify JDK 8 can use jrt-fs.jar to work with jrt file system. - * @run main RemoteRuntimeImageTest - */ - -import java.io.File; -import java.io.FileInputStream; -import java.io.FileNotFoundException; -import java.io.IOException; -import java.nio.file.Files; -import java.nio.file.Path; -import java.nio.file.Paths; -import java.util.Arrays; -import java.util.List; -import java.util.Properties; -public class RemoteRuntimeImageTest { - //the jrt-fs.jar shipped together with jdk - private static final String JRTFS_JAR = "jrt-fs.jar"; - private static final String SRC_DIR = System.getProperty("test.src"); - private static final String CLASSES_DIR = "classes"; - private static final String TEST_JAVAHOME = System.getProperty("test.jdk"); - - public static void main(String[] args) throws Exception { - // By default, set to ${JT_JAVA} - String jdk8Home = System.getenv("JDK8_HOME"); - if (jdk8Home == null || jdk8Home.isEmpty()) { - System.err.println("Failed to locate JDK8 with system " - + "environment variable 'JDK8_HOME'. Skip testing!"); - return; - } - - Path jdk8Path = Paths.get(jdk8Home); - if (!isJdk8(jdk8Path)) { - System.err.println("This test is only for JDK 8. Skip testing"); - return; - } - - String java = jdk8Path.resolve("bin/java").toAbsolutePath().toString(); - String javac = jdk8Path.resolve("bin/javac").toAbsolutePath().toString(); - Files.createDirectories(Paths.get(".", CLASSES_DIR)); - String jrtJar = Paths.get(TEST_JAVAHOME, "lib", JRTFS_JAR).toAbsolutePath().toString(); - - // Compose command-lines for compiling and executing tests - List> cmds = Arrays.asList( - // Commands to compile test classes - Arrays.asList(javac, "-d", CLASSES_DIR, "-cp", jrtJar, - SRC_DIR + File.separatorChar + "Main.java"), - // Run test - Arrays.asList(java, "-cp", CLASSES_DIR, "Main", TEST_JAVAHOME), - // Run test with jrtfs.jar in class path, - // which means to install jrt FileSystem provider - Arrays.asList(java, "-cp", CLASSES_DIR + File.pathSeparatorChar + jrtJar, - "Main", TEST_JAVAHOME, "installed") - ); - - cmds.forEach(cmd -> execCmd(cmd)); - } - - private static void execCmd(List command){ - System.out.println(); - System.out.println("Executing command: " + command); - Process p = null; - try { - p = new ProcessBuilder(command).inheritIO().start(); - p.waitFor(); - int rc = p.exitValue(); - if (rc != 0) { - throw new RuntimeException("Unexpected exit code:" + rc); - } - } catch (IOException | InterruptedException e) { - throw new RuntimeException(e); - } finally { - if (p != null && p.isAlive()){ - p.destroy(); - } - } - } - - private static boolean isJdk8(Path jdk8HomePath) throws IOException { - File releaseFile = jdk8HomePath.resolve("release").toFile(); - if (!releaseFile.exists()) { - throw new RuntimeException(releaseFile.getPath() + - " doesn't exist"); - } - Properties props = new Properties(); - try (FileInputStream in = new FileInputStream(releaseFile)) { - props.load(in); - } - - String version = props.getProperty("JAVA_VERSION", ""); - System.out.println("JAVA_VERSION is " + version); - return version.startsWith("\"1.8"); - } -}