Working on making the bootstrap process transparent and consistent.

And removed a bunch of what is now cruft in partest.  No review.

git-svn-id: http://lampsvn.epfl.ch/svn-repos/scala/scala/trunk@20990 5e8d7ff9-d8ef-0310-90f0-a4852d11357a
This commit is contained in:
extempore 2010-02-25 18:24:58 +00:00
parent 1a6adc2409
commit 51136ada46
5 changed files with 69 additions and 84 deletions

View File

@ -257,10 +257,10 @@ INITIALISATION
<!-- Define tasks that can be run with Starr --> <!-- Define tasks that can be run with Starr -->
<path id="starr.classpath"> <path id="starr.classpath">
<pathelement location="${lib.starr.jar}"/> <pathelement location="${lib.starr.jar}"/>
<pathelement location="${lib.dir}/forkjoin.jar"/>
<pathelement location="${comp.starr.jar}"/> <pathelement location="${comp.starr.jar}"/>
<pathelement location="${lib.dir}/fjbg.jar"/> <pathelement location="${lib.dir}/fjbg.jar"/>
<pathelement location="${lib.dir}/msil.jar"/> <pathelement location="${lib.dir}/msil.jar"/>
<pathelement location="${lib.dir}/forkjoin.jar"/>
<pathelement location="${ant.jar}"/> <pathelement location="${ant.jar}"/>
</path> </path>
<taskdef resource="scala/tools/ant/sabbus/antlib.xml" classpathref="starr.classpath"/> <taskdef resource="scala/tools/ant/sabbus/antlib.xml" classpathref="starr.classpath"/>
@ -342,12 +342,12 @@ LOCAL REFERENCE BUILD (LOCKER)
<include name="**/*.scala"/> <include name="**/*.scala"/>
<compilationpath> <compilationpath>
<pathelement location="${build-locker.dir}/classes/library"/> <pathelement location="${build-locker.dir}/classes/library"/>
<pathelement location="${lib.dir}/forkjoin.jar"/>
<pathelement location="${build-locker.dir}/classes/compiler"/> <pathelement location="${build-locker.dir}/classes/compiler"/>
<pathelement location="${lib.dir}/fjbg.jar"/> <pathelement location="${lib.dir}/fjbg.jar"/>
<pathelement location="${lib.dir}/msil.jar"/> <pathelement location="${lib.dir}/msil.jar"/>
<pathelement location="${jline.jar}"/> <pathelement location="${lib.dir}/forkjoin.jar"/>
<pathelement location="${ant.jar}"/> <pathelement location="${ant.jar}"/>
<pathelement location="${jline.jar}"/>
</compilationpath> </compilationpath>
</scalacfork> </scalacfork>
<propertyfile file="${build-locker.dir}/classes/compiler/compiler.properties"> <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"/> <touch file="${build-locker.dir}/all.complete" verbose="no"/>
<path id="locker.classpath"> <path id="locker.classpath">
<pathelement location="${build-locker.dir}/classes/library"/> <pathelement location="${build-locker.dir}/classes/library"/>
<pathelement location="${lib.dir}/forkjoin.jar"/>
<pathelement location="${build-locker.dir}/classes/compiler"/> <pathelement location="${build-locker.dir}/classes/compiler"/>
<pathelement location="${lib.dir}/fjbg.jar"/> <pathelement location="${lib.dir}/fjbg.jar"/>
<pathelement location="${lib.dir}/msil.jar"/> <pathelement location="${lib.dir}/msil.jar"/>
<pathelement location="${lib.dir}/forkjoin.jar"/>
<pathelement location="${ant.jar}"/> <pathelement location="${ant.jar}"/>
</path> </path>
</target> </target>
@ -570,12 +570,12 @@ QUICK BUILD (QUICK)
<include name="**/*.scala"/> <include name="**/*.scala"/>
<compilationpath> <compilationpath>
<pathelement location="${build-quick.dir}/classes/library"/> <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="${fjbg.jar}"/>
<pathelement location="${msil.jar}"/> <pathelement location="${msil.jar}"/>
<pathelement location="${jline.jar}"/> <pathelement location="${forkjoin.jar}"/>
<pathelement location="${ant.jar}"/> <pathelement location="${ant.jar}"/>
<pathelement location="${jline.jar}"/>
</compilationpath> </compilationpath>
</scalacfork> </scalacfork>
<propertyfile file="${build-quick.dir}/classes/compiler/compiler.properties"> <propertyfile file="${build-quick.dir}/classes/compiler/compiler.properties">
@ -616,8 +616,8 @@ QUICK BUILD (QUICK)
<compilationpath> <compilationpath>
<pathelement location="${build-quick.dir}/classes/library"/> <pathelement location="${build-quick.dir}/classes/library"/>
<pathelement location="${build-quick.dir}/classes/compiler"/> <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/scalap"/>
<pathelement location="${build-quick.dir}/classes/partest"/>
<pathelement location="${ant.jar}"/> <pathelement location="${ant.jar}"/>
</compilationpath> </compilationpath>
</scalacfork> </scalacfork>
@ -684,11 +684,11 @@ QUICK BUILD (QUICK)
<target name="quick.bin" depends="quick.pre-bin" unless="quick.bin.available"> <target name="quick.bin" depends="quick.pre-bin" unless="quick.bin.available">
<path id="quick.bin.classpath"> <path id="quick.bin.classpath">
<pathelement location="${build-quick.dir}/classes/library"/> <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="${build-quick.dir}/classes/scalap"/> <pathelement location="${build-quick.dir}/classes/scalap"/>
<pathelement location="${fjbg.jar}"/> <pathelement location="${fjbg.jar}"/>
<pathelement location="${msil.jar}"/> <pathelement location="${msil.jar}"/>
<pathelement location="${forkjoin.jar}"/>
<pathelement location="${jline.jar}"/> <pathelement location="${jline.jar}"/>
</path> </path>
<taskdef name="quick-bin" classname="scala.tools.ant.ScalaTool" classpathref="quick.bin.classpath"/> <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"> <target name="quick.done" depends="quick.bin">
<path id="quick.classpath"> <path id="quick.classpath">
<pathelement location="${build-quick.dir}/classes/library"/> <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="${fjbg.jar}"/>
<pathelement location="${msil.jar}"/> <pathelement location="${msil.jar}"/>
<pathelement location="${forkjoin.jar}"/>
<pathelement location="${ant.jar}"/> <pathelement location="${ant.jar}"/>
</path> </path>
</target> </target>
@ -1013,12 +1013,12 @@ BOOTSTRAPPING BUILD (STRAP)
<include name="**/*.scala"/> <include name="**/*.scala"/>
<compilationpath> <compilationpath>
<pathelement location="${build-strap.dir}/classes/library"/> <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="${fjbg.jar}"/>
<pathelement location="${msil.jar}"/> <pathelement location="${msil.jar}"/>
<pathelement location="${jline.jar}"/> <pathelement location="${forkjoin.jar}"/>
<pathelement location="${ant.jar}"/> <pathelement location="${ant.jar}"/>
<pathelement location="${jline.jar}"/>
</compilationpath> </compilationpath>
</scalacfork> </scalacfork>
<propertyfile file="${build-strap.dir}/classes/compiler/compiler.properties"> <propertyfile file="${build-strap.dir}/classes/compiler/compiler.properties">
@ -1059,8 +1059,8 @@ BOOTSTRAPPING BUILD (STRAP)
<compilationpath> <compilationpath>
<pathelement location="${build-strap.dir}/classes/library"/> <pathelement location="${build-strap.dir}/classes/library"/>
<pathelement location="${build-strap.dir}/classes/compiler"/> <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/scalap"/>
<pathelement location="${build-strap.dir}/classes/partest"/>
<pathelement location="${ant.jar}"/> <pathelement location="${ant.jar}"/>
</compilationpath> </compilationpath>
</scalacfork> </scalacfork>
@ -1587,9 +1587,9 @@ STABLE REFERENCE (STARR)
<target name="starr.libs" depends="starr.src" if="libs.outdated"> <target name="starr.libs" depends="starr.src" if="libs.outdated">
<copy toDir="${lib.dir}" overwrite="yes"> <copy toDir="${lib.dir}" overwrite="yes">
<fileset dir="${build-libs.dir}"> <fileset dir="${build-libs.dir}">
<include name="forkjoin.jar"/>
<include name="fjbg.jar"/> <include name="fjbg.jar"/>
<include name="msil.jar"/> <include name="msil.jar"/>
<include name="forkjoin.jar"/>
</fileset> </fileset>
</copy> </copy>
</target> </target>

