summaryrefslogtreecommitdiff
path: root/src/partest
diff options
context:
space:
mode:
authorPhilipp Haller <hallerp@gmail.com>2010-04-12 19:18:31 +0000
committerPhilipp Haller <hallerp@gmail.com>2010-04-12 19:18:31 +0000
commit70322ab6ba5b630bca6d4110a502125cabb5ae2c (patch)
tree4e4da316ac873b8e7d8235781c8a51af59f958b4 /src/partest
parent8ec16299c89c1eb776f3b6b767461231ad17eeb7 (diff)
downloadscala-70322ab6ba5b630bca6d4110a502125cabb5ae2c.tar.gz
scala-70322ab6ba5b630bca6d4110a502125cabb5ae2c.tar.bz2
scala-70322ab6ba5b630bca6d4110a502125cabb5ae2c.zip
Reverted r21500 until all test categories work ...
Reverted r21500 until all test categories work again.
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, 11 insertions, 14 deletions
diff --git a/src/partest/scala/tools/partest/Actions.scala b/src/partest/scala/tools/partest/Actions.scala
index f20a11fb73..15351db2a7 100644
--- a/src/partest/scala/tools/partest/Actions.scala
+++ b/src/partest/scala/tools/partest/Actions.scala
@@ -134,6 +134,10 @@ 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.
@@ -142,7 +146,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 = safeLines(log) mkString ("", "\n", "\n")
+ def output = diffCleanup(log)
def matches = safeSlurp(check).trim == output.trim
def traceMsg =
@@ -162,6 +166,7 @@ trait Actions {
}
}
- def diffOutput(): String = checkFile ifFile (f => diffFiles(f, logFile)) getOrElse ""
+ private def cleanedLog = returning(File makeTemp "partest-diff")(_ writeAll diffCleanup(logFile))
+ def diffOutput(): String = checkFile ifFile (f => diffFiles(f, cleanedLog)) getOrElse ""
}
}
diff --git a/src/partest/scala/tools/partest/io/Logging.scala b/src/partest/scala/tools/partest/io/Logging.scala
index 2600c81c57..3667faaf3d 100644
--- a/src/partest/scala/tools/partest/io/Logging.scala
+++ b/src/partest/scala/tools/partest/io/Logging.scala
@@ -47,18 +47,12 @@ trait Logging {
def loggingOutAndErr[T](body: => T): T = {
val log = logFile.printStream(append = true)
- val result = try Console.withOut(log) {
+ 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.
@@ -79,10 +73,8 @@ trait Logging {
* caught, stringified, and written to the log.
*/
def loggingResult(body: => String) =
- try {
- val result = (body split """\r\n|\r|\n""" toList) map (normalizePaths _) mkString ("", "\n", "\n")
- returning(true)(_ => logFile writeAll result)
- } catch {
+ try returning(true)(_ => logFile writeAll body)
+ catch {
case x: ControlThrowable => throw x
case x: InterruptedException => normal(this + " received interrupt, failing.\n") ; false
case x: Throwable => logException(x)
@@ -138,4 +130,4 @@ trait Logging {
flush()
}
}
-}
+} \ No newline at end of file