Integrated: 8289400: Improve com/sun/jdi/TestScaffold error reporting
Chris Plummer
cjplummer at openjdk.org
Fri Sep 2 16:10:51 UTC 2022
On Thu, 1 Sep 2022 19:09:25 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)
This pull request has now been integrated.
Changeset: da99e3e8
Author: Chris Plummer <cjplummer at openjdk.org>
URL: https://git.openjdk.org/jdk/commit/da99e3e8299f3a476603aa43a99164c2c01adff4
Stats: 4 lines in 1 file changed: 4 ins; 0 del; 0 mod
8289400: Improve com/sun/jdi/TestScaffold error reporting
Reviewed-by: amenkov, lmesnik
-------------
PR: https://git.openjdk.org/jdk/pull/10127
More information about the serviceability-dev
mailing list