@@ -514,10 +514,22 @@ trait ParallelTesting extends RunnerOrchestration { self =>
514
514
this
515
515
}
516
516
517
- protected def updateCheckFile (checkFile : JFile , lines : Seq [String ]): Unit = {
518
- val outFile = dotty.tools.io.File (checkFile.toPath)
519
- outFile.writeAll(lines.mkString(" " , EOL , EOL ))
520
- echo(" Updated checkfile: " + checkFile.getPath)
517
+ protected def dumpOutputToFile (checkFile : JFile , lines : Seq [String ]): Unit = {
518
+ if (updateCheckFiles) {
519
+ val outFile = dotty.tools.io.File (checkFile.toPath)
520
+ outFile.writeAll(lines.mkString(" " , EOL , EOL ))
521
+ echo(" Updated checkfile: " + checkFile.getPath)
522
+ } else {
523
+ val outFile = dotty.tools.io.File (checkFile.toPath.resolveSibling(checkFile.toPath.getFileName + " .out" ))
524
+ outFile.writeAll(lines.mkString(" " , EOL , EOL ))
525
+ echo(
526
+ s """ Test output dumped in: ${outFile.path}
527
+ | See diff of the checkfile
528
+ | > diff $checkFile $outFile
529
+ | Replace checkfile with current output output
530
+ | > mv $outFile $checkFile
531
+ """ .stripMargin)
532
+ }
521
533
}
522
534
523
535
/** Returns all files in directory or the file if not a directory */
@@ -558,26 +570,15 @@ trait ParallelTesting extends RunnerOrchestration { self =>
558
570
.mkString(EOL )
559
571
560
572
if (output.mkString(EOL ) != check) {
561
- val outFile = dotty.tools.io.File (checkFile.toPath).addExtension(" .out" )
562
- if (updateCheckFiles) {
563
- updateCheckFile(checkFile, output)
564
- } else {
565
- outFile.writeAll(output.mkString(" " , EOL , " " ))
566
- val msg =
567
- s """ Output differed for test $name, use the following command to see the diff:
568
- | > diff $checkFile $outFile
569
- """ .stripMargin
570
-
571
- echo(msg)
572
- addFailureInstruction(msg)
573
-
574
- // Print build instructions to file and summary:
575
- val buildInstr = testSource.buildInstructions(0 , rep.warningCount)
576
- addFailureInstruction(buildInstr)
577
-
578
- // Fail target:
579
- failTestSource(testSource)
580
- }
573
+
574
+ dumpOutputToFile(checkFile, output)
575
+
576
+ // Print build instructions to file and summary:
577
+ val buildInstr = testSource.buildInstructions(0 , rep.warningCount)
578
+ addFailureInstruction(buildInstr)
579
+
580
+ // Fail target:
581
+ failTestSource(testSource)
581
582
}
582
583
case _ =>
583
584
}
@@ -651,8 +652,7 @@ trait ParallelTesting extends RunnerOrchestration { self =>
651
652
// Fail target:
652
653
failTestSource(testSource)
653
654
654
- if (updateCheckFiles)
655
- updateCheckFile(checkFile.get, outputLines)
655
+ dumpOutputToFile(checkFile.get, outputLines)
656
656
}
657
657
}
658
658
@@ -790,8 +790,7 @@ trait ParallelTesting extends RunnerOrchestration { self =>
790
790
val expexted = Source .fromFile(checkFile, " UTF-8" ).getLines().toList
791
791
for (msg <- diffMessage(sourceName, actual, expexted)) {
792
792
fail(msg)
793
- if (updateCheckFiles)
794
- updateCheckFile(checkFile, actual)
793
+ dumpOutputToFile(checkFile, actual)
795
794
}
796
795
}
797
796
0 commit comments