aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFelix Mulder <felix.mulder@gmail.com>2017-04-13 10:10:14 +0200
committerFelix Mulder <felix.mulder@gmail.com>2017-04-13 11:02:30 +0200
commit64db05bc9aa5e82e68209ec4f72b1f87279c8c3a (patch)
tree68c82c2d536c0610e1421dbd2d24502fa6ac1e95
parent7e33bc4c11ffc5e6ecc6fb7bcbfd54c497db2c02 (diff)
downloaddotty-64db05bc9aa5e82e68209ec4f72b1f87279c8c3a.zip
dotty-64db05bc9aa5e82e68209ec4f72b1f87279c8c3a.tar.gz
dotty-64db05bc9aa5e82e68209ec4f72b1f87279c8c3a.tar.bz2
Fix #2244: make sure logging goes through appropriate interface
-rw-r--r--compiler/test/dotty/tools/vulpix/ParallelTesting.scala7
-rw-r--r--compiler/test/dotty/tools/vulpix/SummaryReport.scala16
2 files changed, 18 insertions, 5 deletions
diff --git a/compiler/test/dotty/tools/vulpix/ParallelTesting.scala b/compiler/test/dotty/tools/vulpix/ParallelTesting.scala
index 1315da3..355a404 100644
--- a/compiler/test/dotty/tools/vulpix/ParallelTesting.scala
+++ b/compiler/test/dotty/tools/vulpix/ParallelTesting.scala
@@ -192,8 +192,6 @@ trait ParallelTesting extends RunnerOrchestration { self =>
/** A runnable that logs its contents in a buffer */
trait LoggedRunnable extends Runnable {
- import TestReporter.logWriter
-
/** Instances of `LoggedRunnable` implement this method instead of the
* `run` method
*/
@@ -212,8 +210,7 @@ trait ParallelTesting extends RunnerOrchestration { self =>
final def run(): Unit = {
checkTestSource()
- logBuffer.iterator.foreach(logWriter.println)
- logWriter.flush()
+ summaryReport.echoToLog(logBuffer.iterator)
}
}
@@ -309,7 +306,7 @@ trait ParallelTesting extends RunnerOrchestration { self =>
protected def tryCompile(testSource: TestSource)(op: => Unit): Unit =
try {
val testing = s"Testing ${testSource.title}"
- TestReporter.logWriter.println(testing)
+ summaryReport.echoToLog(testing)
if (!isInteractive) realStdout.println(testing)
op
} catch {
diff --git a/compiler/test/dotty/tools/vulpix/SummaryReport.scala b/compiler/test/dotty/tools/vulpix/SummaryReport.scala
index 81da634..678d888 100644
--- a/compiler/test/dotty/tools/vulpix/SummaryReport.scala
+++ b/compiler/test/dotty/tools/vulpix/SummaryReport.scala
@@ -34,6 +34,12 @@ trait SummaryReporting {
/** Echo the summary report to the appropriate locations */
def echoSummary(): Unit
+
+ /** Echoes *immediately* to file */
+ def echoToLog(msg: String): Unit
+
+ /** Echoes contents of `it` to file *immediately* then flushes */
+ def echoToLog(it: Iterator[String]): Unit
}
/** A summary report that doesn't do anything */
@@ -45,6 +51,8 @@ final class NoSummaryReport extends SummaryReporting {
def addStartingMessage(msg: String): Unit = ()
def addCleanup(f: () => Unit): Unit = ()
def echoSummary(): Unit = ()
+ def echoToLog(msg: String): Unit = ()
+ def echoToLog(it: Iterator[String]): Unit = ()
}
/** A summary report that logs to both stdout and the `TestReporter.logWriter`
@@ -122,6 +130,14 @@ final class SummaryReport extends SummaryReporting {
// Perform cleanup callback:
if (cleanUps.nonEmpty) cleanUps.foreach(_.apply())
}
+
+ def echoToLog(msg: String): Unit =
+ TestReporter.logPrintln(msg)
+
+ def echoToLog(it: Iterator[String]): Unit = {
+ it.foreach(TestReporter.logPrint)
+ TestReporter.logFlush()
+ }
}
object SummaryReport {