author | igerasim |
Mon, 20 Jan 2014 19:23:22 +0400 | |
changeset 22355 | 006659506061 |
parent 22255 | b4f108102ca9 |
child 24366 | 57c0a8b7a936 |
permissions | -rw-r--r-- |
21367
679b312e3c5b
8004926: sun/management/jmxremote/bootstrap/CustomLauncherTest.sh oftenly times out
jbachorik
parents:
diff
changeset
|
1 |
/* |
679b312e3c5b
8004926: sun/management/jmxremote/bootstrap/CustomLauncherTest.sh oftenly times out
jbachorik
parents:
diff
changeset
|
2 |
* Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. |
679b312e3c5b
8004926: sun/management/jmxremote/bootstrap/CustomLauncherTest.sh oftenly times out
jbachorik
parents:
diff
changeset
|
3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
679b312e3c5b
8004926: sun/management/jmxremote/bootstrap/CustomLauncherTest.sh oftenly times out
jbachorik
parents:
diff
changeset
|
4 |
* |
679b312e3c5b
8004926: sun/management/jmxremote/bootstrap/CustomLauncherTest.sh oftenly times out
jbachorik
parents:
diff
changeset
|
5 |
* This code is free software; you can redistribute it and/or modify it |
679b312e3c5b
8004926: sun/management/jmxremote/bootstrap/CustomLauncherTest.sh oftenly times out
jbachorik
parents:
diff
changeset
|
6 |
* under the terms of the GNU General Public License version 2 only, as |
679b312e3c5b
8004926: sun/management/jmxremote/bootstrap/CustomLauncherTest.sh oftenly times out
jbachorik
parents:
diff
changeset
|
7 |
* published by the Free Software Foundation. |
679b312e3c5b
8004926: sun/management/jmxremote/bootstrap/CustomLauncherTest.sh oftenly times out
jbachorik
parents:
diff
changeset
|
8 |
* |
679b312e3c5b
8004926: sun/management/jmxremote/bootstrap/CustomLauncherTest.sh oftenly times out
jbachorik
parents:
diff
changeset
|
9 |
* This code is distributed in the hope that it will be useful, but WITHOUT |
679b312e3c5b
8004926: sun/management/jmxremote/bootstrap/CustomLauncherTest.sh oftenly times out
jbachorik
parents:
diff
changeset
|
10 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
679b312e3c5b
8004926: sun/management/jmxremote/bootstrap/CustomLauncherTest.sh oftenly times out
jbachorik
parents:
diff
changeset
|
11 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
679b312e3c5b
8004926: sun/management/jmxremote/bootstrap/CustomLauncherTest.sh oftenly times out
jbachorik
parents:
diff
changeset
|
12 |
* version 2 for more details (a copy is included in the LICENSE file that |
679b312e3c5b
8004926: sun/management/jmxremote/bootstrap/CustomLauncherTest.sh oftenly times out
jbachorik
parents:
diff
changeset
|
13 |
* accompanied this code). |
679b312e3c5b
8004926: sun/management/jmxremote/bootstrap/CustomLauncherTest.sh oftenly times out
jbachorik
parents:
diff
changeset
|
14 |
* |
679b312e3c5b
8004926: sun/management/jmxremote/bootstrap/CustomLauncherTest.sh oftenly times out
jbachorik
parents:
diff
changeset
|
15 |
* You should have received a copy of the GNU General Public License version |
679b312e3c5b
8004926: sun/management/jmxremote/bootstrap/CustomLauncherTest.sh oftenly times out
jbachorik
parents:
diff
changeset
|
16 |
* 2 along with this work; if not, write to the Free Software Foundation, |
679b312e3c5b
8004926: sun/management/jmxremote/bootstrap/CustomLauncherTest.sh oftenly times out
jbachorik
parents:
diff
changeset
|
17 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
679b312e3c5b
8004926: sun/management/jmxremote/bootstrap/CustomLauncherTest.sh oftenly times out
jbachorik
parents:
diff
changeset
|
18 |
* |
679b312e3c5b
8004926: sun/management/jmxremote/bootstrap/CustomLauncherTest.sh oftenly times out
jbachorik
parents:
diff
changeset
|
19 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
679b312e3c5b
8004926: sun/management/jmxremote/bootstrap/CustomLauncherTest.sh oftenly times out
jbachorik
parents:
diff
changeset
|
20 |
* or visit www.oracle.com if you need additional information or have any |
679b312e3c5b
8004926: sun/management/jmxremote/bootstrap/CustomLauncherTest.sh oftenly times out
jbachorik
parents:
diff
changeset
|
21 |
* questions. |
679b312e3c5b
8004926: sun/management/jmxremote/bootstrap/CustomLauncherTest.sh oftenly times out
jbachorik
parents:
diff
changeset
|
22 |
*/ |
679b312e3c5b
8004926: sun/management/jmxremote/bootstrap/CustomLauncherTest.sh oftenly times out
jbachorik
parents:
diff
changeset
|
23 |
|
679b312e3c5b
8004926: sun/management/jmxremote/bootstrap/CustomLauncherTest.sh oftenly times out
jbachorik
parents:
diff
changeset
|
24 |
import java.io.File; |
22062
175604b1209f
8029809: sun/management/jmxremote/bootstrap/CustomLauncherTest.java fails intermittently with "Operation not permitted"
jbachorik
parents:
21822
diff
changeset
|
25 |
import java.io.IOException; |
21367
679b312e3c5b
8004926: sun/management/jmxremote/bootstrap/CustomLauncherTest.sh oftenly times out
jbachorik
parents:
diff
changeset
|
26 |
import java.nio.file.FileSystem; |
679b312e3c5b
8004926: sun/management/jmxremote/bootstrap/CustomLauncherTest.sh oftenly times out
jbachorik
parents:
diff
changeset
|
27 |
import java.nio.file.FileSystems; |
679b312e3c5b
8004926: sun/management/jmxremote/bootstrap/CustomLauncherTest.sh oftenly times out
jbachorik
parents:
diff
changeset
|
28 |
import java.nio.file.Files; |
21802
b36494ddf19e
8027163: sun/management/jmxremote/bootstrap/CustomLauncherTest.java should be updated for jdk8 removal of solaris-32bit support
jbachorik
parents:
21662
diff
changeset
|
29 |
import java.nio.file.LinkOption; |
21367
679b312e3c5b
8004926: sun/management/jmxremote/bootstrap/CustomLauncherTest.sh oftenly times out
jbachorik
parents:
diff
changeset
|
30 |
import java.nio.file.Path; |
22062
175604b1209f
8029809: sun/management/jmxremote/bootstrap/CustomLauncherTest.java fails intermittently with "Operation not permitted"
jbachorik
parents:
21822
diff
changeset
|
31 |
import java.nio.file.StandardCopyOption; |
21802
b36494ddf19e
8027163: sun/management/jmxremote/bootstrap/CustomLauncherTest.java should be updated for jdk8 removal of solaris-32bit support
jbachorik
parents:
21662
diff
changeset
|
32 |
import java.nio.file.attribute.PosixFilePermission; |
b36494ddf19e
8027163: sun/management/jmxremote/bootstrap/CustomLauncherTest.java should be updated for jdk8 removal of solaris-32bit support
jbachorik
parents:
21662
diff
changeset
|
33 |
import java.util.HashSet; |
b36494ddf19e
8027163: sun/management/jmxremote/bootstrap/CustomLauncherTest.java should be updated for jdk8 removal of solaris-32bit support
jbachorik
parents:
21662
diff
changeset
|
34 |
import java.util.Set; |
21367
679b312e3c5b
8004926: sun/management/jmxremote/bootstrap/CustomLauncherTest.sh oftenly times out
jbachorik
parents:
diff
changeset
|
35 |
import java.util.concurrent.TimeUnit; |
679b312e3c5b
8004926: sun/management/jmxremote/bootstrap/CustomLauncherTest.sh oftenly times out
jbachorik
parents:
diff
changeset
|
36 |
import java.util.concurrent.atomic.AtomicReference; |
679b312e3c5b
8004926: sun/management/jmxremote/bootstrap/CustomLauncherTest.sh oftenly times out
jbachorik
parents:
diff
changeset
|
37 |
|
679b312e3c5b
8004926: sun/management/jmxremote/bootstrap/CustomLauncherTest.sh oftenly times out
jbachorik
parents:
diff
changeset
|
38 |
import jdk.testlibrary.ProcessTools; |
679b312e3c5b
8004926: sun/management/jmxremote/bootstrap/CustomLauncherTest.sh oftenly times out
jbachorik
parents:
diff
changeset
|
39 |
|
679b312e3c5b
8004926: sun/management/jmxremote/bootstrap/CustomLauncherTest.sh oftenly times out
jbachorik
parents:
diff
changeset
|
40 |
/** |
679b312e3c5b
8004926: sun/management/jmxremote/bootstrap/CustomLauncherTest.sh oftenly times out
jbachorik
parents:
diff
changeset
|
41 |
* @test |
679b312e3c5b
8004926: sun/management/jmxremote/bootstrap/CustomLauncherTest.sh oftenly times out
jbachorik
parents:
diff
changeset
|
42 |
* @bug 6434402 8004926 |
21404
0e54d286d846
8027358: sun/management/jmxremote/bootstrap/LocalManagementTest.java failing since JDK-8004926
jbachorik
parents:
21367
diff
changeset
|
43 |
* @library /lib/testlibrary |
21822
12f13ba496cd
8028141: test/sun/management/jmxremote/bootstrap/LocalManagementTest|CustomLauncherTest.java failing again
rriggs
parents:
21802
diff
changeset
|
44 |
* @build jdk.testlibrary.ProcessTools |
21367
679b312e3c5b
8004926: sun/management/jmxremote/bootstrap/CustomLauncherTest.sh oftenly times out
jbachorik
parents:
diff
changeset
|
45 |
* @build TestManager TestApplication CustomLauncherTest |
21802
b36494ddf19e
8027163: sun/management/jmxremote/bootstrap/CustomLauncherTest.java should be updated for jdk8 removal of solaris-32bit support
jbachorik
parents:
21662
diff
changeset
|
46 |
* @run main/othervm CustomLauncherTest |
21367
679b312e3c5b
8004926: sun/management/jmxremote/bootstrap/CustomLauncherTest.sh oftenly times out
jbachorik
parents:
diff
changeset
|
47 |
* @author Jaroslav Bachorik |
679b312e3c5b
8004926: sun/management/jmxremote/bootstrap/CustomLauncherTest.sh oftenly times out
jbachorik
parents:
diff
changeset
|
48 |
*/ |
679b312e3c5b
8004926: sun/management/jmxremote/bootstrap/CustomLauncherTest.sh oftenly times out
jbachorik
parents:
diff
changeset
|
49 |
public class CustomLauncherTest { |
21822
12f13ba496cd
8028141: test/sun/management/jmxremote/bootstrap/LocalManagementTest|CustomLauncherTest.java failing again
rriggs
parents:
21802
diff
changeset
|
50 |
private static final String TEST_CLASSPATH = System.getProperty("test.class.path"); |
21367
679b312e3c5b
8004926: sun/management/jmxremote/bootstrap/CustomLauncherTest.sh oftenly times out
jbachorik
parents:
diff
changeset
|
51 |
private static final String TEST_JDK = System.getProperty("test.jdk"); |
22062
175604b1209f
8029809: sun/management/jmxremote/bootstrap/CustomLauncherTest.java fails intermittently with "Operation not permitted"
jbachorik
parents:
21822
diff
changeset
|
52 |
private static final String WORK_DIR = System.getProperty("user.dir"); |
21367
679b312e3c5b
8004926: sun/management/jmxremote/bootstrap/CustomLauncherTest.sh oftenly times out
jbachorik
parents:
diff
changeset
|
53 |
|
679b312e3c5b
8004926: sun/management/jmxremote/bootstrap/CustomLauncherTest.sh oftenly times out
jbachorik
parents:
diff
changeset
|
54 |
private static final String TEST_SRC = System.getProperty("test.src"); |
679b312e3c5b
8004926: sun/management/jmxremote/bootstrap/CustomLauncherTest.sh oftenly times out
jbachorik
parents:
diff
changeset
|
55 |
private static final String OSNAME = System.getProperty("os.name"); |
679b312e3c5b
8004926: sun/management/jmxremote/bootstrap/CustomLauncherTest.sh oftenly times out
jbachorik
parents:
diff
changeset
|
56 |
private static final String ARCH; |
679b312e3c5b
8004926: sun/management/jmxremote/bootstrap/CustomLauncherTest.sh oftenly times out
jbachorik
parents:
diff
changeset
|
57 |
private static final String LIBARCH; |
679b312e3c5b
8004926: sun/management/jmxremote/bootstrap/CustomLauncherTest.sh oftenly times out
jbachorik
parents:
diff
changeset
|
58 |
|
679b312e3c5b
8004926: sun/management/jmxremote/bootstrap/CustomLauncherTest.sh oftenly times out
jbachorik
parents:
diff
changeset
|
59 |
static { |
679b312e3c5b
8004926: sun/management/jmxremote/bootstrap/CustomLauncherTest.sh oftenly times out
jbachorik
parents:
diff
changeset
|
60 |
// magic with os.arch |
679b312e3c5b
8004926: sun/management/jmxremote/bootstrap/CustomLauncherTest.sh oftenly times out
jbachorik
parents:
diff
changeset
|
61 |
String osarch = System.getProperty("os.arch"); |
679b312e3c5b
8004926: sun/management/jmxremote/bootstrap/CustomLauncherTest.sh oftenly times out
jbachorik
parents:
diff
changeset
|
62 |
switch (osarch) { |
679b312e3c5b
8004926: sun/management/jmxremote/bootstrap/CustomLauncherTest.sh oftenly times out
jbachorik
parents:
diff
changeset
|
63 |
case "i386": |
679b312e3c5b
8004926: sun/management/jmxremote/bootstrap/CustomLauncherTest.sh oftenly times out
jbachorik
parents:
diff
changeset
|
64 |
case "i486": |
679b312e3c5b
8004926: sun/management/jmxremote/bootstrap/CustomLauncherTest.sh oftenly times out
jbachorik
parents:
diff
changeset
|
65 |
case "i586": |
679b312e3c5b
8004926: sun/management/jmxremote/bootstrap/CustomLauncherTest.sh oftenly times out
jbachorik
parents:
diff
changeset
|
66 |
case "i686": |
679b312e3c5b
8004926: sun/management/jmxremote/bootstrap/CustomLauncherTest.sh oftenly times out
jbachorik
parents:
diff
changeset
|
67 |
case "i786": |
679b312e3c5b
8004926: sun/management/jmxremote/bootstrap/CustomLauncherTest.sh oftenly times out
jbachorik
parents:
diff
changeset
|
68 |
case "i886": |
679b312e3c5b
8004926: sun/management/jmxremote/bootstrap/CustomLauncherTest.sh oftenly times out
jbachorik
parents:
diff
changeset
|
69 |
case "i986": { |
679b312e3c5b
8004926: sun/management/jmxremote/bootstrap/CustomLauncherTest.sh oftenly times out
jbachorik
parents:
diff
changeset
|
70 |
ARCH = "i586"; |
679b312e3c5b
8004926: sun/management/jmxremote/bootstrap/CustomLauncherTest.sh oftenly times out
jbachorik
parents:
diff
changeset
|
71 |
break; |
679b312e3c5b
8004926: sun/management/jmxremote/bootstrap/CustomLauncherTest.sh oftenly times out
jbachorik
parents:
diff
changeset
|
72 |
} |
679b312e3c5b
8004926: sun/management/jmxremote/bootstrap/CustomLauncherTest.sh oftenly times out
jbachorik
parents:
diff
changeset
|
73 |
case "x86_64": |
679b312e3c5b
8004926: sun/management/jmxremote/bootstrap/CustomLauncherTest.sh oftenly times out
jbachorik
parents:
diff
changeset
|
74 |
case "amd64": { |
679b312e3c5b
8004926: sun/management/jmxremote/bootstrap/CustomLauncherTest.sh oftenly times out
jbachorik
parents:
diff
changeset
|
75 |
ARCH = "amd64"; |
679b312e3c5b
8004926: sun/management/jmxremote/bootstrap/CustomLauncherTest.sh oftenly times out
jbachorik
parents:
diff
changeset
|
76 |
break; |
679b312e3c5b
8004926: sun/management/jmxremote/bootstrap/CustomLauncherTest.sh oftenly times out
jbachorik
parents:
diff
changeset
|
77 |
} |
21802
b36494ddf19e
8027163: sun/management/jmxremote/bootstrap/CustomLauncherTest.java should be updated for jdk8 removal of solaris-32bit support
jbachorik
parents:
21662
diff
changeset
|
78 |
case "sparc": |
b36494ddf19e
8027163: sun/management/jmxremote/bootstrap/CustomLauncherTest.java should be updated for jdk8 removal of solaris-32bit support
jbachorik
parents:
21662
diff
changeset
|
79 |
ARCH = "sparcv9"; |
b36494ddf19e
8027163: sun/management/jmxremote/bootstrap/CustomLauncherTest.java should be updated for jdk8 removal of solaris-32bit support
jbachorik
parents:
21662
diff
changeset
|
80 |
break; |
21367
679b312e3c5b
8004926: sun/management/jmxremote/bootstrap/CustomLauncherTest.sh oftenly times out
jbachorik
parents:
diff
changeset
|
81 |
default: { |
679b312e3c5b
8004926: sun/management/jmxremote/bootstrap/CustomLauncherTest.sh oftenly times out
jbachorik
parents:
diff
changeset
|
82 |
ARCH = osarch; |
679b312e3c5b
8004926: sun/management/jmxremote/bootstrap/CustomLauncherTest.sh oftenly times out
jbachorik
parents:
diff
changeset
|
83 |
} |
679b312e3c5b
8004926: sun/management/jmxremote/bootstrap/CustomLauncherTest.sh oftenly times out
jbachorik
parents:
diff
changeset
|
84 |
} |
679b312e3c5b
8004926: sun/management/jmxremote/bootstrap/CustomLauncherTest.sh oftenly times out
jbachorik
parents:
diff
changeset
|
85 |
LIBARCH = ARCH.equals("i586") ? "i386" : ARCH; |
679b312e3c5b
8004926: sun/management/jmxremote/bootstrap/CustomLauncherTest.sh oftenly times out
jbachorik
parents:
diff
changeset
|
86 |
} |
679b312e3c5b
8004926: sun/management/jmxremote/bootstrap/CustomLauncherTest.sh oftenly times out
jbachorik
parents:
diff
changeset
|
87 |
|
679b312e3c5b
8004926: sun/management/jmxremote/bootstrap/CustomLauncherTest.sh oftenly times out
jbachorik
parents:
diff
changeset
|
88 |
public static void main(String[] args) throws Exception { |
21822
12f13ba496cd
8028141: test/sun/management/jmxremote/bootstrap/LocalManagementTest|CustomLauncherTest.java failing again
rriggs
parents:
21802
diff
changeset
|
89 |
if (TEST_CLASSPATH == null || TEST_CLASSPATH.isEmpty()) { |
21367
679b312e3c5b
8004926: sun/management/jmxremote/bootstrap/CustomLauncherTest.sh oftenly times out
jbachorik
parents:
diff
changeset
|
90 |
System.out.println("Test is designed to be run from jtreg only"); |
679b312e3c5b
8004926: sun/management/jmxremote/bootstrap/CustomLauncherTest.sh oftenly times out
jbachorik
parents:
diff
changeset
|
91 |
return; |
679b312e3c5b
8004926: sun/management/jmxremote/bootstrap/CustomLauncherTest.sh oftenly times out
jbachorik
parents:
diff
changeset
|
92 |
} |
679b312e3c5b
8004926: sun/management/jmxremote/bootstrap/CustomLauncherTest.sh oftenly times out
jbachorik
parents:
diff
changeset
|
93 |
|
22255
b4f108102ca9
8031420: sun/management/jmxremote/bootstrap/CustomLauncherTest.java fails on some platforms: Unable to locate 'libjvm.so'
jbachorik
parents:
22062
diff
changeset
|
94 |
if (getPlatform() == null) { |
b4f108102ca9
8031420: sun/management/jmxremote/bootstrap/CustomLauncherTest.java fails on some platforms: Unable to locate 'libjvm.so'
jbachorik
parents:
22062
diff
changeset
|
95 |
System.out.println("Test not designed to run on this operating " + |
b4f108102ca9
8031420: sun/management/jmxremote/bootstrap/CustomLauncherTest.java fails on some platforms: Unable to locate 'libjvm.so'
jbachorik
parents:
22062
diff
changeset
|
96 |
"system (" + OSNAME + "), skipping..."); |
b4f108102ca9
8031420: sun/management/jmxremote/bootstrap/CustomLauncherTest.java fails on some platforms: Unable to locate 'libjvm.so'
jbachorik
parents:
22062
diff
changeset
|
97 |
return; |
b4f108102ca9
8031420: sun/management/jmxremote/bootstrap/CustomLauncherTest.java fails on some platforms: Unable to locate 'libjvm.so'
jbachorik
parents:
22062
diff
changeset
|
98 |
} |
b4f108102ca9
8031420: sun/management/jmxremote/bootstrap/CustomLauncherTest.java fails on some platforms: Unable to locate 'libjvm.so'
jbachorik
parents:
22062
diff
changeset
|
99 |
|
21367
679b312e3c5b
8004926: sun/management/jmxremote/bootstrap/CustomLauncherTest.sh oftenly times out
jbachorik
parents:
diff
changeset
|
100 |
final FileSystem FS = FileSystems.getDefault(); |
679b312e3c5b
8004926: sun/management/jmxremote/bootstrap/CustomLauncherTest.sh oftenly times out
jbachorik
parents:
diff
changeset
|
101 |
|
679b312e3c5b
8004926: sun/management/jmxremote/bootstrap/CustomLauncherTest.sh oftenly times out
jbachorik
parents:
diff
changeset
|
102 |
Path libjvmPath = findLibjvm(FS); |
679b312e3c5b
8004926: sun/management/jmxremote/bootstrap/CustomLauncherTest.sh oftenly times out
jbachorik
parents:
diff
changeset
|
103 |
if (libjvmPath == null) { |
679b312e3c5b
8004926: sun/management/jmxremote/bootstrap/CustomLauncherTest.sh oftenly times out
jbachorik
parents:
diff
changeset
|
104 |
throw new Error("Unable to locate 'libjvm.so' in " + TEST_JDK); |
679b312e3c5b
8004926: sun/management/jmxremote/bootstrap/CustomLauncherTest.sh oftenly times out
jbachorik
parents:
diff
changeset
|
105 |
} |
679b312e3c5b
8004926: sun/management/jmxremote/bootstrap/CustomLauncherTest.sh oftenly times out
jbachorik
parents:
diff
changeset
|
106 |
|
679b312e3c5b
8004926: sun/management/jmxremote/bootstrap/CustomLauncherTest.sh oftenly times out
jbachorik
parents:
diff
changeset
|
107 |
Process serverPrc = null, clientPrc = null; |
679b312e3c5b
8004926: sun/management/jmxremote/bootstrap/CustomLauncherTest.sh oftenly times out
jbachorik
parents:
diff
changeset
|
108 |
|
679b312e3c5b
8004926: sun/management/jmxremote/bootstrap/CustomLauncherTest.sh oftenly times out
jbachorik
parents:
diff
changeset
|
109 |
try { |
22062
175604b1209f
8029809: sun/management/jmxremote/bootstrap/CustomLauncherTest.java fails intermittently with "Operation not permitted"
jbachorik
parents:
21822
diff
changeset
|
110 |
String[] launcher = getLauncher(); |
21802
b36494ddf19e
8027163: sun/management/jmxremote/bootstrap/CustomLauncherTest.java should be updated for jdk8 removal of solaris-32bit support
jbachorik
parents:
21662
diff
changeset
|
111 |
|
21367
679b312e3c5b
8004926: sun/management/jmxremote/bootstrap/CustomLauncherTest.sh oftenly times out
jbachorik
parents:
diff
changeset
|
112 |
System.out.println("Starting custom launcher:"); |
679b312e3c5b
8004926: sun/management/jmxremote/bootstrap/CustomLauncherTest.sh oftenly times out
jbachorik
parents:
diff
changeset
|
113 |
System.out.println("========================="); |
22062
175604b1209f
8029809: sun/management/jmxremote/bootstrap/CustomLauncherTest.java fails intermittently with "Operation not permitted"
jbachorik
parents:
21822
diff
changeset
|
114 |
System.out.println(" launcher : " + launcher[0]); |
21367
679b312e3c5b
8004926: sun/management/jmxremote/bootstrap/CustomLauncherTest.sh oftenly times out
jbachorik
parents:
diff
changeset
|
115 |
System.out.println(" libjvm : " + libjvmPath.toString()); |
21822
12f13ba496cd
8028141: test/sun/management/jmxremote/bootstrap/LocalManagementTest|CustomLauncherTest.java failing again
rriggs
parents:
21802
diff
changeset
|
116 |
System.out.println(" classpath : " + TEST_CLASSPATH); |
22062
175604b1209f
8029809: sun/management/jmxremote/bootstrap/CustomLauncherTest.java fails intermittently with "Operation not permitted"
jbachorik
parents:
21822
diff
changeset
|
117 |
ProcessBuilder server = new ProcessBuilder( |
175604b1209f
8029809: sun/management/jmxremote/bootstrap/CustomLauncherTest.java fails intermittently with "Operation not permitted"
jbachorik
parents:
21822
diff
changeset
|
118 |
launcher[1], |
175604b1209f
8029809: sun/management/jmxremote/bootstrap/CustomLauncherTest.java fails intermittently with "Operation not permitted"
jbachorik
parents:
21822
diff
changeset
|
119 |
libjvmPath.toString(), |
175604b1209f
8029809: sun/management/jmxremote/bootstrap/CustomLauncherTest.java fails intermittently with "Operation not permitted"
jbachorik
parents:
21822
diff
changeset
|
120 |
TEST_CLASSPATH, |
175604b1209f
8029809: sun/management/jmxremote/bootstrap/CustomLauncherTest.java fails intermittently with "Operation not permitted"
jbachorik
parents:
21822
diff
changeset
|
121 |
"TestApplication" |
175604b1209f
8029809: sun/management/jmxremote/bootstrap/CustomLauncherTest.java fails intermittently with "Operation not permitted"
jbachorik
parents:
21822
diff
changeset
|
122 |
); |
21367
679b312e3c5b
8004926: sun/management/jmxremote/bootstrap/CustomLauncherTest.sh oftenly times out
jbachorik
parents:
diff
changeset
|
123 |
|
679b312e3c5b
8004926: sun/management/jmxremote/bootstrap/CustomLauncherTest.sh oftenly times out
jbachorik
parents:
diff
changeset
|
124 |
final AtomicReference<String> port = new AtomicReference<>(); |
679b312e3c5b
8004926: sun/management/jmxremote/bootstrap/CustomLauncherTest.sh oftenly times out
jbachorik
parents:
diff
changeset
|
125 |
final AtomicReference<String> pid = new AtomicReference<>(); |
679b312e3c5b
8004926: sun/management/jmxremote/bootstrap/CustomLauncherTest.sh oftenly times out
jbachorik
parents:
diff
changeset
|
126 |
|
679b312e3c5b
8004926: sun/management/jmxremote/bootstrap/CustomLauncherTest.sh oftenly times out
jbachorik
parents:
diff
changeset
|
127 |
serverPrc = ProcessTools.startProcess( |
679b312e3c5b
8004926: sun/management/jmxremote/bootstrap/CustomLauncherTest.sh oftenly times out
jbachorik
parents:
diff
changeset
|
128 |
"Launcher", |
679b312e3c5b
8004926: sun/management/jmxremote/bootstrap/CustomLauncherTest.sh oftenly times out
jbachorik
parents:
diff
changeset
|
129 |
server, |
679b312e3c5b
8004926: sun/management/jmxremote/bootstrap/CustomLauncherTest.sh oftenly times out
jbachorik
parents:
diff
changeset
|
130 |
(String line) -> { |
679b312e3c5b
8004926: sun/management/jmxremote/bootstrap/CustomLauncherTest.sh oftenly times out
jbachorik
parents:
diff
changeset
|
131 |
if (line.startsWith("port:")) { |
679b312e3c5b
8004926: sun/management/jmxremote/bootstrap/CustomLauncherTest.sh oftenly times out
jbachorik
parents:
diff
changeset
|
132 |
port.set(line.split("\\:")[1]); |
679b312e3c5b
8004926: sun/management/jmxremote/bootstrap/CustomLauncherTest.sh oftenly times out
jbachorik
parents:
diff
changeset
|
133 |
} else if (line.startsWith("pid:")) { |
679b312e3c5b
8004926: sun/management/jmxremote/bootstrap/CustomLauncherTest.sh oftenly times out
jbachorik
parents:
diff
changeset
|
134 |
pid.set(line.split("\\:")[1]); |
679b312e3c5b
8004926: sun/management/jmxremote/bootstrap/CustomLauncherTest.sh oftenly times out
jbachorik
parents:
diff
changeset
|
135 |
} else if (line.startsWith("waiting")) { |
679b312e3c5b
8004926: sun/management/jmxremote/bootstrap/CustomLauncherTest.sh oftenly times out
jbachorik
parents:
diff
changeset
|
136 |
return true; |
679b312e3c5b
8004926: sun/management/jmxremote/bootstrap/CustomLauncherTest.sh oftenly times out
jbachorik
parents:
diff
changeset
|
137 |
} |
679b312e3c5b
8004926: sun/management/jmxremote/bootstrap/CustomLauncherTest.sh oftenly times out
jbachorik
parents:
diff
changeset
|
138 |
return false; |
679b312e3c5b
8004926: sun/management/jmxremote/bootstrap/CustomLauncherTest.sh oftenly times out
jbachorik
parents:
diff
changeset
|
139 |
}, |
679b312e3c5b
8004926: sun/management/jmxremote/bootstrap/CustomLauncherTest.sh oftenly times out
jbachorik
parents:
diff
changeset
|
140 |
5, |
679b312e3c5b
8004926: sun/management/jmxremote/bootstrap/CustomLauncherTest.sh oftenly times out
jbachorik
parents:
diff
changeset
|
141 |
TimeUnit.SECONDS |
679b312e3c5b
8004926: sun/management/jmxremote/bootstrap/CustomLauncherTest.sh oftenly times out
jbachorik
parents:
diff
changeset
|
142 |
); |
679b312e3c5b
8004926: sun/management/jmxremote/bootstrap/CustomLauncherTest.sh oftenly times out
jbachorik
parents:
diff
changeset
|
143 |
|
679b312e3c5b
8004926: sun/management/jmxremote/bootstrap/CustomLauncherTest.sh oftenly times out
jbachorik
parents:
diff
changeset
|
144 |
System.out.println("Attaching test manager:"); |
679b312e3c5b
8004926: sun/management/jmxremote/bootstrap/CustomLauncherTest.sh oftenly times out
jbachorik
parents:
diff
changeset
|
145 |
System.out.println("========================="); |
679b312e3c5b
8004926: sun/management/jmxremote/bootstrap/CustomLauncherTest.sh oftenly times out
jbachorik
parents:
diff
changeset
|
146 |
System.out.println(" PID : " + pid.get()); |
679b312e3c5b
8004926: sun/management/jmxremote/bootstrap/CustomLauncherTest.sh oftenly times out
jbachorik
parents:
diff
changeset
|
147 |
System.out.println(" shutdown port : " + port.get()); |
679b312e3c5b
8004926: sun/management/jmxremote/bootstrap/CustomLauncherTest.sh oftenly times out
jbachorik
parents:
diff
changeset
|
148 |
|
679b312e3c5b
8004926: sun/management/jmxremote/bootstrap/CustomLauncherTest.sh oftenly times out
jbachorik
parents:
diff
changeset
|
149 |
ProcessBuilder client = ProcessTools.createJavaProcessBuilder( |
679b312e3c5b
8004926: sun/management/jmxremote/bootstrap/CustomLauncherTest.sh oftenly times out
jbachorik
parents:
diff
changeset
|
150 |
"-cp", |
21822
12f13ba496cd
8028141: test/sun/management/jmxremote/bootstrap/LocalManagementTest|CustomLauncherTest.java failing again
rriggs
parents:
21802
diff
changeset
|
151 |
TEST_CLASSPATH + |
21367
679b312e3c5b
8004926: sun/management/jmxremote/bootstrap/CustomLauncherTest.sh oftenly times out
jbachorik
parents:
diff
changeset
|
152 |
File.pathSeparator + |
679b312e3c5b
8004926: sun/management/jmxremote/bootstrap/CustomLauncherTest.sh oftenly times out
jbachorik
parents:
diff
changeset
|
153 |
TEST_JDK + |
679b312e3c5b
8004926: sun/management/jmxremote/bootstrap/CustomLauncherTest.sh oftenly times out
jbachorik
parents:
diff
changeset
|
154 |
File.separator + |
679b312e3c5b
8004926: sun/management/jmxremote/bootstrap/CustomLauncherTest.sh oftenly times out
jbachorik
parents:
diff
changeset
|
155 |
"lib" + |
679b312e3c5b
8004926: sun/management/jmxremote/bootstrap/CustomLauncherTest.sh oftenly times out
jbachorik
parents:
diff
changeset
|
156 |
File.separator + |
679b312e3c5b
8004926: sun/management/jmxremote/bootstrap/CustomLauncherTest.sh oftenly times out
jbachorik
parents:
diff
changeset
|
157 |
"tools.jar", |
679b312e3c5b
8004926: sun/management/jmxremote/bootstrap/CustomLauncherTest.sh oftenly times out
jbachorik
parents:
diff
changeset
|
158 |
"TestManager", |
679b312e3c5b
8004926: sun/management/jmxremote/bootstrap/CustomLauncherTest.sh oftenly times out
jbachorik
parents:
diff
changeset
|
159 |
pid.get(), |
679b312e3c5b
8004926: sun/management/jmxremote/bootstrap/CustomLauncherTest.sh oftenly times out
jbachorik
parents:
diff
changeset
|
160 |
port.get(), |
679b312e3c5b
8004926: sun/management/jmxremote/bootstrap/CustomLauncherTest.sh oftenly times out
jbachorik
parents:
diff
changeset
|
161 |
"true" |
679b312e3c5b
8004926: sun/management/jmxremote/bootstrap/CustomLauncherTest.sh oftenly times out
jbachorik
parents:
diff
changeset
|
162 |
); |
679b312e3c5b
8004926: sun/management/jmxremote/bootstrap/CustomLauncherTest.sh oftenly times out
jbachorik
parents:
diff
changeset
|
163 |
|
679b312e3c5b
8004926: sun/management/jmxremote/bootstrap/CustomLauncherTest.sh oftenly times out
jbachorik
parents:
diff
changeset
|
164 |
clientPrc = ProcessTools.startProcess( |
679b312e3c5b
8004926: sun/management/jmxremote/bootstrap/CustomLauncherTest.sh oftenly times out
jbachorik
parents:
diff
changeset
|
165 |
"TestManager", |
679b312e3c5b
8004926: sun/management/jmxremote/bootstrap/CustomLauncherTest.sh oftenly times out
jbachorik
parents:
diff
changeset
|
166 |
client, |
679b312e3c5b
8004926: sun/management/jmxremote/bootstrap/CustomLauncherTest.sh oftenly times out
jbachorik
parents:
diff
changeset
|
167 |
(String line) -> line.startsWith("Starting TestManager for PID"), |
679b312e3c5b
8004926: sun/management/jmxremote/bootstrap/CustomLauncherTest.sh oftenly times out
jbachorik
parents:
diff
changeset
|
168 |
10, |
679b312e3c5b
8004926: sun/management/jmxremote/bootstrap/CustomLauncherTest.sh oftenly times out
jbachorik
parents:
diff
changeset
|
169 |
TimeUnit.SECONDS |
679b312e3c5b
8004926: sun/management/jmxremote/bootstrap/CustomLauncherTest.sh oftenly times out
jbachorik
parents:
diff
changeset
|
170 |
); |
679b312e3c5b
8004926: sun/management/jmxremote/bootstrap/CustomLauncherTest.sh oftenly times out
jbachorik
parents:
diff
changeset
|
171 |
|
679b312e3c5b
8004926: sun/management/jmxremote/bootstrap/CustomLauncherTest.sh oftenly times out
jbachorik
parents:
diff
changeset
|
172 |
int clientExitCode = clientPrc.waitFor(); |
679b312e3c5b
8004926: sun/management/jmxremote/bootstrap/CustomLauncherTest.sh oftenly times out
jbachorik
parents:
diff
changeset
|
173 |
int serverExitCode = serverPrc.waitFor(); |
679b312e3c5b
8004926: sun/management/jmxremote/bootstrap/CustomLauncherTest.sh oftenly times out
jbachorik
parents:
diff
changeset
|
174 |
|
679b312e3c5b
8004926: sun/management/jmxremote/bootstrap/CustomLauncherTest.sh oftenly times out
jbachorik
parents:
diff
changeset
|
175 |
if (clientExitCode != 0 || serverExitCode != 0) { |
679b312e3c5b
8004926: sun/management/jmxremote/bootstrap/CustomLauncherTest.sh oftenly times out
jbachorik
parents:
diff
changeset
|
176 |
throw new Error("Test failed"); |
679b312e3c5b
8004926: sun/management/jmxremote/bootstrap/CustomLauncherTest.sh oftenly times out
jbachorik
parents:
diff
changeset
|
177 |
} |
679b312e3c5b
8004926: sun/management/jmxremote/bootstrap/CustomLauncherTest.sh oftenly times out
jbachorik
parents:
diff
changeset
|
178 |
} finally { |
679b312e3c5b
8004926: sun/management/jmxremote/bootstrap/CustomLauncherTest.sh oftenly times out
jbachorik
parents:
diff
changeset
|
179 |
if (clientPrc != null) { |
679b312e3c5b
8004926: sun/management/jmxremote/bootstrap/CustomLauncherTest.sh oftenly times out
jbachorik
parents:
diff
changeset
|
180 |
clientPrc.destroy(); |
679b312e3c5b
8004926: sun/management/jmxremote/bootstrap/CustomLauncherTest.sh oftenly times out
jbachorik
parents:
diff
changeset
|
181 |
clientPrc.waitFor(); |
679b312e3c5b
8004926: sun/management/jmxremote/bootstrap/CustomLauncherTest.sh oftenly times out
jbachorik
parents:
diff
changeset
|
182 |
} |
679b312e3c5b
8004926: sun/management/jmxremote/bootstrap/CustomLauncherTest.sh oftenly times out
jbachorik
parents:
diff
changeset
|
183 |
if (serverPrc != null) { |
679b312e3c5b
8004926: sun/management/jmxremote/bootstrap/CustomLauncherTest.sh oftenly times out
jbachorik
parents:
diff
changeset
|
184 |
serverPrc.destroy(); |
679b312e3c5b
8004926: sun/management/jmxremote/bootstrap/CustomLauncherTest.sh oftenly times out
jbachorik
parents:
diff
changeset
|
185 |
serverPrc.waitFor(); |
679b312e3c5b
8004926: sun/management/jmxremote/bootstrap/CustomLauncherTest.sh oftenly times out
jbachorik
parents:
diff
changeset
|
186 |
} |
679b312e3c5b
8004926: sun/management/jmxremote/bootstrap/CustomLauncherTest.sh oftenly times out
jbachorik
parents:
diff
changeset
|
187 |
} |
679b312e3c5b
8004926: sun/management/jmxremote/bootstrap/CustomLauncherTest.sh oftenly times out
jbachorik
parents:
diff
changeset
|
188 |
} |
679b312e3c5b
8004926: sun/management/jmxremote/bootstrap/CustomLauncherTest.sh oftenly times out
jbachorik
parents:
diff
changeset
|
189 |
|
679b312e3c5b
8004926: sun/management/jmxremote/bootstrap/CustomLauncherTest.sh oftenly times out
jbachorik
parents:
diff
changeset
|
190 |
private static Path findLibjvm(FileSystem FS) { |
679b312e3c5b
8004926: sun/management/jmxremote/bootstrap/CustomLauncherTest.sh oftenly times out
jbachorik
parents:
diff
changeset
|
191 |
Path libjvmPath = findLibjvm(FS.getPath(TEST_JDK, "jre", "lib", LIBARCH)); |
679b312e3c5b
8004926: sun/management/jmxremote/bootstrap/CustomLauncherTest.sh oftenly times out
jbachorik
parents:
diff
changeset
|
192 |
if (libjvmPath == null) { |
679b312e3c5b
8004926: sun/management/jmxremote/bootstrap/CustomLauncherTest.sh oftenly times out
jbachorik
parents:
diff
changeset
|
193 |
libjvmPath = findLibjvm(FS.getPath(TEST_JDK, "lib", LIBARCH)); |
679b312e3c5b
8004926: sun/management/jmxremote/bootstrap/CustomLauncherTest.sh oftenly times out
jbachorik
parents:
diff
changeset
|
194 |
} |
679b312e3c5b
8004926: sun/management/jmxremote/bootstrap/CustomLauncherTest.sh oftenly times out
jbachorik
parents:
diff
changeset
|
195 |
return libjvmPath; |
679b312e3c5b
8004926: sun/management/jmxremote/bootstrap/CustomLauncherTest.sh oftenly times out
jbachorik
parents:
diff
changeset
|
196 |
} |
679b312e3c5b
8004926: sun/management/jmxremote/bootstrap/CustomLauncherTest.sh oftenly times out
jbachorik
parents:
diff
changeset
|
197 |
|
679b312e3c5b
8004926: sun/management/jmxremote/bootstrap/CustomLauncherTest.sh oftenly times out
jbachorik
parents:
diff
changeset
|
198 |
private static Path findLibjvm(Path libPath) { |
679b312e3c5b
8004926: sun/management/jmxremote/bootstrap/CustomLauncherTest.sh oftenly times out
jbachorik
parents:
diff
changeset
|
199 |
// ARCH/libjvm.so -> ARCH/server/libjvm.so -> ARCH/client/libjvm.so |
679b312e3c5b
8004926: sun/management/jmxremote/bootstrap/CustomLauncherTest.sh oftenly times out
jbachorik
parents:
diff
changeset
|
200 |
Path libjvmPath = libPath.resolve("libjvm.so"); |
679b312e3c5b
8004926: sun/management/jmxremote/bootstrap/CustomLauncherTest.sh oftenly times out
jbachorik
parents:
diff
changeset
|
201 |
if (isFileOk(libjvmPath)) { |
679b312e3c5b
8004926: sun/management/jmxremote/bootstrap/CustomLauncherTest.sh oftenly times out
jbachorik
parents:
diff
changeset
|
202 |
return libjvmPath; |
679b312e3c5b
8004926: sun/management/jmxremote/bootstrap/CustomLauncherTest.sh oftenly times out
jbachorik
parents:
diff
changeset
|
203 |
} |
679b312e3c5b
8004926: sun/management/jmxremote/bootstrap/CustomLauncherTest.sh oftenly times out
jbachorik
parents:
diff
changeset
|
204 |
libjvmPath = libPath.resolve("server/libjvm.so"); |
679b312e3c5b
8004926: sun/management/jmxremote/bootstrap/CustomLauncherTest.sh oftenly times out
jbachorik
parents:
diff
changeset
|
205 |
if (isFileOk(libjvmPath)) { |
679b312e3c5b
8004926: sun/management/jmxremote/bootstrap/CustomLauncherTest.sh oftenly times out
jbachorik
parents:
diff
changeset
|
206 |
return libjvmPath; |
679b312e3c5b
8004926: sun/management/jmxremote/bootstrap/CustomLauncherTest.sh oftenly times out
jbachorik
parents:
diff
changeset
|
207 |
} |
679b312e3c5b
8004926: sun/management/jmxremote/bootstrap/CustomLauncherTest.sh oftenly times out
jbachorik
parents:
diff
changeset
|
208 |
libjvmPath = libPath.resolve("client/libjvm.so"); |
679b312e3c5b
8004926: sun/management/jmxremote/bootstrap/CustomLauncherTest.sh oftenly times out
jbachorik
parents:
diff
changeset
|
209 |
if (isFileOk(libPath)) { |
679b312e3c5b
8004926: sun/management/jmxremote/bootstrap/CustomLauncherTest.sh oftenly times out
jbachorik
parents:
diff
changeset
|
210 |
return libjvmPath; |
679b312e3c5b
8004926: sun/management/jmxremote/bootstrap/CustomLauncherTest.sh oftenly times out
jbachorik
parents:
diff
changeset
|
211 |
} |
679b312e3c5b
8004926: sun/management/jmxremote/bootstrap/CustomLauncherTest.sh oftenly times out
jbachorik
parents:
diff
changeset
|
212 |
|
679b312e3c5b
8004926: sun/management/jmxremote/bootstrap/CustomLauncherTest.sh oftenly times out
jbachorik
parents:
diff
changeset
|
213 |
return null; |
679b312e3c5b
8004926: sun/management/jmxremote/bootstrap/CustomLauncherTest.sh oftenly times out
jbachorik
parents:
diff
changeset
|
214 |
} |
679b312e3c5b
8004926: sun/management/jmxremote/bootstrap/CustomLauncherTest.sh oftenly times out
jbachorik
parents:
diff
changeset
|
215 |
|
679b312e3c5b
8004926: sun/management/jmxremote/bootstrap/CustomLauncherTest.sh oftenly times out
jbachorik
parents:
diff
changeset
|
216 |
private static boolean isFileOk(Path path) { |
679b312e3c5b
8004926: sun/management/jmxremote/bootstrap/CustomLauncherTest.sh oftenly times out
jbachorik
parents:
diff
changeset
|
217 |
return Files.isRegularFile(path) && Files.isReadable(path); |
679b312e3c5b
8004926: sun/management/jmxremote/bootstrap/CustomLauncherTest.sh oftenly times out
jbachorik
parents:
diff
changeset
|
218 |
} |
22062
175604b1209f
8029809: sun/management/jmxremote/bootstrap/CustomLauncherTest.java fails intermittently with "Operation not permitted"
jbachorik
parents:
21822
diff
changeset
|
219 |
|
175604b1209f
8029809: sun/management/jmxremote/bootstrap/CustomLauncherTest.java fails intermittently with "Operation not permitted"
jbachorik
parents:
21822
diff
changeset
|
220 |
private static String getPlatform() { |
175604b1209f
8029809: sun/management/jmxremote/bootstrap/CustomLauncherTest.java fails intermittently with "Operation not permitted"
jbachorik
parents:
21822
diff
changeset
|
221 |
String platform = null; |
175604b1209f
8029809: sun/management/jmxremote/bootstrap/CustomLauncherTest.java fails intermittently with "Operation not permitted"
jbachorik
parents:
21822
diff
changeset
|
222 |
switch (OSNAME.toLowerCase()) { |
175604b1209f
8029809: sun/management/jmxremote/bootstrap/CustomLauncherTest.java fails intermittently with "Operation not permitted"
jbachorik
parents:
21822
diff
changeset
|
223 |
case "linux": { |
175604b1209f
8029809: sun/management/jmxremote/bootstrap/CustomLauncherTest.java fails intermittently with "Operation not permitted"
jbachorik
parents:
21822
diff
changeset
|
224 |
platform = "linux"; |
175604b1209f
8029809: sun/management/jmxremote/bootstrap/CustomLauncherTest.java fails intermittently with "Operation not permitted"
jbachorik
parents:
21822
diff
changeset
|
225 |
break; |
175604b1209f
8029809: sun/management/jmxremote/bootstrap/CustomLauncherTest.java fails intermittently with "Operation not permitted"
jbachorik
parents:
21822
diff
changeset
|
226 |
} |
175604b1209f
8029809: sun/management/jmxremote/bootstrap/CustomLauncherTest.java fails intermittently with "Operation not permitted"
jbachorik
parents:
21822
diff
changeset
|
227 |
case "sunos": { |
175604b1209f
8029809: sun/management/jmxremote/bootstrap/CustomLauncherTest.java fails intermittently with "Operation not permitted"
jbachorik
parents:
21822
diff
changeset
|
228 |
platform = "solaris"; |
175604b1209f
8029809: sun/management/jmxremote/bootstrap/CustomLauncherTest.java fails intermittently with "Operation not permitted"
jbachorik
parents:
21822
diff
changeset
|
229 |
break; |
175604b1209f
8029809: sun/management/jmxremote/bootstrap/CustomLauncherTest.java fails intermittently with "Operation not permitted"
jbachorik
parents:
21822
diff
changeset
|
230 |
} |
175604b1209f
8029809: sun/management/jmxremote/bootstrap/CustomLauncherTest.java fails intermittently with "Operation not permitted"
jbachorik
parents:
21822
diff
changeset
|
231 |
default: { |
22255
b4f108102ca9
8031420: sun/management/jmxremote/bootstrap/CustomLauncherTest.java fails on some platforms: Unable to locate 'libjvm.so'
jbachorik
parents:
22062
diff
changeset
|
232 |
platform = null; |
22062
175604b1209f
8029809: sun/management/jmxremote/bootstrap/CustomLauncherTest.java fails intermittently with "Operation not permitted"
jbachorik
parents:
21822
diff
changeset
|
233 |
} |
175604b1209f
8029809: sun/management/jmxremote/bootstrap/CustomLauncherTest.java fails intermittently with "Operation not permitted"
jbachorik
parents:
21822
diff
changeset
|
234 |
} |
175604b1209f
8029809: sun/management/jmxremote/bootstrap/CustomLauncherTest.java fails intermittently with "Operation not permitted"
jbachorik
parents:
21822
diff
changeset
|
235 |
|
175604b1209f
8029809: sun/management/jmxremote/bootstrap/CustomLauncherTest.java fails intermittently with "Operation not permitted"
jbachorik
parents:
21822
diff
changeset
|
236 |
return platform; |
175604b1209f
8029809: sun/management/jmxremote/bootstrap/CustomLauncherTest.java fails intermittently with "Operation not permitted"
jbachorik
parents:
21822
diff
changeset
|
237 |
} |
175604b1209f
8029809: sun/management/jmxremote/bootstrap/CustomLauncherTest.java fails intermittently with "Operation not permitted"
jbachorik
parents:
21822
diff
changeset
|
238 |
|
175604b1209f
8029809: sun/management/jmxremote/bootstrap/CustomLauncherTest.java fails intermittently with "Operation not permitted"
jbachorik
parents:
21822
diff
changeset
|
239 |
private static String[] getLauncher() throws IOException { |
175604b1209f
8029809: sun/management/jmxremote/bootstrap/CustomLauncherTest.java fails intermittently with "Operation not permitted"
jbachorik
parents:
21822
diff
changeset
|
240 |
String platform = getPlatform(); |
175604b1209f
8029809: sun/management/jmxremote/bootstrap/CustomLauncherTest.java fails intermittently with "Operation not permitted"
jbachorik
parents:
21822
diff
changeset
|
241 |
if (platform == null) { |
175604b1209f
8029809: sun/management/jmxremote/bootstrap/CustomLauncherTest.java fails intermittently with "Operation not permitted"
jbachorik
parents:
21822
diff
changeset
|
242 |
return null; |
175604b1209f
8029809: sun/management/jmxremote/bootstrap/CustomLauncherTest.java fails intermittently with "Operation not permitted"
jbachorik
parents:
21822
diff
changeset
|
243 |
} |
175604b1209f
8029809: sun/management/jmxremote/bootstrap/CustomLauncherTest.java fails intermittently with "Operation not permitted"
jbachorik
parents:
21822
diff
changeset
|
244 |
|
175604b1209f
8029809: sun/management/jmxremote/bootstrap/CustomLauncherTest.java fails intermittently with "Operation not permitted"
jbachorik
parents:
21822
diff
changeset
|
245 |
String launcher = TEST_SRC + File.separator + platform + "-" + ARCH + |
175604b1209f
8029809: sun/management/jmxremote/bootstrap/CustomLauncherTest.java fails intermittently with "Operation not permitted"
jbachorik
parents:
21822
diff
changeset
|
246 |
File.separator + "launcher"; |
175604b1209f
8029809: sun/management/jmxremote/bootstrap/CustomLauncherTest.java fails intermittently with "Operation not permitted"
jbachorik
parents:
21822
diff
changeset
|
247 |
|
175604b1209f
8029809: sun/management/jmxremote/bootstrap/CustomLauncherTest.java fails intermittently with "Operation not permitted"
jbachorik
parents:
21822
diff
changeset
|
248 |
final FileSystem FS = FileSystems.getDefault(); |
175604b1209f
8029809: sun/management/jmxremote/bootstrap/CustomLauncherTest.java fails intermittently with "Operation not permitted"
jbachorik
parents:
21822
diff
changeset
|
249 |
Path launcherPath = FS.getPath(launcher); |
175604b1209f
8029809: sun/management/jmxremote/bootstrap/CustomLauncherTest.java fails intermittently with "Operation not permitted"
jbachorik
parents:
21822
diff
changeset
|
250 |
|
175604b1209f
8029809: sun/management/jmxremote/bootstrap/CustomLauncherTest.java fails intermittently with "Operation not permitted"
jbachorik
parents:
21822
diff
changeset
|
251 |
final boolean hasLauncher = Files.isRegularFile(launcherPath, LinkOption.NOFOLLOW_LINKS)&& |
175604b1209f
8029809: sun/management/jmxremote/bootstrap/CustomLauncherTest.java fails intermittently with "Operation not permitted"
jbachorik
parents:
21822
diff
changeset
|
252 |
Files.isReadable(launcherPath); |
175604b1209f
8029809: sun/management/jmxremote/bootstrap/CustomLauncherTest.java fails intermittently with "Operation not permitted"
jbachorik
parents:
21822
diff
changeset
|
253 |
if (!hasLauncher) { |
175604b1209f
8029809: sun/management/jmxremote/bootstrap/CustomLauncherTest.java fails intermittently with "Operation not permitted"
jbachorik
parents:
21822
diff
changeset
|
254 |
System.out.println("Launcher [" + launcher + "] does not exist. Skipping the test."); |
175604b1209f
8029809: sun/management/jmxremote/bootstrap/CustomLauncherTest.java fails intermittently with "Operation not permitted"
jbachorik
parents:
21822
diff
changeset
|
255 |
return null; |
175604b1209f
8029809: sun/management/jmxremote/bootstrap/CustomLauncherTest.java fails intermittently with "Operation not permitted"
jbachorik
parents:
21822
diff
changeset
|
256 |
} |
175604b1209f
8029809: sun/management/jmxremote/bootstrap/CustomLauncherTest.java fails intermittently with "Operation not permitted"
jbachorik
parents:
21822
diff
changeset
|
257 |
|
175604b1209f
8029809: sun/management/jmxremote/bootstrap/CustomLauncherTest.java fails intermittently with "Operation not permitted"
jbachorik
parents:
21822
diff
changeset
|
258 |
// It is impossible to store an executable file in the source control |
175604b1209f
8029809: sun/management/jmxremote/bootstrap/CustomLauncherTest.java fails intermittently with "Operation not permitted"
jbachorik
parents:
21822
diff
changeset
|
259 |
// We need to copy the launcher to the working directory |
175604b1209f
8029809: sun/management/jmxremote/bootstrap/CustomLauncherTest.java fails intermittently with "Operation not permitted"
jbachorik
parents:
21822
diff
changeset
|
260 |
// and set the executable flag |
175604b1209f
8029809: sun/management/jmxremote/bootstrap/CustomLauncherTest.java fails intermittently with "Operation not permitted"
jbachorik
parents:
21822
diff
changeset
|
261 |
Path localLauncherPath = FS.getPath(WORK_DIR, "launcher"); |
175604b1209f
8029809: sun/management/jmxremote/bootstrap/CustomLauncherTest.java fails intermittently with "Operation not permitted"
jbachorik
parents:
21822
diff
changeset
|
262 |
Files.copy(launcherPath, localLauncherPath, |
175604b1209f
8029809: sun/management/jmxremote/bootstrap/CustomLauncherTest.java fails intermittently with "Operation not permitted"
jbachorik
parents:
21822
diff
changeset
|
263 |
StandardCopyOption.REPLACE_EXISTING, |
175604b1209f
8029809: sun/management/jmxremote/bootstrap/CustomLauncherTest.java fails intermittently with "Operation not permitted"
jbachorik
parents:
21822
diff
changeset
|
264 |
StandardCopyOption.COPY_ATTRIBUTES); |
175604b1209f
8029809: sun/management/jmxremote/bootstrap/CustomLauncherTest.java fails intermittently with "Operation not permitted"
jbachorik
parents:
21822
diff
changeset
|
265 |
if (!Files.isExecutable(localLauncherPath)) { |
175604b1209f
8029809: sun/management/jmxremote/bootstrap/CustomLauncherTest.java fails intermittently with "Operation not permitted"
jbachorik
parents:
21822
diff
changeset
|
266 |
Set<PosixFilePermission> perms = new HashSet<>( |
175604b1209f
8029809: sun/management/jmxremote/bootstrap/CustomLauncherTest.java fails intermittently with "Operation not permitted"
jbachorik
parents:
21822
diff
changeset
|
267 |
Files.getPosixFilePermissions( |
175604b1209f
8029809: sun/management/jmxremote/bootstrap/CustomLauncherTest.java fails intermittently with "Operation not permitted"
jbachorik
parents:
21822
diff
changeset
|
268 |
localLauncherPath, |
175604b1209f
8029809: sun/management/jmxremote/bootstrap/CustomLauncherTest.java fails intermittently with "Operation not permitted"
jbachorik
parents:
21822
diff
changeset
|
269 |
LinkOption.NOFOLLOW_LINKS |
175604b1209f
8029809: sun/management/jmxremote/bootstrap/CustomLauncherTest.java fails intermittently with "Operation not permitted"
jbachorik
parents:
21822
diff
changeset
|
270 |
) |
175604b1209f
8029809: sun/management/jmxremote/bootstrap/CustomLauncherTest.java fails intermittently with "Operation not permitted"
jbachorik
parents:
21822
diff
changeset
|
271 |
); |
175604b1209f
8029809: sun/management/jmxremote/bootstrap/CustomLauncherTest.java fails intermittently with "Operation not permitted"
jbachorik
parents:
21822
diff
changeset
|
272 |
perms.add(PosixFilePermission.OWNER_EXECUTE); |
175604b1209f
8029809: sun/management/jmxremote/bootstrap/CustomLauncherTest.java fails intermittently with "Operation not permitted"
jbachorik
parents:
21822
diff
changeset
|
273 |
Files.setPosixFilePermissions(localLauncherPath, perms); |
175604b1209f
8029809: sun/management/jmxremote/bootstrap/CustomLauncherTest.java fails intermittently with "Operation not permitted"
jbachorik
parents:
21822
diff
changeset
|
274 |
} |
175604b1209f
8029809: sun/management/jmxremote/bootstrap/CustomLauncherTest.java fails intermittently with "Operation not permitted"
jbachorik
parents:
21822
diff
changeset
|
275 |
return new String[] {launcher, localLauncherPath.toAbsolutePath().toString()}; |
175604b1209f
8029809: sun/management/jmxremote/bootstrap/CustomLauncherTest.java fails intermittently with "Operation not permitted"
jbachorik
parents:
21822
diff
changeset
|
276 |
} |
21367
679b312e3c5b
8004926: sun/management/jmxremote/bootstrap/CustomLauncherTest.sh oftenly times out
jbachorik
parents:
diff
changeset
|
277 |
} |