@@ -6,17 +6,18 @@ import java.io.{ File => JFile }
6
6
import java .text .SimpleDateFormat
7
7
import java .util .HashMap
8
8
import java .nio .file .StandardCopyOption .REPLACE_EXISTING
9
- import java .nio .file .{ Files , NoSuchFileException , Path , Paths }
10
- import java .util .concurrent .{ TimeUnit , TimeoutException , Executors => JExecutors }
9
+ import java .nio .file .{ Files , Path , Paths , NoSuchFileException }
10
+ import java .util .concurrent .{ Executors => JExecutors , TimeUnit , TimeoutException }
11
11
12
12
import scala .io .Source
13
13
import scala .util .control .NonFatal
14
14
import scala .util .Try
15
15
import scala .collection .mutable
16
16
import scala .util .matching .Regex
17
17
import scala .util .Random
18
+
18
19
import dotc .core .Contexts ._
19
- import dotc .reporting .{ Reporter , StoredTestReporter , TestReporter }
20
+ import dotc .reporting .{ Reporter , TestReporter }
20
21
import dotc .reporting .diagnostic .MessageContainer
21
22
import dotc .interfaces .Diagnostic .ERROR
22
23
import dotc .util .DiffUtil
@@ -128,7 +129,7 @@ trait ParallelTesting extends RunnerOrchestration { self =>
128
129
/** A group of files that may all be compiled together, with the same flags
129
130
* and output directory
130
131
*/
131
- case class JointCompilationSource (
132
+ private final case class JointCompilationSource (
132
133
name : String ,
133
134
files : Array [JFile ],
134
135
flags : TestFlags ,
@@ -178,7 +179,7 @@ trait ParallelTesting extends RunnerOrchestration { self =>
178
179
/** Each `Test` takes the `testSources` and performs the compilation and assertions
179
180
* according to the implementing class "neg", "run" or "pos".
180
181
*/
181
- private abstract class Test (testSources : List [TestSource ], times : Int , threadLimit : Option [Int ], suppressAllOutput : Boolean , checkCompileOutput : Boolean = false )(implicit val summaryReport : SummaryReporting ) { test =>
182
+ private abstract class Test (testSources : List [TestSource ], times : Int , threadLimit : Option [Int ], suppressAllOutput : Boolean )(implicit val summaryReport : SummaryReporting ) { test =>
182
183
183
184
import summaryReport ._
184
185
@@ -354,12 +355,9 @@ trait ParallelTesting extends RunnerOrchestration { self =>
354
355
else None
355
356
} else None
356
357
357
- val logLevel = if (suppressErrors || suppressAllOutput) ERROR + 1 else ERROR
358
358
val reporter =
359
- if (checkCompileOutput)
360
- TestReporter .storedReporter(realStdout, logLevel = logLevel)
361
- else
362
- TestReporter .reporter(realStdout, logLevel = logLevel)
359
+ TestReporter .reporter(realStdout, logLevel =
360
+ if (suppressErrors || suppressAllOutput) ERROR + 1 else ERROR )
363
361
364
362
val driver =
365
363
if (times == 1 ) new Driver
@@ -499,33 +497,10 @@ trait ParallelTesting extends RunnerOrchestration { self =>
499
497
private def flattenFiles (f : JFile ): Array [JFile ] =
500
498
if (f.isDirectory) f.listFiles.flatMap(flattenFiles)
501
499
else Array (f)
502
-
503
- protected def verifyCompileOutput (source : TestSource , checkFile : JFile , reporter : StoredTestReporter ): Unit = {
504
- reporter.writer.flush()
505
- val checkLines = Source .fromFile(checkFile).getLines().mkString(" \n " )
506
- val outputLines = reporter.writer.toString.trim.replaceAll(" \\ s+\n " , " \n " )
507
-
508
- if (outputLines != checkLines) {
509
- val msg =
510
- s """ |Output from ' ${source.title}' did not match check file ' ${checkFile.getName}'.
511
- |-------------------------------------
512
- |expected:
513
- | $checkLines
514
- |
515
- |actual:
516
- | $outputLines
517
- |-------------------------------------
518
- """ .stripMargin
519
-
520
- echo(msg)
521
- addFailureInstruction(msg)
522
- failTestSource(source)
523
- }
524
- }
525
500
}
526
501
527
- private final class PosTest (testSources : List [TestSource ], times : Int , threadLimit : Option [Int ], suppressAllOutput : Boolean , checkCompileOutput : Boolean = false )(implicit summaryReport : SummaryReporting )
528
- extends Test (testSources, times, threadLimit, suppressAllOutput, checkCompileOutput ) {
502
+ private final class PosTest (testSources : List [TestSource ], times : Int , threadLimit : Option [Int ], suppressAllOutput : Boolean )(implicit summaryReport : SummaryReporting )
503
+ extends Test (testSources, times, threadLimit, suppressAllOutput) {
529
504
protected def encapsulatedCompilation (testSource : TestSource ) = new LoggedRunnable {
530
505
def checkTestSource (): Unit = tryCompile(testSource) {
531
506
testSource match {
@@ -603,14 +578,6 @@ trait ParallelTesting extends RunnerOrchestration { self =>
603
578
reporters.foreach(logReporterContents)
604
579
logBuildInstructions(reporters.head, testSource, errorCount, warningCount)
605
580
}
606
-
607
- // verify compilation check file
608
- (1 to testSource.compilationGroups.length).foreach { index =>
609
- val checkFile = new JFile (dir.getAbsolutePath.reverse.dropWhile(_ == '/' ).reverse + " /" + index + " .check" )
610
-
611
- if (checkFile.exists && checkCompileOutput)
612
- verifyCompileOutput(testSource, checkFile, reporters(index).asInstanceOf [StoredTestReporter ])
613
- }
614
581
}
615
582
}
616
583
}
@@ -734,8 +701,8 @@ trait ParallelTesting extends RunnerOrchestration { self =>
734
701
}
735
702
}
736
703
737
- private final class NegTest (testSources : List [TestSource ], times : Int , threadLimit : Option [Int ], suppressAllOutput : Boolean , checkCompileOutput : Boolean = false )(implicit summaryReport : SummaryReporting )
738
- extends Test (testSources, times, threadLimit, suppressAllOutput, checkCompileOutput ) {
704
+ private final class NegTest (testSources : List [TestSource ], times : Int , threadLimit : Option [Int ], suppressAllOutput : Boolean )(implicit summaryReport : SummaryReporting )
705
+ extends Test (testSources, times, threadLimit, suppressAllOutput) {
739
706
protected def encapsulatedCompilation (testSource : TestSource ) = new LoggedRunnable {
740
707
def checkTestSource (): Unit = tryCompile(testSource) {
741
708
// In neg-tests we allow two types of error annotations,
@@ -812,14 +779,6 @@ trait ParallelTesting extends RunnerOrchestration { self =>
812
779
if (actualErrors > 0 )
813
780
reporters.foreach(logReporterContents)
814
781
815
- // Compilation check file: for testing plugins
816
- (1 to testSource.compilationGroups.length).foreach { index =>
817
- val checkFile = new JFile (dir.getAbsolutePath.reverse.dropWhile(_ == '/' ).reverse + " /" + index + " .check" )
818
-
819
- if (checkFile.exists && checkCompileOutput)
820
- verifyCompileOutput(testSource, checkFile, reporters(index).asInstanceOf [StoredTestReporter ])
821
- }
822
-
823
782
(compilerCrashed, expectedErrors, actualErrors, () => getMissingExpectedErrors(errorMap, errors), errorMap)
824
783
}
825
784
}
@@ -992,8 +951,8 @@ trait ParallelTesting extends RunnerOrchestration { self =>
992
951
* compilation without generating errors and that they do not crash the
993
952
* compiler
994
953
*/
995
- def checkCompile (checkCompileOutput : Boolean = false )(implicit summaryReport : SummaryReporting ): this .type = {
996
- val test = new PosTest (targets, times, threadLimit, shouldFail || shouldSuppressOutput, checkCompileOutput ).executeTestSuite()
954
+ def checkCompile ()(implicit summaryReport : SummaryReporting ): this .type = {
955
+ val test = new PosTest (targets, times, threadLimit, shouldFail || shouldSuppressOutput).executeTestSuite()
997
956
998
957
cleanup()
999
958
@@ -1011,8 +970,8 @@ trait ParallelTesting extends RunnerOrchestration { self =>
1011
970
* correct amount of errors at the correct positions. It also makes sure
1012
971
* that none of these tests crash the compiler
1013
972
*/
1014
- def checkExpectedErrors (checkCompileOutput : Boolean = false )(implicit summaryReport : SummaryReporting ): this .type = {
1015
- val test = new NegTest (targets, times, threadLimit, shouldFail || shouldSuppressOutput, checkCompileOutput ).executeTestSuite()
973
+ def checkExpectedErrors ()(implicit summaryReport : SummaryReporting ): this .type = {
974
+ val test = new NegTest (targets, times, threadLimit, shouldFail || shouldSuppressOutput).executeTestSuite()
1016
975
1017
976
cleanup()
1018
977
0 commit comments