Longer stack trace for scalatest

1,906 views
Skip to first unread message

Sciss

unread,
Nov 29, 2011, 11:31:43 PM11/29/11
to simple-b...@googlegroups.com
hi,

i'm having a problem finding the origin of an exception, as the stack trace is printed truncted when testing with sbt (i use scalatest 1.6.1)

[info] java.io.IOException:
[info] at de.sciss.lucrestm.BerkeleyDB$System$$anonfun$read$mIc$sp$1.apply(BerkeleyDB.scala:255)
[info] at de.sciss.lucrestm.BerkeleyDB$System$$anonfun$read$mIc$sp$1.apply(BerkeleyDB.scala:249)
[info] at de.sciss.lucrestm.BerkeleyDB$System.de$sciss$lucrestm$BerkeleyDB$System$$withIO(BerkeleyDB.scala:230)
[info] at de.sciss.lucrestm.BerkeleyDB$System.read$mIc$sp(BerkeleyDB.scala:249)
[info] at de.sciss.lucrestm.BerkeleyDB$System$IntVal.get$mcI$sp(BerkeleyDB.scala:311)
[info] at de.sciss.lucrestm.BerkeleyDB$System$IntVal.transform$mcI$sp(BerkeleyDB.scala:315)
[info] at de.sciss.lucrestm.BerkeleyDB$System$IntVal.transform(BerkeleyDB.scala:315)
[info] at de.sciss.lucrestm.BerkeleyDB$System$IntVal.transform(BerkeleyDB.scala:310)
[info] at de.sciss.collection.txn.TotalOrder$Set$Entry.disposeData(TotalOrder.scala:184)
[info] at de.sciss.lucrestm.Mutable$class.dispose(Mutable.scala:48)
[info] ...

also last test-only doesn't give me useful info (it just shows some threading stuff, but not the above)

can i configure this somewhere so i get the full trace?


thanks, -sciss-

Sciss

unread,
Nov 29, 2011, 11:33:59 PM11/29/11
to simple-b...@googlegroups.com
(in the meantime, i could find a spot to surround with a try-catch, printing the full trace and rethrowing the exception)

> --
> You received this message because you are subscribed to the Google Groups "simple-build-tool" group.
> To post to this group, send email to simple-b...@googlegroups.com.
> To unsubscribe from this group, send email to simple-build-t...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/simple-build-tool?hl=en.
>

Tony Sloane

unread,
Nov 29, 2011, 11:46:26 PM11/29/11
to simple-b...@googlegroups.com
Which version of sbt are you using?

sbt 0.7 has the trace command for configuring how much trace information is given.

sbt 0.10+ has the trace-level key.

Tony

Sciss

unread,
Nov 29, 2011, 11:56:30 PM11/29/11
to simple-b...@googlegroups.com
0.11 -- ok, found trace-level!

Sciss

unread,
Dec 6, 2011, 7:53:26 PM12/6/11
to Sciss, simple-b...@googlegroups.com
do i need to do anything special to enable this in scalatest testing? because if i just add like 'traceLevel := 20' this affects only the final print in testing which is like

java.lang.RuntimeException: Tests unsuccessful
at scala.sys.package$.error(package.scala:27)
at scala.Predef$.error(Predef.scala:66)
at sbt.Tests$.showResults(Tests.scala:168)
at sbt.Defaults$$anonfun$testOnlyTask$2$$anonfun$apply$13$$anonfun$apply$15.apply(Defaults.scala:315)
...

but not the underlying assertion that failed during the test

[info] Scenario: Verifying marked ancestor lookup *** FAILED ***
[info] java.lang.IndexOutOfBoundsException:
[info] at de.sciss.lucrestm.DataInput.readUnsignedInt(DataInput.java:422)
[info] at de.sciss.lucrestm.DataInput.readInt(DataInput.java:241)
...

this latter is still just 10 lines.....

thanks, -sciss-

Peter Vlugter

unread,
Dec 7, 2011, 7:51:17 PM12/7/11
to simple-b...@googlegroups.com

On 7/12/2011, at 1:53 PM, Sciss wrote:

> do i need to do anything special to enable this in scalatest testing? because if i just add like 'traceLevel := 20' this affects only the final print in testing which is like
>
> java.lang.RuntimeException: Tests unsuccessful
> at scala.sys.package$.error(package.scala:27)
> at scala.Predef$.error(Predef.scala:66)
> at sbt.Tests$.showResults(Tests.scala:168)
> at sbt.Defaults$$anonfun$testOnlyTask$2$$anonfun$apply$13$$anonfun$apply$15.apply(Defaults.scala:315)
> ...
>
> but not the underlying assertion that failed during the test
>
> [info] Scenario: Verifying marked ancestor lookup *** FAILED ***
> [info] java.lang.IndexOutOfBoundsException:
> [info] at de.sciss.lucrestm.DataInput.readUnsignedInt(DataInput.java:422)
> [info] at de.sciss.lucrestm.DataInput.readInt(DataInput.java:241)
> ...
>
> this latter is still just 10 lines.....

The stack trace is truncated by scalatest. The -F option gives full traces, which can be enabled with this setting:

testOptions in Test += Tests.Argument("-oF")

Peter

Sciss

unread,
Dec 8, 2011, 9:19:43 AM12/8/11
to simple-b...@googlegroups.com
that did it, thanks a lot!
Reply all
Reply to author
Forward
0 new messages