# HG changeset patch # User ykantser # Date 1432728800 -7200 # Node ID 794e08f6dad48e8808d252550f6020b347e28ad5 # Parent d2a0ec86d6efd360add8f06ed8ce769d4efbaf12 8081037: serviceability/sa/ tests time out on Windows Reviewed-by: jbachorik, sla, dsamersoff diff -r d2a0ec86d6ef -r 794e08f6dad4 hotspot/test/serviceability/sa/TestClassLoaderStats.java --- a/hotspot/test/serviceability/sa/TestClassLoaderStats.java Thu May 28 11:37:13 2015 -0700 +++ b/hotspot/test/serviceability/sa/TestClassLoaderStats.java Wed May 27 14:13:20 2015 +0200 @@ -24,11 +24,14 @@ import jdk.test.lib.Platform; import jdk.test.lib.ProcessTools; import jdk.test.lib.OutputAnalyzer; +import jdk.test.lib.apps.LingeredApp; /* * @test + * @library /../../test/lib/share/classes * @library /testlibrary * @build jdk.test.lib.* + * @build jdk.test.lib.apps.* * @run main TestClassLoaderStats */ public class TestClassLoaderStats { @@ -39,19 +42,27 @@ return; } - ProcessBuilder processBuilder = ProcessTools.createJavaProcessBuilder( - "-XX:+UsePerfData", - "sun.jvm.hotspot.tools.ClassLoaderStats", - Integer.toString(ProcessTools.getProcessId())); - OutputAnalyzer output = ProcessTools.executeProcess(processBuilder); - System.out.println(output.getOutput()); + LingeredApp app = null; + try { + app = LingeredApp.startApp(); - output.shouldHaveExitValue(0); - output.shouldContain("Debugger attached successfully."); - // The class loader stats header needs to be presented in the output: - output.shouldMatch("class_loader\\W+classes\\W+bytes\\W+parent_loader\\W+alive?\\W+type"); - output.stderrShouldNotMatch("[E|e]xception"); - output.stderrShouldNotMatch("[E|e]rror"); + System.out.println("Attaching sun.jvm.hotspot.tools.ClassLoaderStats to " + app.getPid()); + ProcessBuilder processBuilder = ProcessTools.createJavaProcessBuilder( + "-XX:+UsePerfData", + "sun.jvm.hotspot.tools.ClassLoaderStats", + Long.toString(app.getPid())); + OutputAnalyzer output = ProcessTools.executeProcess(processBuilder); + System.out.println(output.getOutput()); + + output.shouldHaveExitValue(0); + output.shouldContain("Debugger attached successfully."); + // The class loader stats header needs to be presented in the output: + output.shouldMatch("class_loader\\W+classes\\W+bytes\\W+parent_loader\\W+alive?\\W+type"); + output.stderrShouldNotMatch("[E|e]xception"); + output.stderrShouldNotMatch("[E|e]rror"); + } finally { + app.stopApp(); + } } } diff -r d2a0ec86d6ef -r 794e08f6dad4 hotspot/test/serviceability/sa/TestStackTrace.java --- a/hotspot/test/serviceability/sa/TestStackTrace.java Thu May 28 11:37:13 2015 -0700 +++ b/hotspot/test/serviceability/sa/TestStackTrace.java Wed May 27 14:13:20 2015 +0200 @@ -24,11 +24,14 @@ import jdk.test.lib.OutputAnalyzer; import jdk.test.lib.Platform; import jdk.test.lib.ProcessTools; +import jdk.test.lib.apps.LingeredApp; /* * @test + * @library /../../test/lib/share/classes * @library /testlibrary * @build jdk.test.lib.* + * @build jdk.test.lib.apps.* * @run main TestStackTrace */ public class TestStackTrace { @@ -39,17 +42,25 @@ return; } - ProcessBuilder processBuilder = ProcessTools.createJavaProcessBuilder( - "-XX:+UsePerfData", - "sun.jvm.hotspot.tools.StackTrace", - Integer.toString(ProcessTools.getProcessId())); - OutputAnalyzer output = ProcessTools.executeProcess(processBuilder); - System.out.println(output.getOutput()); + LingeredApp app = null; + try { + app = LingeredApp.startApp(); - output.shouldHaveExitValue(0); - output.shouldContain("Debugger attached successfully."); - output.stderrShouldNotMatch("[E|e]xception"); - output.stderrShouldNotMatch("[E|e]rror"); + System.out.println("Attaching sun.jvm.hotspot.tools.StackTrace to " + app.getPid()); + ProcessBuilder processBuilder = ProcessTools.createJavaProcessBuilder( + "-XX:+UsePerfData", + "sun.jvm.hotspot.tools.StackTrace", + Long.toString(app.getPid())); + OutputAnalyzer output = ProcessTools.executeProcess(processBuilder); + System.out.println(output.getOutput()); + + output.shouldHaveExitValue(0); + output.shouldContain("Debugger attached successfully."); + output.stderrShouldNotMatch("[E|e]xception"); + output.stderrShouldNotMatch("[E|e]rror"); + } finally { + app.stopApp(); + } } }