Skip to content

Commit b312fd6

Browse files
committed
remove unnecessary changes to vulpix
1 parent 688d8ea commit b312fd6

File tree

7 files changed

+19
-132
lines changed

7 files changed

+19
-132
lines changed

compiler/test/dotty/tools/dotc/CompilationTests.scala

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -338,7 +338,6 @@ class CompilationTests extends ParallelTesting {
338338
}
339339

340340
compileFilesInDir("../tests/plugins/neg").checkExpectedErrors()
341-
compileFilesInDir("../tests/plugins/pos").checkCompile(checkCompileOutput = true)
342341
}
343342

344343
private val (compilerSources, backendSources, backendJvmSources) = {

compiler/test/dotty/tools/dotc/reporting/TestReporter.scala

Lines changed: 2 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,12 @@ package dotty.tools
22
package dotc
33
package reporting
44

5-
import java.io.{ FileOutputStream, PrintStream, PrintWriter, StringWriter, File => JFile }
5+
import java.io.{ PrintStream, PrintWriter, File => JFile, FileOutputStream }
66
import java.text.SimpleDateFormat
77
import java.util.Date
88

99
import scala.collection.mutable
10+
1011
import util.SourcePosition
1112
import core.Contexts._
1213
import Reporter._
@@ -78,23 +79,6 @@ extends Reporter with UniqueMessagePositions with HideNonSensicalMessages with M
7879
}
7980
}
8081

81-
class StoredTestReporter (val writer: StringWriter, val superWriter: PrintWriter, filePrintln: String => Unit, logLevel: Int)
82-
extends TestReporter(superWriter, filePrintln, logLevel) {
83-
override def doReport(m: MessageContainer)(implicit ctx: Context): Unit = {
84-
super.doReport(m)
85-
86-
val msg =
87-
if (m.pos.exists)
88-
"[" + diagnosticLevel(m) + "] Line " + (m.pos.line + 1) + ": " + m.contained().msg
89-
else
90-
"[" + diagnosticLevel(m) + "] " + m.contained().msg
91-
92-
writer.write(msg + "\n")
93-
}
94-
95-
override def summary: String = ""
96-
}
97-
9882
object TestReporter {
9983
private[this] var outFile: JFile = _
10084
private[this] var logWriter: PrintWriter = _
@@ -131,9 +115,6 @@ object TestReporter {
131115
def reporter(ps: PrintStream, logLevel: Int): TestReporter =
132116
new TestReporter(new PrintWriter(ps, true), logPrintln, logLevel)
133117

134-
def storedReporter(ps: PrintStream, logLevel: Int): TestReporter =
135-
new StoredTestReporter(new StringWriter(), new PrintWriter(ps, true), logPrintln, logLevel)
136-
137118
def simplifiedReporter(writer: PrintWriter): TestReporter = {
138119
val rep = new TestReporter(writer, logPrintln, WARNING) {
139120
/** Prints the message with the given position indication in a simplified manner */

compiler/test/dotty/tools/vulpix/ParallelTesting.scala

Lines changed: 17 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -6,21 +6,22 @@ import java.io.{ File => JFile }
66
import java.text.SimpleDateFormat
77
import java.util.HashMap
88
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 }
1111

1212
import scala.io.Source
1313
import scala.util.control.NonFatal
1414
import scala.util.Try
1515
import scala.collection.mutable
1616
import scala.util.matching.Regex
1717
import scala.util.Random
18+
1819
import dotc.core.Contexts._
19-
import dotc.reporting.{ Reporter, StoredTestReporter, TestReporter }
20+
import dotc.reporting.{ Reporter, TestReporter }
2021
import dotc.reporting.diagnostic.MessageContainer
2122
import dotc.interfaces.Diagnostic.ERROR
2223
import dotc.util.DiffUtil
23-
import dotc.{ Compiler, Driver }
24+
import dotc.{ Driver, Compiler }
2425

2526
/** A parallel testing suite whose goal is to integrate nicely with JUnit
2627
*
@@ -127,7 +128,7 @@ trait ParallelTesting extends RunnerOrchestration { self =>
127128
/** A group of files that may all be compiled together, with the same flags
128129
* and output directory
129130
*/
130-
final case class JointCompilationSource(
131+
private final case class JointCompilationSource(
131132
name: String,
132133
files: Array[JFile],
133134
flags: TestFlags,
@@ -175,7 +176,7 @@ trait ParallelTesting extends RunnerOrchestration { self =>
175176
/** Each `Test` takes the `testSources` and performs the compilation and assertions
176177
* according to the implementing class "neg", "run" or "pos".
177178
*/
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 =>
179180

180181
import summaryReport._
181182

@@ -351,12 +352,9 @@ trait ParallelTesting extends RunnerOrchestration { self =>
351352
else None
352353
} else None
353354

354-
val logLevel = if (suppressErrors || suppressAllOutput) ERROR + 1 else ERROR
355355
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)
360358

361359
val driver =
362360
if (times == 1) new Driver
@@ -465,33 +463,10 @@ trait ParallelTesting extends RunnerOrchestration { self =>
465463
private def flattenFiles(f: JFile): Array[JFile] =
466464
if (f.isDirectory) f.listFiles.flatMap(flattenFiles)
467465
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-
}
491466
}
492467

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) {
495470
protected def encapsulatedCompilation(testSource: TestSource) = new LoggedRunnable {
496471
def checkTestSource(): Unit = tryCompile(testSource) {
497472
testSource match {
@@ -524,14 +499,6 @@ trait ParallelTesting extends RunnerOrchestration { self =>
524499
reporters.foreach(logReporterContents)
525500
logBuildInstructions(reporters.head, testSource, errorCount, warningCount)
526501
}
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-
}
535502
}
536503
}
537504
}
@@ -655,8 +622,8 @@ trait ParallelTesting extends RunnerOrchestration { self =>
655622
}
656623
}
657624

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) {
660627
protected def encapsulatedCompilation(testSource: TestSource) = new LoggedRunnable {
661628
def checkTestSource(): Unit = tryCompile(testSource) {
662629
// In neg-tests we allow two types of error annotations,
@@ -733,14 +700,6 @@ trait ParallelTesting extends RunnerOrchestration { self =>
733700
if (actualErrors > 0)
734701
reporters.foreach(logReporterContents)
735702

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-
744703
(compilerCrashed, expectedErrors, actualErrors, () => getMissingExpectedErrors(errorMap, errors), errorMap)
745704
}
746705
}
@@ -920,8 +879,8 @@ trait ParallelTesting extends RunnerOrchestration { self =>
920879
* compilation without generating errors and that they do not crash the
921880
* compiler
922881
*/
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()
925884

926885
cleanup()
927886

@@ -939,8 +898,8 @@ trait ParallelTesting extends RunnerOrchestration { self =>
939898
* correct amount of errors at the correct positions. It also makes sure
940899
* that none of these tests crash the compiler
941900
*/
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()
944903

945904
cleanup()
946905

tests/plugins/pos/divideZero/2.check

Lines changed: 0 additions & 3 deletions
This file was deleted.

tests/plugins/pos/divideZero/Test_2.scala

Lines changed: 0 additions & 5 deletions
This file was deleted.

tests/plugins/pos/divideZero/plugin_1.scala

Lines changed: 0 additions & 40 deletions
This file was deleted.

tests/plugins/pos/divideZero/scalac-plugin.xml

Lines changed: 0 additions & 4 deletions
This file was deleted.

0 commit comments

Comments
 (0)