I was puzzled by the lack of a useful stack trace containing test source files in
https://bugs.openjdk.java.net/browse/JDK-8159767
Looking at the jtreg sources, I see that toString is called on each junit Failure, but that is not enough to get the stacktrace. And the stacktrace is Job One!
Here is an obvious but completely untested change (I haven't seriously tried to build recent jtreg yet)
--- a/src/share/classes/com/sun/javatest/regtest/JUnitAction.java
+++ b/src/share/classes/com/sun/javatest/regtest/JUnitAction.java
@@ -119,11 +119,8 @@
throw new Exception(JUNIT_NO_DRIVER, ex);
}
if (!result.wasSuccessful()) {
- List<org.junit.runner.notification.Failure> failures = result.getFailures();
- for (Iterator<org.junit.runner.notification.Failure>
- it = failures.iterator(); it.hasNext(); ) {
- org.junit.runner.notification.Failure failure = it.next();
- System.err.println("JavaTest Message: JUnit Failure: "+failure);
+ for (org.junit.runner.notification.Failure failure : result.getFailures()) {
+ System.err.println("JavaTest Message: JUnit Failure: "+failure.getTrace());
}
throw new Exception("JUnit test failure");
}
https://bugs.openjdk.java.net/browse/JDK-8159767
Looking at the jtreg sources, I see that toString is called on each junit Failure, but that is not enough to get the stacktrace. And the stacktrace is Job One!
Here is an obvious but completely untested change (I haven't seriously tried to build recent jtreg yet)
--- a/src/share/classes/com/sun/javatest/regtest/JUnitAction.java
+++ b/src/share/classes/com/sun/javatest/regtest/JUnitAction.java
@@ -119,11 +119,8 @@
throw new Exception(JUNIT_NO_DRIVER, ex);
}
if (!result.wasSuccessful()) {
- List<org.junit.runner.notification.Failure> failures = result.getFailures();
- for (Iterator<org.junit.runner.notification.Failure>
- it = failures.iterator(); it.hasNext(); ) {
- org.junit.runner.notification.Failure failure = it.next();
- System.err.println("JavaTest Message: JUnit Failure: "+failure);
+ for (org.junit.runner.notification.Failure failure : result.getFailures()) {
+ System.err.println("JavaTest Message: JUnit Failure: "+failure.getTrace());
}
throw new Exception("JUnit test failure");
}
- relates to
-
JDK-8159767 testTransfer2(LinkedTransferQueueTest): expected:<1> but was:<0>
-
- Closed
-