aboutsummaryrefslogtreecommitdiff
path: root/compiler/test/dotty/tools/dotc
diff options
context:
space:
mode:
authorFelix Mulder <felix.mulder@gmail.com>2017-03-28 16:34:23 +0200
committerFelix Mulder <felix.mulder@gmail.com>2017-03-29 13:34:51 +0200
commit8dc162cf28a3e2dfa6923730c3304467b12c5b78 (patch)
tree01f0e9b4edfca972058b1411bd7165a4a756cb88 /compiler/test/dotty/tools/dotc
parentc8321d6a42348308feaf586380ef07ae24e420c8 (diff)
downloaddotty-8dc162cf28a3e2dfa6923730c3304467b12c5b78.tar.gz
dotty-8dc162cf28a3e2dfa6923730c3304467b12c5b78.tar.bz2
dotty-8dc162cf28a3e2dfa6923730c3304467b12c5b78.zip
Preserve stack trace when invoking main in run tests
Diffstat (limited to 'compiler/test/dotty/tools/dotc')
-rw-r--r--compiler/test/dotty/tools/dotc/ParallelTesting.scala12
1 files changed, 8 insertions, 4 deletions
diff --git a/compiler/test/dotty/tools/dotc/ParallelTesting.scala b/compiler/test/dotty/tools/dotc/ParallelTesting.scala
index 6fedfe379..c01c444b2 100644
--- a/compiler/test/dotty/tools/dotc/ParallelTesting.scala
+++ b/compiler/test/dotty/tools/dotc/ParallelTesting.scala
@@ -406,8 +406,12 @@ trait ParallelTesting {
private final class RunTest(testSources: List[TestSource], times: Int, threadLimit: Option[Int], suppressAllOutput: Boolean)
extends Test(testSources, times, threadLimit, suppressAllOutput) {
-
private def runMain(dir: JFile, testSource: TestSource): Array[String] = {
+ def renderStackTrace(ex: Throwable): String =
+ ex.getStackTrace
+ .takeWhile(_.getMethodName != "invoke0")
+ .mkString(" ", "\n ", "")
+
import java.io.ByteArrayOutputStream
import java.net.{ URL, URLClassLoader }
@@ -424,15 +428,15 @@ trait ParallelTesting {
}
catch {
case ex: NoSuchMethodException =>
- echo(s"test in '$dir' did not contain method: ${ex.getMessage} ")
+ echo(s"test in '$dir' did not contain method: ${ex.getMessage}\n${renderStackTrace(ex.getCause)}")
failTestSource(testSource)
case ex: ClassNotFoundException =>
- echo(s"test in '$dir' did not contain class: ${ex.getMessage} ")
+ echo(s"test in '$dir' did not contain class: ${ex.getMessage}\n${renderStackTrace(ex.getCause)}")
failTestSource(testSource)
case ex: InvocationTargetException =>
- echo(s"An exception ocurred when running main: ${ex.getCause} ")
+ echo(s"An exception ocurred when running main: ${ex.getCause}\n${renderStackTrace(ex.getCause)}")
failTestSource(testSource)
}
printStream.toString("utf-8").lines.toArray