diff options
-rw-r--r-- | src/partest/scala/tools/partest/Actions.scala | 9 | ||||
-rw-r--r-- | src/partest/scala/tools/partest/io/Logging.scala | 16 |
2 files changed, 14 insertions, 11 deletions
diff --git a/src/partest/scala/tools/partest/Actions.scala b/src/partest/scala/tools/partest/Actions.scala index 15351db2a7..f20a11fb73 100644 --- a/src/partest/scala/tools/partest/Actions.scala +++ b/src/partest/scala/tools/partest/Actions.scala @@ -134,10 +134,6 @@ trait Actions { if (s != s2) s2.replaceAll("""\\""", "/") else s2 } - /** The default cleanup normalizes paths relative to sourcesDir. - */ - def diffCleanup(f: File) = safeLines(f) map normalizePaths mkString ("", "\n", "\n") - /** If optional is true, a missing check file is considered * a successful diff. Necessary since many categories use * checkfiles in an ad hoc manner. @@ -146,7 +142,7 @@ trait Actions { def arg1 = tracePath(check) def arg2 = tracePath(log) def noCheck = !check.exists && returning(true)(_ => trace("diff %s %s [unchecked]".format(arg1, arg2))) - def output = diffCleanup(log) + def output = safeLines(log) mkString ("", "\n", "\n") def matches = safeSlurp(check).trim == output.trim def traceMsg = @@ -166,7 +162,6 @@ trait Actions { } } - private def cleanedLog = returning(File makeTemp "partest-diff")(_ writeAll diffCleanup(logFile)) - def diffOutput(): String = checkFile ifFile (f => diffFiles(f, cleanedLog)) getOrElse "" + def diffOutput(): String = checkFile ifFile (f => diffFiles(f, logFile)) getOrElse "" } } diff --git a/src/partest/scala/tools/partest/io/Logging.scala b/src/partest/scala/tools/partest/io/Logging.scala index 3667faaf3d..2600c81c57 100644 --- a/src/partest/scala/tools/partest/io/Logging.scala +++ b/src/partest/scala/tools/partest/io/Logging.scala @@ -47,12 +47,18 @@ trait Logging { def loggingOutAndErr[T](body: => T): T = { val log = logFile.printStream(append = true) - try Console.withOut(log) { + val result = try Console.withOut(log) { Console.withErr(log) { body } } finally log.close() + + // The default cleanup normalizes paths relative to sourcesDir. + val cleaned = safeLines(logFile) map normalizePaths mkString ("", "\n", "\n") + logFile writeAll cleaned + + result } /** XXX needs attention. @@ -73,8 +79,10 @@ trait Logging { * caught, stringified, and written to the log. */ def loggingResult(body: => String) = - try returning(true)(_ => logFile writeAll body) - catch { + try { + val result = (body split """\r\n|\r|\n""" toList) map (normalizePaths _) mkString ("", "\n", "\n") + returning(true)(_ => logFile writeAll result) + } catch { case x: ControlThrowable => throw x case x: InterruptedException => normal(this + " received interrupt, failing.\n") ; false case x: Throwable => logException(x) @@ -130,4 +138,4 @@ trait Logging { flush() } } -}
\ No newline at end of file +} |