From 6500bf0035617d7e38d7c7bc6070a256ae6646a6 Mon Sep 17 00:00:00 2001 From: Yasumasa Suenaga Date: Mon, 8 Aug 2016 21:59:33 +0900 Subject: [PATCH 1/2] 8163272: jhsdb jinfo cannot show system properties Reviewed-by: dholmes, dsamersoff --- .../sun/tools/jhsdb/BasicLauncherTest.java | 29 ++++++++++++------- 1 file changed, 19 insertions(+), 10 deletions(-) diff --git a/jdk/test/sun/tools/jhsdb/BasicLauncherTest.java b/jdk/test/sun/tools/jhsdb/BasicLauncherTest.java index 4125dbfb4d4..604b28241ee 100644 --- a/jdk/test/sun/tools/jhsdb/BasicLauncherTest.java +++ b/jdk/test/sun/tools/jhsdb/BasicLauncherTest.java @@ -40,6 +40,7 @@ import java.io.File; import java.util.ArrayList; import java.util.List; import java.util.Arrays; +import java.util.Optional; import jdk.testlibrary.JDKToolLauncher; import jdk.testlibrary.Utils; import jdk.testlibrary.OutputAnalyzer; @@ -111,7 +112,8 @@ public class BasicLauncherTest { * @param vmArgs - vm and java arguments to launch test app * @return exit code of tool */ - public static void launch(String expectedMessage, List toolArgs) + public static void launch(String expectedMessage, + Optional unexpectedMessage, List toolArgs) throws IOException { System.out.println("Starting LingeredApp"); @@ -131,6 +133,7 @@ public class BasicLauncherTest { processBuilder.redirectError(ProcessBuilder.Redirect.INHERIT); OutputAnalyzer output = ProcessTools.executeProcess(processBuilder);; output.shouldContain(expectedMessage); + unexpectedMessage.ifPresent(output::shouldNotContain); output.shouldHaveExitValue(0); } catch (Exception ex) { @@ -140,13 +143,16 @@ public class BasicLauncherTest { } } - public static void launch(String expectedMessage, String... toolArgs) + public static void launch(String expectedMessage, + String unexpectedMessage, String... toolArgs) throws IOException { - launch(expectedMessage, Arrays.asList(toolArgs)); + launch(expectedMessage, Optional.ofNullable(unexpectedMessage), + Arrays.asList(toolArgs)); } - public static void launchNotOSX(String expectedMessage, String... toolArgs) + public static void launchNotOSX(String expectedMessage, + String unexpectedMessage, String... toolArgs) throws IOException { if (Platform.isOSX()) { @@ -154,6 +160,8 @@ public class BasicLauncherTest { System.out.println("This test is not expected to work on OS X. Skipping"); return; } + + launch(expectedMessage, unexpectedMessage, toolArgs); } public static void testHeapDump() throws IOException { @@ -164,7 +172,7 @@ public class BasicLauncherTest { } dump.deleteOnExit(); - launch("heap written to", "jmap", + launch("heap written to", null, "jmap", "--binaryheap", "--dumpfile=" + dump.getAbsolutePath()); assertTrue(dump.exists() && dump.isFile(), @@ -182,11 +190,12 @@ public class BasicLauncherTest { launchCLHSDB(); - launch("compiler detected", "jmap", "--clstats"); - launchNotOSX("No deadlocks found", "jstack"); - launch("compiler detected", "jmap"); - launch("Java System Properties", "jinfo"); - launch("java.threads", "jsnap"); + launch("compiler detected", null, "jmap", "--clstats"); + launchNotOSX("No deadlocks found", null, "jstack"); + launch("compiler detected", null, "jmap"); + launch("Java System Properties", + "System Properties info not available", "jinfo"); + launch("java.threads", null, "jsnap"); testHeapDump(); From 1920a07b8c1f262622379770a29ce5c3a74553de Mon Sep 17 00:00:00 2001 From: Jini George Date: Thu, 11 Aug 2016 17:47:47 +0300 Subject: [PATCH 2/2] 8163143: illegal bci error with interpreted frames in SA due to mirror being stored in interpreted frames Added code to represent the frame mirror offset in SA Reviewed-by: dsamersoff --- .../sun/tools/jhsdb/BasicLauncherTest.java | 47 +++++++++++++------ 1 file changed, 33 insertions(+), 14 deletions(-) diff --git a/jdk/test/sun/tools/jhsdb/BasicLauncherTest.java b/jdk/test/sun/tools/jhsdb/BasicLauncherTest.java index 604b28241ee..e18b5c76c1d 100644 --- a/jdk/test/sun/tools/jhsdb/BasicLauncherTest.java +++ b/jdk/test/sun/tools/jhsdb/BasicLauncherTest.java @@ -107,6 +107,38 @@ public class BasicLauncherTest { } } + public static void launchJStack() throws IOException { + + if (Platform.isOSX()) { + // Coredump stackwalking is not implemented for Darwin + System.out.println("This test is not expected to work on OS X. Skipping"); + return; + } + + System.out.println("Starting LingeredApp"); + try { + theApp = LingeredApp.startApp(Arrays.asList("-Xmx256m")); + + System.out.println("Starting jstack against " + theApp.getPid()); + JDKToolLauncher launcher = createSALauncher(); + + launcher.addToolArg("jstack"); + launcher.addToolArg("--pid=" + Long.toString(theApp.getPid())); + + ProcessBuilder processBuilder = new ProcessBuilder(launcher.getCommand()); + OutputAnalyzer output = ProcessTools.executeProcess(processBuilder);; + output.shouldContain("No deadlocks found"); + output.shouldNotContain("illegal bci"); + output.shouldNotContain("AssertionFailure"); + output.shouldHaveExitValue(0); + + } catch (Exception ex) { + throw new RuntimeException("Test ERROR " + ex, ex); + } finally { + LingeredApp.stopApp(theApp); + } + } + /** * * @param vmArgs - vm and java arguments to launch test app @@ -151,19 +183,6 @@ public class BasicLauncherTest { Arrays.asList(toolArgs)); } - public static void launchNotOSX(String expectedMessage, - String unexpectedMessage, String... toolArgs) - throws IOException { - - if (Platform.isOSX()) { - // Coredump stackwalking is not implemented for Darwin - System.out.println("This test is not expected to work on OS X. Skipping"); - return; - } - - launch(expectedMessage, unexpectedMessage, toolArgs); - } - public static void testHeapDump() throws IOException { File dump = new File("jhsdb.jmap.dump." + System.currentTimeMillis() + ".hprof"); @@ -191,7 +210,7 @@ public class BasicLauncherTest { launchCLHSDB(); launch("compiler detected", null, "jmap", "--clstats"); - launchNotOSX("No deadlocks found", null, "jstack"); + launchJStack(); launch("compiler detected", null, "jmap"); launch("Java System Properties", "System Properties info not available", "jinfo");