diff options
author | michelou <michelou@epfl.ch> | 2007-11-13 17:49:56 +0000 |
---|---|---|
committer | michelou <michelou@epfl.ch> | 2007-11-13 17:49:56 +0000 |
commit | 96f925078fdcf764e84f4691e6589004f09ca709 (patch) | |
tree | 007d4a188f8ccb80d58a6f81642d9b8f1fc730cd /src/partest | |
parent | bdc8a6a607b599a7292e55a45634f2177c77ee76 (diff) | |
download | scala-96f925078fdcf764e84f4691e6589004f09ca709.tar.gz scala-96f925078fdcf764e84f4691e6589004f09ca709.tar.bz2 scala-96f925078fdcf764e84f4691e6589004f09ca709.zip |
fixed partest, removed mergeLines (useless)
Diffstat (limited to 'src/partest')
5 files changed, 94 insertions, 14 deletions
diff --git a/src/partest/scala/tools/partest/MasterActor.scala b/src/partest/scala/tools/partest/MasterActor.scala index 90c081418f..8ead5e5ea8 100644 --- a/src/partest/scala/tools/partest/MasterActor.scala +++ b/src/partest/scala/tools/partest/MasterActor.scala @@ -6,7 +6,7 @@ ** |/ ** \* */ -// $Id: $ +// $Id$ package scala.tools.partest diff --git a/src/partest/scala/tools/partest/TestRunner.scala b/src/partest/scala/tools/partest/TestRunner.scala index 623b0ae28a..36c1d13722 100644 --- a/src/partest/scala/tools/partest/TestRunner.scala +++ b/src/partest/scala/tools/partest/TestRunner.scala @@ -6,7 +6,7 @@ ** |/ ** \* */ -// $Id: $ +// $Id$ package scala.tools.partest @@ -134,18 +134,24 @@ object TestRunner { private def printUsage { println("Usage: TestRunner [<options>] <testdir> [<resfile>]") - println(" --pos ...") - println(" --neg ...") - println(" --jvm ...") - println(" --run ...") + println(" --pos next files test a compilation success") + println(" --neg next files test a compilation failure") + println(" --jvm next files test the JVM backend") + println(" --run next files test the interpreter and all backends") println(" --shootout ...") println(" --conservative ...") println(" --verbose display progress information") + println(" --version output version information and exit") println println("Send bugs to <scala@listes.epfl.ch>") exit(1) } + private def printVersion { + println(util.Properties.versionMsg) + exit(0) + } + final def printVerbose(msg: String) { if (verbose) { printOutline("debug : ") @@ -166,6 +172,7 @@ object TestRunner { case "--shootout" => shootoutCheck = true case "--conservative" => conservative = true case "--verbose" => verbose = true + case "--version" => printVersion case _ => if (testDir eq null) { val dir = new File(arg) diff --git a/src/partest/scala/tools/partest/WorkerActor.scala b/src/partest/scala/tools/partest/WorkerActor.scala index d0cf133c82..a76a728f56 100644 --- a/src/partest/scala/tools/partest/WorkerActor.scala +++ b/src/partest/scala/tools/partest/WorkerActor.scala @@ -6,7 +6,7 @@ ** |/ ** \* */ -// $Id: $ +// $Id$ package scala.tools.partest @@ -53,6 +53,10 @@ class WorkerActor(val master: MasterActor, val settings: Settings, var reporter: dir.delete } + private val PATH_SEP = java.io.File.pathSeparatorChar + private val CLASSPATH = System.getProperty("CLASSPATH", "") + private val EXT_CLASSPATH = System.getProperty("JVMEXTCP", "") + def act() { var compiler = newGlobal val bufferSize = 1024 @@ -175,7 +179,11 @@ class WorkerActor(val master: MasterActor, val settings: Settings, var reporter: case _ => {} } - var classpath: List[URL] = outDir.toURL :: List((new File(test.dir)).toURL) ::: List.fromString(System.getProperty("CLASSPATH"), ':').map(x => (new File(x)).toURL) ::: List.fromString(System.getProperty("JVMEXTCP"), ':').map(x => (new File(x)).toURL) + var classpath: List[URL] = + outDir.toURL :: + List((new File(test.dir)).toURL) ::: + (List.fromString(CLASSPATH, PATH_SEP) map { x => (new File(x)).toURL }) ::: + (List.fromString(EXT_CLASSPATH, PATH_SEP) map { x => (new File(x)).toURL }) try { //println(this.toString + " " + "Launching test " + test.fileBase) @@ -230,13 +238,21 @@ class WorkerActor(val master: MasterActor, val settings: Settings, var reporter: case (_, NegTest(_)) => case (true, _) => result = true - var javaoptsFile = new File(test.dir, test.fileBase + ".javaopts") + //var javaoptsFile = new File(test.dir, test.fileBase + ".javaopts") //var javaNewOpts = (new BufferedFileReader(javaoptsFile)).readLine //if (javaoptsFile.exists && javaNewOpts != null) {} - //Use Runtime.exec to execute the compiled file and pipe the standard system out and the console out to the logfile - var cmd = "env JAVACMD=java JAVA_OPTS=-Djava.library.path="+test.dir+" "+System.getProperty("SCALA")+" -Dscalatest.lib="+System.getProperty("scalatest.lib")+" -Dscalatest.cwd="+test.dir+" -Dscalatest.output="+outDir+" -classpath "+outDir+":"+System.getProperty("CLASSPATH")+":"+System.getProperty("JVMEXTCP")+" Test jvm" - - //println(cmd) + //Use Runtime.exec to execute the compiled file and pipe the standard system + //out and the console out to the logfile + var cmd = + "env JAVACMD=java JAVA_OPTS=-Djava.library.path=\"" + test.dir + "\" " + + System.getProperty("SCALA")+ + " -Dscalatest.lib=\"" + System.getProperty("scalatest.lib") + "\" " + + "-Dscalatest.cwd=\"" + test.dir + "\" " + + "-Dscalatest.output=" + outDir + + " -classpath " + outDir + PATH_SEP + CLASSPATH + PATH_SEP + EXT_CLASSPATH + + " Test jvm" + + TestRunner.printVerbose("Worker command: " + cmd) var execution = Runtime.getRuntime.exec(cmd) diff --git a/src/partest/scala/tools/partest/utils/PrintMgr.scala b/src/partest/scala/tools/partest/utils/PrintMgr.scala index a47657d611..96ab7823ae 100644 --- a/src/partest/scala/tools/partest/utils/PrintMgr.scala +++ b/src/partest/scala/tools/partest/utils/PrintMgr.scala @@ -6,7 +6,7 @@ ** |/ ** \* */ -// $Id: $ +// $Id$ package scala.tools.partest.utils diff --git a/src/partest/scala/tools/partest/utils/Properties.scala b/src/partest/scala/tools/partest/utils/Properties.scala new file mode 100644 index 0000000000..3fd2a29575 --- /dev/null +++ b/src/partest/scala/tools/partest/utils/Properties.scala @@ -0,0 +1,57 @@ +/* __ *\ +** ________ ___ / / ___ Scala Parallel Testing ** +** / __/ __// _ | / / / _ | (c) 2007-2008, LAMP/EPFL ** +** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ ** +** /____/\___/_/ |_/____/_/ | | ** +** |/ ** +\* */ + +// $Id$ + +package scala.tools.partest.util + +/** A utility to load the library properties from a Java properties file + * included in the jar. + * + * @author Stephane Micheloud + */ +object Properties { + + /** The name of the properties file */ + private val propFilename = "/partest.properties" + + /** The loaded properties */ + private val props = { + val props = new java.util.Properties + val stream = classOf[Application].getResourceAsStream(propFilename) + if (stream != null) + props.load(stream) + props + } + + /** The version number of the jar this was loaded from, or + * "(unknown)" if it cannot be determined. + */ + val versionString: String = { + val defaultString = "(unknown)" + "version " + props.getProperty("version.number") + } + + val copyrightString: String = { + val defaultString = "(c) 2002-2007 LAMP/EPFL" + props.getProperty("copyright.string", defaultString) + } + + val encodingString: String = { + val defaultString = "ISO-8859-1" + props.getProperty("file.encoding", defaultString) + } + + private val writer = new java.io.PrintWriter(Console.err, true) + + val versionMsg = "Scala partest " + versionString + " -- " + copyrightString + + def main(args: Array[String]) { + writer.println(versionMsg) + } +} |