Skip to content

Commit

Permalink
Merge pull request #663 from pshipton/uncaught
Browse files Browse the repository at this point in the history
Cause a better system dump on failure of UncaughtExceptionsTest
  • Loading branch information
keithc-ca committed Jun 1, 2023
2 parents 4c9f7d7 + 2458fae commit 359f15b
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions test/jdk/java/lang/Thread/UncaughtExceptionsTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -67,14 +67,9 @@ public Object[][] testCases() {
public void test(String className, int exitValue, String stdOutMatch, String stdErrMatch) throws Throwable {
ProcessBuilder processBuilder = ProcessTools.createJavaProcessBuilder(String.format("UncaughtExitSimulator$%s",className));
OutputAnalyzer outputAnalyzer = ProcessTools.executeCommand(processBuilder);
try {
outputAnalyzer.shouldHaveExitValue(exitValue);
outputAnalyzer.stderrShouldMatch(stdErrMatch);
outputAnalyzer.stdoutShouldMatch(stdOutMatch);
} catch (RuntimeException e) {
com.ibm.jvm.Dump.SystemDump();
throw e;
}
outputAnalyzer.shouldHaveExitValue(exitValue);
outputAnalyzer.stderrShouldMatch(stdErrMatch);
outputAnalyzer.stdoutShouldMatch(stdOutMatch);
}

}
Expand All @@ -98,7 +93,12 @@ class UncaughtExitSimulator extends Thread implements Runnable {

public static void throwRuntimeException() { throw new RuntimeException("simulateUncaughtExitEvent"); }

public void run() { throwRuntimeException(); }
public void run() {
if (!Thread.currentThread().getName().equals("Thread-0")) {
com.ibm.jvm.Dump.SystemDump();
}
throwRuntimeException();
}

/**
* A thread is never alive after you've join()ed it.
Expand Down

0 comments on commit 359f15b

Please sign in to comment.