author | mr |
Wed, 16 Jan 2019 16:27:21 -0800 | |
changeset 53372 | 4003935e6e5f |
parent 53229 | 76a4b08fdf59 |
child 53273 | bbc79e0ec9ee |
permissions | -rw-r--r-- |
4340 | 1 |
/* |
30034
a0f26b338318
8078520: [TESTBUG] fix 'test/tools/launcher/ExecutionEnvironment.java' to run on arbitrary *nix systems
simonis
parents:
28115
diff
changeset
|
2 |
* Copyright (c) 2009, 2015, Oracle and/or its affiliates. All rights reserved. |
4340 | 3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 |
* |
|
5 |
* This code is free software; you can redistribute it and/or modify it |
|
6 |
* under the terms of the GNU General Public License version 2 only, as |
|
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 |
* |
|
5506 | 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. |
|
4340 | 22 |
*/ |
23 |
||
24 |
/* |
|
25 |
* @test |
|
26 |
* @bug 4780570 4731671 6354700 6367077 6670965 4882974 |
|
27 |
* @summary Checks for LD_LIBRARY_PATH and execution on *nixes |
|
45944
882cea808912
8179292: a number of launcher tests fail when run with --limit-modules due to CNFE: javax.tools.ToolProvider
anazarov
parents:
37540
diff
changeset
|
28 |
* @modules jdk.compiler |
882cea808912
8179292: a number of launcher tests fail when run with --limit-modules due to CNFE: javax.tools.ToolProvider
anazarov
parents:
37540
diff
changeset
|
29 |
* jdk.zipfs |
11687
f13cadbb0bb5
7127906: (launcher) convert the launcher regression tests to java
ksrini
parents:
10053
diff
changeset
|
30 |
* @compile -XDignore.symbol.file ExecutionEnvironment.java |
20201
50cc2d25a60b
8020552: [launcher] changes to support removal of Solaris 32-bit distribution
ksrini
parents:
12047
diff
changeset
|
31 |
* @run main/othervm ExecutionEnvironment |
4340 | 32 |
*/ |
33 |
||
34 |
/* |
|
9244
84d85c90d5db
7029048: (launcher) fence the launcher against LD_LIBRARY_PATH
ksrini
parents:
5506
diff
changeset
|
35 |
* This tests for various things as follows: |
4340 | 36 |
* Ensures that: |
37 |
* 1. uneccessary execs do not occur |
|
38 |
* 2. the environment is pristine, users environment variable wrt. |
|
39 |
* LD_LIBRARY_PATH if set are not modified in any way. |
|
40 |
* 3. the correct vm is chosen with -server and -client options |
|
41 |
* 4. the VM on Solaris correctly interprets the LD_LIBRARY_PATH32 |
|
42 |
* and LD_LIBRARY_PATH64 variables if set by the user, ie. |
|
43 |
* i. on 32 bit systems: |
|
44 |
* a. if LD_LIBRARY_PATH32 is set it will override LD_LIBRARY_PATH |
|
45 |
* b. LD_LIBRARY_PATH64 is ignored if set |
|
46 |
* ii. on 64 bit systems: |
|
47 |
* a. if LD_LIBRARY_PATH64 is set it will override LD_LIBRARY_PATH |
|
48 |
* b. LD_LIBRARY_PATH32 is ignored if set |
|
49 |
* 5. no extra symlink exists on Solaris ie. |
|
28115
3931c251d78f
8061442: Update jdk/tools tests to remove check for the "jre" directory
ksrini
parents:
22606
diff
changeset
|
50 |
* lib/$arch/libjvm.so -> client/libjvm.so |
4340 | 51 |
* TODO: |
52 |
* a. perhaps we need to add a test to audit all environment variables are |
|
53 |
* in pristine condition after the launch, there may be a few that the |
|
54 |
* launcher may add as implementation details. |
|
55 |
* b. add a pldd for solaris to ensure only one libjvm.so is linked |
|
56 |
*/ |
|
57 |
import java.io.File; |
|
58 |
import java.io.FileNotFoundException; |
|
59 |
import java.util.ArrayList; |
|
60 |
import java.util.HashMap; |
|
61 |
import java.util.List; |
|
62 |
import java.util.Map; |
|
63 |
||
11687
f13cadbb0bb5
7127906: (launcher) convert the launcher regression tests to java
ksrini
parents:
10053
diff
changeset
|
64 |
public class ExecutionEnvironment extends TestHelper { |
12047
320a714614e9
7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
11687
diff
changeset
|
65 |
static final String LD_LIBRARY_PATH = TestHelper.isMacOSX |
320a714614e9
7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
11687
diff
changeset
|
66 |
? "DYLD_LIBRARY_PATH" |
22602
0d9a07b0d7e9
8028537: PPC64: Updated the JDK regression tests to run on AIX
simonis
parents:
21812
diff
changeset
|
67 |
: TestHelper.isAIX |
0d9a07b0d7e9
8028537: PPC64: Updated the JDK regression tests to run on AIX
simonis
parents:
21812
diff
changeset
|
68 |
? "LIBPATH" |
0d9a07b0d7e9
8028537: PPC64: Updated the JDK regression tests to run on AIX
simonis
parents:
21812
diff
changeset
|
69 |
: "LD_LIBRARY_PATH"; |
4340 | 70 |
static final String LD_LIBRARY_PATH_32 = LD_LIBRARY_PATH + "_32"; |
71 |
static final String LD_LIBRARY_PATH_64 = LD_LIBRARY_PATH + "_64"; |
|
72 |
||
73 |
// Note: these paths need not exist on the filesytem |
|
74 |
static final String LD_LIBRARY_PATH_VALUE = "/Bridge/On/The/River/Kwai"; |
|
75 |
static final String LD_LIBRARY_PATH_32_VALUE = "/Lawrence/Of/Arabia"; |
|
76 |
static final String LD_LIBRARY_PATH_64_VALUE = "/A/Passage/To/India"; |
|
77 |
||
78 |
static final String[] LD_PATH_STRINGS = { |
|
79 |
LD_LIBRARY_PATH + "=" + LD_LIBRARY_PATH_VALUE, |
|
80 |
LD_LIBRARY_PATH_32 + "=" + LD_LIBRARY_PATH_32_VALUE, |
|
81 |
LD_LIBRARY_PATH_64 + "=" + LD_LIBRARY_PATH_64_VALUE |
|
82 |
}; |
|
83 |
||
84 |
static final File testJarFile = new File("EcoFriendly.jar"); |
|
85 |
||
20201
50cc2d25a60b
8020552: [launcher] changes to support removal of Solaris 32-bit distribution
ksrini
parents:
12047
diff
changeset
|
86 |
public ExecutionEnvironment() { |
50cc2d25a60b
8020552: [launcher] changes to support removal of Solaris 32-bit distribution
ksrini
parents:
12047
diff
changeset
|
87 |
createTestJar(); |
50cc2d25a60b
8020552: [launcher] changes to support removal of Solaris 32-bit distribution
ksrini
parents:
12047
diff
changeset
|
88 |
} |
50cc2d25a60b
8020552: [launcher] changes to support removal of Solaris 32-bit distribution
ksrini
parents:
12047
diff
changeset
|
89 |
|
9244
84d85c90d5db
7029048: (launcher) fence the launcher against LD_LIBRARY_PATH
ksrini
parents:
5506
diff
changeset
|
90 |
static void createTestJar() { |
4340 | 91 |
try { |
11687
f13cadbb0bb5
7127906: (launcher) convert the launcher regression tests to java
ksrini
parents:
10053
diff
changeset
|
92 |
List<String> codeList = new ArrayList<>(); |
4340 | 93 |
codeList.add("static void printValue(String name, boolean property) {\n"); |
94 |
codeList.add(" String value = (property) ? System.getProperty(name) : System.getenv(name);\n"); |
|
95 |
codeList.add(" System.out.println(name + \"=\" + value);\n"); |
|
96 |
codeList.add("}\n"); |
|
97 |
codeList.add("public static void main(String... args) {\n"); |
|
98 |
codeList.add(" System.out.println(\"Execute test:\");\n"); |
|
99 |
codeList.add(" printValue(\"os.name\", true);\n"); |
|
100 |
codeList.add(" printValue(\"os.arch\", true);\n"); |
|
101 |
codeList.add(" printValue(\"os.version\", true);\n"); |
|
102 |
codeList.add(" printValue(\"sun.arch.data.model\", true);\n"); |
|
103 |
codeList.add(" printValue(\"java.library.path\", true);\n"); |
|
104 |
codeList.add(" printValue(\"" + LD_LIBRARY_PATH + "\", false);\n"); |
|
105 |
codeList.add(" printValue(\"" + LD_LIBRARY_PATH_32 + "\", false);\n"); |
|
106 |
codeList.add(" printValue(\"" + LD_LIBRARY_PATH_64 + "\", false);\n"); |
|
107 |
codeList.add("}\n"); |
|
108 |
String[] clist = new String[codeList.size()]; |
|
11687
f13cadbb0bb5
7127906: (launcher) convert the launcher regression tests to java
ksrini
parents:
10053
diff
changeset
|
109 |
createJar(testJarFile, codeList.toArray(clist)); |
4340 | 110 |
} catch (FileNotFoundException fnfe) { |
111 |
throw new RuntimeException(fnfe); |
|
112 |
} |
|
113 |
} |
|
20201
50cc2d25a60b
8020552: [launcher] changes to support removal of Solaris 32-bit distribution
ksrini
parents:
12047
diff
changeset
|
114 |
private void flagError(TestResult tr, String message) { |
50cc2d25a60b
8020552: [launcher] changes to support removal of Solaris 32-bit distribution
ksrini
parents:
12047
diff
changeset
|
115 |
System.err.println(tr); |
50cc2d25a60b
8020552: [launcher] changes to support removal of Solaris 32-bit distribution
ksrini
parents:
12047
diff
changeset
|
116 |
throw new RuntimeException(message); |
50cc2d25a60b
8020552: [launcher] changes to support removal of Solaris 32-bit distribution
ksrini
parents:
12047
diff
changeset
|
117 |
} |
4340 | 118 |
/* |
119 |
* tests if the launcher pollutes the LD_LIBRARY_PATH variables ie. there |
|
120 |
* should not be any new variables or pollution/mutations of any kind, the |
|
121 |
* environment should be pristine. |
|
122 |
*/ |
|
20201
50cc2d25a60b
8020552: [launcher] changes to support removal of Solaris 32-bit distribution
ksrini
parents:
12047
diff
changeset
|
123 |
@Test |
50cc2d25a60b
8020552: [launcher] changes to support removal of Solaris 32-bit distribution
ksrini
parents:
12047
diff
changeset
|
124 |
void testEcoFriendly() { |
11687
f13cadbb0bb5
7127906: (launcher) convert the launcher regression tests to java
ksrini
parents:
10053
diff
changeset
|
125 |
Map<String, String> env = new HashMap<>(); |
4340 | 126 |
for (String x : LD_PATH_STRINGS) { |
127 |
String pairs[] = x.split("="); |
|
128 |
env.put(pairs[0], pairs[1]); |
|
129 |
} |
|
130 |
||
37540
e92d95400f31
8154470: defines.h confused about PROGNAME and JAVA_ARGS
martin
parents:
30034
diff
changeset
|
131 |
TestResult tr = |
e92d95400f31
8154470: defines.h confused about PROGNAME and JAVA_ARGS
martin
parents:
30034
diff
changeset
|
132 |
doExec(env, javaCmd, "-jar", testJarFile.getAbsolutePath()); |
4340 | 133 |
|
134 |
if (!tr.isNotZeroOutput()) { |
|
20201
50cc2d25a60b
8020552: [launcher] changes to support removal of Solaris 32-bit distribution
ksrini
parents:
12047
diff
changeset
|
135 |
flagError(tr, "Error: No output at all. Did the test execute ?"); |
4340 | 136 |
} |
137 |
||
138 |
for (String x : LD_PATH_STRINGS) { |
|
139 |
if (!tr.contains(x)) { |
|
22602
0d9a07b0d7e9
8028537: PPC64: Updated the JDK regression tests to run on AIX
simonis
parents:
21812
diff
changeset
|
140 |
if (TestHelper.isAIX && x.startsWith(LD_LIBRARY_PATH)) { |
0d9a07b0d7e9
8028537: PPC64: Updated the JDK regression tests to run on AIX
simonis
parents:
21812
diff
changeset
|
141 |
// AIX does not support the '-rpath' linker options so the |
0d9a07b0d7e9
8028537: PPC64: Updated the JDK regression tests to run on AIX
simonis
parents:
21812
diff
changeset
|
142 |
// launchers have to prepend the jdk library path to 'LIBPATH'. |
0d9a07b0d7e9
8028537: PPC64: Updated the JDK regression tests to run on AIX
simonis
parents:
21812
diff
changeset
|
143 |
String aixLibPath = LD_LIBRARY_PATH + "=" + |
0d9a07b0d7e9
8028537: PPC64: Updated the JDK regression tests to run on AIX
simonis
parents:
21812
diff
changeset
|
144 |
System.getenv(LD_LIBRARY_PATH) + |
0d9a07b0d7e9
8028537: PPC64: Updated the JDK regression tests to run on AIX
simonis
parents:
21812
diff
changeset
|
145 |
System.getProperty("path.separator") + LD_LIBRARY_PATH_VALUE; |
0d9a07b0d7e9
8028537: PPC64: Updated the JDK regression tests to run on AIX
simonis
parents:
21812
diff
changeset
|
146 |
if (!tr.matches(aixLibPath)) { |
0d9a07b0d7e9
8028537: PPC64: Updated the JDK regression tests to run on AIX
simonis
parents:
21812
diff
changeset
|
147 |
flagError(tr, "FAIL: did not get <" + aixLibPath + ">"); |
0d9a07b0d7e9
8028537: PPC64: Updated the JDK regression tests to run on AIX
simonis
parents:
21812
diff
changeset
|
148 |
} |
0d9a07b0d7e9
8028537: PPC64: Updated the JDK regression tests to run on AIX
simonis
parents:
21812
diff
changeset
|
149 |
} |
0d9a07b0d7e9
8028537: PPC64: Updated the JDK regression tests to run on AIX
simonis
parents:
21812
diff
changeset
|
150 |
else { |
0d9a07b0d7e9
8028537: PPC64: Updated the JDK regression tests to run on AIX
simonis
parents:
21812
diff
changeset
|
151 |
flagError(tr, "FAIL: did not get <" + x + ">"); |
0d9a07b0d7e9
8028537: PPC64: Updated the JDK regression tests to run on AIX
simonis
parents:
21812
diff
changeset
|
152 |
} |
4340 | 153 |
} |
154 |
} |
|
155 |
} |
|
156 |
||
157 |
/* |
|
158 |
* ensures that there are no execs as long as we are in the same |
|
159 |
* data model |
|
160 |
*/ |
|
20201
50cc2d25a60b
8020552: [launcher] changes to support removal of Solaris 32-bit distribution
ksrini
parents:
12047
diff
changeset
|
161 |
@Test |
50cc2d25a60b
8020552: [launcher] changes to support removal of Solaris 32-bit distribution
ksrini
parents:
12047
diff
changeset
|
162 |
void testNoExec() { |
11687
f13cadbb0bb5
7127906: (launcher) convert the launcher regression tests to java
ksrini
parents:
10053
diff
changeset
|
163 |
Map<String, String> env = new HashMap<>(); |
4340 | 164 |
env.put(JLDEBUG_KEY, "true"); |
11687
f13cadbb0bb5
7127906: (launcher) convert the launcher regression tests to java
ksrini
parents:
10053
diff
changeset
|
165 |
TestResult tr = doExec(env, javaCmd, "-version"); |
4340 | 166 |
if (tr.testOutput.contains(EXPECTED_MARKER)) { |
20201
50cc2d25a60b
8020552: [launcher] changes to support removal of Solaris 32-bit distribution
ksrini
parents:
12047
diff
changeset
|
167 |
flagError(tr, "testNoExec: found warning <" + EXPECTED_MARKER + |
4340 | 168 |
"> the process execing ?"); |
169 |
} |
|
170 |
} |
|
171 |
||
172 |
/* |
|
173 |
* This test ensures that LD_LIBRARY_PATH* values are interpreted by the VM |
|
174 |
* and the expected java.library.path behaviour. |
|
175 |
* For Generic platforms (All *nixes): |
|
176 |
* * All LD_LIBRARY_PATH variable should be on java.library.path |
|
177 |
* For Solaris 32-bit |
|
178 |
* * The LD_LIBRARY_PATH_32 should override LD_LIBRARY_PATH if specified |
|
179 |
* For Solaris 64-bit |
|
180 |
* * The LD_LIBRARY_PATH_64 should override LD_LIBRARY_PATH if specified |
|
181 |
*/ |
|
20201
50cc2d25a60b
8020552: [launcher] changes to support removal of Solaris 32-bit distribution
ksrini
parents:
12047
diff
changeset
|
182 |
@Test |
50cc2d25a60b
8020552: [launcher] changes to support removal of Solaris 32-bit distribution
ksrini
parents:
12047
diff
changeset
|
183 |
void testJavaLibraryPath() { |
37540
e92d95400f31
8154470: defines.h confused about PROGNAME and JAVA_ARGS
martin
parents:
30034
diff
changeset
|
184 |
TestResult tr; |
4340 | 185 |
|
11687
f13cadbb0bb5
7127906: (launcher) convert the launcher regression tests to java
ksrini
parents:
10053
diff
changeset
|
186 |
Map<String, String> env = new HashMap<>(); |
4340 | 187 |
|
30034
a0f26b338318
8078520: [TESTBUG] fix 'test/tools/launcher/ExecutionEnvironment.java' to run on arbitrary *nix systems
simonis
parents:
28115
diff
changeset
|
188 |
if (TestHelper.isSolaris) { |
4340 | 189 |
// no override |
190 |
env.clear(); |
|
191 |
env.put(LD_LIBRARY_PATH, LD_LIBRARY_PATH_VALUE); |
|
11687
f13cadbb0bb5
7127906: (launcher) convert the launcher regression tests to java
ksrini
parents:
10053
diff
changeset
|
192 |
tr = doExec(env, javaCmd, "-jar", testJarFile.getAbsolutePath()); |
4340 | 193 |
verifyJavaLibraryPathGeneric(tr); |
194 |
||
195 |
env.clear(); |
|
196 |
for (String x : LD_PATH_STRINGS) { |
|
197 |
String pairs[] = x.split("="); |
|
198 |
env.put(pairs[0], pairs[1]); |
|
199 |
} |
|
200 |
||
20201
50cc2d25a60b
8020552: [launcher] changes to support removal of Solaris 32-bit distribution
ksrini
parents:
12047
diff
changeset
|
201 |
// verify the override occurs for 64-bit system |
11687
f13cadbb0bb5
7127906: (launcher) convert the launcher regression tests to java
ksrini
parents:
10053
diff
changeset
|
202 |
tr = doExec(env, javaCmd, "-jar", testJarFile.getAbsolutePath()); |
20201
50cc2d25a60b
8020552: [launcher] changes to support removal of Solaris 32-bit distribution
ksrini
parents:
12047
diff
changeset
|
203 |
verifyJavaLibraryPathOverride(tr, false); |
30034
a0f26b338318
8078520: [TESTBUG] fix 'test/tools/launcher/ExecutionEnvironment.java' to run on arbitrary *nix systems
simonis
parents:
28115
diff
changeset
|
204 |
} else { |
a0f26b338318
8078520: [TESTBUG] fix 'test/tools/launcher/ExecutionEnvironment.java' to run on arbitrary *nix systems
simonis
parents:
28115
diff
changeset
|
205 |
for (String x : LD_PATH_STRINGS) { |
a0f26b338318
8078520: [TESTBUG] fix 'test/tools/launcher/ExecutionEnvironment.java' to run on arbitrary *nix systems
simonis
parents:
28115
diff
changeset
|
206 |
String pairs[] = x.split("="); |
a0f26b338318
8078520: [TESTBUG] fix 'test/tools/launcher/ExecutionEnvironment.java' to run on arbitrary *nix systems
simonis
parents:
28115
diff
changeset
|
207 |
env.put(pairs[0], pairs[1]); |
a0f26b338318
8078520: [TESTBUG] fix 'test/tools/launcher/ExecutionEnvironment.java' to run on arbitrary *nix systems
simonis
parents:
28115
diff
changeset
|
208 |
} |
a0f26b338318
8078520: [TESTBUG] fix 'test/tools/launcher/ExecutionEnvironment.java' to run on arbitrary *nix systems
simonis
parents:
28115
diff
changeset
|
209 |
|
a0f26b338318
8078520: [TESTBUG] fix 'test/tools/launcher/ExecutionEnvironment.java' to run on arbitrary *nix systems
simonis
parents:
28115
diff
changeset
|
210 |
tr = doExec(env, javaCmd, "-jar", testJarFile.getAbsolutePath()); |
a0f26b338318
8078520: [TESTBUG] fix 'test/tools/launcher/ExecutionEnvironment.java' to run on arbitrary *nix systems
simonis
parents:
28115
diff
changeset
|
211 |
verifyJavaLibraryPathGeneric(tr); |
4340 | 212 |
} |
213 |
} |
|
214 |
||
20201
50cc2d25a60b
8020552: [launcher] changes to support removal of Solaris 32-bit distribution
ksrini
parents:
12047
diff
changeset
|
215 |
private void verifyJavaLibraryPathGeneric(TestResult tr) { |
4340 | 216 |
if (!tr.matches("java.library.path=.*" + LD_LIBRARY_PATH_VALUE + ".*")) { |
20201
50cc2d25a60b
8020552: [launcher] changes to support removal of Solaris 32-bit distribution
ksrini
parents:
12047
diff
changeset
|
217 |
flagError(tr, "testJavaLibraryPath: java.library.path does not contain " + |
4340 | 218 |
LD_LIBRARY_PATH_VALUE); |
219 |
} |
|
220 |
} |
|
221 |
||
20201
50cc2d25a60b
8020552: [launcher] changes to support removal of Solaris 32-bit distribution
ksrini
parents:
12047
diff
changeset
|
222 |
private void verifyJavaLibraryPathOverride(TestResult tr, |
4340 | 223 |
boolean is32Bit) { |
224 |
// make sure the 32/64 bit value exists |
|
225 |
if (!tr.matches("java.library.path=.*" + |
|
226 |
(is32Bit ? LD_LIBRARY_PATH_32_VALUE : LD_LIBRARY_PATH_64_VALUE) + ".*")) { |
|
20201
50cc2d25a60b
8020552: [launcher] changes to support removal of Solaris 32-bit distribution
ksrini
parents:
12047
diff
changeset
|
227 |
flagError(tr, "verifyJavaLibraryPathOverride: " + |
50cc2d25a60b
8020552: [launcher] changes to support removal of Solaris 32-bit distribution
ksrini
parents:
12047
diff
changeset
|
228 |
" java.library.path does not contain " + |
4340 | 229 |
(is32Bit ? LD_LIBRARY_PATH_32_VALUE : LD_LIBRARY_PATH_64_VALUE)); |
20201
50cc2d25a60b
8020552: [launcher] changes to support removal of Solaris 32-bit distribution
ksrini
parents:
12047
diff
changeset
|
230 |
|
4340 | 231 |
} |
232 |
// make sure the generic value is absent |
|
20201
50cc2d25a60b
8020552: [launcher] changes to support removal of Solaris 32-bit distribution
ksrini
parents:
12047
diff
changeset
|
233 |
if (!tr.notMatches("java.library.path=.*" + LD_LIBRARY_PATH_VALUE + ".*")) { |
50cc2d25a60b
8020552: [launcher] changes to support removal of Solaris 32-bit distribution
ksrini
parents:
12047
diff
changeset
|
234 |
flagError(tr, "verifyJavaLibraryPathOverride: " + |
50cc2d25a60b
8020552: [launcher] changes to support removal of Solaris 32-bit distribution
ksrini
parents:
12047
diff
changeset
|
235 |
" java.library.path contains " + LD_LIBRARY_PATH_VALUE); |
4340 | 236 |
} |
237 |
} |
|
238 |
||
239 |
/* |
|
21812
c43ac963db3d
8023978: [TEST_BUG] launcher tests must exclude platforms without server vm
ksrini
parents:
20201
diff
changeset
|
240 |
* ensures we have indeed exec'ed the correct vm of choice if it exists |
4340 | 241 |
*/ |
20201
50cc2d25a60b
8020552: [launcher] changes to support removal of Solaris 32-bit distribution
ksrini
parents:
12047
diff
changeset
|
242 |
@Test |
50cc2d25a60b
8020552: [launcher] changes to support removal of Solaris 32-bit distribution
ksrini
parents:
12047
diff
changeset
|
243 |
void testVmSelection() { |
53229
76a4b08fdf59
8210669: Some launcher tests assume a pre-JDK 9 run-time image layout
mr
parents:
47216
diff
changeset
|
244 |
boolean haveSomeVM = false; |
21812
c43ac963db3d
8023978: [TEST_BUG] launcher tests must exclude platforms without server vm
ksrini
parents:
20201
diff
changeset
|
245 |
if (haveClientVM) { |
53229
76a4b08fdf59
8210669: Some launcher tests assume a pre-JDK 9 run-time image layout
mr
parents:
47216
diff
changeset
|
246 |
tryVmOption("-client", ".*Client VM.*"); |
76a4b08fdf59
8210669: Some launcher tests assume a pre-JDK 9 run-time image layout
mr
parents:
47216
diff
changeset
|
247 |
haveSomeVM = true; |
4340 | 248 |
} |
21812
c43ac963db3d
8023978: [TEST_BUG] launcher tests must exclude platforms without server vm
ksrini
parents:
20201
diff
changeset
|
249 |
if (haveServerVM) { |
53229
76a4b08fdf59
8210669: Some launcher tests assume a pre-JDK 9 run-time image layout
mr
parents:
47216
diff
changeset
|
250 |
tryVmOption("-server", ".*Server VM.*"); |
76a4b08fdf59
8210669: Some launcher tests assume a pre-JDK 9 run-time image layout
mr
parents:
47216
diff
changeset
|
251 |
haveSomeVM = true; |
76a4b08fdf59
8210669: Some launcher tests assume a pre-JDK 9 run-time image layout
mr
parents:
47216
diff
changeset
|
252 |
} |
76a4b08fdf59
8210669: Some launcher tests assume a pre-JDK 9 run-time image layout
mr
parents:
47216
diff
changeset
|
253 |
if (!haveSomeVM) { |
76a4b08fdf59
8210669: Some launcher tests assume a pre-JDK 9 run-time image layout
mr
parents:
47216
diff
changeset
|
254 |
String msg = "Don't have a known VM"; |
76a4b08fdf59
8210669: Some launcher tests assume a pre-JDK 9 run-time image layout
mr
parents:
47216
diff
changeset
|
255 |
System.err.println(msg); |
76a4b08fdf59
8210669: Some launcher tests assume a pre-JDK 9 run-time image layout
mr
parents:
47216
diff
changeset
|
256 |
throw new RuntimeException(msg); |
76a4b08fdf59
8210669: Some launcher tests assume a pre-JDK 9 run-time image layout
mr
parents:
47216
diff
changeset
|
257 |
} |
76a4b08fdf59
8210669: Some launcher tests assume a pre-JDK 9 run-time image layout
mr
parents:
47216
diff
changeset
|
258 |
} |
76a4b08fdf59
8210669: Some launcher tests assume a pre-JDK 9 run-time image layout
mr
parents:
47216
diff
changeset
|
259 |
|
76a4b08fdf59
8210669: Some launcher tests assume a pre-JDK 9 run-time image layout
mr
parents:
47216
diff
changeset
|
260 |
private void tryVmOption(String opt, String expected) { |
76a4b08fdf59
8210669: Some launcher tests assume a pre-JDK 9 run-time image layout
mr
parents:
47216
diff
changeset
|
261 |
TestResult tr = doExec(javaCmd, opt, "-version"); |
76a4b08fdf59
8210669: Some launcher tests assume a pre-JDK 9 run-time image layout
mr
parents:
47216
diff
changeset
|
262 |
if (!tr.matches(expected)) { |
76a4b08fdf59
8210669: Some launcher tests assume a pre-JDK 9 run-time image layout
mr
parents:
47216
diff
changeset
|
263 |
flagError(tr, "the expected vm " + opt + " did not launch"); |
4340 | 264 |
} |
265 |
} |
|
266 |
||
267 |
/* |
|
268 |
* checks to see there is no extra libjvm.so than needed |
|
269 |
*/ |
|
20201
50cc2d25a60b
8020552: [launcher] changes to support removal of Solaris 32-bit distribution
ksrini
parents:
12047
diff
changeset
|
270 |
@Test |
50cc2d25a60b
8020552: [launcher] changes to support removal of Solaris 32-bit distribution
ksrini
parents:
12047
diff
changeset
|
271 |
void testNoSymLink() { |
11687
f13cadbb0bb5
7127906: (launcher) convert the launcher regression tests to java
ksrini
parents:
10053
diff
changeset
|
272 |
if (is64Bit) { |
4340 | 273 |
return; |
274 |
} |
|
275 |
||
276 |
File symLink = null; |
|
28115
3931c251d78f
8061442: Update jdk/tools tests to remove check for the "jre" directory
ksrini
parents:
22606
diff
changeset
|
277 |
String libPathPrefix = "/lib"; |
11687
f13cadbb0bb5
7127906: (launcher) convert the launcher regression tests to java
ksrini
parents:
10053
diff
changeset
|
278 |
symLink = new File(JAVAHOME, libPathPrefix + |
f13cadbb0bb5
7127906: (launcher) convert the launcher regression tests to java
ksrini
parents:
10053
diff
changeset
|
279 |
getJreArch() + "/" + LIBJVM); |
4340 | 280 |
if (symLink.exists()) { |
20201
50cc2d25a60b
8020552: [launcher] changes to support removal of Solaris 32-bit distribution
ksrini
parents:
12047
diff
changeset
|
281 |
throw new RuntimeException("symlink exists " + symLink.getAbsolutePath()); |
4340 | 282 |
} |
283 |
} |
|
284 |
public static void main(String... args) throws Exception { |
|
11687
f13cadbb0bb5
7127906: (launcher) convert the launcher regression tests to java
ksrini
parents:
10053
diff
changeset
|
285 |
if (isWindows) { |
20201
50cc2d25a60b
8020552: [launcher] changes to support removal of Solaris 32-bit distribution
ksrini
parents:
12047
diff
changeset
|
286 |
System.err.println("Warning: test not applicable to windows"); |
4340 | 287 |
return; |
288 |
} |
|
20201
50cc2d25a60b
8020552: [launcher] changes to support removal of Solaris 32-bit distribution
ksrini
parents:
12047
diff
changeset
|
289 |
ExecutionEnvironment ee = new ExecutionEnvironment(); |
50cc2d25a60b
8020552: [launcher] changes to support removal of Solaris 32-bit distribution
ksrini
parents:
12047
diff
changeset
|
290 |
ee.run(args); |
4340 | 291 |
} |
292 |
} |