< prev index next >

test/jdk/vm/JniLauncher.java

Print this page
rev 52683 : [mq]: 8213362

*** 22,78 **** * */ /** * @test ! * @bug 8067744 ! * @comment Test uses custom launcher that starts VM in primordial thread. This is ! * not possible on aix. ! * @requires os.family != "aix" * @library /test/lib * @modules java.base/jdk.internal.misc ! * @run main/native FPRegs */ import jdk.test.lib.Platform; import jdk.test.lib.Utils; - import jdk.test.lib.process.ProcessTools; import jdk.test.lib.process.OutputAnalyzer; - import java.io.File; import java.io.IOException; import java.nio.file.Files; import java.nio.file.Path; import java.nio.file.Paths; - import java.util.Optional; ! public class FPRegs { public static void main(String[] args) throws IOException { ! Path launcher = Paths.get(System.getProperty("test.nativepath"), "FPRegs" + (Platform.isWindows() ? ".exe" : "")); System.out.println("Launcher = " + launcher + (Files.exists(launcher) ? " (exists)" : " (not exists)")); ! Path jvmLib = findJVM(); ! ProcessBuilder pb = new ProcessBuilder(launcher.toString(), jvmLib.toString()); ! // bin as working directory to let Windows load dll ! pb.directory(jvmLib.getParent().getParent().toFile()); OutputAnalyzer outputf = new OutputAnalyzer(pb.start()); outputf.shouldHaveExitValue(0); } - - static Path findJVM() throws IOException { - String root = Utils.TEST_JDK; - String lib = System.mapLibraryName("jvm"); - System.out.println("Root = " + root); - System.out.println("Library = " + lib); - - Optional<Path> jvmLib = Files.find(new File(root).toPath(), 4, (p, attr) -> p.toFile().getName().equals(lib)).findFirst(); - Path p = null; - if (jvmLib.isPresent()) { - p = jvmLib.get().toRealPath(); - System.out.println("JVM = " + p); - } else { - System.out.println("TESTBUG: JVM not found in "); - Files.walk(new File(root).toPath(), 4).map(Path::toString).forEach(System.out::println); - } - return p; - } } --- 22,57 ---- * */ /** * @test ! * @bug 8213362 ! * @comment Test uses custom launcher that starts VM using JNI via libjli, only for MacOS ! * @requires os.family == "mac" * @library /test/lib * @modules java.base/jdk.internal.misc ! * @run main/native JniLauncher */ + import java.util.Map; import jdk.test.lib.Platform; import jdk.test.lib.Utils; import jdk.test.lib.process.OutputAnalyzer; import java.io.IOException; import java.nio.file.Files; import java.nio.file.Path; import java.nio.file.Paths; ! public class JniLauncher { public static void main(String[] args) throws IOException { ! Path launcher = Paths.get(System.getProperty("test.nativepath"), "JniLauncher" + (Platform.isWindows() ? ".exe" : "")); System.out.println("Launcher = " + launcher + (Files.exists(launcher) ? " (exists)" : " (not exists)")); ! ProcessBuilder pb = new ProcessBuilder(launcher.toString()); ! Map<String, String> env = pb.environment(); ! String libdir = Paths.get(Utils.TEST_JDK).resolve("lib").toAbsolutePath().toString(); ! env.compute("DYLD_LIBRARY_PATH", (k, v) -> (k == null) ? libdir : v + ":" + libdir); OutputAnalyzer outputf = new OutputAnalyzer(pb.start()); outputf.shouldHaveExitValue(0); } }
< prev index next >