@@ -90,9 +90,10 @@ trait ParallelTesting extends RunnerOrchestration { self =>
90
90
sb.append(
91
91
s """ |
92
92
|Test ' $title' compiled with $errors error(s) and $warnings warning(s),
93
- |the test can be reproduced by running: """ .stripMargin
93
+ |the test can be reproduced by running from SBT (prefix it with ./bin/ if you
94
+ |want to run from the command line): """ .stripMargin
94
95
)
95
- sb.append(" \n\n ./bin/dotc " )
96
+ sb.append(" \n\n dotc " )
96
97
flags.all.foreach { arg =>
97
98
if (lineLen > maxLen) {
98
99
sb.append(" \\\n " )
@@ -225,11 +226,10 @@ trait ParallelTesting extends RunnerOrchestration { self =>
225
226
* Checks if the given actual lines are the same as the ones in the check file.
226
227
* If not, fails the test.
227
228
*/
228
- final def diffTest (testSource : TestSource , checkFile : JFile , actual : List [String ]) = {
229
+ final def diffTest (testSource : TestSource , checkFile : JFile , actual : List [String ], reporters : Seq [ TestReporter ], logger : LoggedRunnable ) = {
229
230
val expected = Source .fromFile(checkFile, " UTF-8" ).getLines().toList
230
231
for (msg <- diffMessage(testSource.title, actual, expected)) {
231
- echo(msg)
232
- failTestSource(testSource)
232
+ onFailure(testSource, reporters, logger, Some (msg))
233
233
dumpOutputToFile(checkFile, actual)
234
234
}
235
235
}
@@ -609,11 +609,11 @@ trait ParallelTesting extends RunnerOrchestration { self =>
609
609
}
610
610
}
611
611
612
- private def verifyOutput (checkFile : Option [JFile ], dir : JFile , testSource : TestSource , warnings : Int ) = {
612
+ private def verifyOutput (checkFile : Option [JFile ], dir : JFile , testSource : TestSource , warnings : Int , reporters : Seq [ TestReporter ], logger : LoggedRunnable ) = {
613
613
if (Properties .testsNoRun) addNoRunWarning()
614
614
else runMain(testSource.runClassPath) match {
615
615
case Success (output) => checkFile match {
616
- case Some (file) if file.exists => diffTest(testSource, file, output.linesIterator.toList)
616
+ case Some (file) if file.exists => diffTest(testSource, file, output.linesIterator.toList, reporters, logger )
617
617
case _ =>
618
618
}
619
619
case Failure (output) =>
@@ -627,7 +627,7 @@ trait ParallelTesting extends RunnerOrchestration { self =>
627
627
}
628
628
629
629
override def onSuccess (testSource : TestSource , reporters : Seq [TestReporter ], logger : LoggedRunnable ) =
630
- verifyOutput(checkFile(testSource), testSource.outDir, testSource, countWarnings(reporters))
630
+ verifyOutput(checkFile(testSource), testSource.outDir, testSource, countWarnings(reporters), reporters, logger )
631
631
}
632
632
633
633
private final class NegTest (testSources : List [TestSource ], times : Int , threadLimit : Option [Int ], suppressAllOutput : Boolean )(implicit summaryReport : SummaryReporting )
@@ -649,11 +649,10 @@ trait ParallelTesting extends RunnerOrchestration { self =>
649
649
}
650
650
651
651
override def onSuccess (testSource : TestSource , reporters : Seq [TestReporter ], logger : LoggedRunnable ): Unit =
652
- checkFile(testSource).foreach(diffTest(testSource, _, reporterOutputLines(reporters)))
652
+ checkFile(testSource).foreach(diffTest(testSource, _, reporterOutputLines(reporters), reporters, logger ))
653
653
654
654
def reporterOutputLines (reporters : Seq [TestReporter ]): List [String ] =
655
- reporters.flatMap(_.allErrors).sortBy(_.pos.source.toString).flatMap { error =>
656
- (error.pos.span.toString + " in " + error.pos.source.file.name) :: error.getMessage().linesIterator.toList }.toList
655
+ reporters.flatMap(_.consoleOutput.split(" \n " )).toList
657
656
658
657
// In neg-tests we allow two types of error annotations,
659
658
// "nopos-error" which doesn't care about position and "error" which
@@ -715,16 +714,11 @@ trait ParallelTesting extends RunnerOrchestration { self =>
715
714
def linesMatch =
716
715
(outputLines, checkLines).zipped.forall(_ == _)
717
716
718
- if (outputLines.length != checkLines.length || ! linesMatch) {
719
- // Print diff to files and summary:
720
- val diff = DiffUtil .mkColoredLineDiff(checkLines :+ DiffUtil .EOF , outputLines :+ DiffUtil .EOF )
721
-
722
- Some (
723
- s """ |Output from ' $sourceTitle' did not match check file.
724
- |Diff (expected on the left, actual right):
725
- | """ .stripMargin + diff + " \n " )
726
- } else None
727
-
717
+ if (outputLines.length != checkLines.length || ! linesMatch) Some (
718
+ s """ |Output from ' $sourceTitle' did not match check file. Actual output:
719
+ | ${outputLines.mkString(EOL )}
720
+ | """ .stripMargin + " \n " )
721
+ else None
728
722
}
729
723
730
724
/** The `CompilationTest` is the main interface to `ParallelTesting`, it
0 commit comments