summaryrefslogtreecommitdiff
path: root/src/partest
diff options
context:
space:
mode:
authorPhilipp Haller <hallerp@gmail.com>2010-04-12 17:27:14 +0000
committerPhilipp Haller <hallerp@gmail.com>2010-04-12 17:27:14 +0000
commit010889645cc64ce5c10538a947d37c4760204d0f (patch)
treec8de357712a88c4697e2014f180b801d8055dd1c /src/partest
parent18f75625a83a01d13e04276856246f35f63e0ac4 (diff)
downloadscala-010889645cc64ce5c10538a947d37c4760204d0f.tar.gz
scala-010889645cc64ce5c10538a947d37c4760204d0f.tar.bz2
scala-010889645cc64ce5c10538a947d37c4760204d0f.zip
Restored partest behavior to write log files wi...
Restored partest behavior to write log files with normalized paths. For new tests the check file can be copied from the log file. This makes the behavior of --show-diff exactly the same as diffing the log and check file. Review by extempore.
Diffstat (limited to 'src/partest')
-rw-r--r--src/partest/scala/tools/partest/Actions.scala9
-rw-r--r--src/partest/scala/tools/partest/io/Logging.scala16
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
+}