diff options
-rw-r--r-- | lib/ScalaCheckHelper.jar.desired.sha1 | 1 | ||||
-rw-r--r-- | src/library/scala/util/ClassLoader.scala | 2 | ||||
-rw-r--r-- | src/partest/scala/tools/partest/nest/Worker.scala | 48 | ||||
-rw-r--r-- | test/disabled/scalacheck/list.scala | 10 | ||||
-rw-r--r-- | test/files/lib/ScalaCheck.jar.desired.sha1 | 2 | ||||
-rw-r--r-- | test/files/scalacheck/list.scala | 7 |
6 files changed, 36 insertions, 34 deletions
diff --git a/lib/ScalaCheckHelper.jar.desired.sha1 b/lib/ScalaCheckHelper.jar.desired.sha1 deleted file mode 100644 index 9ef8a64b66..0000000000 --- a/lib/ScalaCheckHelper.jar.desired.sha1 +++ /dev/null @@ -1 +0,0 @@ -cb0006856c854f2faad0c32f9d943c883ea92fd2 ?ScalaCheckHelper.jar diff --git a/src/library/scala/util/ClassLoader.scala b/src/library/scala/util/ClassLoader.scala index 5663b5b74f..6458b0900c 100644 --- a/src/library/scala/util/ClassLoader.scala +++ b/src/library/scala/util/ClassLoader.scala @@ -55,7 +55,7 @@ trait ScalaClassLoader extends JavaClassLoader } } -class URLClassLoader(urls: List[URL], parent: JavaClassLoader) +class URLClassLoader(urls: Seq[URL], parent: JavaClassLoader) extends java.net.URLClassLoader(urls.toArray, parent) with ScalaClassLoader { diff --git a/src/partest/scala/tools/partest/nest/Worker.scala b/src/partest/scala/tools/partest/nest/Worker.scala index 0473955ed9..e48be3da7b 100644 --- a/src/partest/scala/tools/partest/nest/Worker.scala +++ b/src/partest/scala/tools/partest/nest/Worker.scala @@ -13,6 +13,7 @@ import java.net.{URLClassLoader, URL} import java.util.{Timer, TimerTask} import scala.tools.nsc.{ObjectRunner, GenericRunnerCommand} +import scala.tools.nsc.io import scala.actors.{Actor, Exit, TIMEOUT} import scala.actors.Actor._ @@ -462,32 +463,37 @@ class Worker(val fileManager: FileManager) extends Actor { succeeded = false } if (succeeded) { + val consFM = new ConsoleFileManager + import consFM.{latestCompFile, latestLibFile, latestActFile, + latestPartestFile} + NestUI.verbose("compilation of "+file+" succeeded\n") val libs = new File(fileManager.LIB_DIR) - val urls = List((new File(libs, "ScalaCheck.jar")).toURL, - (new File(libs, "ScalaCheckHelper.jar")).toURL) + val scalacheckURL = new File(libs, "ScalaCheck.jar") toURL val outURL = outDir.getCanonicalFile.toURL - val urlArr = (outURL :: urls).toArray - NestUI.verbose("loading classes from:") - urlArr foreach {url => NestUI.verbose(url.toString)} - val loader = new java.net.URLClassLoader(urlArr, fileManager.getClass.getClassLoader) + val classpath: List[URL] = + List(outURL, scalacheckURL, latestCompFile.toURL, latestLibFile.toURL, + latestActFile.toURL, latestPartestFile.toURL).removeDuplicates - (try { - Some(Class.forName("ScalaCheckHelper", true, loader)) - } catch { - case se: SecurityException => None - case cnfe: ClassNotFoundException => None - }) match { - case None => - NestUI.verbose("cannot find ScalaCheckHelper class") - succeeded = false - case Some(clazz) => - val method = clazz.getMethod("passed", Array(classOf[File], classOf[Array[URL]]): _*) - val res = method.invoke(null, Array(logFile, urlArr): _*).asInstanceOf[String] - NestUI.verbose("ScalaCheck result: "+res) - succeeded = res.equals("ok") - } + // XXX this is a big cut-and-paste mess, but the revamp is coming + val logOut = new FileOutputStream(logFile) + val logWriter = new PrintStream(logOut) + val oldStdOut = System.out + val oldStdErr = System.err + System.setOut(logWriter) + System.setErr(logWriter) + + ObjectRunner.run(classpath, "Test", Nil) + + logWriter.flush() + logWriter.close() + System.setOut(oldStdOut) + System.setErr(oldStdErr) + + NestUI.verbose(io.File(logFile).slurp()) + // obviously this must be improved upon + succeeded = io.File(logFile).lines() forall (_ contains " OK") } }) diff --git a/test/disabled/scalacheck/list.scala b/test/disabled/scalacheck/list.scala deleted file mode 100644 index 93d3a59458..0000000000 --- a/test/disabled/scalacheck/list.scala +++ /dev/null @@ -1,10 +0,0 @@ -import org.scalacheck._ -import Prop._ - -object Test { - val prop_ConcatLists = - property((l1: List[Int], l2: List[Int]) => (l1.size + l2.size) == (l1 ::: l2).size) - - val tests = List(("ConcatLists", prop_ConcatLists)) -} - diff --git a/test/files/lib/ScalaCheck.jar.desired.sha1 b/test/files/lib/ScalaCheck.jar.desired.sha1 index e02477c12a..55aa27f176 100644 --- a/test/files/lib/ScalaCheck.jar.desired.sha1 +++ b/test/files/lib/ScalaCheck.jar.desired.sha1 @@ -1 +1 @@ -231ed6a57d97017d55c52e4742570af442e303bf ?ScalaCheck.jar +08cea28f282d8360a6344a8cfb853522e18915bb ?ScalaCheck.jar diff --git a/test/files/scalacheck/list.scala b/test/files/scalacheck/list.scala new file mode 100644 index 0000000000..bf38626d45 --- /dev/null +++ b/test/files/scalacheck/list.scala @@ -0,0 +1,7 @@ +import org.scalacheck._ +import Prop._ + +object Test extends Properties("List") { + property("concat") = forAll { (l1: List[Int], l2: List[Int]) => (l1.size + l2.size) == (l1 ::: l2).size } +} + |