Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fail when the forked test harness fails #2730

Merged
merged 4 commits into from
Sep 5, 2016
Merged

Conversation

dwijnand
Copy link
Member

@dwijnand dwijnand commented Sep 2, 2016

Fixes #2442/#2722

Replaces #2723

@dwijnand
Copy link
Member Author

dwijnand commented Sep 2, 2016

Given this attracted some initial feedback in #2723, I'm holding back on merging this until it gets some LGTMs.

Review by @eed3si9n / @retronym plz

@@ -73,6 +74,8 @@ private[sbt] object ForkTests {
os.flush()

new React(is, os, log, opts.testListeners, resultsAcc).react()
} catch {
case NonFatal(e) => resultsAcc("Forked test harness failed: " + e.getMessage) = SuiteResult.Error
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would still prefer:

scala> def throwableToString(t: Throwable): String = { import java.io._; val sw = new StringWriter; t.printStackTrace(new PrintWriter(sw)); sw.toString }
throwableToString: (t: Throwable)String

scala> println(throwableToString(new Throwable({def foo = new Throwable; foo})))
java.lang.Throwable: java.lang.Throwable
    at $line13.$read$$iw$$iw$.<init>(<console>:13)
    at $line13.$read$$iw$$iw$.<clinit>(<console>)
    at $line13.$eval$.$print$lzycompute(<console>:7)
    at $line13.$eval$.$print(<console>:6)
    at $line13.$eval.$print(<console>)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at scala.tools.nsc.interpreter.IMain$ReadEvalPrint.call(IMain.scala:786)
    at scala.tools.nsc.interpreter.IMain$Request.loadAndRun(IMain.scala:1047)
    at scala.tools.nsc.interpreter.IMain$WrappedRequest$$anonfun$loadAndRunReq$1.apply(IMain.scala:638)
    at scala.tools.nsc.interpreter.IMain$WrappedRequest$$anonfun$loadAndRunReq$1.apply(IMain.scala:637)
    at scala.reflect.internal.util.ScalaClassLoader$class.asContext(ScalaClassLoader.scala:31)
    at scala.reflect.internal.util.AbstractFileClassLoader.asContext(AbstractFileClassLoader.scala:19)
    at scala.tools.nsc.interpreter.IMain$WrappedRequest.loadAndRunReq(IMain.scala:637)
    at scala.tools.nsc.interpreter.IMain.interpret(IMain.scala:569)
    at scala.tools.nsc.interpreter.IMain.interpret(IMain.scala:565)
    at scala.tools.nsc.interpreter.ILoop.interpretStartingWith(ILoop.scala:807)
    at scala.tools.nsc.interpreter.ILoop.command(ILoop.scala:681)
    at scala.tools.nsc.interpreter.ILoop.processLine(ILoop.scala:395)
    at scala.tools.nsc.interpreter.ILoop.loop(ILoop.scala:415)
    at scala.tools.nsc.interpreter.ILoop$$anonfun$process$1.apply$mcZ$sp(ILoop.scala:923)
    at scala.tools.nsc.interpreter.ILoop$$anonfun$process$1.apply(ILoop.scala:909)
    at scala.tools.nsc.interpreter.ILoop$$anonfun$process$1.apply(ILoop.scala:909)
    at scala.reflect.internal.util.ScalaClassLoader$.savingContextLoader(ScalaClassLoader.scala:97)
    at scala.tools.nsc.interpreter.ILoop.process(ILoop.scala:909)
    at scala.tools.nsc.MainGenericRunner.runTarget$1(MainGenericRunner.scala:74)
    at scala.tools.nsc.MainGenericRunner.run$1(MainGenericRunner.scala:87)
    at scala.tools.nsc.MainGenericRunner.process(MainGenericRunner.scala:98)
    at scala.tools.nsc.MainGenericRunner$.main(MainGenericRunner.scala:103)
    at scala.tools.nsc.MainGenericRunner.main(MainGenericRunner.scala)
Caused by: java.lang.Throwable
    at $line13.$read$$iw$$iw$.foo$1(<console>:13)
    ... 32 more

@dwijnand
Copy link
Member Author

dwijnand commented Sep 4, 2016

By the way, this is green in TravisCI. So if the implementation and testing is good enough, it's ready to be merged.

@eed3si9n
Copy link
Member

eed3si9n commented Sep 5, 2016

LGTM

@eed3si9n eed3si9n merged commit 0a13ac1 into sbt:0.13 Sep 5, 2016
@dwijnand dwijnand deleted the wip/forked_test branch September 5, 2016 18:19
@eed3si9n
Copy link
Member

eed3si9n commented Sep 5, 2016

Forward port this please.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants