@@ -90,9 +90,10 @@ trait ParallelTesting extends RunnerOrchestration { self =>
9090 sb.append(
9191 s """ |
9292 |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
9495 )
95- sb.append(" \n\n ./bin/dotc " )
96+ sb.append(" \n\n dotc " )
9697 flags.all.foreach { arg =>
9798 if (lineLen > maxLen) {
9899 sb.append(" \\\n " )
@@ -225,11 +226,10 @@ trait ParallelTesting extends RunnerOrchestration { self =>
225226 * Checks if the given actual lines are the same as the ones in the check file.
226227 * If not, fails the test.
227228 */
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 ) = {
229230 val expected = Source .fromFile(checkFile, " UTF-8" ).getLines().toList
230231 for (msg <- diffMessage(testSource.title, actual, expected)) {
231- echo(msg)
232- failTestSource(testSource)
232+ onFailure(testSource, reporters, logger, Some (msg))
233233 dumpOutputToFile(checkFile, actual)
234234 }
235235 }
@@ -609,11 +609,11 @@ trait ParallelTesting extends RunnerOrchestration { self =>
609609 }
610610 }
611611
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 ) = {
613613 if (Properties .testsNoRun) addNoRunWarning()
614614 else runMain(testSource.runClassPath) match {
615615 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 )
617617 case _ =>
618618 }
619619 case Failure (output) =>
@@ -627,7 +627,7 @@ trait ParallelTesting extends RunnerOrchestration { self =>
627627 }
628628
629629 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 )
631631 }
632632
633633 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 =>
649649 }
650650
651651 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 ))
653653
654654 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
657656
658657 // In neg-tests we allow two types of error annotations,
659658 // "nopos-error" which doesn't care about position and "error" which
@@ -715,16 +714,11 @@ trait ParallelTesting extends RunnerOrchestration { self =>
715714 def linesMatch =
716715 (outputLines, checkLines).zipped.forall(_ == _)
717716
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
728722 }
729723
730724 /** The `CompilationTest` is the main interface to `ParallelTesting`, it
0 commit comments