summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/compiler/scala/tools/nsc/io/Process.scala6
-rw-r--r--src/partest/scala/tools/partest/PartestTask.scala2
-rw-r--r--src/partest/scala/tools/partest/nest/CompileManager.scala4
-rw-r--r--src/partest/scala/tools/partest/nest/ConsoleFileManager.scala87
-rw-r--r--src/partest/scala/tools/partest/nest/ConsoleRunner.scala4
-rw-r--r--src/partest/scala/tools/partest/nest/DirectRunner.scala11
-rw-r--r--src/partest/scala/tools/partest/nest/ReflectiveRunner.scala18
-rw-r--r--src/partest/scala/tools/partest/nest/Worker.scala27
-rw-r--r--src/partest/scala/tools/partest/package.scala33
-rwxr-xr-xtools/quickcp5
-rwxr-xr-xtools/strapcp5
11 files changed, 126 insertions, 76 deletions
diff --git a/src/compiler/scala/tools/nsc/io/Process.scala b/src/compiler/scala/tools/nsc/io/Process.scala
index 66ed123658..8297ab8d4d 100644
--- a/src/compiler/scala/tools/nsc/io/Process.scala
+++ b/src/compiler/scala/tools/nsc/io/Process.scala
@@ -34,7 +34,11 @@ import java.util.concurrent.LinkedBlockingQueue
object Process
{
- lazy val javaVmArguments = java.lang.management.ManagementFactory.getRuntimeMXBean().getInputArguments()
+ def javaVmArguments: List[String] = {
+ import collection.JavaConversions._
+
+ java.lang.management.ManagementFactory.getRuntimeMXBean().getInputArguments().toList
+ }
lazy val runtime = Runtime.getRuntime()
class Pipe[T](xs: Seq[T], stringify: T => String) {
diff --git a/src/partest/scala/tools/partest/PartestTask.scala b/src/partest/scala/tools/partest/PartestTask.scala
index ffcd7e4b59..45f1ebc2f1 100644
--- a/src/partest/scala/tools/partest/PartestTask.scala
+++ b/src/partest/scala/tools/partest/PartestTask.scala
@@ -165,7 +165,7 @@ class PartestTask extends Task {
private def getScalapFiles = getFiles(scalapFiles)
override def execute() {
- if (debug)
+ if (isPartestDebug)
System.setProperty("partest.debug", "true")
if (classpath.isEmpty)
diff --git a/src/partest/scala/tools/partest/nest/CompileManager.scala b/src/partest/scala/tools/partest/nest/CompileManager.scala
index 9535b35c95..3ef5a0f723 100644
--- a/src/partest/scala/tools/partest/nest/CompileManager.scala
+++ b/src/partest/scala/tools/partest/nest/CompileManager.scala
@@ -45,9 +45,9 @@ class DirectCompiler(val fileManager: FileManager) extends SimpleCompiler {
settings.deprecation.value = true
settings.nowarnings.value = false
settings.encoding.value = "iso-8859-1"
+ settings.classpath.value += fileManager.LATEST_LIB
// XXX
- settings.javabootclasspath.value =
- ClassPath.join(Seq(PathResolver.Environment.javaBootClassPath, fileManager.LATEST_LIB))
+ // settings.javabootAppend.value = fileManager.LATEST_LIB
settings
}
diff --git a/src/partest/scala/tools/partest/nest/ConsoleFileManager.scala b/src/partest/scala/tools/partest/nest/ConsoleFileManager.scala
index eeb7f96342..cd5023573b 100644
--- a/src/partest/scala/tools/partest/nest/ConsoleFileManager.scala
+++ b/src/partest/scala/tools/partest/nest/ConsoleFileManager.scala
@@ -11,24 +11,24 @@ package nest
import java.io.{ File, FilenameFilter, IOException, StringWriter }
import java.net.URI
import scala.tools.util.PathResolver
-import scala.tools.nsc.io.{ Path }
+import scala.tools.nsc.io
+import io.{ Path, Directory }
import File.pathSeparator
class ConsoleFileManager extends FileManager {
+ implicit private def tempPathConversion(x: Path): File = x.jfile
- var testBuild = System.getProperty("scalatest.build")
- var testClasses: Option[String] = None
+ var testBuild: Option[String] = Option(System.getProperty("scalatest.build"))
+ def testBuildFile = testBuild map (testParent / _)
- val debug: Boolean =
- (System.getProperty("partest.debug", "false") equals "true") ||
- (System.getProperty("scalatest.debug", "false") equals "true")
+ var testClasses: Option[String] = None
def this(buildPath: String, rawClasses: Boolean) = {
this()
if (rawClasses)
testClasses = Some(buildPath)
else
- testBuild = buildPath
+ testBuild = Some(buildPath)
// re-run because initialization of default
// constructor must be updated
findLatest()
@@ -43,7 +43,7 @@ class ConsoleFileManager extends FileManager {
SCALAC_OPTS = SCALAC_OPTS+" "+moreOpts
}
- var CLASSPATH = PathResolver.Environment.javaUserClassPath match { case "" => "." ; case x => x }
+ var CLASSPATH = PathResolver.Environment.javaUserClassPath
NestUI.verbose("CLASSPATH: "+CLASSPATH)
@@ -93,23 +93,17 @@ else
}
val TESTROOT = testRootFile.getAbsolutePath
+ def testParent = Path(testRootFile).parent
+
var srcDirName: String = ""
- val srcDir: File = {
- val srcDirProp = System.getProperty("partest.srcdir")
- val src =
- if (srcDirProp != null) {
- srcDirName = srcDirProp
- new File(testRootFile, srcDirName)
- } else {
- srcDirName = "files"
- new File(testRootFile, srcDirName)
- }
- if (src.isDirectory)
- src.getCanonicalFile
+ val srcDir: io.Directory = {
+ srcDirName = Option(System.getProperty("partest.srcdir")) getOrElse "files"
+ val src = Path(testRootFile) / srcDirName
+
+ if (src.isDirectory) src.toDirectory
else {
- val path = TESTROOT + File.separator + "files"
- NestUI.failure("Source directory \"" + path + "\" not found")
+ NestUI.failure("Source directory \"" + src.path + "\" not found")
exit(1)
}
}
@@ -117,38 +111,35 @@ else
LIB_DIR = (Path(testRootFile.getParentFile) / "lib").normalize.toAbsolute.path
CLASSPATH = {
- val libs = (Path(srcDir) / "lib").toDirectory.files filter (_ hasExtension "jar") map (_.normalize.toAbsolute.path)
+ val libs = (srcDir / Directory("lib")).files filter (_ hasExtension "jar") map (_.normalize.toAbsolute.path)
// add all jars in libs
(CLASSPATH :: libs.toList) mkString pathSeparator
}
def findLatest() {
- val testParent = testRootFile.getParentFile
NestUI.verbose("test parent: "+testParent)
- def prefixFileWith(parent: File, relPath: String): File =
- (new File(parent, relPath)).getCanonicalFile
-
- def prefixFile(relPath: String): File =
- prefixFileWith(testParent, relPath)
+ def prefixFileWith(parent: File, relPath: String) = (io.File(parent) / relPath).normalize
+ def prefixFile(relPath: String) = (testParent / relPath).normalize
if (!testClasses.isEmpty) {
- testClassesFile = (new File(testClasses.get)).getCanonicalFile
- NestUI.verbose("Running with classes in "+testClassesFile)
- latestFile = prefixFileWith(testClassesFile.getParentFile, "bin")
- latestLibFile = prefixFileWith(testClassesFile, "library")
- latestCompFile = prefixFileWith(testClassesFile, "compiler")
- latestPartestFile = prefixFileWith(testClassesFile, "partest")
- latestFjbgFile = prefixFile("lib/fjbg.jar")
+ testClassesDir = Path(testClasses.get).normalize.toDirectory
+ NestUI.verbose("Running with classes in "+testClassesDir)
+
+ latestFile = testClassesDir.parent / "bin"
+ latestLibFile = testClassesDir / "library"
+ latestCompFile = testClassesDir / "compiler"
+ latestPartestFile = testClassesDir / "partest"
+ latestFjbgFile = testParent / "lib" / "fjbg.jar"
}
- else if (testBuild != null) {
- testBuildFile = prefixFile(testBuild)
- NestUI.verbose("Running on "+testBuild)
- latestFile = prefixFile(testBuild+"/bin")
- latestLibFile = prefixFile(testBuild+"/lib/scala-library.jar")
- latestCompFile = prefixFile(testBuild+"/lib/scala-compiler.jar")
- latestPartestFile = prefixFile(testBuild+"/lib/scala-partest.jar")
+ else if (testBuild.isDefined) {
+ val dir = Path(testBuild.get)
+ NestUI.verbose("Running on "+dir)
+ latestFile = dir / "bin"
+ latestLibFile = dir / "lib/scala-library.jar"
+ latestCompFile = dir / "lib/scala-compiler.jar"
+ latestPartestFile = dir / "lib/scala-partest.jar"
}
else {
def setupQuick() {
@@ -184,10 +175,10 @@ else
latestPartestFile = prefixFile("build/pack/lib/scala-partest.jar")
}
- val dists = new File(testParent, "dists")
- val build = new File(testParent, "build")
+ val dists = testParent / "dists"
+ val build = testParent / "build"
// in case of an installed dist, testRootFile is one level deeper
- val bin = new File(testParent.getParentFile, "bin")
+ val bin = testParent.parent / "bin"
def mostRecentOf(base: String, names: String*) =
names map (x => prefixFile(base + "/" + x).lastModified) reduceLeft (_ max _)
@@ -237,14 +228,14 @@ else
var latestCompFile: File = _
var latestPartestFile: File = _
var latestFjbgFile: File = _
- var testBuildFile: File = _
- var testClassesFile: File = _
+ var testClassesDir: Directory = _
// initialize above fields
findLatest()
var testFiles: List[File] = List()
def getFiles(kind: String, doCheck: Boolean, filter: Option[(String, Boolean)]): List[File] = {
+
val dir = new File(srcDir, kind)
NestUI.verbose("look in "+dir+" for tests")
val files = if (dir.isDirectory) {
diff --git a/src/partest/scala/tools/partest/nest/ConsoleRunner.scala b/src/partest/scala/tools/partest/nest/ConsoleRunner.scala
index 12b4d0a038..373da5e3db 100644
--- a/src/partest/scala/tools/partest/nest/ConsoleRunner.scala
+++ b/src/partest/scala/tools/partest/nest/ConsoleRunner.scala
@@ -127,7 +127,7 @@ class ConsoleRunner extends DirectRunner with RunnerUtils {
val dir =
if (!fileManager.testClasses.isEmpty)
- fileManager.testClassesFile
+ fileManager.testClassesDir
else if (fileManager.testBuild != null)
fileManager.testBuildFile
else
@@ -144,7 +144,7 @@ class ConsoleRunner extends DirectRunner with RunnerUtils {
NestUI.outline("Java binaries in: "+vmBin+"\n")
NestUI.outline("Java runtime is: "+vmName+"\n")
NestUI.outline("Java options are: "+vmOpts+"\n")
- NestUI.outline("Source directory is: "+fileManager.srcDir.getAbsolutePath+"\n")
+ NestUI.outline("Source directory is: "+fileManager.srcDir.path+"\n")
val start = System.currentTimeMillis
diff --git a/src/partest/scala/tools/partest/nest/DirectRunner.scala b/src/partest/scala/tools/partest/nest/DirectRunner.scala
index 43d2882628..0853a9a84b 100644
--- a/src/partest/scala/tools/partest/nest/DirectRunner.scala
+++ b/src/partest/scala/tools/partest/nest/DirectRunner.scala
@@ -22,8 +22,7 @@ trait DirectRunner {
private val numActors = Integer.parseInt(System.getProperty("scalatest.actors", "8"))
- if ((System.getProperty("partest.debug", "false") equals "true") ||
- (System.getProperty("scalatest.debug", "false") equals "true"))
+ if (isPartestDebug)
scala.actors.Debug.level = 3
private val coreProp = try {
@@ -67,9 +66,11 @@ trait DirectRunner {
results = results + ("worker timed out; adding failed test" -> 2)
}
}
- for (x <- logsToDelete ::: outdirsToDelete) {
- NestUI.verbose("deleting "+x)
- Directory(x).deleteRecursively()
+ if (!isPartestDebug) {
+ for (x <- logsToDelete ::: outdirsToDelete) {
+ NestUI.verbose("deleting "+x)
+ Directory(x).deleteRecursively()
+ }
}
results
diff --git a/src/partest/scala/tools/partest/nest/ReflectiveRunner.scala b/src/partest/scala/tools/partest/nest/ReflectiveRunner.scala
index af8a368489..77c9291a4b 100644
--- a/src/partest/scala/tools/partest/nest/ReflectiveRunner.scala
+++ b/src/partest/scala/tools/partest/nest/ReflectiveRunner.scala
@@ -9,6 +9,8 @@ package scala.tools.partest
package nest
import scala.tools.nsc.util.ClassPath
+import scala.tools.nsc.io
+import io.Path
/* This class is used to load an instance of DirectRunner using
* a custom class loader.
@@ -30,6 +32,9 @@ class ReflectiveRunner extends RunnerUtils {
def main(args: String) {
val argList = (args.split("\\s")).toList
+ if (isPartestDebug)
+ showAllJVMInfo
+
// find out which build to test
val buildPath = searchPath("--buildpath", argList)
val classPath = searchPath("--classpath", argList)
@@ -46,21 +51,24 @@ class ReflectiveRunner extends RunnerUtils {
import fileManager.
{ latestCompFile, latestLibFile, latestPartestFile, latestFjbgFile }
val files =
- Array(latestCompFile, latestLibFile, latestPartestFile, latestFjbgFile)
+ Array(latestCompFile, latestLibFile, latestPartestFile, latestFjbgFile) map (x => io.File(x))
- val sepUrls = files map { _.toURI.toURL }
+ val sepUrls = files map (_.toURL)
val sepLoader = new URLClassLoader(sepUrls, null)
- if (fileManager.debug)
+ if (isPartestDebug)
println("Loading classes from:\n" + sepUrls.mkString("\n"))
- val paths = (if (classPath.isEmpty) files.slice(0, 4) else files) map { _.getPath }
+ val paths = classPath match {
+ case Some(cp) => Nil
+ case _ => files.toList map (_.path)
+ }
val newClasspath = ClassPath join paths
syspropset("java.class.path", newClasspath)
syspropset("scala.home", "")
- if (fileManager.debug)
+ if (isPartestDebug)
for (prop <- List("java.class.path", "sun.boot.class.path", "java.ext.dirs"))
println(prop + ": " + sysprop(prop))
diff --git a/src/partest/scala/tools/partest/nest/Worker.scala b/src/partest/scala/tools/partest/nest/Worker.scala
index 19fa35cdeb..b21f2c603b 100644
--- a/src/partest/scala/tools/partest/nest/Worker.scala
+++ b/src/partest/scala/tools/partest/nest/Worker.scala
@@ -247,23 +247,30 @@ class Worker(val fileManager: FileManager) extends Actor {
//
// debug: Found javaopts file 'files/shootout/message.scala-2.javaopts', using options: '-Xss32k'
// debug: java -Xss32k -Xss2m -Xms256M -Xmx1024M -classpath [...]
- val cmd = List(
- JAVACMD,
- JAVA_OPTS,
- argString,
- "-classpath " + join(Seq(outDir.toString, CLASSPATH)),
+ val propertyOptions = List(
"-Djava.library.path="+logFile.getParentFile.getAbsolutePath,
"-Dscalatest.output="+outDir.getAbsolutePath,
"-Dscalatest.lib="+LATEST_LIB,
"-Dscalatest.cwd="+outDir.getParent,
"-Djavacmd="+JAVACMD,
- "-Duser.language=en -Duser.country=US",
- "scala.tools.nsc.MainGenericRunner",
- "Test",
- "jvm"
+ "-Duser.language=en -Duser.country=US"
+ ) ::: (
+ if (isPartestDebug) List("-Dpartest.debug=true") else Nil
+ )
+
+ val cmd = (
+ List(
+ JAVACMD,
+ JAVA_OPTS,
+ argString,
+ "-classpath " + join(Seq(outDir.toString, CLASSPATH))
+ ) ::: propertyOptions ::: List(
+ "scala.tools.nsc.MainGenericRunner",
+ "Test",
+ "jvm"
+ )
) mkString " "
- NestUI.verbose(cmd)
runCommand(cmd, logFile)
if (fileManager.showLog) {
diff --git a/src/partest/scala/tools/partest/package.scala b/src/partest/scala/tools/partest/package.scala
new file mode 100644
index 0000000000..017974c232
--- /dev/null
+++ b/src/partest/scala/tools/partest/package.scala
@@ -0,0 +1,33 @@
+/* NEST (New Scala Test)
+ * Copyright 2007-2010 LAMP/EPFL
+ */
+
+package scala.tools
+
+package object partest {
+ import nest.NestUI
+
+ def showVMArgs {
+ import scala.tools.nsc.io.Process
+
+ val str = Process.javaVmArguments mkString " "
+ NestUI.verbose("Java VM started with arguments: '%s'" format str)
+ }
+
+ def showAllProperties {
+ import collection.JavaConversions._
+ for ((k, v) <- System.getProperties.toList.sorted) {
+ NestUI.verbose("%s -> %s".format(k, v))
+ }
+ }
+
+ def showAllJVMInfo {
+ showVMArgs
+ showAllProperties
+ }
+
+ def isPartestDebug = {
+ (System.getProperty("partest.debug") == "true") ||
+ (System.getProperty("scalatest.debug") == "true")
+ }
+} \ No newline at end of file
diff --git a/tools/quickcp b/tools/quickcp
index 9d7ff8dfb0..0bfcad1941 100755
--- a/tools/quickcp
+++ b/tools/quickcp
@@ -2,4 +2,7 @@
#
THISDIR=`dirname $0`
-${THISDIR}/cpof ${THISDIR}/../build/quick/classes
+cp=`${THISDIR}/cpof ${THISDIR}/../build/quick/classes`
+fjbg=`${THISDIR}/abspath ${THISDIR}/../lib/fjbg.jar`
+
+echo ${cp}:${fjbg}
diff --git a/tools/strapcp b/tools/strapcp
index 87e6ef720e..61e4a61b2c 100755
--- a/tools/strapcp
+++ b/tools/strapcp
@@ -2,4 +2,7 @@
#
THISDIR=`dirname $0`
-${THISDIR}/cpof ${THISDIR}/../build/strap/classes
+cp=`${THISDIR}/cpof ${THISDIR}/../build/strap/classes`
+fjbg=`${THISDIR}/abspath ${THISDIR}/../lib/fjbg.jar`
+
+echo ${cp}:${fjbg}