summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Phillips <paulp@improving.org>2010-02-25 18:24:58 +0000
committerPaul Phillips <paulp@improving.org>2010-02-25 18:24:58 +0000
commit10d7b668b9e73c3390a172096197299f59cc8c86 (patch)
treecc656a50d1c556a310daa219b6635c3bda65bb7a
parent6ca74641f0b21ec3dca91741d14dfaf94abc753b (diff)
downloadscala-10d7b668b9e73c3390a172096197299f59cc8c86.tar.gz
scala-10d7b668b9e73c3390a172096197299f59cc8c86.tar.bz2
scala-10d7b668b9e73c3390a172096197299f59cc8c86.zip
Working on making the bootstrap process transpa...
Working on making the bootstrap process transparent and consistent. And removed a bunch of what is now cruft in partest. No review.
-rw-r--r--build.xml30
-rw-r--r--src/partest/scala/tools/partest/nest/AntRunner.scala1
-rw-r--r--src/partest/scala/tools/partest/nest/ConsoleFileManager.scala53
-rw-r--r--src/partest/scala/tools/partest/nest/ConsoleRunner.scala27
-rw-r--r--src/partest/scala/tools/partest/nest/PathSettings.scala38
5 files changed, 67 insertions, 82 deletions
diff --git a/build.xml b/build.xml
index 87acbf7c45..acdb4281d4 100644
--- a/build.xml
+++ b/build.xml
@@ -257,10 +257,10 @@ INITIALISATION
<!-- Define tasks that can be run with Starr -->
<path id="starr.classpath">
<pathelement location="${lib.starr.jar}"/>
- <pathelement location="${lib.dir}/forkjoin.jar"/>
<pathelement location="${comp.starr.jar}"/>
<pathelement location="${lib.dir}/fjbg.jar"/>
<pathelement location="${lib.dir}/msil.jar"/>
+ <pathelement location="${lib.dir}/forkjoin.jar"/>
<pathelement location="${ant.jar}"/>
</path>
<taskdef resource="scala/tools/ant/sabbus/antlib.xml" classpathref="starr.classpath"/>
@@ -342,12 +342,12 @@ LOCAL REFERENCE BUILD (LOCKER)
<include name="**/*.scala"/>
<compilationpath>
<pathelement location="${build-locker.dir}/classes/library"/>
- <pathelement location="${lib.dir}/forkjoin.jar"/>
<pathelement location="${build-locker.dir}/classes/compiler"/>
<pathelement location="${lib.dir}/fjbg.jar"/>
<pathelement location="${lib.dir}/msil.jar"/>
- <pathelement location="${jline.jar}"/>
+ <pathelement location="${lib.dir}/forkjoin.jar"/>
<pathelement location="${ant.jar}"/>
+ <pathelement location="${jline.jar}"/>
</compilationpath>
</scalacfork>
<propertyfile file="${build-locker.dir}/classes/compiler/compiler.properties">
@@ -374,10 +374,10 @@ LOCAL REFERENCE BUILD (LOCKER)
<touch file="${build-locker.dir}/all.complete" verbose="no"/>
<path id="locker.classpath">
<pathelement location="${build-locker.dir}/classes/library"/>
- <pathelement location="${lib.dir}/forkjoin.jar"/>
<pathelement location="${build-locker.dir}/classes/compiler"/>
<pathelement location="${lib.dir}/fjbg.jar"/>
<pathelement location="${lib.dir}/msil.jar"/>
+ <pathelement location="${lib.dir}/forkjoin.jar"/>
<pathelement location="${ant.jar}"/>
</path>
</target>
@@ -570,12 +570,12 @@ QUICK BUILD (QUICK)
<include name="**/*.scala"/>
<compilationpath>
<pathelement location="${build-quick.dir}/classes/library"/>
- <pathelement location="${forkjoin.jar}"/>
- <pathelement location="${build-quick.dir}/classes/compiler"/>
+ <!-- <pathelement location="${build-quick.dir}/classes/compiler"/> -->
<pathelement location="${fjbg.jar}"/>
<pathelement location="${msil.jar}"/>
- <pathelement location="${jline.jar}"/>
+ <pathelement location="${forkjoin.jar}"/>
<pathelement location="${ant.jar}"/>
+ <pathelement location="${jline.jar}"/>
</compilationpath>
</scalacfork>
<propertyfile file="${build-quick.dir}/classes/compiler/compiler.properties">
@@ -616,8 +616,8 @@ QUICK BUILD (QUICK)
<compilationpath>
<pathelement location="${build-quick.dir}/classes/library"/>
<pathelement location="${build-quick.dir}/classes/compiler"/>
- <pathelement location="${build-quick.dir}/classes/partest"/>
<pathelement location="${build-quick.dir}/classes/scalap"/>
+ <pathelement location="${build-quick.dir}/classes/partest"/>
<pathelement location="${ant.jar}"/>
</compilationpath>
</scalacfork>
@@ -684,11 +684,11 @@ QUICK BUILD (QUICK)
<target name="quick.bin" depends="quick.pre-bin" unless="quick.bin.available">
<path id="quick.bin.classpath">
<pathelement location="${build-quick.dir}/classes/library"/>
- <pathelement location="${forkjoin.jar}"/>
<pathelement location="${build-quick.dir}/classes/compiler"/>
<pathelement location="${build-quick.dir}/classes/scalap"/>
<pathelement location="${fjbg.jar}"/>
<pathelement location="${msil.jar}"/>
+ <pathelement location="${forkjoin.jar}"/>
<pathelement location="${jline.jar}"/>
</path>
<taskdef name="quick-bin" classname="scala.tools.ant.ScalaTool" classpathref="quick.bin.classpath"/>
@@ -729,10 +729,10 @@ QUICK BUILD (QUICK)
<target name="quick.done" depends="quick.bin">
<path id="quick.classpath">
<pathelement location="${build-quick.dir}/classes/library"/>
- <pathelement location="${forkjoin.jar}"/>
<pathelement location="${build-quick.dir}/classes/compiler"/>
<pathelement location="${fjbg.jar}"/>
<pathelement location="${msil.jar}"/>
+ <pathelement location="${forkjoin.jar}"/>
<pathelement location="${ant.jar}"/>
</path>
</target>
@@ -1013,12 +1013,12 @@ BOOTSTRAPPING BUILD (STRAP)
<include name="**/*.scala"/>
<compilationpath>
<pathelement location="${build-strap.dir}/classes/library"/>
- <pathelement location="${forkjoin.jar}"/>
- <pathelement location="${build-strap.dir}/classes/compiler"/>
+ <!-- <pathelement location="${build-strap.dir}/classes/compiler"/> -->
<pathelement location="${fjbg.jar}"/>
<pathelement location="${msil.jar}"/>
- <pathelement location="${jline.jar}"/>
+ <pathelement location="${forkjoin.jar}"/>
<pathelement location="${ant.jar}"/>
+ <pathelement location="${jline.jar}"/>
</compilationpath>
</scalacfork>
<propertyfile file="${build-strap.dir}/classes/compiler/compiler.properties">
@@ -1059,8 +1059,8 @@ BOOTSTRAPPING BUILD (STRAP)
<compilationpath>
<pathelement location="${build-strap.dir}/classes/library"/>
<pathelement location="${build-strap.dir}/classes/compiler"/>
- <pathelement location="${build-strap.dir}/classes/partest"/>
<pathelement location="${build-strap.dir}/classes/scalap"/>
+ <pathelement location="${build-strap.dir}/classes/partest"/>
<pathelement location="${ant.jar}"/>
</compilationpath>
</scalacfork>
@@ -1586,9 +1586,9 @@ STABLE REFERENCE (STARR)
<target name="starr.libs" depends="starr.src" if="libs.outdated">
<copy toDir="${lib.dir}" overwrite="yes">
<fileset dir="${build-libs.dir}">
- <include name="forkjoin.jar"/>
<include name="fjbg.jar"/>
<include name="msil.jar"/>
+ <include name="forkjoin.jar"/>
</fileset>
</copy>
</target>
diff --git a/src/partest/scala/tools/partest/nest/AntRunner.scala b/src/partest/scala/tools/partest/nest/AntRunner.scala
index 9219ed3305..16a7141653 100644
--- a/src/partest/scala/tools/partest/nest/AntRunner.scala
+++ b/src/partest/scala/tools/partest/nest/AntRunner.scala
@@ -19,7 +19,6 @@ class AntRunner extends DirectRunner {
var JAVACMD: String = "java"
var JAVAC_CMD: String = "javac"
var CLASSPATH: String = _
- var EXT_CLASSPATH: String = _
var LATEST_LIB: String = _
val TESTROOT: String = ""
}
diff --git a/src/partest/scala/tools/partest/nest/ConsoleFileManager.scala b/src/partest/scala/tools/partest/nest/ConsoleFileManager.scala
index c5d67fb4e2..9c395c3d05 100644
--- a/src/partest/scala/tools/partest/nest/ConsoleFileManager.scala
+++ b/src/partest/scala/tools/partest/nest/ConsoleFileManager.scala
@@ -21,10 +21,6 @@ import ClassPath.{ join }
import PathResolver.{ Environment, Defaults }
import RunnerUtils._
-object ConsoleFileManager {
- def testRootPropDir = Option(propOrElse("scalatest.root", null)) map (x => Directory(x))
-}
-import ConsoleFileManager._
class ConsoleFileManager extends FileManager {
implicit private def temporaryPath2File(x: Path): File = x.jfile
@@ -61,46 +57,18 @@ class ConsoleFileManager extends FileManager {
NestUI.verbose("CLASSPATH: "+CLASSPATH)
- val prefixDir = PartestDefaults.prefixDir getOrElse error("user.dir property not set")
- val srcDirName = PartestDefaults.srcDirName
+ val prefixDir = PathSettings.prefixDir
val PREFIX = prefixDir.toAbsolute.path
-
-/*
-if [ -d "$PREFIX/test" ]; then
- TESTROOT="$PREFIX/test";
-elif [ -d "$PREFIX/misc/scala-test" ]; then
- TESTROOT="$PREFIX/misc/scala-test";
-else
- abort "Test directory not found";
-*/
-
- val testRootDir = {
- def isTestDir(d: Directory) = d.name == "test" && (d / "files" isDirectory)
-
- (
- testRootPropDir orElse (
- if (isTestDir(prefixDir)) Some(prefixDir) else None // cwd is `test`
- ) orElse (
- (prefixDir / "test") ifDirectory (x => x) // cwd is `test/..`
- ) orElse (
- (prefixDir / "misc" / "scala-test") ifDirectory (x => x)
- ) getOrElse (
- error("Test directory not found")
- )
- ).normalize
- }
- val TESTROOT = testRootDir.toAbsolute.path
-
- def testParent = testRootDir.parent
-
- val srcDir = (testRootDir / srcDirName).toDirectory
+ val testRootDir = PathSettings.testRoot
+ val TESTROOT = testRootDir.toAbsolute.path
+ def testParent = testRootDir.parent
+ val srcDir = PathSettings.srcDir
if (!srcDir.isDirectory) {
NestUI.failure("Source directory \"" + srcDir.path + "\" not found")
exit(1)
}
-
LIB_DIR = (testParent / "lib").normalize.toAbsolute.path
CLASSPATH = {
@@ -195,21 +163,10 @@ else
latestFjbgFile = prefixFile("lib/fjbg.jar")
}
- BIN_DIR = latestFile.getAbsolutePath
LATEST_LIB = latestLibFile.getAbsolutePath
- LATEST_COMP = latestCompFile.getAbsolutePath
- LATEST_PARTEST = latestPartestFile.getAbsolutePath
-
- SCALA = (latestFile / scalaCmd).toAbsolute.path
- SCALAC_CMD = (latestFile / scalacCmd).toAbsolute.path
}
- var BIN_DIR: String = ""
var LATEST_LIB: String = ""
- var LATEST_COMP: String = ""
- var LATEST_PARTEST: String = ""
- var SCALA: String = ""
- var SCALAC_CMD: String = ""
var latestFile: File = _
var latestLibFile: File = _
diff --git a/src/partest/scala/tools/partest/nest/ConsoleRunner.scala b/src/partest/scala/tools/partest/nest/ConsoleRunner.scala
index fd25a9c8f3..0020581301 100644
--- a/src/partest/scala/tools/partest/nest/ConsoleRunner.scala
+++ b/src/partest/scala/tools/partest/nest/ConsoleRunner.scala
@@ -48,6 +48,7 @@ class ConsoleRunner extends DirectRunner {
private var testFiles: List[File] = List()
private val errors = PartestDefaults.errorCount
+ private val testSetKinds = testSets map (_.kind)
private val testSetArgMap = testSets map (x => ("--" + x.loc) -> x) toMap
private val testSetArgs = testSets map ("--" + _.loc)
def denotesTestSet(arg: String) = testSetArgs contains arg
@@ -175,25 +176,15 @@ class ConsoleRunner extends DirectRunner {
*/
def testCheckAll(enabledSets: List[TestSet]): (Int, Int) = {
def runTestsFiles = if (!testFiles.isEmpty) {
- def absName(f: File): String = f.getAbsoluteFile.getCanonicalPath
-
- def kindOf(f: File): String = {
- val firstName = absName(f)
- val len = fileManager.srcDirName.length
- val filesPos = firstName.indexOf(fileManager.srcDirName)
- if (filesPos == -1) {
- NestUI.failure("invalid test file: "+firstName+"\n")
+ def kindOf(f: File) = {
+ val srcDirSegments = PathSettings.srcDir.segments
+ val segments = Path(f).normalize.toAbsolute.segments
+ lazy val kind = (segments drop srcDirSegments.size).head
+
+ if ((segments startsWith srcDirSegments) && (testSetKinds contains kind)) kind
+ else {
+ NestUI.failure("invalid test file: "+f.getPath+"\n")
Predef.exit(1)
- } else {
- val short = firstName drop (filesPos + len + 1) take 3
- val shortKinds = List("pos", "neg", "run", "jvm", "res")
- if (shortKinds contains short) short
- else short match {
- case "sho" => "shootout"
- case "scr" => "script"
- case "sca" => "scalacheck"
- case "bui" => "buildmanager"
- }
}
}
diff --git a/src/partest/scala/tools/partest/nest/PathSettings.scala b/src/partest/scala/tools/partest/nest/PathSettings.scala
new file mode 100644
index 0000000000..17461b3d4d
--- /dev/null
+++ b/src/partest/scala/tools/partest/nest/PathSettings.scala
@@ -0,0 +1,38 @@
+/* NEST (New Scala Test)
+ * Copyright 2007-2010 LAMP/EPFL
+ */
+
+package scala.tools.partest
+package nest
+
+import scala.tools.nsc.Properties.{ setProp, propOrEmpty, propOrNone, propOrElse }
+import scala.tools.nsc.util.ClassPath
+import scala.tools.nsc.io
+import io.{ Path, File, Directory }
+import RunnerUtils._
+import java.net.URLClassLoader
+
+object PathSettings {
+ private def isTestDirectory(d: Path) =
+ d.isDirectory && (d.name == "test") && (d / srcDirProperty isDirectory)
+
+ def testRootProperty = propOrNone("scalatest.root") map (x => Directory(x))
+ def srcDirProperty = propOrElse("partest.srcdir", "files")
+
+ // XXX temp
+ def prefixDir = Directory.Current getOrElse error("user.dir property not set")
+
+ lazy val testRoot: Directory = testRootProperty getOrElse {
+ // val cwd = Directory.Current getOrElse error("user.dir property not set")
+ val cwd = prefixDir
+ val candidates = (cwd :: cwd.parents) flatMap (d => List(d, d / "test"))
+
+ candidates find isTestDirectory map (_.toDirectory) getOrElse error("Directory 'test' not found.")
+ }
+
+ lazy val srcDir = Directory((testRoot / srcDirProperty).normalize.toAbsolute)
+}
+
+class PathSettings() {
+ // def classpathAsURLs: List[URL]
+}