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