--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/com/sun/jdi/cds/CDSBreakpointTest.java Thu Jun 25 09:48:36 2015 -0700
@@ -0,0 +1,57 @@
+/*
+ * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @bug 8054386
+ * @summary java debugging test for CDS
+ * @modules jdk.jdi
+ * java.base/sun.misc
+ * java.management
+ * jdk.jartool/sun.tools.jar
+ * @library /lib/testlibrary
+ * @library ..
+ * @run compile -g ../BreakpointTest.java
+ * @run main CDSBreakpointTest
+ */
+
+/*
+ * Launch the JDI BreakpointTest, which will set a debugger breakpoint in
+ * BreakpointTarg. BreakpointTarg is first dumped into the CDS archive,
+ * so this will test debugging a class in the archive.
+ */
+
+public class CDSBreakpointTest extends CDSJDITest {
+ static String jarClasses[] = {
+ // BreakpointTarg is the only class we need in the archive. It will
+ // be launched by BreakpointTest as the debuggee application. Note,
+ // compiling BreakpointTest.java above will cause BreakpointTarg to
+ // be compiled since it is also in BreakpointTest.java.
+ "BreakpointTarg",
+ };
+ static String testname = "BreakpointTest";
+
+ public static void main(String[] args) throws Exception {
+ runTest(testname, jarClasses);
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/com/sun/jdi/cds/CDSDeleteAllBkptsTest.java Thu Jun 25 09:48:36 2015 -0700
@@ -0,0 +1,57 @@
+/*
+ * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @bug 8054386
+ * @summary java debugging test for CDS
+ * @modules jdk.jdi
+ * java.base/sun.misc
+ * java.management
+ * jdk.jartool/sun.tools.jar
+ * @library /lib/testlibrary
+ * @library ..
+ * @run compile -g ../DeleteAllBkptsTest.java
+ * @run main CDSDeleteAllBkptsTest
+ */
+
+/*
+ * Launch the JDI DeleteAllBkptsTest, which will set a debugger breakpoint in
+ * DeleteAllBkptsTarg and then clear them. DeleteAllBkptsTarg is first dumped
+ * into the CDS archive, so this will test debugging a class in the archive.
+ */
+
+public class CDSDeleteAllBkptsTest extends CDSJDITest {
+ static String jarClasses[] = {
+ // DeleteAllBkptsTarg is the only class we need in the archive. It will
+ // be launched by DeleteAllBkptsTest as the debuggee application. Note,
+ // compiling DeleteAllBkptsTest.java above will cause DeleteAllBkptsTarg to
+ // be compiled since it is also in DeleteAllBkptsTest.java.
+ "DeleteAllBkptsTarg",
+ };
+ static String testname = "DeleteAllBkptsTest";
+
+ public static void main(String[] args) throws Exception {
+ runTest(testname, jarClasses);
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/com/sun/jdi/cds/CDSFieldWatchpoints.java Thu Jun 25 09:48:36 2015 -0700
@@ -0,0 +1,57 @@
+/*
+ * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @bug 8054386
+ * @summary java debugging test for CDS
+ * @modules jdk.jdi
+ * java.base/sun.misc
+ * java.management
+ * jdk.jartool/sun.tools.jar
+ * @library /lib/testlibrary
+ * @library ..
+ * @run compile -g ../FieldWatchpoints.java
+ * @run main CDSFieldWatchpoints
+ */
+
+/*
+ * Launch the JDI FieldWatchpoints test, which will setup field watchpoints in
+ * FieldWatchpointsDebugee. FieldWatchpointsDebugee is first dumped into the
+ * CDS archive, so this will test debugging a class in the archive.
+ */
+
+public class CDSFieldWatchpoints extends CDSJDITest {
+ static String jarClasses[] = {
+ // FieldWatchpointsDebugee. A, and B are the only classes we need in the archive.
+ // FieldWatchpointsDebugee will be launched by FieldWatchpoints as the debuggee
+ // application. Note, compiling FieldWatchpoints.java above will cause
+ // FieldWatchpointsDebugee to be compiled since it is also in FieldWatchpoints.java.
+ "FieldWatchpointsDebugee", "A", "B",
+ };
+ static String testname = "FieldWatchpoints";
+
+ public static void main(String[] args) throws Exception {
+ runTest(testname, jarClasses);
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/com/sun/jdi/cds/CDSJDITest.java Thu Jun 25 09:48:36 2015 -0700
@@ -0,0 +1,202 @@
+/*
+ * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * Helper superclass for launching JDI tests out of the CDS archive.
+*/
+
+import jdk.testlibrary.OutputAnalyzer;
+import jdk.testlibrary.ProcessTools;
+
+import java.io.*;
+import java.util.ArrayList;
+import sun.tools.jar.Main;
+
+public class CDSJDITest {
+ private static final String classesDir = System.getProperty("test.classes");
+
+ public static void runTest(String testname, String[] jarClasses) throws Exception {
+ File jarClasslistFile = makeClassList(jarClasses);
+ String appJar = buildJar(testname, jarClasses);
+
+ // These are the arguments passed to createJavaProcessBuilder() to launch
+ // the JDI test.
+ String[] testArgs = {
+ // JVM Args:
+ // These first three properties are setup by jtreg, and must be passed
+ // to the JDI test subprocess because it needs them in order to
+ // pass them to the subprocess it will create for the debuggee. This
+ // is how the JPRT -javaopts are passed to the debggee. See
+ // VMConnection.getDebuggeeVMOptions().
+ getPropOpt("test.classes"),
+ getPropOpt("test.java.opts"),
+ getPropOpt("test.vm.opts"),
+ // Pass -showversion to the JDI test just so we get a bit of trace output.
+ "-showversion",
+ // Main class:
+ testname,
+ // Args to the Main Class:
+ // These argument all follow the above <testname> argument, and are
+ // in fact passed to <testname>.main() as java arguments. <testname> will
+ // pass them as JVM arguments to the debuggee process it creates.
+ "-Xbootclasspath/a:" + appJar,
+ "-XX:+UnlockDiagnosticVMOptions",
+ "-XX:+TraceClassPaths",
+ "-XX:SharedArchiveFile=./SharedArchiveFile.jsa",
+ "-Xshare:on",
+ "-showversion"
+ };
+
+ // Dump the archive
+ ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(
+ "-Xbootclasspath/a:" + appJar,
+ "-XX:+UnlockDiagnosticVMOptions", "-XX:SharedArchiveFile=./SharedArchiveFile.jsa",
+ "-XX:ExtraSharedClassListFile=" + jarClasslistFile.getPath(),
+ "-Xshare:dump");
+ OutputAnalyzer outputDump = executeAndLog(pb, "exec");
+ for (String jarClass : jarClasses) {
+ outputDump.shouldNotContain("Cannot find " + jarClass);
+ }
+ outputDump.shouldContain("Loading classes to share");
+ outputDump.shouldHaveExitValue(0);
+
+ // Run the test specified JDI test
+ pb = ProcessTools.createJavaProcessBuilder(true, testArgs);
+ OutputAnalyzer outputRun = executeAndLog(pb, "exec");
+ try {
+ outputRun.shouldContain("sharing");
+ outputRun.shouldHaveExitValue(0);
+ } catch (RuntimeException e) {
+ outputRun.shouldContain("Unable to use shared archive");
+ outputRun.shouldHaveExitValue(1);
+ }
+ }
+
+ public static String getPropOpt(String prop) {
+ String propVal = System.getProperty(prop);
+ if (propVal == null) propVal = "";
+ System.out.println(prop + ": '" + propVal + "'");
+ return "-D" + prop + "=" + propVal;
+ }
+
+ public static File makeClassList(String appClasses[]) throws Exception {
+ File classList = getOutputFile("test.classlist");
+ FileOutputStream fos = new FileOutputStream(classList);
+ PrintStream ps = new PrintStream(fos);
+
+ addToClassList(ps, appClasses);
+
+ ps.close();
+ fos.close();
+
+ return classList;
+ }
+
+ public static OutputAnalyzer executeAndLog(ProcessBuilder pb, String logName) throws Exception {
+ long started = System.currentTimeMillis();
+ OutputAnalyzer output = ProcessTools.executeProcess(pb);
+ writeFile(getOutputFile(logName + ".stdout"), output.getStdout());
+ writeFile(getOutputFile(logName + ".stderr"), output.getStderr());
+ System.out.println("[ELAPSED: " + (System.currentTimeMillis() - started) + " ms]");
+ System.out.println("[STDOUT]\n" + output.getStdout());
+ System.out.println("[STDERR]\n" + output.getStderr());
+ return output;
+ }
+
+ private static void writeFile(File file, String content) throws Exception {
+ FileOutputStream fos = new FileOutputStream(file);
+ PrintStream ps = new PrintStream(fos);
+ ps.print(content);
+ ps.close();
+ fos.close();
+ }
+
+ public static File getOutputFile(String name) {
+ File dir = new File(System.getProperty("test.classes", "."));
+ return new File(dir, getTestNamePrefix() + name);
+ }
+
+ private static void addToClassList(PrintStream ps, String classes[]) throws IOException {
+ if (classes != null) {
+ for (String s : classes) {
+ ps.println(s);
+ }
+ }
+ }
+
+ private static String testNamePrefix;
+
+ private static String getTestNamePrefix() {
+ if (testNamePrefix == null) {
+ StackTraceElement[] elms = (new Throwable()).getStackTrace();
+ if (elms.length > 0) {
+ for (StackTraceElement n: elms) {
+ if ("main".equals(n.getMethodName())) {
+ testNamePrefix = n.getClassName() + "-";
+ break;
+ }
+ }
+ }
+
+ if (testNamePrefix == null) {
+ testNamePrefix = "";
+ }
+ }
+ return testNamePrefix;
+ }
+
+ private static String buildJar(String jarName, String ...classNames)
+ throws Exception {
+
+ String jarFullName = classesDir + File.separator + jarName + ".jar";
+ createSimpleJar(classesDir, jarFullName, classNames);
+ return jarFullName;
+ }
+
+ private static void createSimpleJar(String jarClassesDir, String jarName,
+ String[] classNames) throws Exception {
+
+ ArrayList<String> args = new ArrayList<String>();
+ args.add("cf");
+ args.add(jarName);
+ addJarClassArgs(args, jarClassesDir, classNames);
+ createJar(args);
+ }
+
+ private static void addJarClassArgs(ArrayList<String> args, String jarClassesDir,
+ String[] classNames) {
+
+ for (String name : classNames) {
+ args.add("-C");
+ args.add(jarClassesDir);
+ args.add(name + ".class");
+ }
+ }
+
+ private static void createJar(ArrayList<String> args) {
+ Main jarTool = new Main(System.out, System.err, "jar");
+ if (!jarTool.run(args.toArray(new String[1]))) {
+ throw new RuntimeException("jar operation failed");
+ }
+ }
+}
--- a/jdk/test/com/sun/tools/attach/BasicTests.java Fri Jun 19 15:25:09 2015 -0700
+++ b/jdk/test/com/sun/tools/attach/BasicTests.java Thu Jun 25 09:48:36 2015 -0700
@@ -21,17 +21,21 @@
* questions.
*/
-import com.sun.tools.attach.*;
+import java.io.File;
+import java.io.IOException;
import java.net.ServerSocket;
import java.net.Socket;
-import java.io.IOException;
+import java.util.List;
import java.util.Properties;
-import java.util.List;
-import java.io.File;
+
import jdk.testlibrary.OutputAnalyzer;
-import jdk.testlibrary.JDKToolLauncher;
+import jdk.testlibrary.ProcessThread;
import jdk.testlibrary.ProcessTools;
-import jdk.testlibrary.ProcessThread;
+
+import com.sun.tools.attach.AgentInitializationException;
+import com.sun.tools.attach.AgentLoadException;
+import com.sun.tools.attach.VirtualMachine;
+import com.sun.tools.attach.VirtualMachineDescriptor;
/*
* @test
--- a/jdk/test/com/sun/tools/attach/RunnerUtil.java Fri Jun 19 15:25:09 2015 -0700
+++ b/jdk/test/com/sun/tools/attach/RunnerUtil.java Thu Jun 25 09:48:36 2015 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -48,7 +48,7 @@
*/
public static ProcessThread startApplication(String... additionalOpts) throws Throwable {
String classpath = System.getProperty("test.class.path", ".");
- String[] myArgs = concat(additionalOpts, new String [] { "-Dattach.test=true", "-classpath", classpath, "Application" });
+ String[] myArgs = concat(additionalOpts, new String [] { "-XX:+UsePerfData", "-Dattach.test=true", "-classpath", classpath, "Application" });
String[] args = Utils.addTestJavaOpts(myArgs);
ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(args);
ProcessThread pt = new ProcessThread("runApplication", (line) -> line.equals(Application.READY_MSG), pb);
--- a/jdk/test/javax/management/loading/MLetCLR/MLetCommand.java Fri Jun 19 15:25:09 2015 -0700
+++ b/jdk/test/javax/management/loading/MLetCLR/MLetCommand.java Thu Jun 25 09:48:36 2015 -0700
@@ -31,7 +31,7 @@
* @modules java.management
* @run clean MLetCommand
* @run build MLetCommand
- * @run main/othervm/policy=policy MLetCommand
+ * @run main/othervm/java.security.policy=policy MLetCommand
*/
import javax.management.MBeanServer;
--- a/jdk/test/javax/management/modelmbean/ModelMBeanInfoSupport/GetAllDescriptorsTest.java Fri Jun 19 15:25:09 2015 -0700
+++ b/jdk/test/javax/management/modelmbean/ModelMBeanInfoSupport/GetAllDescriptorsTest.java Thu Jun 25 09:48:36 2015 -0700
@@ -30,7 +30,7 @@
* @modules java.management
* @run clean GetAllDescriptorsTest
* @run build GetAllDescriptorsTest
- * @run main/othervm/policy=policy GetAllDescriptorsTest
+ * @run main/othervm/java.security.policy=policy GetAllDescriptorsTest
*/
import java.lang.reflect.*;
--- a/jdk/test/javax/management/modelmbean/SimpleModelMBean/SimpleModelMBeanCommand.java Fri Jun 19 15:25:09 2015 -0700
+++ b/jdk/test/javax/management/modelmbean/SimpleModelMBean/SimpleModelMBeanCommand.java Thu Jun 25 09:48:36 2015 -0700
@@ -31,7 +31,7 @@
* @modules java.management
* @run clean SimpleModelMBeanCommand
* @run build SimpleModelMBeanCommand
- * @run main/othervm/policy=policy SimpleModelMBeanCommand
+ * @run main/othervm/java.security.policy=policy SimpleModelMBeanCommand
*/
import java.lang.reflect.*;
--- a/jdk/test/javax/management/remote/mandatory/notif/DeadListenerTest.java Fri Jun 19 15:25:09 2015 -0700
+++ b/jdk/test/javax/management/remote/mandatory/notif/DeadListenerTest.java Thu Jun 25 09:48:36 2015 -0700
@@ -27,6 +27,7 @@
* @summary Test that a listener can be removed remotely from an MBean that no longer exists.
* @modules java.management/com.sun.jmx.remote.internal
* @author Eamonn McManus
+ * @run main/othervm -XX:+UsePerfData DeadListenerTest
*/
import com.sun.jmx.remote.internal.ServerNotifForwarder;
--- a/jdk/test/lib/testlibrary/jdk/testlibrary/ProcessTools.java Fri Jun 19 15:25:09 2015 -0700
+++ b/jdk/test/lib/testlibrary/jdk/testlibrary/ProcessTools.java Thu Jun 25 09:48:36 2015 -0700
@@ -278,16 +278,46 @@
}
/**
- * Create ProcessBuilder using the java launcher from the jdk to be tested
- * and with any platform specific arguments prepended
+ * Create ProcessBuilder using the java launcher from the jdk to be tested,
+ * and with any platform specific arguments prepended.
+ *
+ * @param command Arguments to pass to the java command.
+ * @return The ProcessBuilder instance representing the java command.
*/
public static ProcessBuilder createJavaProcessBuilder(String... command)
throws Exception {
+ return createJavaProcessBuilder(false, command);
+ }
+
+ /**
+ * Create ProcessBuilder using the java launcher from the jdk to be tested,
+ * and with any platform specific arguments prepended.
+ *
+ * @param addTestVmAndJavaOptions If true, adds test.vm.opts and test.java.opts
+ * to the java arguments.
+ * @param command Arguments to pass to the java command.
+ * @return The ProcessBuilder instance representing the java command.
+ */
+ public static ProcessBuilder createJavaProcessBuilder(boolean addTestVmAndJavaOptions, String... command) throws Exception {
String javapath = JDKToolFinder.getJDKTool("java");
ArrayList<String> args = new ArrayList<>();
args.add(javapath);
Collections.addAll(args, getPlatformSpecificVMArgs());
+
+ if (addTestVmAndJavaOptions) {
+ // -cp is needed to make sure the same classpath is used whether the test is
+ // run in AgentVM mode or OtherVM mode. It was added to the hotspot version
+ // of this API as part of 8077608. However, for the jdk version it is only
+ // added when addTestVmAndJavaOptions is true in order to minimize
+ // disruption to existing JDK tests, which have yet to be tested with -cp
+ // being added. At some point -cp should always be added to be consistent
+ // with what the hotspot version does.
+ args.add("-cp");
+ args.add(System.getProperty("java.class.path"));
+ Collections.addAll(args, Utils.getTestJavaOpts());
+ }
+
Collections.addAll(args, command);
// Reporting
--- a/jdk/test/sun/management/jmxremote/bootstrap/LocalManagementTest.java Fri Jun 19 15:25:09 2015 -0700
+++ b/jdk/test/sun/management/jmxremote/bootstrap/LocalManagementTest.java Thu Jun 25 09:48:36 2015 -0700
@@ -21,14 +21,15 @@
* questions.
*/
-import java.io.File;
import java.lang.reflect.Method;
import java.lang.reflect.Modifier;
import java.util.ArrayList;
import java.util.List;
-import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicReference;
+import jdk.testlibrary.ProcessTools;
+import jdk.testlibrary.Utils;
+
/**
* @test
* @library /lib/testlibrary
@@ -39,14 +40,10 @@
* both agent properties and jvmstat buffer.
* @modules java.management/sun.management
* @build jdk.testlibrary.* TestManager TestApplication
- * @run main/othervm/timeout=300 -XX:+UsePerfData LocalManagementTest
+ * @run main/othervm/timeout=300 LocalManagementTest
*/
-
-import jdk.testlibrary.ProcessTools;
-
public class LocalManagementTest {
private static final String TEST_CLASSPATH = System.getProperty("test.class.path");
- private static final String TEST_JDK = System.getProperty("test.jdk");
public static void main(String[] args) throws Exception {
int failures = 0;
@@ -96,6 +93,8 @@
private static boolean doTest(String testId, String arg) throws Exception {
List<String> args = new ArrayList<>();
+ args.add("-XX:+UsePerfData");
+ args.addAll(Utils.getVmOptions());
args.add("-cp");
args.add(TEST_CLASSPATH);
--- a/jdk/test/sun/management/jmxremote/startstop/JMXStartStopTest.java Fri Jun 19 15:25:09 2015 -0700
+++ b/jdk/test/sun/management/jmxremote/startstop/JMXStartStopTest.java Thu Jun 25 09:48:36 2015 -0700
@@ -21,6 +21,7 @@
* questions.
*/
+import java.io.EOFException;
import java.io.File;
import java.io.IOException;
import java.lang.reflect.InvocationTargetException;
@@ -36,7 +37,6 @@
import java.util.List;
import java.util.Objects;
import java.util.Set;
-import java.util.concurrent.TimeUnit;
import java.util.concurrent.TimeoutException;
import java.util.concurrent.atomic.AtomicBoolean;
@@ -45,6 +45,7 @@
import javax.net.ssl.SSLHandshakeException;
import jdk.testlibrary.ProcessTools;
+import jdk.testlibrary.Utils;
import sun.management.Agent;
import sun.management.AgentConfigurationError;
@@ -155,7 +156,28 @@
}
private static void testConnect(int port, int rmiPort) throws Exception {
+ EOFException lastException = null;
+ // factor adjusted timeout (5 seconds) for the RMI to become available
+ long timeout = System.currentTimeMillis() + Utils.adjustTimeout(5000);
+ do {
+ try {
+ doTestConnect(port, rmiPort);
+ lastException = null;
+ } catch (EOFException e) {
+ lastException = e;
+ System.out.println("Error establishing RMI connection. Retrying in 500ms.");
+ Thread.sleep(500);
+ }
+ } while (lastException != null && System.currentTimeMillis() < timeout);
+ if (lastException != null) {
+ // didn't manage to get the RMI running in time
+ // rethrow the exception
+ throw lastException;
+ }
+ }
+
+ private static void doTestConnect(int port, int rmiPort) throws Exception {
dbg_print("RmiRegistry lookup...");
dbg_print("Using port: " + port);
--- a/jdk/test/sun/management/jmxremote/startstop/ManagementAgentJcmd.java Fri Jun 19 15:25:09 2015 -0700
+++ b/jdk/test/sun/management/jmxremote/startstop/ManagementAgentJcmd.java Thu Jun 25 09:48:36 2015 -0700
@@ -196,7 +196,9 @@
l.addToolArg(cmd);
}
- StringBuilder output = new StringBuilder();
+ // this buffer will get filled in different threads
+ // -> must be the synchronized StringBuffer
+ StringBuffer output = new StringBuffer();
AtomicBoolean portUnavailable = new AtomicBoolean(false);
Process p = ProcessTools.startProcess(
--- a/jdk/test/sun/tools/jmap/heapconfig/TmtoolTestScenario.java Fri Jun 19 15:25:09 2015 -0700
+++ b/jdk/test/sun/tools/jmap/heapconfig/TmtoolTestScenario.java Thu Jun 25 09:48:36 2015 -0700
@@ -38,7 +38,7 @@
public class TmtoolTestScenario {
- private final ArrayList<String> toolOutput = new ArrayList();
+ private final ArrayList<String> toolOutput = new ArrayList<String>();
private LingeredApp theApp = null;
private final String toolName;
private final String[] toolArgs;
@@ -72,7 +72,7 @@
*/
public Map<String, String> parseFlagsFinal() {
List<String> astr = theApp.getAppOutput();
- Map<String, String> vmMap = new HashMap();
+ Map<String, String> vmMap = new HashMap<String, String>();
for (String line : astr) {
String[] lv = line.trim().split("\\s+");
@@ -94,7 +94,10 @@
System.out.println("Starting LingeredApp");
try {
try {
- theApp = LingeredApp.startApp(vmArgs);
+ List<String> vmArgsExtended = new ArrayList<String>();
+ vmArgsExtended.add("-XX:+UsePerfData");
+ vmArgsExtended.addAll(vmArgs);
+ theApp = LingeredApp.startApp(vmArgsExtended);
System.out.println("Starting " + toolName + " against " + theApp.getPid());
JDKToolLauncher launcher = JDKToolLauncher.createUsingTestJDK(toolName);
@@ -120,7 +123,7 @@
return toolProcess.exitValue();
} finally {
- theApp.stopApp();
+ LingeredApp.stopApp(theApp);
}
} catch (IOException | InterruptedException ex) {
throw new RuntimeException("Test ERROR " + ex, ex);
--- a/jdk/test/sun/tools/jps/JpsHelper.java Fri Jun 19 15:25:09 2015 -0700
+++ b/jdk/test/sun/tools/jps/JpsHelper.java Thu Jun 25 09:48:36 2015 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -94,9 +94,10 @@
}
/**
- * VM arguments to start test application with
+ * VM arguments to start test application with.
+ * -XX:+UsePerfData is required for running the tests on embedded platforms.
*/
- public static final String[] VM_ARGS = {"-Xmx512m", "-XX:+PrintGCDetails"};
+ public static final String[] VM_ARGS = {"-XX:+UsePerfData", "-Xmx512m", "-XX:+PrintGCDetails"};
/**
* VM flag to start test application with
*/