@@ -505,19 +505,28 @@ trait ParallelTesting extends RunnerOrchestration { self =>
505
505
}
506
506
507
507
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
521
530
522
531
protected def compileWithOtherCompiler (compiler : String , files : Array [JFile ], flags : TestFlags , targetDir : JFile ): TestReporter =
523
532
val compilerDir = getCompiler(compiler).toString
@@ -531,9 +540,9 @@ trait ParallelTesting extends RunnerOrchestration { self =>
531
540
val flags1 = flags.copy(defaultClassPath = substituteClasspath(flags.defaultClassPath))
532
541
.withClasspath(targetDir.getPath)
533
542
.and(" -d" , targetDir.getPath)
543
+ .and(" -pagewidth" , " 80" )
534
544
535
- val dummyStream = new PrintStream (new ByteArrayOutputStream ())
536
- val reporter = TestReporter .reporter(dummyStream, ERROR )
545
+ val reporter = TestReporter .reporter(System .out, ERROR )
537
546
538
547
val command = Array (compilerDir + " /bin/scalac" ) ++ flags1.all ++ files.map(_.getPath)
539
548
val process = Runtime .getRuntime.exec(command)
0 commit comments