Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

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.
  • Loading branch information...
commit e4f62c00f2c5820f6eb6750e1098a5fb6c28cc0d 1 parent bf0db36
@som-snytt som-snytt authored paulp committed
Showing with 18 additions and 14 deletions.
  1. +18 −14 src/partest/scala/tools/partest/nest/Runner.scala
View
32 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() = {
Please sign in to comment.
Something went wrong with that request. Please try again.