8027163: sun/management/jmxremote/bootstrap/CustomLauncherTest.java should be updated for jdk8 removal of solaris-32bit support
Reviewed-by: sla
--- a/jdk/test/lib/testlibrary/jdk/testlibrary/ProcessTools.java Mon Nov 18 17:00:23 2013 +0400
+++ b/jdk/test/lib/testlibrary/jdk/testlibrary/ProcessTools.java Mon Nov 18 15:25:15 2013 +0100
@@ -32,6 +32,7 @@
import java.lang.reflect.Method;
import java.util.ArrayList;
import java.util.Collections;
+import java.util.Map;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.Future;
import java.util.concurrent.Phaser;
@@ -131,6 +132,10 @@
phs.awaitAdvanceInterruptibly(0, timeout, unit);
}
} catch (TimeoutException | InterruptedException e) {
+ System.err.println("Failed to start a process (thread dump follows)");
+ for(Map.Entry<Thread, StackTraceElement[]> s : Thread.getAllStackTraces().entrySet()) {
+ printStack(s.getKey(), s.getValue());
+ }
stdoutTask.cancel(true);
stderrTask.cancel(true);
throw e;
@@ -250,4 +255,15 @@
return new ProcessBuilder(args.toArray(new String[args.size()]));
}
+ private static void printStack(Thread t, StackTraceElement[] stack) {
+ System.out.println("\t" + t +
+ " stack: (length = " + stack.length + ")");
+ if (t != null) {
+ for (StackTraceElement stack1 : stack) {
+ System.out.println("\t" + stack1);
+ }
+ System.out.println();
+ }
+ }
+
}
--- a/jdk/test/sun/management/jmxremote/bootstrap/CustomLauncherTest.java Mon Nov 18 17:00:23 2013 +0400
+++ b/jdk/test/sun/management/jmxremote/bootstrap/CustomLauncherTest.java Mon Nov 18 15:25:15 2013 +0100
@@ -25,7 +25,11 @@
import java.nio.file.FileSystem;
import java.nio.file.FileSystems;
import java.nio.file.Files;
+import java.nio.file.LinkOption;
import java.nio.file.Path;
+import java.nio.file.attribute.PosixFilePermission;
+import java.util.HashSet;
+import java.util.Set;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicReference;
@@ -36,7 +40,7 @@
* @bug 6434402 8004926
* @library /lib/testlibrary
* @build TestManager TestApplication CustomLauncherTest
- * @run main CustomLauncherTest
+ * @run main/othervm CustomLauncherTest
* @author Jaroslav Bachorik
*/
public class CustomLauncherTest {
@@ -67,6 +71,9 @@
ARCH = "amd64";
break;
}
+ case "sparc":
+ ARCH = "sparcv9";
+ break;
default: {
ARCH = osarch;
}
@@ -101,7 +108,10 @@
File.separator + "launcher";
final FileSystem FS = FileSystems.getDefault();
- final boolean hasLauncher = Files.isExecutable(FS.getPath(LAUNCHER));
+ Path launcherPath = FS.getPath(LAUNCHER);
+
+ final boolean hasLauncher = Files.isRegularFile(launcherPath, LinkOption.NOFOLLOW_LINKS)&&
+ Files.isReadable(launcherPath);
if (!hasLauncher) {
System.out.println("Launcher [" + LAUNCHER + "] does not exist. Skipping the test.");
return;
@@ -114,7 +124,17 @@
Process serverPrc = null, clientPrc = null;
+ final Set<PosixFilePermission> launcherOrigPerms =
+ Files.getPosixFilePermissions(launcherPath, LinkOption.NOFOLLOW_LINKS);
try {
+ // It is impossible to store an executable file in the source control
+ // We need to set the executable flag here
+ if (!Files.isExecutable(launcherPath)) {
+ Set<PosixFilePermission> perms = new HashSet<>(launcherOrigPerms);
+ perms.add(PosixFilePermission.OWNER_EXECUTE);
+ Files.setPosixFilePermissions(launcherPath, perms);
+ }
+
System.out.println("Starting custom launcher:");
System.out.println("=========================");
System.out.println(" launcher : " + LAUNCHER);
@@ -177,6 +197,8 @@
throw new Error("Test failed");
}
} finally {
+ // Let's restore the original launcher permissions
+ Files.setPosixFilePermissions(launcherPath, launcherOrigPerms);
if (clientPrc != null) {
clientPrc.destroy();
clientPrc.waitFor();
--- a/jdk/test/sun/management/jmxremote/bootstrap/LocalManagementTest.java Mon Nov 18 17:00:23 2013 +0400
+++ b/jdk/test/sun/management/jmxremote/bootstrap/LocalManagementTest.java Mon Nov 18 15:25:15 2013 +0100
@@ -42,7 +42,7 @@
* TestManager will attempt a connection to the address obtained from
* both agent properties and jvmstat buffer.
* @build TestManager TestApplication
- * @run main/timeout=300 LocalManagementTest
+ * @run main/othervm/timeout=300 LocalManagementTest
*/
import jdk.testlibrary.ProcessTools;
@@ -77,14 +77,14 @@
}
private static boolean test1() throws Exception {
- return doTest("-Dcom.sun.management.jmxremote");
+ return doTest("1", "-Dcom.sun.management.jmxremote");
}
private static boolean test2() throws Exception {
Path agentPath = findAgent();
if (agentPath != null) {
String agent = agentPath.toString();
- return doTest("-javaagent:" + agent);
+ return doTest("2", "-javaagent:" + agent);
} else {
return false;
}
@@ -94,7 +94,7 @@
* no args (blank) - manager should attach and start agent
*/
private static boolean test3() throws Exception {
- return doTest(null);
+ return doTest("3", null);
}
/**
@@ -136,7 +136,7 @@
* use DNS-only name service
*/
private static boolean test5() throws Exception {
- return doTest("-Dsun.net.spi.namservice.provider.1=\"dns,sun\"");
+ return doTest("5", "-Dsun.net.spi.namservice.provider.1=\"dns,sun\"");
}
private static Path findAgent() {
@@ -160,7 +160,7 @@
return Files.isRegularFile(path) && Files.isReadable(path);
}
- private static boolean doTest(String arg) throws Exception {
+ private static boolean doTest(String testId, String arg) throws Exception {
List<String> args = new ArrayList<>();
args.add("-cp");
args.add(TEST_CLASSES);
@@ -179,7 +179,7 @@
final AtomicReference<String> pid = new AtomicReference<>();
serverPrc = ProcessTools.startProcess(
- "TestApplication",
+ "TestApplication(" + testId + ")",
server,
(String line) -> {
if (line.startsWith("port:")) {
Binary file jdk/test/sun/management/jmxremote/bootstrap/solaris-amd64/launcher has changed
Binary file jdk/test/sun/management/jmxremote/bootstrap/solaris-i586/launcher has changed
Binary file jdk/test/sun/management/jmxremote/bootstrap/solaris-sparc/launcher has changed
Binary file jdk/test/sun/management/jmxremote/bootstrap/solaris-sparcv9/launcher has changed