RFR: 8289400: Improve com/sun/jdi/TestScaffold error reporting [v2]
Chris Plummer
cjplummer at openjdk.org
Fri Sep 2 16:07:50 UTC 2022
On Thu, 1 Sep 2022 21:11:09 GMT, Chris Plummer <cjplummer at 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.
>>
>>
>> [2ms] run args: [SuspendAfterDeathTarg]
>> [514ms] FAILED: got Breakpoint event before ThreadDeath event.
>> at TestScaffold.failure(TestScaffold.java:455)
>> at SuspendAfterDeath.breakpointReached(SuspendAfterDeath.java:64)
>> at TestScaffold$EventHandler.notifyEvent(TestScaffold.java:194)
>> at TestScaffold$EventHandler.run(TestScaffold.java:278)
>> at java.base/java.lang.Thread.run(Thread.java:1589)
>> 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)
>
> Chris Plummer has updated the pull request incrementally with one additional commit since the last revision:
>
> Add curly braces.
Thanks Alex and Leonid!
-------------
PR: https://git.openjdk.org/jdk/pull/10127
More information about the serviceability-dev
mailing list