diff options
author | vsalvis <salvisbergvera@gmail.com> | 2015-06-24 16:41:37 +0200 |
---|---|---|
committer | vsalvis <salvisbergvera@gmail.com> | 2015-06-24 16:41:37 +0200 |
commit | 4b42a198a1db7bb2613e9553e7e4250e6c66f4e3 (patch) | |
tree | 32caf9cc8730393b015818f1367f8c8c7f8008a9 /test/dotty/partest/DPConsoleRunner.scala | |
parent | 5e4e0cf35036906423e13eb74093af07a29f0521 (diff) | |
download | dotty-4b42a198a1db7bb2613e9553e7e4250e6c66f4e3.tar.gz dotty-4b42a198a1db7bb2613e9553e7e4250e6c66f4e3.tar.bz2 dotty-4b42a198a1db7bb2613e9553e7e4250e6c66f4e3.zip |
Partest 3/3: Proper compiler output redirection
Diffstat (limited to 'test/dotty/partest/DPConsoleRunner.scala')
-rw-r--r-- | test/dotty/partest/DPConsoleRunner.scala | 29 |
1 files changed, 11 insertions, 18 deletions
diff --git a/test/dotty/partest/DPConsoleRunner.scala b/test/dotty/partest/DPConsoleRunner.scala index 13ffed050..fa6256398 100644 --- a/test/dotty/partest/DPConsoleRunner.scala +++ b/test/dotty/partest/DPConsoleRunner.scala @@ -9,7 +9,7 @@ import scala.tools.partest._ import scala.tools.partest.nest._ import scala.util.matching.Regex import tools.nsc.io.{ File => NSCFile } -import java.io.{ File, PrintStream, FileOutputStream } +import java.io.{ File, PrintStream, FileOutputStream, PrintWriter, FileWriter } import java.net.URLClassLoader /** Runs dotty partest from the Console, discovering test sources in @@ -91,23 +91,11 @@ extends SuiteRunner(testSourcePath, fileManager, updateCheck, failed, javaCmdPat val state = try { - // IO redirection is messy, there are no concurrency guarantees. - // Parts of test output might end up in the wrong file or get lost. - Console.out.flush - Console.err.flush - val clog = runner.cLogFile - val stream = new PrintStream(new FileOutputStream(clog.jfile), true) - val result = Console.withOut(stream)({ Console.withErr(stream)({ - val res = runner.run() - Console.err.flush - Console.out.flush - res - })}) - result match { + runner.run match { // Append compiler output to transcript if compilation failed, // printed with --verbose option case TestState.Fail(f, r@"compilation failed", transcript) => - TestState.Fail(f, r, transcript ++ clog.fileLines.dropWhile(_ == "")) + TestState.Fail(f, r, transcript ++ runner.cLogFile.fileLines.dropWhile(_ == "")) case res => res } } catch { @@ -261,11 +249,16 @@ class DPTestRunner(testFile: File, suiteRunner: DPSuiteRunner) extends nest.Runn override def groupedFiles(sources: List[File]): List[List[File]] = { val grouped = sources groupBy (_.group) val flatGroup = List(grouped.keys.toList.sorted.map({ k => grouped(k) sortBy (_.getName) }).flatten) - try { // try/catch because of bug in partest + try { // try/catch because of bug in partest that throws exception if (flatGroup != super.groupedFiles(sources)) - NestUI.echoWarning("Warning: Overriding compilation groups for tests: " + sources) + throw new java.lang.UnsupportedOperationException() } catch { - case e: java.lang.UnsupportedOperationException => NestUI.echoWarning("Warning: Overriding compilation groups for tests: " + sources) + case e: java.lang.UnsupportedOperationException => + val genlogFWriter = new FileWriter(DPConfig.genLog.jfile, true) + val genlogWriter = new PrintWriter(genlogFWriter, true) + genlogWriter.println("Warning: Overriding compilation groups for tests: " + sources) + genlogWriter.close + genlogFWriter.close } flatGroup } |