@@ -505,19 +505,28 @@ trait ParallelTesting extends RunnerOrchestration { self =>
505505 }
506506
507507 private def parseErrors (errorsText : String , compilerVersion : String ) =
508- val errorPattern = """ .*Error: (.*\.scala):(\d+):(\d+).*""" .r
509- errorsText.linesIterator.toSeq.collect {
510- case errorPattern(filePath, line, column) =>
511- val lineNum = line.toInt
512- val columnNum = column.toInt
513- val abstractFile = AbstractFile .getFile(filePath)
514- val sourceFile = SourceFile (abstractFile, Codec .UTF8 )
515- val offset = sourceFile.lineToOffset(lineNum - 1 ) + columnNum - 1
516- val span = Spans .Span (offset)
517- val sourcePos = SourcePosition (sourceFile, span)
518-
519- Diagnostic .Error (s " Compilation of $filePath with Scala $compilerVersion failed at line: $line, column: $column. Full error output: \n\n $errorsText\n " , sourcePos)
520- }
508+ val errorPattern = """ ^.*Error: (.*\.scala):(\d+):(\d+).*""" .r
509+ val summaryPattern = """ \d+ (?:warning|error)s? found""" .r
510+ val indent = " "
511+ var diagnostics = List .empty[Diagnostic .Error ]
512+ for line <- errorsText.linesIterator do
513+ line match
514+ case error @ errorPattern(filePath, line, column) =>
515+ val lineNum = line.toInt
516+ val columnNum = column.toInt
517+ val abstractFile = AbstractFile .getFile(filePath)
518+ val sourceFile = SourceFile (abstractFile, Codec .UTF8 )
519+ val offset = sourceFile.lineToOffset(lineNum - 1 ) + columnNum - 1
520+ val span = Spans .Span (offset)
521+ val sourcePos = SourcePosition (sourceFile, span)
522+ diagnostics ::= Diagnostic .Error (s " Compilation of $filePath with Scala $compilerVersion failed at line: $line, column: $column. Full error output: \n\n $indent$error\n " , sourcePos)
523+ case summaryPattern() => // Ignored
524+ case errorLine =>
525+ diagnostics match
526+ case head :: tail =>
527+ diagnostics = Diagnostic .Error (s " ${head.msg.rawMessage}$indent$errorLine\n " , head.pos) :: tail
528+ case Nil =>
529+ diagnostics.reverse
521530
522531 protected def compileWithOtherCompiler (compiler : String , files : Array [JFile ], flags : TestFlags , targetDir : JFile ): TestReporter =
523532 val compilerDir = getCompiler(compiler).toString
@@ -531,9 +540,9 @@ trait ParallelTesting extends RunnerOrchestration { self =>
531540 val flags1 = flags.copy(defaultClassPath = substituteClasspath(flags.defaultClassPath))
532541 .withClasspath(targetDir.getPath)
533542 .and(" -d" , targetDir.getPath)
543+ .and(" -pagewidth" , " 80" )
534544
535- val dummyStream = new PrintStream (new ByteArrayOutputStream ())
536- val reporter = TestReporter .reporter(dummyStream, ERROR )
545+ val reporter = TestReporter .reporter(System .out, ERROR )
537546
538547 val command = Array (compilerDir + " /bin/scalac" ) ++ flags1.all ++ files.map(_.getPath)
539548 val process = Runtime .getRuntime.exec(command)
0 commit comments