summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSom Snytt <som.snytt@gmail.com>2013-04-11 09:15:12 -0700
committerPaul Phillips <paulp@improving.org>2013-04-30 08:18:22 -0700
commite4f62c00f2c5820f6eb6750e1098a5fb6c28cc0d (patch)
tree5e9c5a51fc9355ce7145e8cbf6303032256de7b7
parentbf0db36d8bbb0ac7faa0652b98458cfebca8e78a (diff)
downloadscala-e4f62c00f2c5820f6eb6750e1098a5fb6c28cc0d.tar.gz
scala-e4f62c00f2c5820f6eb6750e1098a5fb6c28cc0d.tar.bz2
scala-e4f62c00f2c5820f6eb6750e1098a5fb6c28cc0d.zip
SI-7358 Partest fails on scalacheck failure
A failing test generates a test failure. The failure log is added to the transcript. The log stream is closed when done.
-rw-r--r--src/partest/scala/tools/partest/nest/Runner.scala32
1 files changed, 18 insertions, 14 deletions
diff --git a/src/partest/scala/tools/partest/nest/Runner.scala b/src/partest/scala/tools/partest/nest/Runner.scala
index fc56818bfc..34676a8c89 100644
--- a/src/partest/scala/tools/partest/nest/Runner.scala
+++ b/src/partest/scala/tools/partest/nest/Runner.scala
@@ -495,24 +495,28 @@ class Runner(val testFile: File, fileManager: FileManager) {
}
def runScalacheckTest() = runTestCommon {
- NestUI.verbose("compilation of "+testFile+" succeeded\n")
+ def runScalacheckTest0() = {
+ NestUI.verbose("compilation of "+testFile+" succeeded\n")
- val outURL = outDir.getAbsoluteFile.toURI.toURL
- val logWriter = new PrintStream(new FileOutputStream(logFile), true)
+ val outURL = outDir.getAbsoluteFile.toURI.toURL
+ val logWriter = new PrintStream(new FileOutputStream(logFile), true)
- Output.withRedirected(logWriter) {
- // this classloader is test specific: its parent contains library classes and others
- ScalaClassLoader.fromURLs(List(outURL), testRunParams.scalaCheckParentClassLoader).run("Test", Nil)
+ try Output.withRedirected(logWriter) {
+ // this classloader is test specific: its parent contains library classes and others
+ ScalaClassLoader.fromURLs(List(outURL), testRunParams.scalaCheckParentClassLoader).run("Test", Nil)
+ } finally logWriter.close()
+ true // succeeds trivially
}
-
- NestUI.verbose(file2String(logFile))
- // obviously this must be improved upon
- val lines = SFile(logFile).lines map (_.trim) filterNot (_ == "") toBuffer;
- lines.forall(x => !x.startsWith("!")) || {
- NestUI.normal("ScalaCheck test failed. Output:\n")
- lines foreach (x => NestUI.normal(x + "\n"))
- false
+ def checkScalacheckLog = {
+ NestUI.verbose(file2String(logFile))
+ // obviously this must be improved upon
+ val lines = SFile(logFile).lines map (_.trim) filterNot (_ == "") toBuffer;
+ lines.forall(x => !x.startsWith("!")) || {
+ _transcript append logFile.fileContents
+ false
+ }
}
+ (runScalacheckTest0() && nextTestActionExpectTrue("ScalaCheck test failed", checkScalacheckLog))
}
def runResidentTest() = {