author | kvn |
Fri, 28 Oct 2016 12:28:46 -0700 | |
changeset 42076 | d6c3ecec1d34 |
permissions | -rw-r--r-- |
42076
d6c3ecec1d34
8067744: XMM/SSE float register values corrupted by JNI_CreateVM call in JRE 8 (Windows)
kvn
parents:
diff
changeset
|
1 |
/* |
d6c3ecec1d34
8067744: XMM/SSE float register values corrupted by JNI_CreateVM call in JRE 8 (Windows)
kvn
parents:
diff
changeset
|
2 |
* Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved. |
d6c3ecec1d34
8067744: XMM/SSE float register values corrupted by JNI_CreateVM call in JRE 8 (Windows)
kvn
parents:
diff
changeset
|
3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
d6c3ecec1d34
8067744: XMM/SSE float register values corrupted by JNI_CreateVM call in JRE 8 (Windows)
kvn
parents:
diff
changeset
|
4 |
* |
d6c3ecec1d34
8067744: XMM/SSE float register values corrupted by JNI_CreateVM call in JRE 8 (Windows)
kvn
parents:
diff
changeset
|
5 |
* This code is free software; you can redistribute it and/or modify it |
d6c3ecec1d34
8067744: XMM/SSE float register values corrupted by JNI_CreateVM call in JRE 8 (Windows)
kvn
parents:
diff
changeset
|
6 |
* under the terms of the GNU General Public License version 2 only, as |
d6c3ecec1d34
8067744: XMM/SSE float register values corrupted by JNI_CreateVM call in JRE 8 (Windows)
kvn
parents:
diff
changeset
|
7 |
* published by the Free Software Foundation. |
d6c3ecec1d34
8067744: XMM/SSE float register values corrupted by JNI_CreateVM call in JRE 8 (Windows)
kvn
parents:
diff
changeset
|
8 |
* |
d6c3ecec1d34
8067744: XMM/SSE float register values corrupted by JNI_CreateVM call in JRE 8 (Windows)
kvn
parents:
diff
changeset
|
9 |
* This code is distributed in the hope that it will be useful, but WITHOUT |
d6c3ecec1d34
8067744: XMM/SSE float register values corrupted by JNI_CreateVM call in JRE 8 (Windows)
kvn
parents:
diff
changeset
|
10 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
d6c3ecec1d34
8067744: XMM/SSE float register values corrupted by JNI_CreateVM call in JRE 8 (Windows)
kvn
parents:
diff
changeset
|
11 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
d6c3ecec1d34
8067744: XMM/SSE float register values corrupted by JNI_CreateVM call in JRE 8 (Windows)
kvn
parents:
diff
changeset
|
12 |
* version 2 for more details (a copy is included in the LICENSE file that |
d6c3ecec1d34
8067744: XMM/SSE float register values corrupted by JNI_CreateVM call in JRE 8 (Windows)
kvn
parents:
diff
changeset
|
13 |
* accompanied this code). |
d6c3ecec1d34
8067744: XMM/SSE float register values corrupted by JNI_CreateVM call in JRE 8 (Windows)
kvn
parents:
diff
changeset
|
14 |
* |
d6c3ecec1d34
8067744: XMM/SSE float register values corrupted by JNI_CreateVM call in JRE 8 (Windows)
kvn
parents:
diff
changeset
|
15 |
* You should have received a copy of the GNU General Public License version |
d6c3ecec1d34
8067744: XMM/SSE float register values corrupted by JNI_CreateVM call in JRE 8 (Windows)
kvn
parents:
diff
changeset
|
16 |
* 2 along with this work; if not, write to the Free Software Foundation, |
d6c3ecec1d34
8067744: XMM/SSE float register values corrupted by JNI_CreateVM call in JRE 8 (Windows)
kvn
parents:
diff
changeset
|
17 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
d6c3ecec1d34
8067744: XMM/SSE float register values corrupted by JNI_CreateVM call in JRE 8 (Windows)
kvn
parents:
diff
changeset
|
18 |
* |
d6c3ecec1d34
8067744: XMM/SSE float register values corrupted by JNI_CreateVM call in JRE 8 (Windows)
kvn
parents:
diff
changeset
|
19 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
d6c3ecec1d34
8067744: XMM/SSE float register values corrupted by JNI_CreateVM call in JRE 8 (Windows)
kvn
parents:
diff
changeset
|
20 |
* or visit www.oracle.com if you need additional information or have any |
d6c3ecec1d34
8067744: XMM/SSE float register values corrupted by JNI_CreateVM call in JRE 8 (Windows)
kvn
parents:
diff
changeset
|
21 |
* questions. |
d6c3ecec1d34
8067744: XMM/SSE float register values corrupted by JNI_CreateVM call in JRE 8 (Windows)
kvn
parents:
diff
changeset
|
22 |
* |
d6c3ecec1d34
8067744: XMM/SSE float register values corrupted by JNI_CreateVM call in JRE 8 (Windows)
kvn
parents:
diff
changeset
|
23 |
*/ |
d6c3ecec1d34
8067744: XMM/SSE float register values corrupted by JNI_CreateVM call in JRE 8 (Windows)
kvn
parents:
diff
changeset
|
24 |
/* |
d6c3ecec1d34
8067744: XMM/SSE float register values corrupted by JNI_CreateVM call in JRE 8 (Windows)
kvn
parents:
diff
changeset
|
25 |
* @test |
d6c3ecec1d34
8067744: XMM/SSE float register values corrupted by JNI_CreateVM call in JRE 8 (Windows)
kvn
parents:
diff
changeset
|
26 |
* @bug 8067744 |
d6c3ecec1d34
8067744: XMM/SSE float register values corrupted by JNI_CreateVM call in JRE 8 (Windows)
kvn
parents:
diff
changeset
|
27 |
* @library /test/lib |
d6c3ecec1d34
8067744: XMM/SSE float register values corrupted by JNI_CreateVM call in JRE 8 (Windows)
kvn
parents:
diff
changeset
|
28 |
* @modules java.base/jdk.internal.misc |
d6c3ecec1d34
8067744: XMM/SSE float register values corrupted by JNI_CreateVM call in JRE 8 (Windows)
kvn
parents:
diff
changeset
|
29 |
* @run main/native FPRegs |
d6c3ecec1d34
8067744: XMM/SSE float register values corrupted by JNI_CreateVM call in JRE 8 (Windows)
kvn
parents:
diff
changeset
|
30 |
*/ |
d6c3ecec1d34
8067744: XMM/SSE float register values corrupted by JNI_CreateVM call in JRE 8 (Windows)
kvn
parents:
diff
changeset
|
31 |
|
d6c3ecec1d34
8067744: XMM/SSE float register values corrupted by JNI_CreateVM call in JRE 8 (Windows)
kvn
parents:
diff
changeset
|
32 |
import jdk.test.lib.Platform; |
d6c3ecec1d34
8067744: XMM/SSE float register values corrupted by JNI_CreateVM call in JRE 8 (Windows)
kvn
parents:
diff
changeset
|
33 |
import jdk.test.lib.Utils; |
d6c3ecec1d34
8067744: XMM/SSE float register values corrupted by JNI_CreateVM call in JRE 8 (Windows)
kvn
parents:
diff
changeset
|
34 |
import jdk.test.lib.process.ProcessTools; |
d6c3ecec1d34
8067744: XMM/SSE float register values corrupted by JNI_CreateVM call in JRE 8 (Windows)
kvn
parents:
diff
changeset
|
35 |
import jdk.test.lib.process.OutputAnalyzer; |
d6c3ecec1d34
8067744: XMM/SSE float register values corrupted by JNI_CreateVM call in JRE 8 (Windows)
kvn
parents:
diff
changeset
|
36 |
|
d6c3ecec1d34
8067744: XMM/SSE float register values corrupted by JNI_CreateVM call in JRE 8 (Windows)
kvn
parents:
diff
changeset
|
37 |
import java.io.File; |
d6c3ecec1d34
8067744: XMM/SSE float register values corrupted by JNI_CreateVM call in JRE 8 (Windows)
kvn
parents:
diff
changeset
|
38 |
import java.io.IOException; |
d6c3ecec1d34
8067744: XMM/SSE float register values corrupted by JNI_CreateVM call in JRE 8 (Windows)
kvn
parents:
diff
changeset
|
39 |
import java.nio.file.Files; |
d6c3ecec1d34
8067744: XMM/SSE float register values corrupted by JNI_CreateVM call in JRE 8 (Windows)
kvn
parents:
diff
changeset
|
40 |
import java.nio.file.Path; |
d6c3ecec1d34
8067744: XMM/SSE float register values corrupted by JNI_CreateVM call in JRE 8 (Windows)
kvn
parents:
diff
changeset
|
41 |
import java.nio.file.Paths; |
d6c3ecec1d34
8067744: XMM/SSE float register values corrupted by JNI_CreateVM call in JRE 8 (Windows)
kvn
parents:
diff
changeset
|
42 |
import java.util.Optional; |
d6c3ecec1d34
8067744: XMM/SSE float register values corrupted by JNI_CreateVM call in JRE 8 (Windows)
kvn
parents:
diff
changeset
|
43 |
|
d6c3ecec1d34
8067744: XMM/SSE float register values corrupted by JNI_CreateVM call in JRE 8 (Windows)
kvn
parents:
diff
changeset
|
44 |
public class FPRegs { |
d6c3ecec1d34
8067744: XMM/SSE float register values corrupted by JNI_CreateVM call in JRE 8 (Windows)
kvn
parents:
diff
changeset
|
45 |
public static void main(String[] args) throws IOException { |
d6c3ecec1d34
8067744: XMM/SSE float register values corrupted by JNI_CreateVM call in JRE 8 (Windows)
kvn
parents:
diff
changeset
|
46 |
Path launcher = Paths.get(System.getProperty("test.nativepath"), "FPRegs" + (Platform.isWindows() ? ".exe" : "")); |
d6c3ecec1d34
8067744: XMM/SSE float register values corrupted by JNI_CreateVM call in JRE 8 (Windows)
kvn
parents:
diff
changeset
|
47 |
System.out.println("Launcher = " + launcher + (Files.exists(launcher) ? " (exists)" : " (not exists)")); |
d6c3ecec1d34
8067744: XMM/SSE float register values corrupted by JNI_CreateVM call in JRE 8 (Windows)
kvn
parents:
diff
changeset
|
48 |
Path jvmLib = findJVM(); |
d6c3ecec1d34
8067744: XMM/SSE float register values corrupted by JNI_CreateVM call in JRE 8 (Windows)
kvn
parents:
diff
changeset
|
49 |
ProcessBuilder pb = new ProcessBuilder(launcher.toString(), jvmLib.toString()); |
d6c3ecec1d34
8067744: XMM/SSE float register values corrupted by JNI_CreateVM call in JRE 8 (Windows)
kvn
parents:
diff
changeset
|
50 |
// bin as working directory to let Windows load dll |
d6c3ecec1d34
8067744: XMM/SSE float register values corrupted by JNI_CreateVM call in JRE 8 (Windows)
kvn
parents:
diff
changeset
|
51 |
pb.directory(jvmLib.getParent().getParent().toFile()); |
d6c3ecec1d34
8067744: XMM/SSE float register values corrupted by JNI_CreateVM call in JRE 8 (Windows)
kvn
parents:
diff
changeset
|
52 |
OutputAnalyzer outputf = new OutputAnalyzer(pb.start()); |
d6c3ecec1d34
8067744: XMM/SSE float register values corrupted by JNI_CreateVM call in JRE 8 (Windows)
kvn
parents:
diff
changeset
|
53 |
outputf.shouldHaveExitValue(0); |
d6c3ecec1d34
8067744: XMM/SSE float register values corrupted by JNI_CreateVM call in JRE 8 (Windows)
kvn
parents:
diff
changeset
|
54 |
} |
d6c3ecec1d34
8067744: XMM/SSE float register values corrupted by JNI_CreateVM call in JRE 8 (Windows)
kvn
parents:
diff
changeset
|
55 |
|
d6c3ecec1d34
8067744: XMM/SSE float register values corrupted by JNI_CreateVM call in JRE 8 (Windows)
kvn
parents:
diff
changeset
|
56 |
static Path findJVM() throws IOException { |
d6c3ecec1d34
8067744: XMM/SSE float register values corrupted by JNI_CreateVM call in JRE 8 (Windows)
kvn
parents:
diff
changeset
|
57 |
String root = Utils.TEST_JDK; |
d6c3ecec1d34
8067744: XMM/SSE float register values corrupted by JNI_CreateVM call in JRE 8 (Windows)
kvn
parents:
diff
changeset
|
58 |
String lib = System.mapLibraryName("jvm"); |
d6c3ecec1d34
8067744: XMM/SSE float register values corrupted by JNI_CreateVM call in JRE 8 (Windows)
kvn
parents:
diff
changeset
|
59 |
System.out.println("Root = " + root); |
d6c3ecec1d34
8067744: XMM/SSE float register values corrupted by JNI_CreateVM call in JRE 8 (Windows)
kvn
parents:
diff
changeset
|
60 |
System.out.println("Library = " + lib); |
d6c3ecec1d34
8067744: XMM/SSE float register values corrupted by JNI_CreateVM call in JRE 8 (Windows)
kvn
parents:
diff
changeset
|
61 |
|
d6c3ecec1d34
8067744: XMM/SSE float register values corrupted by JNI_CreateVM call in JRE 8 (Windows)
kvn
parents:
diff
changeset
|
62 |
Optional<Path> jvmLib = Files.find(new File(root).toPath(), 4, (p, attr) -> p.toFile().getName().equals(lib)).findFirst(); |
d6c3ecec1d34
8067744: XMM/SSE float register values corrupted by JNI_CreateVM call in JRE 8 (Windows)
kvn
parents:
diff
changeset
|
63 |
Path p = null; |
d6c3ecec1d34
8067744: XMM/SSE float register values corrupted by JNI_CreateVM call in JRE 8 (Windows)
kvn
parents:
diff
changeset
|
64 |
if (jvmLib.isPresent()) { |
d6c3ecec1d34
8067744: XMM/SSE float register values corrupted by JNI_CreateVM call in JRE 8 (Windows)
kvn
parents:
diff
changeset
|
65 |
p = jvmLib.get().toRealPath(); |
d6c3ecec1d34
8067744: XMM/SSE float register values corrupted by JNI_CreateVM call in JRE 8 (Windows)
kvn
parents:
diff
changeset
|
66 |
System.out.println("JVM = " + p); |
d6c3ecec1d34
8067744: XMM/SSE float register values corrupted by JNI_CreateVM call in JRE 8 (Windows)
kvn
parents:
diff
changeset
|
67 |
} else { |
d6c3ecec1d34
8067744: XMM/SSE float register values corrupted by JNI_CreateVM call in JRE 8 (Windows)
kvn
parents:
diff
changeset
|
68 |
System.out.println("TESTBUG: JVM not found in "); |
d6c3ecec1d34
8067744: XMM/SSE float register values corrupted by JNI_CreateVM call in JRE 8 (Windows)
kvn
parents:
diff
changeset
|
69 |
Files.walk(new File(root).toPath(), 4).map(Path::toString).forEach(System.out::println); |
d6c3ecec1d34
8067744: XMM/SSE float register values corrupted by JNI_CreateVM call in JRE 8 (Windows)
kvn
parents:
diff
changeset
|
70 |
} |
d6c3ecec1d34
8067744: XMM/SSE float register values corrupted by JNI_CreateVM call in JRE 8 (Windows)
kvn
parents:
diff
changeset
|
71 |
return p; |
d6c3ecec1d34
8067744: XMM/SSE float register values corrupted by JNI_CreateVM call in JRE 8 (Windows)
kvn
parents:
diff
changeset
|
72 |
} |
d6c3ecec1d34
8067744: XMM/SSE float register values corrupted by JNI_CreateVM call in JRE 8 (Windows)
kvn
parents:
diff
changeset
|
73 |
} |
d6c3ecec1d34
8067744: XMM/SSE float register values corrupted by JNI_CreateVM call in JRE 8 (Windows)
kvn
parents:
diff
changeset
|
74 |