aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFelix Mulder <felix.mulder@gmail.com>2017-04-12 11:19:02 +0200
committerFelix Mulder <felix.mulder@gmail.com>2017-04-12 11:48:41 +0200
commitebd16700937d2e522f99ac5dd046217d889e8cb4 (patch)
treeab9098ffd2ca4005a6387122f6f9679168f9860b
parent7c4227709666e5390afa1b5f43aeb3c32cc93016 (diff)
downloaddotty-ebd16700937d2e522f99ac5dd046217d889e8cb4.tar.gz
dotty-ebd16700937d2e522f99ac5dd046217d889e8cb4.tar.bz2
dotty-ebd16700937d2e522f99ac5dd046217d889e8cb4.zip
Remove duplication with run test output verification
-rw-r--r--compiler/test/dotty/tools/vulpix/ParallelTesting.scala26
1 files changed, 7 insertions, 19 deletions
diff --git a/compiler/test/dotty/tools/vulpix/ParallelTesting.scala b/compiler/test/dotty/tools/vulpix/ParallelTesting.scala
index 5957e3ec5..f43462011 100644
--- a/compiler/test/dotty/tools/vulpix/ParallelTesting.scala
+++ b/compiler/test/dotty/tools/vulpix/ParallelTesting.scala
@@ -482,12 +482,13 @@ trait ParallelTesting extends RunnerOrchestration { self =>
}
}
- private def verifyOutput(checkFile: JFile, dir: JFile, testSource: TestSource, warnings: Int) = {
+ private def verifyOutput(checkFile: Option[JFile], dir: JFile, testSource: TestSource, warnings: Int) = {
if (Properties.testsNoRun) addNoRunWarning()
else runMain(testSource.classPath) match {
+ case Success(_) if !checkFile.isDefined || !checkFile.get.exists => // success!
case Success(output) => {
val outputLines = output.lines.toArray
- val checkLines: Array[String] = Source.fromFile(checkFile).getLines.toArray
+ val checkLines: Array[String] = Source.fromFile(checkFile.get).getLines.toArray
val sourceTitle = testSource.title
def linesMatch =
@@ -529,7 +530,7 @@ trait ParallelTesting extends RunnerOrchestration { self =>
protected def encapsulatedCompilation(testSource: TestSource) = new LoggedRunnable {
def checkTestSource(): Unit = tryCompile(testSource) {
- val (compilerCrashed, errorCount, warningCount, hasCheckFile, verifier: Function0[Unit]) = testSource match {
+ val (compilerCrashed, errorCount, warningCount, verifier: Function0[Unit]) = testSource match {
case testSource @ JointCompilationSource(_, files, flags, outDir) => {
val checkFile = files.flatMap { file =>
if (file.isDirectory) Nil
@@ -547,7 +548,7 @@ trait ParallelTesting extends RunnerOrchestration { self =>
logBuildInstructions(reporter, testSource, reporter.errorCount, reporter.warningCount)
}
- (reporter.compilerCrashed, reporter.errorCount, reporter.warningCount, checkFile.isDefined, () => verifyOutput(checkFile.get, outDir, testSource, reporter.warningCount))
+ (reporter.compilerCrashed, reporter.errorCount, reporter.warningCount, () => verifyOutput(checkFile, outDir, testSource, reporter.warningCount))
}
case testSource @ SeparateCompilationSource(_, dir, flags, outDir) => {
@@ -567,24 +568,11 @@ trait ParallelTesting extends RunnerOrchestration { self =>
logBuildInstructions(reporters.head, testSource, errorCount, warningCount)
}
- (compilerCrashed, errorCount, warningCount, checkFile.exists, () => verifyOutput(checkFile, outDir, testSource, warningCount))
+ (compilerCrashed, errorCount, warningCount, () => verifyOutput(Some(checkFile), outDir, testSource, warningCount))
}
}
- if (!compilerCrashed && errorCount == 0 && hasCheckFile) verifier()
- else if (!compilerCrashed && errorCount == 0) {
- if (Properties.testsNoRun) addNoRunWarning()
- else runMain(testSource.classPath) match {
- case Success(_) => // success!
- case Failure(output) =>
- echo(s" failed when running '${testSource.title}'")
- echo(output)
- failTestSource(testSource)
- case Timeout =>
- echo(" failed because test " + testSource.title + " timed out")
- failTestSource(testSource, Some("test timed out"))
- }
- }
+ if (!compilerCrashed && errorCount == 0) verifier()
else {
echo(s"\n Compilation failed for: '$testSource'")
val buildInstr = testSource.buildInstructions(errorCount, warningCount)