Skip to content

Commit c9e1bc5

Browse files
committed
Fix #2243: improve failing test output
1 parent 3a9deec commit c9e1bc5

File tree

3 files changed

+8
-6
lines changed

3 files changed

+8
-6
lines changed

compiler/test/dotty/tools/dotc/CompilationTests.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -216,9 +216,9 @@ class CompilationTests extends ParallelTesting {
216216
val opt = Array(
217217
"-classpath",
218218
// compile with bootstrapped library on cp:
219-
defaultOutputDir + "lib$1/src/:" +
219+
defaultOutputDir + "lib/src/:" +
220220
// as well as bootstrapped compiler:
221-
defaultOutputDir + "dotty1$1/dotty/:" +
221+
defaultOutputDir + "dotty1/dotty/:" +
222222
Jars.dottyInterfaces
223223
)
224224

compiler/test/dotty/tools/vulpix/ParallelTesting.scala

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -265,7 +265,7 @@ trait ParallelTesting extends RunnerOrchestration { self =>
265265
private[this] val failedTestSources = mutable.ArrayBuffer.empty[String]
266266
protected final def failTestSource(testSource: TestSource, reason: Option[String] = None) = synchronized {
267267
val extra = reason.map(" with reason: " + _).getOrElse("")
268-
failedTestSources.append(testSource.title + s" failed (in ${testSource.name})" + extra)
268+
failedTestSources.append(testSource.title + s" failed" + extra)
269269
fail()
270270
}
271271

@@ -519,6 +519,7 @@ trait ParallelTesting extends RunnerOrchestration { self =>
519519
}
520520

521521
case Failure(output) =>
522+
echo(s"Test '${testSource.title}' failed with output:")
522523
echo(output)
523524
failTestSource(testSource)
524525

@@ -1018,6 +1019,7 @@ trait ParallelTesting extends RunnerOrchestration { self =>
10181019
.getOrElse {
10191020
throw new IllegalStateException("Unable to reflectively find calling method")
10201021
}
1022+
.takeWhile(_ != '$')
10211023
}
10221024

10231025
/** Compiles a single file from the string path `f` using the supplied flags */
@@ -1072,7 +1074,7 @@ trait ParallelTesting extends RunnerOrchestration { self =>
10721074
val targetDir = new JFile(outDir + "/" + sourceDir.getName + "/")
10731075
targetDir.mkdirs()
10741076

1075-
val target = JointCompilationSource(callingMethod, randomized, flags, targetDir)
1077+
val target = JointCompilationSource(s"compiling '$f' in test '$callingMethod'", randomized, flags, targetDir)
10761078
new CompilationTest(target)
10771079
}
10781080

@@ -1089,7 +1091,7 @@ trait ParallelTesting extends RunnerOrchestration { self =>
10891091
targetDir.mkdirs()
10901092
assert(targetDir.exists, s"couldn't create target directory: $targetDir")
10911093

1092-
val target = JointCompilationSource(callingMethod, files.map(new JFile(_)).toArray, flags, targetDir)
1094+
val target = JointCompilationSource(s"$testName from $callingMethod", files.map(new JFile(_)).toArray, flags, targetDir)
10931095

10941096
// Create a CompilationTest and let the user decide whether to execute a pos or a neg test
10951097
new CompilationTest(target)

compiler/test/dotty/tools/vulpix/SummaryReport.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ final class SummaryReport extends SummaryReporting {
9595

9696
startingMessages.foreach(rep.append)
9797

98-
failedTests.map(x => " " + x).foreach(rep.append)
98+
failedTests.map(x => s" $x\n").foreach(rep.append)
9999

100100
// If we're compiling locally, we don't need instructions on how to
101101
// reproduce failures

0 commit comments

Comments
 (0)