RFR: 8289400: Improve com/sun/jdi/TestScaffold error reporting
Chris Plummer
cjplummer at openjdk.org
Thu Sep 1 19:17:43 UTC 2022
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.
-------------
Commit messages:
- Includes stack trace when there is a failure.
Changes: https://git.openjdk.org/jdk/pull/10127/files
Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=10127&range=00
Issue: https://bugs.openjdk.org/browse/JDK-8289400
Stats: 3 lines in 1 file changed: 3 ins; 0 del; 0 mod
Patch: https://git.openjdk.org/jdk/pull/10127.diff
Fetch: git fetch https://git.openjdk.org/jdk pull/10127/head:pull/10127
PR: https://git.openjdk.org/jdk/pull/10127
More information about the serviceability-dev
mailing list