On Thu, 1 Sep 2022 19:09:25 GMT, Chris Plummer <cjplum...@openjdk.org> wrote:
> com/sun/jdi tests report errors by calling TestScaffold.failure(msg), which > prints the failure message and sets the testFailed flag. At some later point > the failure is detected and an exception is thrown. The end result is the > exception has just has a vanilla message that says something like "TestXXX > failed", and the backtrace is not indicative of where the failure occurred. > If you have tools that search logs looking for exceptions to determine the > reason for the failure, you likely won't find any. Here's an example: > > [2ms] run args: [SuspendAfterDeathTarg] > [514ms] FAILED: got Breakpoint event before ThreadDeath event. > java.lang.Exception: SuspendAfterDeath: failed > at SuspendAfterDeath.runTests(SuspendAfterDeath.java:110) > at TestScaffold.startTests(TestScaffold.java:432) > at SuspendAfterDeath.main(SuspendAfterDeath.java:47) > at > java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:104) > at java.base/java.lang.reflect.Method.invoke(Method.java:578) > at > com.sun.javatest.regtest.agent.MainWrapper$MainThread.run(MainWrapper.java:127) > at java.base/java.lang.Thread.run(Thread.java:1589) > > So the reason for the failure is clear (the "FAILED" message), but its stack > trace is missing and the reason is not included in the exception message that > is printed much later on. This PR adds printing of the stack trace at the > time of the failure. test/jdk/com/sun/jdi/TestScaffold.java line 457: > 455: println(str); > 456: StackTraceElement[] trace = > Thread.currentThread().getStackTrace(); > 457: for (StackTraceElement traceElement : trace) Please add curly braces around the cycle body ------------- PR: https://git.openjdk.org/jdk/pull/10127