Skip to content
Permalink
Browse files

8234277: ClhsdbLauncher should enable verbose exceptions and do a bet…

…ter job of detecting SA failures

Reviewed-by: sspitsyn, ysuenaga
  • Loading branch information
plummercj committed Dec 18, 2019
1 parent eb6beea commit 5cb06ce2fbcdabf0a99066c7f3e020738ba33c21
Showing with 19 additions and 4 deletions.
  1. +1 −1 test/hotspot/jtreg/ProblemList.txt
  2. +18 −3 test/hotspot/jtreg/serviceability/sa/ClhsdbLauncher.java
@@ -115,7 +115,7 @@ serviceability/sa/ClhsdbPrintAs.java 8193639 solaris-all
serviceability/sa/ClhsdbPrintStatics.java 8193639 solaris-all
serviceability/sa/ClhsdbPstack.java 8193639 solaris-all
serviceability/sa/ClhsdbRegionDetailsScanOopsForG1.java 8193639 solaris-all
serviceability/sa/ClhsdbScanOops.java 8193639 solaris-all
serviceability/sa/ClhsdbScanOops.java 8193639,8235220,8230731 solaris-all,linux-x64,macosx-x64,windows-x64
serviceability/sa/ClhsdbSource.java 8193639 solaris-all
serviceability/sa/ClhsdbThread.java 8193639 solaris-all
serviceability/sa/ClhsdbVmStructsDump.java 8193639 solaris-all
@@ -71,7 +71,6 @@ private void attach(long lingeredAppPid)
cmdStringList = SATestUtils.addPrivileges(cmdStringList);
}
ProcessBuilder processBuilder = new ProcessBuilder(cmdStringList);
processBuilder.redirectError(ProcessBuilder.Redirect.INHERIT);
toolProcess = processBuilder.start();
}

@@ -91,8 +90,6 @@ private void loadCore(String coreFileName)
" and exe " + JDKToolFinder.getTestJDKTool("java"));

ProcessBuilder processBuilder = new ProcessBuilder(launcher.getCommand());
processBuilder.redirectError(ProcessBuilder.Redirect.INHERIT);

toolProcess = processBuilder.start();
}

@@ -116,6 +113,17 @@ private String runCmd(List<String> commands,
throw new RuntimeException("CLHSDB command must be provided\n");
}

// Enable verbose exception tracing so we see the full exception backtrace
// when there is a failure. We need to insert this command into the start
// of the commands list. We can't just issue the "verbose true" command seperately
// because code below won't work correctly if all executed commands are
// not in the commands list. And since it's immutable, we need to allocate
// a mutable one.
List<String> savedCommands = commands;
commands = new java.util.LinkedList<String>();
commands.add("verbose true");
commands.addAll(savedCommands);

try (OutputStream out = toolProcess.getOutputStream()) {
for (String cmd : commands) {
out.write((cmd + "\n").getBytes());
@@ -134,8 +142,15 @@ private String runCmd(List<String> commands,

oa.shouldHaveExitValue(0);
output = oa.getOutput();
System.out.println("Output: ");
System.out.println(output);

// This will detect most SA failures, including during the attach.
oa.shouldNotMatch("^sun.jvm.hotspot.debugger.DebuggerException:.*$");
// This will detect unexpected exceptions, like NPEs and asserts, that are caught
// by sun.jvm.hotspot.CommandProcessor.
oa.shouldNotMatch("^Error: .*$");

String[] parts = output.split("hsdb>");
for (String cmd : commands) {
int index = commands.indexOf(cmd) + 1;

0 comments on commit 5cb06ce

Please sign in to comment.
You can’t perform that action at this time.