From a17be60676ae8329672868872e33b65fa79cbe03 Mon Sep 17 00:00:00 2001 From: Stefan Zeiger Date: Tue, 22 Nov 2011 18:44:00 +0000 Subject: Make partest work with spaces in the path (from... Make partest work with spaces in the path (from batch script and ant task). - The 'partest' ant task gets a new 'compilerargs' element for scalac - options (like in scalacfork and javac). Fixed argument list handling - in partest task. Further improvements to argument list handling for - all ant tasks. Fixed argument list handling in DirectTest (used by - partest shell scripts) Fixed path handling in several test cases. Closes SI-622. Review by phaller. --- test/files/jvm/inner.scala | 8 ++++---- test/scaladoc/scala/IndexScriptTest.scala | 4 ++-- test/scaladoc/scala/IndexTest.scala | 6 +++--- test/scaladoc/scala/html/HtmlFactoryTest.scala | 6 +++--- 4 files changed, 12 insertions(+), 12 deletions(-) (limited to 'test') diff --git a/test/files/jvm/inner.scala b/test/files/jvm/inner.scala index 156d9e69a8..009d52e5bc 100644 --- a/test/files/jvm/inner.scala +++ b/test/files/jvm/inner.scala @@ -71,15 +71,15 @@ object Scalatest { val tmpfile = new FileWriter(tmpfilename) tmpfile.write(src) tmpfile.close - exec(javac + " -d " + outputdir + " -classpath " + classpath + " " + tmpfilename) + exec(javac, "-d", outputdir, "-classpath", classpath, tmpfilename) } def java(cname: String) = - exec(javacmd + " -cp " + classpath + " " + cname) + exec(javacmd, "-cp", classpath, cname) /** Execute cmd, wait for the process to end and pipe it's output to stdout */ - private def exec(cmd: String) { - val proc = Runtime.getRuntime().exec(cmd) + private def exec(args: String*) { + val proc = Runtime.getRuntime().exec(args.toArray) val inp = new BufferedReader(new InputStreamReader(proc.getInputStream)) val errp = new BufferedReader(new InputStreamReader(proc.getErrorStream)) proc.waitFor() diff --git a/test/scaladoc/scala/IndexScriptTest.scala b/test/scaladoc/scala/IndexScriptTest.scala index 991491c376..e0372020fd 100644 --- a/test/scaladoc/scala/IndexScriptTest.scala +++ b/test/scaladoc/scala/IndexScriptTest.scala @@ -3,7 +3,7 @@ import org.scalacheck.Prop._ import scala.tools.nsc.doc import scala.tools.nsc.doc.html.page.IndexScript -import java.net.URLClassLoader +import java.net.{URLClassLoader, URLDecoder} object Test extends Properties("IndexScript") { @@ -11,7 +11,7 @@ object Test extends Properties("IndexScript") { val loader = Thread.currentThread.getContextClassLoader val paths = loader.asInstanceOf[URLClassLoader].getURLs val morepaths = loader.getParent.asInstanceOf[URLClassLoader].getURLs - (paths ++ morepaths).map(_.getPath).mkString(java.io.File.pathSeparator) + (paths ++ morepaths).map(u => URLDecoder.decode(u.getPath)).mkString(java.io.File.pathSeparator) } val docFactory = { diff --git a/test/scaladoc/scala/IndexTest.scala b/test/scaladoc/scala/IndexTest.scala index 2d731643da..c14fd98297 100644 --- a/test/scaladoc/scala/IndexTest.scala +++ b/test/scaladoc/scala/IndexTest.scala @@ -3,7 +3,7 @@ import org.scalacheck.Prop._ import scala.tools.nsc.doc import scala.tools.nsc.doc.html.page.Index -import java.net.URLClassLoader +import java.net.{URLClassLoader, URLDecoder} object Test extends Properties("Index") { @@ -12,8 +12,8 @@ object Test extends Properties("Index") { // this test previously relied on the assumption that the current thread's classloader is an url classloader and contains all the classpaths // does partest actually guarantee this? to quote Leonard Nimoy: The answer, of course, is no. // this test _will_ fail again some time in the future. - val paths = Thread.currentThread.getContextClassLoader.asInstanceOf[URLClassLoader].getURLs.map(_.getPath) - val morepaths = Thread.currentThread.getContextClassLoader.getParent.asInstanceOf[URLClassLoader].getURLs.map(_.getPath) + val paths = Thread.currentThread.getContextClassLoader.asInstanceOf[URLClassLoader].getURLs.map(u => URLDecoder.decode(u.getPath)) + val morepaths = Thread.currentThread.getContextClassLoader.getParent.asInstanceOf[URLClassLoader].getURLs.map(u => URLDecoder.decode(u.getPath)) (paths ++ morepaths).mkString(java.io.File.pathSeparator) } diff --git a/test/scaladoc/scala/html/HtmlFactoryTest.scala b/test/scaladoc/scala/html/HtmlFactoryTest.scala index 9d40996799..916fe2e42f 100644 --- a/test/scaladoc/scala/html/HtmlFactoryTest.scala +++ b/test/scaladoc/scala/html/HtmlFactoryTest.scala @@ -1,7 +1,7 @@ import org.scalacheck._ import org.scalacheck.Prop._ -import java.net.URLClassLoader +import java.net.{URLClassLoader, URLDecoder} object XMLUtil { import scala.xml._ @@ -31,8 +31,8 @@ object Test extends Properties("HtmlFactory") { // this test previously relied on the assumption that the current thread's classloader is an url classloader and contains all the classpaths // does partest actually guarantee this? to quote Leonard Nimoy: The answer, of course, is no. // this test _will_ fail again some time in the future. - val paths = Thread.currentThread.getContextClassLoader.asInstanceOf[URLClassLoader].getURLs.map(_.getPath) - val morepaths = Thread.currentThread.getContextClassLoader.getParent.asInstanceOf[URLClassLoader].getURLs.map(_.getPath) + val paths = Thread.currentThread.getContextClassLoader.asInstanceOf[URLClassLoader].getURLs.map(u => URLDecoder.decode(u.getPath)) + val morepaths = Thread.currentThread.getContextClassLoader.getParent.asInstanceOf[URLClassLoader].getURLs.map(u => URLDecoder.decode(u.getPath)) (paths ++ morepaths).mkString(java.io.File.pathSeparator) } -- cgit v1.2.3