Print this page
Split |
Close |
Expand all |
Collapse all |
--- old/jdk/test/tools/launcher/RunpathTest.java
+++ new/jdk/test/tools/launcher/RunpathTest.java
1 1 /*
2 2 * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
3 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 4 *
5 5 * This code is free software; you can redistribute it and/or modify it
6 6 * under the terms of the GNU General Public License version 2 only, as
7 7 * published by the Free Software Foundation.
8 8 *
9 9 * This code is distributed in the hope that it will be useful, but WITHOUT
10 10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 12 * version 2 for more details (a copy is included in the LICENSE file that
13 13 * accompanied this code).
14 14 *
15 15 * You should have received a copy of the GNU General Public License version
16 16 * 2 along with this work; if not, write to the Free Software Foundation,
17 17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 18 *
19 19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 20 * or visit www.oracle.com if you need additional information or have any
21 21 * questions.
22 22 */
23 23
24 24 /*
25 25 * @test
26 26 * @bug 7190813 8022719
27 27 * @summary Check for extended RPATHs on *nixes
28 28 * @compile -XDignore.symbol.file RunpathTest.java
29 29 * @run main RunpathTest
30 30 * @author ksrini
31 31 */
32 32
↓ open down ↓ |
32 lines elided |
↑ open up ↑ |
33 33 import java.io.File;
34 34
35 35 public class RunpathTest extends TestHelper {
36 36
37 37 final String elfreaderCmd;
38 38 RunpathTest() {
39 39 elfreaderCmd = findElfReader();
40 40 }
41 41
42 42 final String findElfReader() {
43 - String[] paths = {"/bin", "/sbin", "/usr/bin", "/usr/sbin", "/usr/ccs/bin"};
43 + String[] paths = {"/usr/sbin", "/usr/bin"};
44 44 final String cmd = isSolaris ? "elfdump" : "readelf";
45 45 for (String x : paths) {
46 46 File p = new File(x);
47 47 File e = new File(p, cmd);
48 48 if (e.canExecute()) {
49 49 return e.getAbsolutePath();
50 50 }
51 51 }
52 52 System.err.println("Warning: no suitable elf reader!");
53 53 return null;
54 54 }
55 55
56 56 void elfCheck(String javacmd, String expectedRpath) {
57 57 final TestResult tr = doExec(elfreaderCmd, "-d", javacmd);
58 58 if (!tr.matches(expectedRpath)) {
59 59 System.out.println(tr);
60 60 throw new RuntimeException("FAILED: RPATH strings " +
61 61 expectedRpath + " not found in " + javaCmd);
62 62 }
63 63 System.out.println(javacmd + " contains expected RPATHS");
64 64 }
65 65
66 66 void testRpath() {
67 67 String expectedRpath = ".*RPATH.*\\$ORIGIN/../lib/" + getJreArch() + ".*";
68 68 elfCheck(javaCmd, expectedRpath);
69 69 }
70 70
71 71 public static void main(String... args) throws Exception {
72 72 if (isSolaris || isLinux) {
73 73 RunpathTest rp = new RunpathTest();
74 74 rp.testRpath();
75 75 }
76 76 }
77 77 }
↓ open down ↓ |
24 lines elided |
↑ open up ↑ |
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX