7 * published by the Free Software Foundation.
8 *
9 * This code is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * version 2 for more details (a copy is included in the LICENSE file that
13 * accompanied this code).
14 *
15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 *
23 */
24
25 /**
26 * @test
27 * @bug 8067744
28 * @comment Test uses custom launcher that starts VM in primordial thread. This is
29 * not possible on aix.
30 * @requires os.family != "aix"
31 * @library /test/lib
32 * @modules java.base/jdk.internal.misc
33 * @run main/native FPRegs
34 */
35
36 import jdk.test.lib.Platform;
37 import jdk.test.lib.Utils;
38 import jdk.test.lib.process.ProcessTools;
39 import jdk.test.lib.process.OutputAnalyzer;
40
41 import java.io.File;
42 import java.io.IOException;
43 import java.nio.file.Files;
44 import java.nio.file.Path;
45 import java.nio.file.Paths;
46 import java.util.Optional;
47
48 public class FPRegs {
49 public static void main(String[] args) throws IOException {
50 Path launcher = Paths.get(System.getProperty("test.nativepath"), "FPRegs" + (Platform.isWindows() ? ".exe" : ""));
51 System.out.println("Launcher = " + launcher + (Files.exists(launcher) ? " (exists)" : " (not exists)"));
52 Path jvmLib = findJVM();
53 ProcessBuilder pb = new ProcessBuilder(launcher.toString(), jvmLib.toString());
54 // bin as working directory to let Windows load dll
55 pb.directory(jvmLib.getParent().getParent().toFile());
56 OutputAnalyzer outputf = new OutputAnalyzer(pb.start());
57 outputf.shouldHaveExitValue(0);
58 }
59
60 static Path findJVM() throws IOException {
61 String root = Utils.TEST_JDK;
62 String lib = System.mapLibraryName("jvm");
63 System.out.println("Root = " + root);
64 System.out.println("Library = " + lib);
65
66 Optional<Path> jvmLib = Files.find(new File(root).toPath(), 4, (p, attr) -> p.toFile().getName().equals(lib)).findFirst();
67 Path p = null;
68 if (jvmLib.isPresent()) {
69 p = jvmLib.get().toRealPath();
70 System.out.println("JVM = " + p);
71 } else {
72 System.out.println("TESTBUG: JVM not found in ");
73 Files.walk(new File(root).toPath(), 4).map(Path::toString).forEach(System.out::println);
74 }
75 return p;
76 }
77 }
78
|
7 * published by the Free Software Foundation.
8 *
9 * This code is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * version 2 for more details (a copy is included in the LICENSE file that
13 * accompanied this code).
14 *
15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 *
23 */
24
25 /**
26 * @test
27 * @bug 8213362
28 * @comment Test uses custom launcher that starts VM using JNI via libjli, only for MacOS
29 * @requires os.family == "mac"
30 * @library /test/lib
31 * @modules java.base/jdk.internal.misc
32 * @run main/native JniLauncher
33 */
34
35 import java.util.Map;
36 import jdk.test.lib.Platform;
37 import jdk.test.lib.Utils;
38 import jdk.test.lib.process.OutputAnalyzer;
39
40 import java.io.IOException;
41 import java.nio.file.Files;
42 import java.nio.file.Path;
43 import java.nio.file.Paths;
44
45 public class JniLauncher {
46 public static void main(String[] args) throws IOException {
47 Path launcher = Paths.get(System.getProperty("test.nativepath"), "JniLauncher" + (Platform.isWindows() ? ".exe" : ""));
48 System.out.println("Launcher = " + launcher + (Files.exists(launcher) ? " (exists)" : " (not exists)"));
49 ProcessBuilder pb = new ProcessBuilder(launcher.toString());
50 Map<String, String> env = pb.environment();
51 String libdir = Paths.get(Utils.TEST_JDK).resolve("lib").toAbsolutePath().toString();
52 env.compute("DYLD_LIBRARY_PATH", (k, v) -> (k == null) ? libdir : v + ":" + libdir);
53 OutputAnalyzer outputf = new OutputAnalyzer(pb.start());
54 outputf.shouldHaveExitValue(0);
55 }
56 }
57
|