Completed
Details
Assignee
UnassignedUnassignedReporter
Gary TrakhmanGary TrakhmanLabels
Approval
OkPatch
CodePriority
MajorAffects versions
Fix versions
Details
Details
Assignee
Unassigned
UnassignedReporter
Gary Trakhman
Gary TrakhmanLabels
Approval
Ok
Patch
Code
Priority

Affects versions
Fix versions
Created November 24, 2015 at 10:15 PM
Updated December 6, 2015 at 2:15 AM
Resolved December 6, 2015 at 2:15 AM
Test failure locations are being mis-reported (wrong class/line number).
Given a test ns:
The results with 1.8-RC2 (with CLJ-1854 patch included) are:
Cause: The location of the error is calculated in test.clj by constructing a Throwable in
do-report
and then dropping the top 1 frame (which isdo-report
itself) to find the user frame where the assertion failed. However, with direct linking there are now 2 frames on top of of the failure in user code, so the same (incorrect) location in test.clj is reported every time.Approach: Change to a different strategy to filter the top frames based on content, not hard-coded depth. This strategy will work regardless of whether direct linking is involved or not.
1. Instead of constructing an exception and using it's stack trace, instead call Thread.getStackTrace() on the current thread. Create a new function that works on stack traces rather than exceptions and no longer needs a depth check.
2. Drop top frames while their class name starts with java.lang (this filters the call to java.lang.Thread.getStackTrace()) or clojure.test. The top frame will then be in the user's code.
3. Deprecated old file-and-line function (not sure if other clojure test reporting frameworks use this, despite it being private).
4. Updated tests that check that these functions work with an empty stack trace, as the JVM may elide it.
Patch: clj-1856.patch