aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--compiler/test/dotty/tools/dotc/reporting/TestReporter.scala28
-rw-r--r--compiler/test/dotty/tools/vulpix/SummaryReport.scala11
2 files changed, 29 insertions, 10 deletions
diff --git a/compiler/test/dotty/tools/dotc/reporting/TestReporter.scala b/compiler/test/dotty/tools/dotc/reporting/TestReporter.scala
index 7952ed728..213181b56 100644
--- a/compiler/test/dotty/tools/dotc/reporting/TestReporter.scala
+++ b/compiler/test/dotty/tools/dotc/reporting/TestReporter.scala
@@ -91,23 +91,41 @@ extends Reporter with UniqueMessagePositions with HideNonSensicalMessages with M
}
object TestReporter {
- val logWriter = {
+ private[this] var outFile: JFile = _
+ private[this] var logWriter: PrintWriter = _
+
+ private[this] def initLog() = if (logWriter eq null) {
val df = new SimpleDateFormat("yyyy-MM-dd-HH:mm")
val timestamp = df.format(new Date)
new JFile("../testlogs").mkdirs()
- new PrintWriter(new FileOutputStream(new JFile(s"../testlogs/tests-$timestamp.log"), true))
+ outFile = new JFile(s"../testlogs/tests-$timestamp.log")
+ logWriter = new PrintWriter(new FileOutputStream(outFile, true))
}
- def writeToLog(str: String) = {
+ def logPrintln(str: String) = {
+ initLog()
logWriter.println(str)
logWriter.flush()
}
+ def logPrint(str: String): Unit = {
+ initLog()
+ logWriter.println(str)
+ }
+
+ def logFlush(): Unit =
+ if (logWriter ne null) logWriter.flush()
+
+ def logPath: String = {
+ initLog()
+ outFile.getCanonicalPath
+ }
+
def reporter(ps: PrintStream, logLevel: Int): TestReporter =
- new TestReporter(new PrintWriter(ps, true), writeToLog, logLevel)
+ new TestReporter(new PrintWriter(ps, true), logPrintln, logLevel)
def simplifiedReporter(writer: PrintWriter): TestReporter = {
- val rep = new TestReporter(writer, writeToLog, WARNING) {
+ val rep = new TestReporter(writer, logPrintln, WARNING) {
/** Prints the message with the given position indication in a simplified manner */
override def printMessageAndPos(m: MessageContainer, extra: String)(implicit ctx: Context): Unit = {
def report() = {
diff --git a/compiler/test/dotty/tools/vulpix/SummaryReport.scala b/compiler/test/dotty/tools/vulpix/SummaryReport.scala
index efca94bba..81da634f7 100644
--- a/compiler/test/dotty/tools/vulpix/SummaryReport.scala
+++ b/compiler/test/dotty/tools/vulpix/SummaryReport.scala
@@ -102,10 +102,11 @@ final class SummaryReport extends SummaryReporting {
if (isInteractive) {
println(rep.toString)
if (failed > 0) println {
- """|
- |----------------------------------------------------------
- |Note: reproduction instructed have been dumped to log file
- |----------------------------------------------------------""".stripMargin
+ s"""|
+ |--------------------------------------------------------------------------------
+ |Note - reproduction instructions have been dumped to log file:
+ | ${TestReporter.logPath}
+ |--------------------------------------------------------------------------------""".stripMargin
}
}
@@ -116,7 +117,7 @@ final class SummaryReport extends SummaryReporting {
// If we're on the CI, we want everything
if (!isInteractive) println(rep.toString)
- TestReporter.writeToLog(rep.toString)
+ TestReporter.logPrintln(rep.toString)
// Perform cleanup callback:
if (cleanUps.nonEmpty) cleanUps.foreach(_.apply())