diff options
author | Aleksandar Pokopec <aleksandar.prokopec@epfl.ch> | 2010-10-06 14:03:00 +0000 |
---|---|---|
committer | Aleksandar Pokopec <aleksandar.prokopec@epfl.ch> | 2010-10-06 14:03:00 +0000 |
commit | f22b627730aecff56443083816c36b3e145a2474 (patch) | |
tree | 181f293e0ac47b94c038ae6cd4229f766d8bb6f3 /src/partest | |
parent | bf84cd2f44e3be39247e7fd05a93ca660aed1cc0 (diff) | |
download | scala-f22b627730aecff56443083816c36b3e145a2474.tar.gz scala-f22b627730aecff56443083816c36b3e145a2474.tar.bz2 scala-f22b627730aecff56443083816c36b3e145a2474.zip |
Solved issues with fork join pool creators, and...
Solved issues with fork join pool creators, and the issue with
scalacheck output.
Done by Philipp and me.
Review by phaller.
Diffstat (limited to 'src/partest')
-rw-r--r-- | src/partest/scala/tools/partest/nest/DirectRunner.scala | 7 | ||||
-rw-r--r-- | src/partest/scala/tools/partest/nest/Worker.scala | 26 |
2 files changed, 18 insertions, 15 deletions
diff --git a/src/partest/scala/tools/partest/nest/DirectRunner.scala b/src/partest/scala/tools/partest/nest/DirectRunner.scala index f774320f4e..6875b3794e 100644 --- a/src/partest/scala/tools/partest/nest/DirectRunner.scala +++ b/src/partest/scala/tools/partest/nest/DirectRunner.scala @@ -12,6 +12,7 @@ import java.io.{File, PrintStream, FileOutputStream, BufferedReader, InputStreamReader, StringWriter, PrintWriter} import java.util.StringTokenizer import scala.util.Properties.{ setProp } +import scala.tools.nsc.util.ScalaClassLoader import scala.tools.nsc.io.Directory import scala.actors.Actor._ @@ -35,9 +36,13 @@ trait DirectRunner { val len = kindFiles.length val (testsEach, lastFrag) = (len/numActors, len%numActors) val last = numActors-1 + val consFM = new ConsoleFileManager + import consFM.{ latestCompFile, latestLibFile, latestPartestFile } + val scalacheckURL = PathSettings.scalaCheck.toURL + val scalaCheckParentClassLoader = ScalaClassLoader.fromURLs(List(scalacheckURL, latestCompFile.toURI.toURL, latestLibFile.toURI.toURL, latestPartestFile.toURI.toURL)) val workers = for (i <- List.range(0, numActors)) yield { val toTest = kindFiles.slice(i*testsEach, (i+1)*testsEach) - val worker = new Worker(fileManager) + val worker = new Worker(fileManager, scalaCheckParentClassLoader) worker.start() if (i == last) worker ! RunTests(kind, (kindFiles splitAt (last*testsEach))._2) diff --git a/src/partest/scala/tools/partest/nest/Worker.scala b/src/partest/scala/tools/partest/nest/Worker.scala index 57ab056cd6..1a6e2bd30e 100644 --- a/src/partest/scala/tools/partest/nest/Worker.scala +++ b/src/partest/scala/tools/partest/nest/Worker.scala @@ -16,7 +16,7 @@ import scala.util.Properties.{ isWin } import scala.tools.nsc.{ ObjectRunner, Settings, CompilerCommand, Global } import scala.tools.nsc.io.{ AbstractFile, PlainFile, Path, Directory, File => SFile } import scala.tools.nsc.reporters.ConsoleReporter -import scala.tools.nsc.util.{ ClassPath, FakePos } +import scala.tools.nsc.util.{ ClassPath, FakePos, ScalaClassLoader } import ClassPath.{ join, split } import scala.actors.{ Actor, Exit, TIMEOUT } @@ -54,7 +54,7 @@ class ScalaCheckFileManager(val origmanager: FileManager) extends FileManager { var LATEST_LIB: String = origmanager.LATEST_LIB } -class Worker(val fileManager: FileManager) extends Actor { +class Worker(val fileManager: FileManager, scalaCheckParentClassLoader: ScalaClassLoader) extends Actor { import fileManager._ val scalaCheckFileManager = new ScalaCheckFileManager(fileManager) @@ -462,29 +462,27 @@ class Worker(val fileManager: FileManager) extends Actor { def processSingleFile(file: File): LogContext = kind match { case "scalacheck" => runTestCommon(file, kind, expectFailure = false)((logFile, outDir) => { - val consFM = new ConsoleFileManager - import consFM.{ latestCompFile, latestLibFile, latestPartestFile } - NestUI.verbose("compilation of "+file+" succeeded\n") - val scalacheckURL = PathSettings.scalaCheck.toURL val outURL = outDir.getCanonicalFile.toURI.toURL - val classpath: List[URL] = - List(outURL, scalacheckURL, latestCompFile.toURI.toURL, latestLibFile.toURI.toURL, latestPartestFile.toURI.toURL).distinct - - NestUI.debug("scalacheck urls") - classpath foreach (x => NestUI.debug(x.toString)) val logWriter = new PrintStream(new FileOutputStream(logFile)) withOutputRedirected(logWriter) { - ObjectRunner.run(classpath, "Test", Nil) + // this classloader is test specific + // its parent contains library classes and others + val classloader = ScalaClassLoader.fromURLs(List(outURL), scalaCheckParentClassLoader) + classloader.run("Test", Nil) } NestUI.verbose(SFile(logFile).slurp()) // obviously this must be improved upon - succeeded = - SFile(logFile).lines.filter(_.trim != "") filter (_ contains "+") forall (_ contains "OK") + succeeded = { + val lines = SFile(logFile).lines.filter(_.trim != "").toBuffer + val failures = lines filter (_ startsWith "!") + val passedok = lines filter (_ startsWith "+") forall (_ contains "OK") + failures.isEmpty && passedok + } }) case "pos" => |