@@ -6,21 +6,22 @@ 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
23
- import dotc .{ Compiler , Driver }
24
+ import dotc .{ Driver , Compiler }
24
25
25
26
/** A parallel testing suite whose goal is to integrate nicely with JUnit
26
27
*
@@ -127,7 +128,7 @@ trait ParallelTesting extends RunnerOrchestration { self =>
127
128
/** A group of files that may all be compiled together, with the same flags
128
129
* and output directory
129
130
*/
130
- case class JointCompilationSource (
131
+ private final case class JointCompilationSource (
131
132
name : String ,
132
133
files : Array [JFile ],
133
134
flags : TestFlags ,
@@ -176,7 +177,7 @@ trait ParallelTesting extends RunnerOrchestration { self =>
176
177
/** Each `Test` takes the `testSources` and performs the compilation and assertions
177
178
* according to the implementing class "neg", "run" or "pos".
178
179
*/
179
- private abstract class Test (testSources : List [TestSource ], times : Int , threadLimit : Option [Int ], suppressAllOutput : Boolean , checkCompileOutput : Boolean = false )(implicit val summaryReport : SummaryReporting ) { test =>
180
+ private abstract class Test (testSources : List [TestSource ], times : Int , threadLimit : Option [Int ], suppressAllOutput : Boolean )(implicit val summaryReport : SummaryReporting ) { test =>
180
181
181
182
import summaryReport ._
182
183
@@ -352,12 +353,9 @@ trait ParallelTesting extends RunnerOrchestration { self =>
352
353
else None
353
354
} else None
354
355
355
- val logLevel = if (suppressErrors || suppressAllOutput) ERROR + 1 else ERROR
356
356
val reporter =
357
- if (checkCompileOutput)
358
- TestReporter .storedReporter(realStdout, logLevel = logLevel)
359
- else
360
- TestReporter .reporter(realStdout, logLevel = logLevel)
357
+ TestReporter .reporter(realStdout, logLevel =
358
+ if (suppressErrors || suppressAllOutput) ERROR + 1 else ERROR )
361
359
362
360
val driver =
363
361
if (times == 1 ) new Driver
@@ -466,33 +464,10 @@ trait ParallelTesting extends RunnerOrchestration { self =>
466
464
private def flattenFiles (f : JFile ): Array [JFile ] =
467
465
if (f.isDirectory) f.listFiles.flatMap(flattenFiles)
468
466
else Array (f)
469
-
470
- protected def verifyCompileOutput (source : TestSource , checkFile : JFile , reporter : StoredTestReporter ): Unit = {
471
- reporter.writer.flush()
472
- val checkLines = Source .fromFile(checkFile).getLines().mkString(" \n " )
473
- val outputLines = reporter.writer.toString.trim.replaceAll(" \\ s+\n " , " \n " )
474
-
475
- if (outputLines != checkLines) {
476
- val msg =
477
- s """ |Output from ' ${source.title}' did not match check file ' ${checkFile.getName}'.
478
- |-------------------------------------
479
- |expected:
480
- | $checkLines
481
- |
482
- |actual:
483
- | $outputLines
484
- |-------------------------------------
485
- """ .stripMargin
486
-
487
- echo(msg)
488
- addFailureInstruction(msg)
489
- failTestSource(source)
490
- }
491
- }
492
467
}
493
468
494
- private final class PosTest (testSources : List [TestSource ], times : Int , threadLimit : Option [Int ], suppressAllOutput : Boolean , checkCompileOutput : Boolean = false )(implicit summaryReport : SummaryReporting )
495
- extends Test (testSources, times, threadLimit, suppressAllOutput, checkCompileOutput ) {
469
+ private final class PosTest (testSources : List [TestSource ], times : Int , threadLimit : Option [Int ], suppressAllOutput : Boolean )(implicit summaryReport : SummaryReporting )
470
+ extends Test (testSources, times, threadLimit, suppressAllOutput) {
496
471
protected def encapsulatedCompilation (testSource : TestSource ) = new LoggedRunnable {
497
472
def checkTestSource (): Unit = tryCompile(testSource) {
498
473
testSource match {
@@ -525,14 +500,6 @@ trait ParallelTesting extends RunnerOrchestration { self =>
525
500
reporters.foreach(logReporterContents)
526
501
logBuildInstructions(reporters.head, testSource, errorCount, warningCount)
527
502
}
528
-
529
- // verify compilation check file
530
- (1 to testSource.compilationGroups.length).foreach { index =>
531
- val checkFile = new JFile (dir.getAbsolutePath.reverse.dropWhile(_ == '/' ).reverse + " /" + index + " .check" )
532
-
533
- if (checkFile.exists && checkCompileOutput)
534
- verifyCompileOutput(testSource, checkFile, reporters(index).asInstanceOf [StoredTestReporter ])
535
- }
536
503
}
537
504
}
538
505
}
@@ -656,8 +623,8 @@ trait ParallelTesting extends RunnerOrchestration { self =>
656
623
}
657
624
}
658
625
659
- private final class NegTest (testSources : List [TestSource ], times : Int , threadLimit : Option [Int ], suppressAllOutput : Boolean , checkCompileOutput : Boolean = false )(implicit summaryReport : SummaryReporting )
660
- extends Test (testSources, times, threadLimit, suppressAllOutput, checkCompileOutput ) {
626
+ private final class NegTest (testSources : List [TestSource ], times : Int , threadLimit : Option [Int ], suppressAllOutput : Boolean )(implicit summaryReport : SummaryReporting )
627
+ extends Test (testSources, times, threadLimit, suppressAllOutput) {
661
628
protected def encapsulatedCompilation (testSource : TestSource ) = new LoggedRunnable {
662
629
def checkTestSource (): Unit = tryCompile(testSource) {
663
630
// In neg-tests we allow two types of error annotations,
@@ -734,14 +701,6 @@ trait ParallelTesting extends RunnerOrchestration { self =>
734
701
if (actualErrors > 0 )
735
702
reporters.foreach(logReporterContents)
736
703
737
- // Compilation check file: for testing plugins
738
- (1 to testSource.compilationGroups.length).foreach { index =>
739
- val checkFile = new JFile (dir.getAbsolutePath.reverse.dropWhile(_ == '/' ).reverse + " /" + index + " .check" )
740
-
741
- if (checkFile.exists && checkCompileOutput)
742
- verifyCompileOutput(testSource, checkFile, reporters(index).asInstanceOf [StoredTestReporter ])
743
- }
744
-
745
704
(compilerCrashed, expectedErrors, actualErrors, () => getMissingExpectedErrors(errorMap, errors), errorMap)
746
705
}
747
706
}
@@ -921,8 +880,8 @@ trait ParallelTesting extends RunnerOrchestration { self =>
921
880
* compilation without generating errors and that they do not crash the
922
881
* compiler
923
882
*/
924
- def checkCompile (checkCompileOutput : Boolean = false )(implicit summaryReport : SummaryReporting ): this .type = {
925
- val test = new PosTest (targets, times, threadLimit, shouldFail || shouldSuppressOutput, checkCompileOutput ).executeTestSuite()
883
+ def checkCompile ()(implicit summaryReport : SummaryReporting ): this .type = {
884
+ val test = new PosTest (targets, times, threadLimit, shouldFail || shouldSuppressOutput).executeTestSuite()
926
885
927
886
cleanup()
928
887
@@ -940,8 +899,8 @@ trait ParallelTesting extends RunnerOrchestration { self =>
940
899
* correct amount of errors at the correct positions. It also makes sure
941
900
* that none of these tests crash the compiler
942
901
*/
943
- def checkExpectedErrors (checkCompileOutput : Boolean = false )(implicit summaryReport : SummaryReporting ): this .type = {
944
- val test = new NegTest (targets, times, threadLimit, shouldFail || shouldSuppressOutput, checkCompileOutput ).executeTestSuite()
902
+ def checkExpectedErrors ()(implicit summaryReport : SummaryReporting ): this .type = {
903
+ val test = new NegTest (targets, times, threadLimit, shouldFail || shouldSuppressOutput).executeTestSuite()
945
904
946
905
cleanup()
947
906
0 commit comments