RFR: 8289400: Improve com/sun/jdi/TestScaffold error reporting [v2]

Chris Plummer cjplummer at openjdk.org
Thu Sep 1 21:11:09 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.

Chris Plummer has updated the pull request incrementally with one additional commit since the last revision:

  Add curly braces.

-------------

Changes:
  - all: https://git.openjdk.org/jdk/pull/10127/files
  - new: https://git.openjdk.org/jdk/pull/10127/files/86e42e53..49cbaf6a

Webrevs:
 - full: https://webrevs.openjdk.org/?repo=jdk&pr=10127&range=01
 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=10127&range=00-01

  Stats: 2 lines in 1 file changed: 1 ins; 0 del; 1 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