View File

@ -19,7 +19,6 @@ class AntRunner extends DirectRunner {
var JAVACMD: String = "java" var JAVACMD: String = "java"
var JAVAC_CMD: String = "javac" var JAVAC_CMD: String = "javac"
var CLASSPATH: String = _ var CLASSPATH: String = _
var EXT_CLASSPATH: String = _
var LATEST_LIB: String = _ var LATEST_LIB: String = _
val TESTROOT: String = "" val TESTROOT: String = ""
} }

View File

@ -21,10 +21,6 @@ import ClassPath.{ join }
import PathResolver.{ Environment, Defaults } import PathResolver.{ Environment, Defaults }
import RunnerUtils._ import RunnerUtils._
object ConsoleFileManager {
def testRootPropDir = Option(propOrElse("scalatest.root", null)) map (x => Directory(x))
}
import ConsoleFileManager._
class ConsoleFileManager extends FileManager { class ConsoleFileManager extends FileManager {
implicit private def temporaryPath2File(x: Path): File = x.jfile implicit private def temporaryPath2File(x: Path): File = x.jfile
@ -61,46 +57,18 @@ class ConsoleFileManager extends FileManager {
NestUI.verbose("CLASSPATH: "+CLASSPATH) NestUI.verbose("CLASSPATH: "+CLASSPATH)
val prefixDir = PartestDefaults.prefixDir getOrElse error("user.dir property not set") val prefixDir = PathSettings.prefixDir
val srcDirName = PartestDefaults.srcDirName
val PREFIX = prefixDir.toAbsolute.path val PREFIX = prefixDir.toAbsolute.path
val testRootDir = PathSettings.testRoot
/* val TESTROOT = testRootDir.toAbsolute.path
if [ -d "$PREFIX/test" ]; then def testParent = testRootDir.parent
TESTROOT="$PREFIX/test"; val srcDir = PathSettings.srcDir
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
if (!srcDir.isDirectory) { if (!srcDir.isDirectory) {
NestUI.failure("Source directory \"" + srcDir.path + "\" not found") NestUI.failure("Source directory \"" + srcDir.path + "\" not found")
exit(1) exit(1)
} }
LIB_DIR = (testParent / "lib").normalize.toAbsolute.path LIB_DIR = (testParent / "lib").normalize.toAbsolute.path
CLASSPATH = { CLASSPATH = {
@ -194,22 +162,11 @@ else
latestFjbgFile = prefixFile("lib/fjbg.jar") latestFjbgFile = prefixFile("lib/fjbg.jar")
} }
BIN_DIR = latestFile.getAbsolutePath
LATEST_LIB = latestLibFile.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_LIB: String = ""
var LATEST_COMP: String = ""
var LATEST_PARTEST: String = ""
var SCALA: String = ""
var SCALAC_CMD: String = ""
var latestFile: File = _ var latestFile: File = _
var latestLibFile: File = _ var latestLibFile: File = _

View File

@ -48,6 +48,7 @@ class ConsoleRunner extends DirectRunner {
private var testFiles: List[File] = List() private var testFiles: List[File] = List()
private val errors = PartestDefaults.errorCount private val errors = PartestDefaults.errorCount
private val testSetKinds = testSets map (_.kind)
private val testSetArgMap = testSets map (x => ("--" + x.loc) -> x) toMap private val testSetArgMap = testSets map (x => ("--" + x.loc) -> x) toMap
private val testSetArgs = testSets map ("--" + _.loc) private val testSetArgs = testSets map ("--" + _.loc)
def denotesTestSet(arg: String) = testSetArgs contains arg def denotesTestSet(arg: String) = testSetArgs contains arg
@ -175,25 +176,15 @@ class ConsoleRunner extends DirectRunner {
*/ */
def testCheckAll(enabledSets: List[TestSet]): (Int, Int) = { def testCheckAll(enabledSets: List[TestSet]): (Int, Int) = {
def runTestsFiles = if (!testFiles.isEmpty) { def runTestsFiles = if (!testFiles.isEmpty) {
def absName(f: File): String = f.getAbsoluteFile.getCanonicalPath def kindOf(f: File) = {
val srcDirSegments = PathSettings.srcDir.segments
def kindOf(f: File): String = { val segments = Path(f).normalize.toAbsolute.segments
val firstName = absName(f) lazy val kind = (segments drop srcDirSegments.size).head
val len = fileManager.srcDirName.length
val filesPos = firstName.indexOf(fileManager.srcDirName) if ((segments startsWith srcDirSegments) && (testSetKinds contains kind)) kind
if (filesPos == -1) { else {
NestUI.failure("invalid test file: "+firstName+"\n") NestUI.failure("invalid test file: "+f.getPath+"\n")
Predef.exit(1) 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"
}
} }
} }

View File

@ -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]
}