summaryrefslogtreecommitdiff
path: root/src/partest
diff options
context:
space:
mode:
authorPaul Phillips <paulp@improving.org>2010-04-06 23:57:11 +0000
committerPaul Phillips <paulp@improving.org>2010-04-06 23:57:11 +0000
commit9a8ba0c87747c50994c4465c04d6f65f23c77752 (patch)
treedd3869923b973aba457b49dcc69200399a7a1ae0 /src/partest
parentd5b8082ce9269f6657d6d3b5467f57fa746f7e76 (diff)
downloadscala-9a8ba0c87747c50994c4465c04d6f65f23c77752.tar.gz
scala-9a8ba0c87747c50994c4465c04d6f65f23c77752.tar.bz2
scala-9a8ba0c87747c50994c4465c04d6f65f23c77752.zip
And another partest gap is filled.
partest it really will use quick as the build dir. No review.
Diffstat (limited to 'src/partest')
-rw-r--r--src/partest/scala/tools/partest/BuildContributors.scala2
-rw-r--r--src/partest/scala/tools/partest/Config.scala14
-rw-r--r--src/partest/scala/tools/partest/Entities.scala2
-rw-r--r--src/partest/scala/tools/partest/Partest.scala5
-rw-r--r--src/partest/scala/tools/partest/PartestSpec.scala21
-rw-r--r--src/partest/scala/tools/partest/io/Logging.scala4
6 files changed, 30 insertions, 18 deletions
diff --git a/src/partest/scala/tools/partest/BuildContributors.scala b/src/partest/scala/tools/partest/BuildContributors.scala
index abd3bb318b..64c7e07bc3 100644
--- a/src/partest/scala/tools/partest/BuildContributors.scala
+++ b/src/partest/scala/tools/partest/BuildContributors.scala
@@ -48,7 +48,7 @@ trait BuildContributors {
* !!! TODO - this should adjust itself depending on the build
* being tested, because pack and quick at least need different jars.
*/
- def classpathPaths = List[Path](library, compiler, partest, fjbg)
+ def classpathPaths = List[Path](library, compiler, partest, fjbg) ++ forkJoinPath
def buildProperties = List(
"scala.home" -> testBuildDir,
"partest.lib" -> library, // used in jvm/inner
diff --git a/src/partest/scala/tools/partest/Config.scala b/src/partest/scala/tools/partest/Config.scala
index 8023574ae4..7d8bb80835 100644
--- a/src/partest/scala/tools/partest/Config.scala
+++ b/src/partest/scala/tools/partest/Config.scala
@@ -57,6 +57,20 @@ trait Config {
*/
val scalaBin = testBuildDir / "bin"
+ /** A hack for now to get quick running.
+ */
+ def needsForkJoin = {
+ val loader = nsc.util.ScalaClassLoader.fromURLs(List(library.toURL))
+ val fjMarker = "scala.concurrent.forkjoin.ForkJoinTask"
+ val clazz = loader.tryToLoadClass(fjMarker)
+
+ if (clazz.isDefined) debug("Loaded ForkJoinTask OK, don't need jar.")
+ else debug("Could not load ForkJoinTask, putting jar on classpath.")
+
+ clazz.isEmpty
+ }
+ lazy val forkJoinPath: List[Path] = if (needsForkJoin) List(forkjoin) else Nil
+
/** Internal **/
private def repo = partestDir.parent.normalize
// XXX - is this needed? Where?
diff --git a/src/partest/scala/tools/partest/Entities.scala b/src/partest/scala/tools/partest/Entities.scala
index ceed145148..658cfdee12 100644
--- a/src/partest/scala/tools/partest/Entities.scala
+++ b/src/partest/scala/tools/partest/Entities.scala
@@ -23,7 +23,7 @@ trait Entities {
def category: TestCategory
lazy val label = location.stripExtension
- lazy val testClasspath = createClasspathString()
+ lazy val testClasspath = returning(createClasspathString())(vtrace)
/** Was this test successful? Calling this for the first time forces
* lazy val "process" which actually runs the test.
diff --git a/src/partest/scala/tools/partest/Partest.scala b/src/partest/scala/tools/partest/Partest.scala
index b3580d0f1c..019ed270e5 100644
--- a/src/partest/scala/tools/partest/Partest.scala
+++ b/src/partest/scala/tools/partest/Partest.scala
@@ -15,10 +15,7 @@ import category.AllCategories
* for the complete list.
*/
class Partest(args: List[String]) extends {
- val parsed = new CommandLine(args, PartestSpecReference.unary, PartestSpecReference.binary) {
- override def onlyKnownOptions = true
- override def errorFn(msg: String) = printAndExit("Error: " + msg)
- }
+ val parsed = PartestSpecReference(args: _*)
} with Universe with PartestSpec with AllCategories {
debug("Partest object created with args: " + (args mkString " "))
diff --git a/src/partest/scala/tools/partest/PartestSpec.scala b/src/partest/scala/tools/partest/PartestSpec.scala
index a1f7d4ef28..a8a1d9b0cb 100644
--- a/src/partest/scala/tools/partest/PartestSpec.scala
+++ b/src/partest/scala/tools/partest/PartestSpec.scala
@@ -8,7 +8,7 @@ package partest
import Properties._
import nsc.io._
-import nsc.util.{ CommandLine, CommandLineSpec }
+import nsc.util.{ CommandLine, CommandLineSpec, CommandLineReferenceSpec }
/** This takes advantage of bits of scala goodness to fully define a command
* line program with a minimum of duplicated code. When the specification object
@@ -59,8 +59,8 @@ trait PartestSpec extends CommandLineSpec {
val javaOpts = "javaopts" / "flags to java on all runs (overrides JAVA_OPTS)" |> envOrElse("JAVA_OPTS", "")
val scalacOpts = "scalacopts" / "flags to scalac on all tests (overrides SCALAC_OPTS)" |> envOrElse("SCALAC_OPTS", "")
- ("pack" / "alias for --builddir build/pack") ?> setProp("partest.build", "build/pack")
- ("quick" / "alias for --builddir build/quick") ?> setProp("partest.build", "build/quick")
+ ("pack" / "alias for --builddir build/pack") ?+> List("--builddir", "build/pack")
+ ("quick" / "alias for --builddir build/quick") ?+> List("--builddir", "build/quick")
heading ("Options influencing output:")
val isTrace = "trace" / "show the individual steps taken by each test" ?
@@ -89,18 +89,15 @@ trait PartestSpec extends CommandLineSpec {
val isInsideAnt = ("is-in-ant" ?)
}
-object PartestSpecReference extends PartestSpec {
+object PartestSpecReference extends PartestSpec with CommandLineReferenceSpec {
import CommandLineSpec._
def parsed: CommandLine = null
- override def isReferenceSpec = true
-
- def unary = unaryOptions
- def binary = binaryOptions
- def allArgs = unary ++ binary
-
- def isunaryOption(s: String) = unary contains toOpt(s)
- def isbinaryOption(s: String) = binary contains toOpt(s)
+ override def creator(args: List[String]) =
+ new ThisCommandLine(args) {
+ override def onlyKnownOptions = true
+ override def errorFn(msg: String) = printAndExit("Error: " + msg)
+ }
def main(args: Array[String]): Unit = println(bashCompletion("partest"))
diff --git a/src/partest/scala/tools/partest/io/Logging.scala b/src/partest/scala/tools/partest/io/Logging.scala
index 2d67ac5ae4..3d1b0fa0b4 100644
--- a/src/partest/scala/tools/partest/io/Logging.scala
+++ b/src/partest/scala/tools/partest/io/Logging.scala
@@ -65,6 +65,10 @@ trait Logging {
def trace(msg: String) = if (isTrace || isDryRun) System.err.println(">> [%s] %s".format(label, msg))
def tracePath(path: Path) = if (isVerbose) path.path else path.name
+ /** v == verbose.
+ */
+ def vtrace(msg: String) = if (isVerbose) trace(msg)
+
/** Run body, writes result to logFile. Any throwable is
* caught, stringified, and written to the log.
*/