@@ -70,6 +70,7 @@ trait ParallelTesting extends RunnerOrchestration { self =>
7070 def outDir : JFile
7171 def flags : TestFlags
7272 def sourceFiles : Array [JFile ]
73+ def checkFile : Option [JFile ]
7374
7475 def runClassPath : String = outDir.getPath + JFile .pathSeparator + flags.runClassPath
7576
@@ -183,6 +184,10 @@ trait ParallelTesting extends RunnerOrchestration { self =>
183184 decompilation : Boolean = false
184185 ) extends TestSource {
185186 def sourceFiles : Array [JFile ] = files.filter(isSourceFile)
187+
188+ def checkFile : Option [JFile ] =
189+ sourceFiles.map(f => new JFile (f.getPath.replaceFirst(" \\ .(scala|java)$" , " .check" )))
190+ .find(_.exists())
186191 }
187192
188193 /** A test source whose files will be compiled separately according to their
@@ -214,6 +219,12 @@ trait ParallelTesting extends RunnerOrchestration { self =>
214219 .map { (g, f) => (g, f.sorted) }
215220
216221 def sourceFiles = compilationGroups.map(_._2).flatten.toArray
222+
223+ def checkFile : Option [JFile ] =
224+ val platform =
225+ if allToolArgs.getOrElse(ToolName .Target , Nil ).nonEmpty then s " . $testPlatform"
226+ else " "
227+ Some (new JFile (dir.getPath + platform + " .check" )).filter(_.exists)
217228 }
218229
219230 protected def shouldSkipTestSource (testSource : TestSource ): Boolean = false
@@ -259,12 +270,6 @@ trait ParallelTesting extends RunnerOrchestration { self =>
259270 final def countWarnings (reporters : Seq [TestReporter ]) = countErrorsAndWarnings(reporters)._2
260271 final def reporterFailed (r : TestReporter ) = r.errorCount > 0
261272
262- /**
263- * For a given test source, returns a check file against which the result of the test run
264- * should be compared. Is used by implementations of this trait.
265- */
266- final def checkFile (testSource : TestSource ): Option [JFile ] = (CompilationLogic .checkFilePath(testSource)).filter(_.exists)
267-
268273 /**
269274 * Checks if the given actual lines are the same as the ones in the check file.
270275 * If not, fails the test.
@@ -340,22 +345,6 @@ trait ParallelTesting extends RunnerOrchestration { self =>
340345 }
341346 }
342347
343- object CompilationLogic {
344- private [ParallelTesting ] def checkFilePath (testSource : TestSource ) = testSource match {
345- case ts : JointCompilationSource =>
346- ts.files.collectFirst {
347- case f if ! f.isDirectory =>
348- new JFile (f.getPath.replaceFirst(" \\ .(scala|java)$" , " .check" ))
349- }
350- case ts : SeparateCompilationSource =>
351- val platform =
352- if testSource.allToolArgs.getOrElse(ToolName .Target , Nil ).nonEmpty then
353- s " . $testPlatform"
354- else " "
355- Option (new JFile (ts.dir.getPath + platform + " .check" ))
356- }
357- }
358-
359348 /** Each `Test` takes the `testSources` and performs the compilation and assertions
360349 * according to the implementing class "neg", "run" or "pos".
361350 */
@@ -735,7 +724,7 @@ trait ParallelTesting extends RunnerOrchestration { self =>
735724 private def mkReporter = TestReporter .reporter(realStdout, logLevel = mkLogLevel)
736725
737726 protected def diffCheckfile (testSource : TestSource , reporters : Seq [TestReporter ], logger : LoggedRunnable ) =
738- checkFile( testSource) .foreach(diffTest(testSource, _, reporterOutputLines(reporters), reporters, logger))
727+ testSource.checkFile .foreach(diffTest(testSource, _, reporterOutputLines(reporters), reporters, logger))
739728
740729 private def reporterOutputLines (reporters : Seq [TestReporter ]): List [String ] =
741730 reporters.flatMap(_.consoleOutput.split(" \n " )).toList
@@ -938,7 +927,7 @@ trait ParallelTesting extends RunnerOrchestration { self =>
938927 }
939928
940929 override def onSuccess (testSource : TestSource , reporters : Seq [TestReporter ], logger : LoggedRunnable ) =
941- verifyOutput(checkFile( testSource) , testSource.outDir, testSource, countWarnings(reporters), reporters, logger)
930+ verifyOutput(testSource.checkFile , testSource.outDir, testSource, countWarnings(reporters), reporters, logger)
942931 }
943932
944933 private final class NegTest (testSources : List [TestSource ], times : Int , threadLimit : Option [Int ], suppressAllOutput : Boolean )(implicit summaryReport : SummaryReporting )
@@ -1177,7 +1166,7 @@ trait ParallelTesting extends RunnerOrchestration { self =>
11771166 def this (targets : List [TestSource ]) =
11781167 this (targets, 1 , true , None , false , false )
11791168
1180- def checkFilePaths : List [JFile ] = targets.map( CompilationLogic .checkFilePath).flatten
1169+ def checkFiles : List [JFile ] = targets.flatMap(_.checkFile)
11811170
11821171 def copy (targets : List [TestSource ],
11831172 times : Int = times,
0 commit comments