25
25
/*
26
26
* @test
27
27
* @summary Test that CDS still works when the JDK is moved to a new directory
28
+ * @bug 8272345
28
29
* @requires vm.cds
29
- * @requires os.family == "linux"
30
+ * @comment This test doesn't work on Windows because it depends on symlinks
31
+ * @requires os.family != "windows"
30
32
* @library /test/lib
31
33
* @compile test-classes/Hello.java
32
34
* @run driver MoveJDKTest
33
35
*/
34
36
35
- // This test works only on Linux because it depends on symlinks and the name of the hotspot DLL (libjvm.so).
36
- // It probably doesn't work on Windows.
37
- // TODO: change libjvm.so to libjvm.dylib on MacOS, before adding "@requires os.family == mac"
38
-
39
37
import java .io .File ;
40
38
import java .nio .file .Files ;
41
39
import java .nio .file .Path ;
@@ -134,6 +132,7 @@ static void clone(File src, File dst) throws Exception {
134
132
throw new RuntimeException ("Cannot create directory: " + dst );
135
133
}
136
134
}
135
+ final String jvmLib = System .mapLibraryName ("jvm" );
137
136
for (String child : src .list ()) {
138
137
if (child .equals ("." ) || child .equals (".." )) {
139
138
continue ;
@@ -145,7 +144,7 @@ static void clone(File src, File dst) throws Exception {
145
144
throw new RuntimeException ("Already exists: " + child_dst );
146
145
}
147
146
if (child_src .isFile ()) {
148
- if (child .equals ("libjvm.so" ) || child .equals ("java" )) {
147
+ if (child .equals (jvmLib ) || child .equals ("java" )) {
149
148
Files .copy (child_src .toPath (), /* copy data to -> */ child_dst .toPath ());
150
149
} else {
151
150
Files .createSymbolicLink (child_dst .toPath (), /* link to -> */ child_src .toPath ());
0 commit comments