Skip to content

Commit 8e042e0

Browse files
Log reproduction instructions on diff test failure
1 parent c4742ee commit 8e042e0

File tree

1 file changed

+6
-7
lines changed

1 file changed

+6
-7
lines changed

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

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -225,11 +225,10 @@ trait ParallelTesting extends RunnerOrchestration { self =>
225225
* Checks if the given actual lines are the same as the ones in the check file.
226226
* If not, fails the test.
227227
*/
228-
final def diffTest(testSource: TestSource, checkFile: JFile, actual: List[String]) = {
228+
final def diffTest(testSource: TestSource, checkFile: JFile, actual: List[String], reporters: Seq[TestReporter], logger: LoggedRunnable) = {
229229
val expected = Source.fromFile(checkFile, "UTF-8").getLines().toList
230230
for (msg <- diffMessage(testSource.title, actual, expected)) {
231-
echo(msg)
232-
failTestSource(testSource)
231+
onFailure(testSource, reporters, logger, Some(msg))
233232
dumpOutputToFile(checkFile, actual)
234233
}
235234
}
@@ -609,11 +608,11 @@ trait ParallelTesting extends RunnerOrchestration { self =>
609608
}
610609
}
611610

612-
private def verifyOutput(checkFile: Option[JFile], dir: JFile, testSource: TestSource, warnings: Int) = {
611+
private def verifyOutput(checkFile: Option[JFile], dir: JFile, testSource: TestSource, warnings: Int, reporters: Seq[TestReporter], logger: LoggedRunnable) = {
613612
if (Properties.testsNoRun) addNoRunWarning()
614613
else runMain(testSource.runClassPath) match {
615614
case Success(output) => checkFile match {
616-
case Some(file) if file.exists => diffTest(testSource, file, output.linesIterator.toList)
615+
case Some(file) if file.exists => diffTest(testSource, file, output.linesIterator.toList, reporters, logger)
617616
case _ =>
618617
}
619618
case Failure(output) =>
@@ -627,7 +626,7 @@ trait ParallelTesting extends RunnerOrchestration { self =>
627626
}
628627

629628
override def onSuccess(testSource: TestSource, reporters: Seq[TestReporter], logger: LoggedRunnable) =
630-
verifyOutput(checkFile(testSource), testSource.outDir, testSource, countWarnings(reporters))
629+
verifyOutput(checkFile(testSource), testSource.outDir, testSource, countWarnings(reporters), reporters, logger)
631630
}
632631

633632
private final class NegTest(testSources: List[TestSource], times: Int, threadLimit: Option[Int], suppressAllOutput: Boolean)(implicit summaryReport: SummaryReporting)
@@ -649,7 +648,7 @@ trait ParallelTesting extends RunnerOrchestration { self =>
649648
}
650649

651650
override def onSuccess(testSource: TestSource, reporters: Seq[TestReporter], logger: LoggedRunnable): Unit =
652-
checkFile(testSource).foreach(diffTest(testSource, _, reporterOutputLines(reporters)))
651+
checkFile(testSource).foreach(diffTest(testSource, _, reporterOutputLines(reporters), reporters, logger))
653652

654653
def reporterOutputLines(reporters: Seq[TestReporter]): List[String] =
655654
reporters.flatMap(_.errors).sortBy(_._1.pos.source.toString).map(_._2).toList

0 commit comments

Comments
 (0)