@@ -186,8 +186,8 @@ trait ParallelTesting extends RunnerOrchestration { self =>
186
186
private trait CompilationLogic { this : Test =>
187
187
val suppressErrors = false
188
188
189
- final def compileTestSource (testSource : TestSource ): List [TestReporter ] =
190
- testSource match {
189
+ final def compileTestSource (testSource : TestSource ): Either [ Throwable , List [TestReporter ] ] =
190
+ Try ( testSource match {
191
191
case testSource @ JointCompilationSource (name, files, flags, outDir, fromTasty, decompilation) =>
192
192
val reporter =
193
193
if (fromTasty) compileFromTasty( flags, suppressErrors, outDir)
@@ -196,7 +196,7 @@ trait ParallelTesting extends RunnerOrchestration { self =>
196
196
197
197
case testSource @ SeparateCompilationSource (_, dir, flags, outDir) =>
198
198
testSource.compilationGroups.map(files => compile(files, flags, suppressErrors, outDir)) // TODO? only `compile` option?
199
- }
199
+ }).toEither
200
200
201
201
final def countErrorsAndWarnings (reporters : Seq [TestReporter ]): (Int , Int ) =
202
202
reporters.foldLeft((0 , 0 )) { case ((err, warn), r) => (err + r.errorCount, warn + r.warningCount) }
@@ -224,14 +224,16 @@ trait ParallelTesting extends RunnerOrchestration { self =>
224
224
225
225
def encapsulatedCompilation (testSource : TestSource ) = new LoggedRunnable { self =>
226
226
def checkTestSource (): Unit = tryCompile(testSource) {
227
- val reporters = compileTestSource(testSource)
228
- onComplete(testSource, reporters , self)
227
+ val reportersOrCrash = compileTestSource(testSource)
228
+ onComplete(testSource, reportersOrCrash , self)
229
229
registerCompletion()
230
230
}
231
231
}
232
232
233
- final def onComplete (testSource : TestSource , reporters : Seq [TestReporter ], logger : LoggedRunnable ): Unit = (
234
- testFailed(testSource, reporters).fold
233
+ final def onComplete (testSource : TestSource , reportersOrCrash : Either [Throwable , Seq [TestReporter ]], logger : LoggedRunnable ): Unit =
234
+ reportersOrCrash.fold(
235
+ exn => onFailure(testSource, Nil , logger, Some (s " Fatal compiler crash when compiling: ${testSource.title}: \n ${exn.getMessage}\n ${exn.getStackTrace.mkString(" \n " )}" ))
236
+ , reporters => testFailed(testSource, reporters).fold
235
237
( onSuccess(testSource, reporters, logger ) )
236
238
(msg => onFailure(testSource, reporters, logger, Option (msg).filter(_.nonEmpty)) ) )
237
239
@@ -646,7 +648,7 @@ trait ParallelTesting extends RunnerOrchestration { self =>
646
648
private final class NegTest (testSources : List [TestSource ], times : Int , threadLimit : Option [Int ], suppressAllOutput : Boolean )(implicit summaryReport : SummaryReporting )
647
649
extends Test (testSources, times, threadLimit, suppressAllOutput) {
648
650
override val suppressErrors = true
649
-
651
+
650
652
override def testFailed (testSource : TestSource , reporters : Seq [TestReporter ]): Option [String ] = {
651
653
val compilerCrashed = reporters.exists(_.compilerCrashed)
652
654
val (errorMap, expectedErrors) = getErrorMapAndExpectedCount(testSource.sourceFiles)
@@ -719,29 +721,9 @@ trait ParallelTesting extends RunnerOrchestration { self =>
719
721
}
720
722
721
723
private final class NoCrashTest (testSources : List [TestSource ], times : Int , threadLimit : Option [Int ], suppressAllOutput : Boolean )(implicit summaryReport : SummaryReporting )
722
- extends Test (testSources, times, threadLimit, suppressAllOutput) {
723
- override def encapsulatedCompilation (testSource : TestSource ) = new LoggedRunnable {
724
- def checkTestSource (): Unit = tryCompile(testSource) {
725
- def fail (msg : String ): Nothing = {
726
- echo(msg)
727
- failTestSource(testSource)
728
- ???
729
- }
730
- testSource match {
731
- case testSource@ JointCompilationSource (_, files, flags, outDir, fromTasty, decompilation) =>
732
- val sourceFiles = testSource.sourceFiles
733
- val reporter =
734
- try compile(sourceFiles, flags, true , outDir)
735
- catch {
736
- case ex : Throwable => fail(s " Fatal compiler crash when compiling: ${testSource.title}" )
737
- }
738
- if (reporter.compilerCrashed)
739
- fail(s " Compiler crashed when compiling: ${testSource.title}" )
740
- case testSource@ SeparateCompilationSource (_, dir, flags, outDir) => unsupported(" NoCrashTest - SeparateCompilationSource" )
741
- }
742
- registerCompletion()
743
- }
744
- }
724
+ extends Test (testSources, times, threadLimit, suppressAllOutput) {
725
+ override val suppressErrors = true
726
+ override def testFailed (testSource : TestSource , reporters : Seq [TestReporter ]): Option [String ] = None
745
727
}
746
728
747
729
def diffMessage (sourceTitle : String , outputLines : Seq [String ], checkLines : Seq [String ]): Option [String ] = {
0 commit comments