author | jwilhelm |
Wed, 23 Jan 2019 19:56:28 +0100 | |
changeset 53457 | e3ed96060992 |
parent 53376 | 4948dda8ea41 |
parent 53455 | c818e66338c1 |
child 54023 | a764c49570c6 |
permissions | -rw-r--r-- |
9244
84d85c90d5db
7029048: (launcher) fence the launcher against LD_LIBRARY_PATH
ksrini
parents:
diff
changeset
|
1 |
/* |
53372
4003935e6e5f
8216532: tools/launcher/Test7029048.java fails (Solaris)
mr
parents:
53229
diff
changeset
|
2 |
* Copyright (c) 2011, 2019, Oracle and/or its affiliates. All rights reserved. |
9244
84d85c90d5db
7029048: (launcher) fence the launcher against LD_LIBRARY_PATH
ksrini
parents:
diff
changeset
|
3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
84d85c90d5db
7029048: (launcher) fence the launcher against LD_LIBRARY_PATH
ksrini
parents:
diff
changeset
|
4 |
* |
84d85c90d5db
7029048: (launcher) fence the launcher against LD_LIBRARY_PATH
ksrini
parents:
diff
changeset
|
5 |
* This code is free software; you can redistribute it and/or modify it |
84d85c90d5db
7029048: (launcher) fence the launcher against LD_LIBRARY_PATH
ksrini
parents:
diff
changeset
|
6 |
* under the terms of the GNU General Public License version 2 only, as |
84d85c90d5db
7029048: (launcher) fence the launcher against LD_LIBRARY_PATH
ksrini
parents:
diff
changeset
|
7 |
* published by the Free Software Foundation. |
84d85c90d5db
7029048: (launcher) fence the launcher against LD_LIBRARY_PATH
ksrini
parents:
diff
changeset
|
8 |
* |
84d85c90d5db
7029048: (launcher) fence the launcher against LD_LIBRARY_PATH
ksrini
parents:
diff
changeset
|
9 |
* This code is distributed in the hope that it will be useful, but WITHOUT |
84d85c90d5db
7029048: (launcher) fence the launcher against LD_LIBRARY_PATH
ksrini
parents:
diff
changeset
|
10 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
84d85c90d5db
7029048: (launcher) fence the launcher against LD_LIBRARY_PATH
ksrini
parents:
diff
changeset
|
11 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
84d85c90d5db
7029048: (launcher) fence the launcher against LD_LIBRARY_PATH
ksrini
parents:
diff
changeset
|
12 |
* version 2 for more details (a copy is included in the LICENSE file that |
84d85c90d5db
7029048: (launcher) fence the launcher against LD_LIBRARY_PATH
ksrini
parents:
diff
changeset
|
13 |
* accompanied this code). |
84d85c90d5db
7029048: (launcher) fence the launcher against LD_LIBRARY_PATH
ksrini
parents:
diff
changeset
|
14 |
* |
84d85c90d5db
7029048: (launcher) fence the launcher against LD_LIBRARY_PATH
ksrini
parents:
diff
changeset
|
15 |
* You should have received a copy of the GNU General Public License version |
84d85c90d5db
7029048: (launcher) fence the launcher against LD_LIBRARY_PATH
ksrini
parents:
diff
changeset
|
16 |
* 2 along with this work; if not, write to the Free Software Foundation, |
84d85c90d5db
7029048: (launcher) fence the launcher against LD_LIBRARY_PATH
ksrini
parents:
diff
changeset
|
17 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
84d85c90d5db
7029048: (launcher) fence the launcher against LD_LIBRARY_PATH
ksrini
parents:
diff
changeset
|
18 |
* |
84d85c90d5db
7029048: (launcher) fence the launcher against LD_LIBRARY_PATH
ksrini
parents:
diff
changeset
|
19 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
84d85c90d5db
7029048: (launcher) fence the launcher against LD_LIBRARY_PATH
ksrini
parents:
diff
changeset
|
20 |
* or visit www.oracle.com if you need additional information or have any |
84d85c90d5db
7029048: (launcher) fence the launcher against LD_LIBRARY_PATH
ksrini
parents:
diff
changeset
|
21 |
* questions. |
84d85c90d5db
7029048: (launcher) fence the launcher against LD_LIBRARY_PATH
ksrini
parents:
diff
changeset
|
22 |
*/ |
84d85c90d5db
7029048: (launcher) fence the launcher against LD_LIBRARY_PATH
ksrini
parents:
diff
changeset
|
23 |
|
53273
bbc79e0ec9ee
8216265: [testbug] Introduce Platform.sharedLibraryPathVariableName() and adapt all tests.
goetz
parents:
53229
diff
changeset
|
24 |
/** |
9244
84d85c90d5db
7029048: (launcher) fence the launcher against LD_LIBRARY_PATH
ksrini
parents:
diff
changeset
|
25 |
* @test |
53376
4948dda8ea41
8217340: Compilation failed: tools/launcher/Test7029048.java
rriggs
parents:
53373
diff
changeset
|
26 |
* @bug 7029048 8217340 |
53372
4003935e6e5f
8216532: tools/launcher/Test7029048.java fails (Solaris)
mr
parents:
53229
diff
changeset
|
27 |
* @summary Ensure that the launcher defends against user settings of the |
4003935e6e5f
8216532: tools/launcher/Test7029048.java fails (Solaris)
mr
parents:
53229
diff
changeset
|
28 |
* LD_LIBRARY_PATH environment variable on Unixes |
53376
4948dda8ea41
8217340: Compilation failed: tools/launcher/Test7029048.java
rriggs
parents:
53373
diff
changeset
|
29 |
* @library /test/lib |
11687
f13cadbb0bb5
7127906: (launcher) convert the launcher regression tests to java
ksrini
parents:
9244
diff
changeset
|
30 |
* @compile -XDignore.symbol.file ExecutionEnvironment.java Test7029048.java |
9244
84d85c90d5db
7029048: (launcher) fence the launcher against LD_LIBRARY_PATH
ksrini
parents:
diff
changeset
|
31 |
* @run main Test7029048 |
84d85c90d5db
7029048: (launcher) fence the launcher against LD_LIBRARY_PATH
ksrini
parents:
diff
changeset
|
32 |
*/ |
84d85c90d5db
7029048: (launcher) fence the launcher against LD_LIBRARY_PATH
ksrini
parents:
diff
changeset
|
33 |
|
84d85c90d5db
7029048: (launcher) fence the launcher against LD_LIBRARY_PATH
ksrini
parents:
diff
changeset
|
34 |
import java.io.File; |
84d85c90d5db
7029048: (launcher) fence the launcher against LD_LIBRARY_PATH
ksrini
parents:
diff
changeset
|
35 |
import java.io.IOException; |
84d85c90d5db
7029048: (launcher) fence the launcher against LD_LIBRARY_PATH
ksrini
parents:
diff
changeset
|
36 |
import java.nio.file.Files; |
84d85c90d5db
7029048: (launcher) fence the launcher against LD_LIBRARY_PATH
ksrini
parents:
diff
changeset
|
37 |
import java.util.ArrayList; |
84d85c90d5db
7029048: (launcher) fence the launcher against LD_LIBRARY_PATH
ksrini
parents:
diff
changeset
|
38 |
import java.util.HashMap; |
84d85c90d5db
7029048: (launcher) fence the launcher against LD_LIBRARY_PATH
ksrini
parents:
diff
changeset
|
39 |
import java.util.List; |
84d85c90d5db
7029048: (launcher) fence the launcher against LD_LIBRARY_PATH
ksrini
parents:
diff
changeset
|
40 |
import java.util.Map; |
84d85c90d5db
7029048: (launcher) fence the launcher against LD_LIBRARY_PATH
ksrini
parents:
diff
changeset
|
41 |
|
11687
f13cadbb0bb5
7127906: (launcher) convert the launcher regression tests to java
ksrini
parents:
9244
diff
changeset
|
42 |
public class Test7029048 extends TestHelper { |
9244
84d85c90d5db
7029048: (launcher) fence the launcher against LD_LIBRARY_PATH
ksrini
parents:
diff
changeset
|
43 |
|
84d85c90d5db
7029048: (launcher) fence the launcher against LD_LIBRARY_PATH
ksrini
parents:
diff
changeset
|
44 |
static int passes = 0; |
84d85c90d5db
7029048: (launcher) fence the launcher against LD_LIBRARY_PATH
ksrini
parents:
diff
changeset
|
45 |
static int errors = 0; |
84d85c90d5db
7029048: (launcher) fence the launcher against LD_LIBRARY_PATH
ksrini
parents:
diff
changeset
|
46 |
|
84d85c90d5db
7029048: (launcher) fence the launcher against LD_LIBRARY_PATH
ksrini
parents:
diff
changeset
|
47 |
private static final String LIBJVM = ExecutionEnvironment.LIBJVM; |
84d85c90d5db
7029048: (launcher) fence the launcher against LD_LIBRARY_PATH
ksrini
parents:
diff
changeset
|
48 |
private static final String LD_LIBRARY_PATH = |
84d85c90d5db
7029048: (launcher) fence the launcher against LD_LIBRARY_PATH
ksrini
parents:
diff
changeset
|
49 |
ExecutionEnvironment.LD_LIBRARY_PATH; |
84d85c90d5db
7029048: (launcher) fence the launcher against LD_LIBRARY_PATH
ksrini
parents:
diff
changeset
|
50 |
private static final String LD_LIBRARY_PATH_64 = |
84d85c90d5db
7029048: (launcher) fence the launcher against LD_LIBRARY_PATH
ksrini
parents:
diff
changeset
|
51 |
ExecutionEnvironment.LD_LIBRARY_PATH_64; |
84d85c90d5db
7029048: (launcher) fence the launcher against LD_LIBRARY_PATH
ksrini
parents:
diff
changeset
|
52 |
|
84d85c90d5db
7029048: (launcher) fence the launcher against LD_LIBRARY_PATH
ksrini
parents:
diff
changeset
|
53 |
private static final File libDir = |
84d85c90d5db
7029048: (launcher) fence the launcher against LD_LIBRARY_PATH
ksrini
parents:
diff
changeset
|
54 |
new File(System.getProperty("sun.boot.library.path")); |
84d85c90d5db
7029048: (launcher) fence the launcher against LD_LIBRARY_PATH
ksrini
parents:
diff
changeset
|
55 |
private static final File srcServerDir = new File(libDir, "server"); |
84d85c90d5db
7029048: (launcher) fence the launcher against LD_LIBRARY_PATH
ksrini
parents:
diff
changeset
|
56 |
private static final File srcLibjvmSo = new File(srcServerDir, LIBJVM); |
84d85c90d5db
7029048: (launcher) fence the launcher against LD_LIBRARY_PATH
ksrini
parents:
diff
changeset
|
57 |
|
84d85c90d5db
7029048: (launcher) fence the launcher against LD_LIBRARY_PATH
ksrini
parents:
diff
changeset
|
58 |
private static final File dstLibDir = new File("lib"); |
53229
76a4b08fdf59
8210669: Some launcher tests assume a pre-JDK 9 run-time image layout
mr
parents:
47216
diff
changeset
|
59 |
private static final File dstServerDir = new File(dstLibDir, "server"); |
9244
84d85c90d5db
7029048: (launcher) fence the launcher against LD_LIBRARY_PATH
ksrini
parents:
diff
changeset
|
60 |
private static final File dstServerLibjvm = new File(dstServerDir, LIBJVM); |
84d85c90d5db
7029048: (launcher) fence the launcher against LD_LIBRARY_PATH
ksrini
parents:
diff
changeset
|
61 |
|
53229
76a4b08fdf59
8210669: Some launcher tests assume a pre-JDK 9 run-time image layout
mr
parents:
47216
diff
changeset
|
62 |
private static final File dstClientDir = new File(dstLibDir, "client"); |
9244
84d85c90d5db
7029048: (launcher) fence the launcher against LD_LIBRARY_PATH
ksrini
parents:
diff
changeset
|
63 |
private static final File dstClientLibjvm = new File(dstClientDir, LIBJVM); |
84d85c90d5db
7029048: (launcher) fence the launcher against LD_LIBRARY_PATH
ksrini
parents:
diff
changeset
|
64 |
|
84d85c90d5db
7029048: (launcher) fence the launcher against LD_LIBRARY_PATH
ksrini
parents:
diff
changeset
|
65 |
private static final Map<String, String> env = new HashMap<>(); |
84d85c90d5db
7029048: (launcher) fence the launcher against LD_LIBRARY_PATH
ksrini
parents:
diff
changeset
|
66 |
|
84d85c90d5db
7029048: (launcher) fence the launcher against LD_LIBRARY_PATH
ksrini
parents:
diff
changeset
|
67 |
static String getValue(String name, List<String> in) { |
84d85c90d5db
7029048: (launcher) fence the launcher against LD_LIBRARY_PATH
ksrini
parents:
diff
changeset
|
68 |
for (String x : in) { |
84d85c90d5db
7029048: (launcher) fence the launcher against LD_LIBRARY_PATH
ksrini
parents:
diff
changeset
|
69 |
String[] s = x.split("="); |
84d85c90d5db
7029048: (launcher) fence the launcher against LD_LIBRARY_PATH
ksrini
parents:
diff
changeset
|
70 |
if (name.equals(s[0].trim())) { |
84d85c90d5db
7029048: (launcher) fence the launcher against LD_LIBRARY_PATH
ksrini
parents:
diff
changeset
|
71 |
return s[1].trim(); |
84d85c90d5db
7029048: (launcher) fence the launcher against LD_LIBRARY_PATH
ksrini
parents:
diff
changeset
|
72 |
} |
84d85c90d5db
7029048: (launcher) fence the launcher against LD_LIBRARY_PATH
ksrini
parents:
diff
changeset
|
73 |
} |
84d85c90d5db
7029048: (launcher) fence the launcher against LD_LIBRARY_PATH
ksrini
parents:
diff
changeset
|
74 |
return null; |
84d85c90d5db
7029048: (launcher) fence the launcher against LD_LIBRARY_PATH
ksrini
parents:
diff
changeset
|
75 |
} |
84d85c90d5db
7029048: (launcher) fence the launcher against LD_LIBRARY_PATH
ksrini
parents:
diff
changeset
|
76 |
|
20201
50cc2d25a60b
8020552: [launcher] changes to support removal of Solaris 32-bit distribution
ksrini
parents:
12047
diff
changeset
|
77 |
static void run(Map<String, String> env, |
9244
84d85c90d5db
7029048: (launcher) fence the launcher against LD_LIBRARY_PATH
ksrini
parents:
diff
changeset
|
78 |
int nLLPComponents, String caseID) { |
84d85c90d5db
7029048: (launcher) fence the launcher against LD_LIBRARY_PATH
ksrini
parents:
diff
changeset
|
79 |
env.put(ExecutionEnvironment.JLDEBUG_KEY, "true"); |
84d85c90d5db
7029048: (launcher) fence the launcher against LD_LIBRARY_PATH
ksrini
parents:
diff
changeset
|
80 |
List<String> cmdsList = new ArrayList<>(); |
20201
50cc2d25a60b
8020552: [launcher] changes to support removal of Solaris 32-bit distribution
ksrini
parents:
12047
diff
changeset
|
81 |
cmdsList.add(javaCmd); |
9244
84d85c90d5db
7029048: (launcher) fence the launcher against LD_LIBRARY_PATH
ksrini
parents:
diff
changeset
|
82 |
cmdsList.add("-server"); |
84d85c90d5db
7029048: (launcher) fence the launcher against LD_LIBRARY_PATH
ksrini
parents:
diff
changeset
|
83 |
cmdsList.add("-jar"); |
84d85c90d5db
7029048: (launcher) fence the launcher against LD_LIBRARY_PATH
ksrini
parents:
diff
changeset
|
84 |
cmdsList.add(ExecutionEnvironment.testJarFile.getAbsolutePath()); |
84d85c90d5db
7029048: (launcher) fence the launcher against LD_LIBRARY_PATH
ksrini
parents:
diff
changeset
|
85 |
String[] cmds = new String[cmdsList.size()]; |
11687
f13cadbb0bb5
7127906: (launcher) convert the launcher regression tests to java
ksrini
parents:
9244
diff
changeset
|
86 |
TestResult tr = doExec(env, cmdsList.toArray(cmds)); |
20201
50cc2d25a60b
8020552: [launcher] changes to support removal of Solaris 32-bit distribution
ksrini
parents:
12047
diff
changeset
|
87 |
System.out.println(tr); |
9244
84d85c90d5db
7029048: (launcher) fence the launcher against LD_LIBRARY_PATH
ksrini
parents:
diff
changeset
|
88 |
analyze(tr, nLLPComponents, caseID); |
84d85c90d5db
7029048: (launcher) fence the launcher against LD_LIBRARY_PATH
ksrini
parents:
diff
changeset
|
89 |
} |
84d85c90d5db
7029048: (launcher) fence the launcher against LD_LIBRARY_PATH
ksrini
parents:
diff
changeset
|
90 |
|
11687
f13cadbb0bb5
7127906: (launcher) convert the launcher regression tests to java
ksrini
parents:
9244
diff
changeset
|
91 |
static void analyze(TestResult tr, int nLLPComponents, String caseID) { |
9244
84d85c90d5db
7029048: (launcher) fence the launcher against LD_LIBRARY_PATH
ksrini
parents:
diff
changeset
|
92 |
String envValue = getValue(LD_LIBRARY_PATH, tr.testOutput); |
84d85c90d5db
7029048: (launcher) fence the launcher against LD_LIBRARY_PATH
ksrini
parents:
diff
changeset
|
93 |
/* |
84d85c90d5db
7029048: (launcher) fence the launcher against LD_LIBRARY_PATH
ksrini
parents:
diff
changeset
|
94 |
* the envValue can never be null, since the test code should always |
84d85c90d5db
7029048: (launcher) fence the launcher against LD_LIBRARY_PATH
ksrini
parents:
diff
changeset
|
95 |
* print a "null" string. |
84d85c90d5db
7029048: (launcher) fence the launcher against LD_LIBRARY_PATH
ksrini
parents:
diff
changeset
|
96 |
*/ |
84d85c90d5db
7029048: (launcher) fence the launcher against LD_LIBRARY_PATH
ksrini
parents:
diff
changeset
|
97 |
if (envValue == null) { |
84d85c90d5db
7029048: (launcher) fence the launcher against LD_LIBRARY_PATH
ksrini
parents:
diff
changeset
|
98 |
throw new RuntimeException("NPE, likely a program crash ??"); |
84d85c90d5db
7029048: (launcher) fence the launcher against LD_LIBRARY_PATH
ksrini
parents:
diff
changeset
|
99 |
} |
53372
4003935e6e5f
8216532: tools/launcher/Test7029048.java fails (Solaris)
mr
parents:
53229
diff
changeset
|
100 |
int len = (envValue.equals("null") |
4003935e6e5f
8216532: tools/launcher/Test7029048.java fails (Solaris)
mr
parents:
53229
diff
changeset
|
101 |
? 0 : envValue.split(File.pathSeparator).length); |
4003935e6e5f
8216532: tools/launcher/Test7029048.java fails (Solaris)
mr
parents:
53229
diff
changeset
|
102 |
if (len == nLLPComponents) { |
4003935e6e5f
8216532: tools/launcher/Test7029048.java fails (Solaris)
mr
parents:
53229
diff
changeset
|
103 |
System.out.println(caseID + ": OK"); |
9244
84d85c90d5db
7029048: (launcher) fence the launcher against LD_LIBRARY_PATH
ksrini
parents:
diff
changeset
|
104 |
passes++; |
84d85c90d5db
7029048: (launcher) fence the launcher against LD_LIBRARY_PATH
ksrini
parents:
diff
changeset
|
105 |
} else { |
84d85c90d5db
7029048: (launcher) fence the launcher against LD_LIBRARY_PATH
ksrini
parents:
diff
changeset
|
106 |
System.out.println("FAIL: test7029048, " + caseID); |
84d85c90d5db
7029048: (launcher) fence the launcher against LD_LIBRARY_PATH
ksrini
parents:
diff
changeset
|
107 |
System.out.println(" expected " + nLLPComponents |
53372
4003935e6e5f
8216532: tools/launcher/Test7029048.java fails (Solaris)
mr
parents:
53229
diff
changeset
|
108 |
+ " but got " + len); |
9244
84d85c90d5db
7029048: (launcher) fence the launcher against LD_LIBRARY_PATH
ksrini
parents:
diff
changeset
|
109 |
System.out.println(envValue); |
84d85c90d5db
7029048: (launcher) fence the launcher against LD_LIBRARY_PATH
ksrini
parents:
diff
changeset
|
110 |
errors++; |
84d85c90d5db
7029048: (launcher) fence the launcher against LD_LIBRARY_PATH
ksrini
parents:
diff
changeset
|
111 |
} |
84d85c90d5db
7029048: (launcher) fence the launcher against LD_LIBRARY_PATH
ksrini
parents:
diff
changeset
|
112 |
} |
84d85c90d5db
7029048: (launcher) fence the launcher against LD_LIBRARY_PATH
ksrini
parents:
diff
changeset
|
113 |
|
84d85c90d5db
7029048: (launcher) fence the launcher against LD_LIBRARY_PATH
ksrini
parents:
diff
changeset
|
114 |
/* |
53372
4003935e6e5f
8216532: tools/launcher/Test7029048.java fails (Solaris)
mr
parents:
53229
diff
changeset
|
115 |
* Describe the cases that we test. Each case sets the environment |
4003935e6e5f
8216532: tools/launcher/Test7029048.java fails (Solaris)
mr
parents:
53229
diff
changeset
|
116 |
* variable LD_LIBRARY_PATH to a different value. The value associated |
4003935e6e5f
8216532: tools/launcher/Test7029048.java fails (Solaris)
mr
parents:
53229
diff
changeset
|
117 |
* with a case is the number of path elements that we expect the launcher |
4003935e6e5f
8216532: tools/launcher/Test7029048.java fails (Solaris)
mr
parents:
53229
diff
changeset
|
118 |
* to add to that variable. |
9244
84d85c90d5db
7029048: (launcher) fence the launcher against LD_LIBRARY_PATH
ksrini
parents:
diff
changeset
|
119 |
*/ |
53372
4003935e6e5f
8216532: tools/launcher/Test7029048.java fails (Solaris)
mr
parents:
53229
diff
changeset
|
120 |
private static enum TestCase { |
4003935e6e5f
8216532: tools/launcher/Test7029048.java fails (Solaris)
mr
parents:
53229
diff
changeset
|
121 |
NO_DIR(0), // Directory does not exist |
4003935e6e5f
8216532: tools/launcher/Test7029048.java fails (Solaris)
mr
parents:
53229
diff
changeset
|
122 |
NO_LIBJVM(0), // Directory exists, but no libjvm.so |
4003935e6e5f
8216532: tools/launcher/Test7029048.java fails (Solaris)
mr
parents:
53229
diff
changeset
|
123 |
LIBJVM(3); // Directory exists, with a libjvm.so |
9244
84d85c90d5db
7029048: (launcher) fence the launcher against LD_LIBRARY_PATH
ksrini
parents:
diff
changeset
|
124 |
private final int value; |
53372
4003935e6e5f
8216532: tools/launcher/Test7029048.java fails (Solaris)
mr
parents:
53229
diff
changeset
|
125 |
TestCase(int i) { |
9244
84d85c90d5db
7029048: (launcher) fence the launcher against LD_LIBRARY_PATH
ksrini
parents:
diff
changeset
|
126 |
this.value = i; |
84d85c90d5db
7029048: (launcher) fence the launcher against LD_LIBRARY_PATH
ksrini
parents:
diff
changeset
|
127 |
} |
84d85c90d5db
7029048: (launcher) fence the launcher against LD_LIBRARY_PATH
ksrini
parents:
diff
changeset
|
128 |
} |
84d85c90d5db
7029048: (launcher) fence the launcher against LD_LIBRARY_PATH
ksrini
parents:
diff
changeset
|
129 |
|
84d85c90d5db
7029048: (launcher) fence the launcher against LD_LIBRARY_PATH
ksrini
parents:
diff
changeset
|
130 |
/* |
84d85c90d5db
7029048: (launcher) fence the launcher against LD_LIBRARY_PATH
ksrini
parents:
diff
changeset
|
131 |
* test for 7029048 |
84d85c90d5db
7029048: (launcher) fence the launcher against LD_LIBRARY_PATH
ksrini
parents:
diff
changeset
|
132 |
*/ |
84d85c90d5db
7029048: (launcher) fence the launcher against LD_LIBRARY_PATH
ksrini
parents:
diff
changeset
|
133 |
static void test7029048() throws IOException { |
84d85c90d5db
7029048: (launcher) fence the launcher against LD_LIBRARY_PATH
ksrini
parents:
diff
changeset
|
134 |
String desc = null; |
53372
4003935e6e5f
8216532: tools/launcher/Test7029048.java fails (Solaris)
mr
parents:
53229
diff
changeset
|
135 |
for (TestCase v : TestCase.values()) { |
9244
84d85c90d5db
7029048: (launcher) fence the launcher against LD_LIBRARY_PATH
ksrini
parents:
diff
changeset
|
136 |
switch (v) { |
53372
4003935e6e5f
8216532: tools/launcher/Test7029048.java fails (Solaris)
mr
parents:
53229
diff
changeset
|
137 |
case LIBJVM: |
9244
84d85c90d5db
7029048: (launcher) fence the launcher against LD_LIBRARY_PATH
ksrini
parents:
diff
changeset
|
138 |
// copy the files into the directory structures |
11687
f13cadbb0bb5
7127906: (launcher) convert the launcher regression tests to java
ksrini
parents:
9244
diff
changeset
|
139 |
copyFile(srcLibjvmSo, dstServerLibjvm); |
9244
84d85c90d5db
7029048: (launcher) fence the launcher against LD_LIBRARY_PATH
ksrini
parents:
diff
changeset
|
140 |
// does not matter if it is client or a server |
11687
f13cadbb0bb5
7127906: (launcher) convert the launcher regression tests to java
ksrini
parents:
9244
diff
changeset
|
141 |
copyFile(srcLibjvmSo, dstClientLibjvm); |
9244
84d85c90d5db
7029048: (launcher) fence the launcher against LD_LIBRARY_PATH
ksrini
parents:
diff
changeset
|
142 |
desc = "LD_LIBRARY_PATH should be set"; |
84d85c90d5db
7029048: (launcher) fence the launcher against LD_LIBRARY_PATH
ksrini
parents:
diff
changeset
|
143 |
break; |
53372
4003935e6e5f
8216532: tools/launcher/Test7029048.java fails (Solaris)
mr
parents:
53229
diff
changeset
|
144 |
case NO_LIBJVM: |
9244
84d85c90d5db
7029048: (launcher) fence the launcher against LD_LIBRARY_PATH
ksrini
parents:
diff
changeset
|
145 |
if (!dstClientDir.exists()) { |
84d85c90d5db
7029048: (launcher) fence the launcher against LD_LIBRARY_PATH
ksrini
parents:
diff
changeset
|
146 |
Files.createDirectories(dstClientDir.toPath()); |
84d85c90d5db
7029048: (launcher) fence the launcher against LD_LIBRARY_PATH
ksrini
parents:
diff
changeset
|
147 |
} else { |
84d85c90d5db
7029048: (launcher) fence the launcher against LD_LIBRARY_PATH
ksrini
parents:
diff
changeset
|
148 |
Files.deleteIfExists(dstClientLibjvm.toPath()); |
84d85c90d5db
7029048: (launcher) fence the launcher against LD_LIBRARY_PATH
ksrini
parents:
diff
changeset
|
149 |
} |
84d85c90d5db
7029048: (launcher) fence the launcher against LD_LIBRARY_PATH
ksrini
parents:
diff
changeset
|
150 |
|
84d85c90d5db
7029048: (launcher) fence the launcher against LD_LIBRARY_PATH
ksrini
parents:
diff
changeset
|
151 |
if (!dstServerDir.exists()) { |
84d85c90d5db
7029048: (launcher) fence the launcher against LD_LIBRARY_PATH
ksrini
parents:
diff
changeset
|
152 |
Files.createDirectories(dstServerDir.toPath()); |
84d85c90d5db
7029048: (launcher) fence the launcher against LD_LIBRARY_PATH
ksrini
parents:
diff
changeset
|
153 |
} else { |
84d85c90d5db
7029048: (launcher) fence the launcher against LD_LIBRARY_PATH
ksrini
parents:
diff
changeset
|
154 |
Files.deleteIfExists(dstServerLibjvm.toPath()); |
84d85c90d5db
7029048: (launcher) fence the launcher against LD_LIBRARY_PATH
ksrini
parents:
diff
changeset
|
155 |
} |
84d85c90d5db
7029048: (launcher) fence the launcher against LD_LIBRARY_PATH
ksrini
parents:
diff
changeset
|
156 |
|
53372
4003935e6e5f
8216532: tools/launcher/Test7029048.java fails (Solaris)
mr
parents:
53229
diff
changeset
|
157 |
desc = "LD_LIBRARY_PATH should not be set (no libjvm.so)"; |
53455
c818e66338c1
8217438: Adapt tools/launcher/Test7029048.java for Aix.
goetz
parents:
53372
diff
changeset
|
158 |
if (TestHelper.isAIX) { |
c818e66338c1
8217438: Adapt tools/launcher/Test7029048.java for Aix.
goetz
parents:
53372
diff
changeset
|
159 |
System.out.println("Skipping test case \"" + desc + |
c818e66338c1
8217438: Adapt tools/launcher/Test7029048.java for Aix.
goetz
parents:
53372
diff
changeset
|
160 |
"\" because the Aix launcher adds the paths in any case."); |
c818e66338c1
8217438: Adapt tools/launcher/Test7029048.java for Aix.
goetz
parents:
53372
diff
changeset
|
161 |
continue; |
c818e66338c1
8217438: Adapt tools/launcher/Test7029048.java for Aix.
goetz
parents:
53372
diff
changeset
|
162 |
} |
9244
84d85c90d5db
7029048: (launcher) fence the launcher against LD_LIBRARY_PATH
ksrini
parents:
diff
changeset
|
163 |
break; |
53372
4003935e6e5f
8216532: tools/launcher/Test7029048.java fails (Solaris)
mr
parents:
53229
diff
changeset
|
164 |
case NO_DIR: |
9244
84d85c90d5db
7029048: (launcher) fence the launcher against LD_LIBRARY_PATH
ksrini
parents:
diff
changeset
|
165 |
if (dstLibDir.exists()) { |
11687
f13cadbb0bb5
7127906: (launcher) convert the launcher regression tests to java
ksrini
parents:
9244
diff
changeset
|
166 |
recursiveDelete(dstLibDir); |
9244
84d85c90d5db
7029048: (launcher) fence the launcher against LD_LIBRARY_PATH
ksrini
parents:
diff
changeset
|
167 |
} |
53372
4003935e6e5f
8216532: tools/launcher/Test7029048.java fails (Solaris)
mr
parents:
53229
diff
changeset
|
168 |
desc = "LD_LIBRARY_PATH should not be set (no directory)"; |
53455
c818e66338c1
8217438: Adapt tools/launcher/Test7029048.java for Aix.
goetz
parents:
53372
diff
changeset
|
169 |
if (TestHelper.isAIX) { |
c818e66338c1
8217438: Adapt tools/launcher/Test7029048.java for Aix.
goetz
parents:
53372
diff
changeset
|
170 |
System.out.println("Skipping test case \"" + desc + |
c818e66338c1
8217438: Adapt tools/launcher/Test7029048.java for Aix.
goetz
parents:
53372
diff
changeset
|
171 |
"\" because the Aix launcher adds the paths in any case."); |
c818e66338c1
8217438: Adapt tools/launcher/Test7029048.java for Aix.
goetz
parents:
53372
diff
changeset
|
172 |
continue; |
c818e66338c1
8217438: Adapt tools/launcher/Test7029048.java for Aix.
goetz
parents:
53372
diff
changeset
|
173 |
} |
9244
84d85c90d5db
7029048: (launcher) fence the launcher against LD_LIBRARY_PATH
ksrini
parents:
diff
changeset
|
174 |
break; |
84d85c90d5db
7029048: (launcher) fence the launcher against LD_LIBRARY_PATH
ksrini
parents:
diff
changeset
|
175 |
default: |
84d85c90d5db
7029048: (launcher) fence the launcher against LD_LIBRARY_PATH
ksrini
parents:
diff
changeset
|
176 |
throw new RuntimeException("unknown case"); |
84d85c90d5db
7029048: (launcher) fence the launcher against LD_LIBRARY_PATH
ksrini
parents:
diff
changeset
|
177 |
} |
84d85c90d5db
7029048: (launcher) fence the launcher against LD_LIBRARY_PATH
ksrini
parents:
diff
changeset
|
178 |
|
84d85c90d5db
7029048: (launcher) fence the launcher against LD_LIBRARY_PATH
ksrini
parents:
diff
changeset
|
179 |
/* |
84d85c90d5db
7029048: (launcher) fence the launcher against LD_LIBRARY_PATH
ksrini
parents:
diff
changeset
|
180 |
* Case 1: set the server path |
84d85c90d5db
7029048: (launcher) fence the launcher against LD_LIBRARY_PATH
ksrini
parents:
diff
changeset
|
181 |
*/ |
84d85c90d5db
7029048: (launcher) fence the launcher against LD_LIBRARY_PATH
ksrini
parents:
diff
changeset
|
182 |
env.clear(); |
84d85c90d5db
7029048: (launcher) fence the launcher against LD_LIBRARY_PATH
ksrini
parents:
diff
changeset
|
183 |
env.put(LD_LIBRARY_PATH, dstServerDir.getAbsolutePath()); |
53372
4003935e6e5f
8216532: tools/launcher/Test7029048.java fails (Solaris)
mr
parents:
53229
diff
changeset
|
184 |
run(env, |
4003935e6e5f
8216532: tools/launcher/Test7029048.java fails (Solaris)
mr
parents:
53229
diff
changeset
|
185 |
v.value + 1, // Add one to account for our setting |
4003935e6e5f
8216532: tools/launcher/Test7029048.java fails (Solaris)
mr
parents:
53229
diff
changeset
|
186 |
"Case 1: " + desc); |
9244
84d85c90d5db
7029048: (launcher) fence the launcher against LD_LIBRARY_PATH
ksrini
parents:
diff
changeset
|
187 |
|
84d85c90d5db
7029048: (launcher) fence the launcher against LD_LIBRARY_PATH
ksrini
parents:
diff
changeset
|
188 |
/* |
84d85c90d5db
7029048: (launcher) fence the launcher against LD_LIBRARY_PATH
ksrini
parents:
diff
changeset
|
189 |
* Case 2: repeat with client path |
84d85c90d5db
7029048: (launcher) fence the launcher against LD_LIBRARY_PATH
ksrini
parents:
diff
changeset
|
190 |
*/ |
84d85c90d5db
7029048: (launcher) fence the launcher against LD_LIBRARY_PATH
ksrini
parents:
diff
changeset
|
191 |
env.clear(); |
84d85c90d5db
7029048: (launcher) fence the launcher against LD_LIBRARY_PATH
ksrini
parents:
diff
changeset
|
192 |
env.put(LD_LIBRARY_PATH, dstClientDir.getAbsolutePath()); |
53372
4003935e6e5f
8216532: tools/launcher/Test7029048.java fails (Solaris)
mr
parents:
53229
diff
changeset
|
193 |
run(env, |
4003935e6e5f
8216532: tools/launcher/Test7029048.java fails (Solaris)
mr
parents:
53229
diff
changeset
|
194 |
v.value + 1, // Add one to account for our setting |
4003935e6e5f
8216532: tools/launcher/Test7029048.java fails (Solaris)
mr
parents:
53229
diff
changeset
|
195 |
"Case 2: " + desc); |
9244
84d85c90d5db
7029048: (launcher) fence the launcher against LD_LIBRARY_PATH
ksrini
parents:
diff
changeset
|
196 |
|
20201
50cc2d25a60b
8020552: [launcher] changes to support removal of Solaris 32-bit distribution
ksrini
parents:
12047
diff
changeset
|
197 |
if (isSolaris) { |
50cc2d25a60b
8020552: [launcher] changes to support removal of Solaris 32-bit distribution
ksrini
parents:
12047
diff
changeset
|
198 |
/* |
50cc2d25a60b
8020552: [launcher] changes to support removal of Solaris 32-bit distribution
ksrini
parents:
12047
diff
changeset
|
199 |
* Case 3: set the appropriate LLP_XX flag, |
45062 | 200 |
* java64 LLP_64 is relevant, LLP_32 is ignored |
20201
50cc2d25a60b
8020552: [launcher] changes to support removal of Solaris 32-bit distribution
ksrini
parents:
12047
diff
changeset
|
201 |
*/ |
50cc2d25a60b
8020552: [launcher] changes to support removal of Solaris 32-bit distribution
ksrini
parents:
12047
diff
changeset
|
202 |
env.clear(); |
50cc2d25a60b
8020552: [launcher] changes to support removal of Solaris 32-bit distribution
ksrini
parents:
12047
diff
changeset
|
203 |
env.put(LD_LIBRARY_PATH_64, dstServerDir.getAbsolutePath()); |
53372
4003935e6e5f
8216532: tools/launcher/Test7029048.java fails (Solaris)
mr
parents:
53229
diff
changeset
|
204 |
run(env, |
4003935e6e5f
8216532: tools/launcher/Test7029048.java fails (Solaris)
mr
parents:
53229
diff
changeset
|
205 |
v.value, // Do not add one, since we didn't set |
4003935e6e5f
8216532: tools/launcher/Test7029048.java fails (Solaris)
mr
parents:
53229
diff
changeset
|
206 |
// LD_LIBRARY_PATH here |
4003935e6e5f
8216532: tools/launcher/Test7029048.java fails (Solaris)
mr
parents:
53229
diff
changeset
|
207 |
"Case 3: " + desc); |
9244
84d85c90d5db
7029048: (launcher) fence the launcher against LD_LIBRARY_PATH
ksrini
parents:
diff
changeset
|
208 |
} |
84d85c90d5db
7029048: (launcher) fence the launcher against LD_LIBRARY_PATH
ksrini
parents:
diff
changeset
|
209 |
} |
84d85c90d5db
7029048: (launcher) fence the launcher against LD_LIBRARY_PATH
ksrini
parents:
diff
changeset
|
210 |
return; |
84d85c90d5db
7029048: (launcher) fence the launcher against LD_LIBRARY_PATH
ksrini
parents:
diff
changeset
|
211 |
} |
84d85c90d5db
7029048: (launcher) fence the launcher against LD_LIBRARY_PATH
ksrini
parents:
diff
changeset
|
212 |
|
84d85c90d5db
7029048: (launcher) fence the launcher against LD_LIBRARY_PATH
ksrini
parents:
diff
changeset
|
213 |
public static void main(String... args) throws Exception { |
12047
320a714614e9
7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
11687
diff
changeset
|
214 |
if (TestHelper.isWindows || TestHelper.isMacOSX) { |
320a714614e9
7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
11687
diff
changeset
|
215 |
System.out.println("Note: applicable on neither Windows nor MacOSX"); |
9244
84d85c90d5db
7029048: (launcher) fence the launcher against LD_LIBRARY_PATH
ksrini
parents:
diff
changeset
|
216 |
return; |
84d85c90d5db
7029048: (launcher) fence the launcher against LD_LIBRARY_PATH
ksrini
parents:
diff
changeset
|
217 |
} |
21812
c43ac963db3d
8023978: [TEST_BUG] launcher tests must exclude platforms without server vm
ksrini
parents:
20201
diff
changeset
|
218 |
if (!TestHelper.haveServerVM) { |
c43ac963db3d
8023978: [TEST_BUG] launcher tests must exclude platforms without server vm
ksrini
parents:
20201
diff
changeset
|
219 |
System.out.println("Note: test relies on server vm, not found, exiting"); |
c43ac963db3d
8023978: [TEST_BUG] launcher tests must exclude platforms without server vm
ksrini
parents:
20201
diff
changeset
|
220 |
return; |
c43ac963db3d
8023978: [TEST_BUG] launcher tests must exclude platforms without server vm
ksrini
parents:
20201
diff
changeset
|
221 |
} |
9244
84d85c90d5db
7029048: (launcher) fence the launcher against LD_LIBRARY_PATH
ksrini
parents:
diff
changeset
|
222 |
// create our test jar first |
84d85c90d5db
7029048: (launcher) fence the launcher against LD_LIBRARY_PATH
ksrini
parents:
diff
changeset
|
223 |
ExecutionEnvironment.createTestJar(); |
84d85c90d5db
7029048: (launcher) fence the launcher against LD_LIBRARY_PATH
ksrini
parents:
diff
changeset
|
224 |
|
84d85c90d5db
7029048: (launcher) fence the launcher against LD_LIBRARY_PATH
ksrini
parents:
diff
changeset
|
225 |
// run the tests |
84d85c90d5db
7029048: (launcher) fence the launcher against LD_LIBRARY_PATH
ksrini
parents:
diff
changeset
|
226 |
test7029048(); |
84d85c90d5db
7029048: (launcher) fence the launcher against LD_LIBRARY_PATH
ksrini
parents:
diff
changeset
|
227 |
if (errors > 0) { |
84d85c90d5db
7029048: (launcher) fence the launcher against LD_LIBRARY_PATH
ksrini
parents:
diff
changeset
|
228 |
throw new Exception("Test7029048: FAIL: with " |
84d85c90d5db
7029048: (launcher) fence the launcher against LD_LIBRARY_PATH
ksrini
parents:
diff
changeset
|
229 |
+ errors + " errors and passes " + passes); |
11687
f13cadbb0bb5
7127906: (launcher) convert the launcher regression tests to java
ksrini
parents:
9244
diff
changeset
|
230 |
} else if (isSolaris && passes < 9) { |
9244
84d85c90d5db
7029048: (launcher) fence the launcher against LD_LIBRARY_PATH
ksrini
parents:
diff
changeset
|
231 |
throw new Exception("Test7029048: FAIL: " + |
84d85c90d5db
7029048: (launcher) fence the launcher against LD_LIBRARY_PATH
ksrini
parents:
diff
changeset
|
232 |
"all tests did not run, expected " + 9 + " got " + passes); |
11687
f13cadbb0bb5
7127906: (launcher) convert the launcher regression tests to java
ksrini
parents:
9244
diff
changeset
|
233 |
} else if (isLinux && passes < 6) { |
9244
84d85c90d5db
7029048: (launcher) fence the launcher against LD_LIBRARY_PATH
ksrini
parents:
diff
changeset
|
234 |
throw new Exception("Test7029048: FAIL: " + |
84d85c90d5db
7029048: (launcher) fence the launcher against LD_LIBRARY_PATH
ksrini
parents:
diff
changeset
|
235 |
"all tests did not run, expected " + 6 + " got " + passes); |
84d85c90d5db
7029048: (launcher) fence the launcher against LD_LIBRARY_PATH
ksrini
parents:
diff
changeset
|
236 |
} else { |
84d85c90d5db
7029048: (launcher) fence the launcher against LD_LIBRARY_PATH
ksrini
parents:
diff
changeset
|
237 |
System.out.println("Test7029048: PASS " + passes); |
84d85c90d5db
7029048: (launcher) fence the launcher against LD_LIBRARY_PATH
ksrini
parents:
diff
changeset
|
238 |
} |
84d85c90d5db
7029048: (launcher) fence the launcher against LD_LIBRARY_PATH
ksrini
parents:
diff
changeset
|
239 |
} |
84d85c90d5db
7029048: (launcher) fence the launcher against LD_LIBRARY_PATH
ksrini
parents:
diff
changeset
|
240 |
} |