summaryrefslogtreecommitdiff
path: root/src/partest
diff options
context:
space:
mode:
authorAntonio Cunei <antonio.cunei@epfl.ch>2010-04-12 07:44:39 +0000
committerAntonio Cunei <antonio.cunei@epfl.ch>2010-04-12 07:44:39 +0000
commitf31eaf606f2f1f524621dacd280abfccb9110f59 (patch)
treecb7aa7c227e526571a74b92b6b9471032dce4ba5 /src/partest
parent8ff235f9491a4a90969b494a32c1f55c69e2e0a8 (diff)
downloadscala-f31eaf606f2f1f524621dacd280abfccb9110f59.tar.gz
scala-f31eaf606f2f1f524621dacd280abfccb9110f59.tar.bz2
scala-f31eaf606f2f1f524621dacd280abfccb9110f59.zip
Merged revisions 21396,21401-21439,21441-21448,...
Merged revisions 21396,21401-21439,21441-21448,21450-21453,21455-21456,21459 via svnmerge from https://lampsvn.epfl.ch/svn-repos/scala/scala/trunk ........ r21396 | rytz | 2010-04-09 11:51:00 +0200 (Fri, 09 Apr 2010) | 1 line close #3207. review by odersky ........ r21401 | rytz | 2010-04-09 14:05:11 +0200 (Fri, 09 Apr 2010) | 1 line minor cleanup in build script. no review ........ r21402 | prokopec | 2010-04-09 14:25:37 +0200 (Fri, 09 Apr 2010) | 1 line Changes to docs of collections in the `immutable` package. Review by odersky. ........ r21403 | dragos | 2010-04-09 17:41:19 +0200 (Fri, 09 Apr 2010) | 1 line Implemented specialized subclassing for traits ........ r21404 | dragos | 2010-04-09 17:41:51 +0200 (Fri, 09 Apr 2010) | 2 lines More information on type skolems when browsing trees and logged normalized member. ........ r21405 | dragos | 2010-04-09 17:41:59 +0200 (Fri, 09 Apr 2010) | 1 line Special-cased 'isHigherKinded' for ThisTypes, in order to get around a CircularReference error. Reviewed by martin ........ r21406 | dragos | 2010-04-09 17:42:08 +0200 (Fri, 09 Apr 2010) | 1 line Made 'specialized' a printable flag. No review. ........ r21407 | dragos | 2010-04-09 17:42:16 +0200 (Fri, 09 Apr 2010) | 3 lines Fixed a cyclic error when specializing Option. Improved the term transformer to transitively rewrite specialized calls. ........ r21408 | dragos | 2010-04-09 17:42:24 +0200 (Fri, 09 Apr 2010) | 7 lines Companion objects of primitive types are now values. Term 'scala.Int' resolves in bytecode to an instance of 'scala.runtime.Int'. This is the first step towards replacing strings in @specialized with a proper list of types, so instead of @specialized("Int, Float") one will write @specialized(Int, Float). Review by odersky. ........ r21409 | dragos | 2010-04-09 17:42:34 +0200 (Fri, 09 Apr 2010) | 5 lines Changed the syntax of the specialized annotation: instead of a flaky string, it now takes a repeated parameter list of primitive types: @specialized("Int, Double") becomes @specialized(Int, Double). No review. ........ r21410 | dragos | 2010-04-09 17:42:53 +0200 (Fri, 09 Apr 2010) | 1 line New starr for primitive companion objects ........ r21411 | dragos | 2010-04-09 17:43:10 +0200 (Fri, 09 Apr 2010) | 3 lines Fixed retyping of singleton types, replacing invalid symbols by their updated symbols, as was done for type refs. ........ r21412 | dragos | 2010-04-09 17:43:18 +0200 (Fri, 09 Apr 2010) | 3 lines Changed default of 'keepsTypeParams' to true. All phases that may change type parameters have to explicitly override this method. ........ r21413 | dragos | 2010-04-09 17:43:27 +0200 (Fri, 09 Apr 2010) | 5 lines Changed TreeSymSubstituter from a traverser to transformer. It now aligns tree nodes that contain names to the symbol name that was substituted. Before this change identifiers may refer to one symbol, while the name they carry would resovlve to another one. ........ r21414 | dragos | 2010-04-09 17:43:35 +0200 (Fri, 09 Apr 2010) | 1 line Less logging unless '-Ydebug', refactorings. ........ r21415 | dragos | 2010-04-09 17:43:44 +0200 (Fri, 09 Apr 2010) | 4 lines Added a cast for alias replacement that caused code to be untypable. The optimization that replaced an overriding param field with its super field now downcasts when they don't have the same type. ........ r21416 | dragos | 2010-04-09 17:43:52 +0200 (Fri, 09 Apr 2010) | 3 lines Brought back stack traces in TypeError. This is essential when debugging any transformer. Review by extempore. ........ r21417 | dragos | 2010-04-09 17:44:03 +0200 (Fri, 09 Apr 2010) | 1 line New starr with the latest fixes to specialization. ........ r21418 | odersky | 2010-04-09 17:56:35 +0200 (Fri, 09 Apr 2010) | 1 line Fixed problem in scaladoc which did not expand variables in top-level classes. ........ r21419 | dragos | 2010-04-09 18:15:45 +0200 (Fri, 09 Apr 2010) | 1 line Fixed weird character that made its way while fixing merge conflicts. Sorry 'bout that. No review. ........ r21420 | odersky | 2010-04-09 18:22:02 +0200 (Fri, 09 Apr 2010) | 1 line Interrupted attempt to fix #2897. I am committing what I have because the refactorings improve things a little bit. To fix the ticket a frightening lot more has to be done. ........ r21421 | odersky | 2010-04-09 18:22:40 +0200 (Fri, 09 Apr 2010) | 1 line @inlined auxiliary typed methods to reduce stack pressure. ........ r21422 | dragos | 2010-04-09 19:10:33 +0200 (Fri, 09 Apr 2010) | 1 line Turn on specialization by default. No review. ........ r21423 | dubochet | 2010-04-09 19:17:47 +0200 (Fri, 09 Apr 2010) | 1 line [scaladoc] FIxed issue with wiki parser that prevented parsing of code blocks. Review by pedrofurla. ........ r21424 | prokopec | 2010-04-09 19:22:58 +0200 (Fri, 09 Apr 2010) | 1 line Work on mutable collections docs. Review by odersky. ........ r21425 | odersky | 2010-04-09 19:25:34 +0200 (Fri, 09 Apr 2010) | 1 line Updated documentation ........ r21426 | odersky | 2010-04-09 19:28:31 +0200 (Fri, 09 Apr 2010) | 1 line more docs ........ r21427 | odersky | 2010-04-09 19:29:00 +0200 (Fri, 09 Apr 2010) | 1 line fixed one more issue that prevented variables in companion objects to be expanded. ........ r21428 | dragos | 2010-04-09 19:36:33 +0200 (Fri, 09 Apr 2010) | 1 line Turn on specialization by default. No review. ........ r21429 | prokopec | 2010-04-09 19:41:15 +0200 (Fri, 09 Apr 2010) | 1 line MultiMap and WeakHashMap docs. no review ........ r21430 | extempore | 2010-04-09 21:07:40 +0200 (Fri, 09 Apr 2010) | 1 line Some tweaks to process to see if it'll fix auxjvm. No review. ........ r21431 | extempore | 2010-04-09 21:26:39 +0200 (Fri, 09 Apr 2010) | 1 line Fix test with new specialized output, no review. ........ r21432 | prokopec | 2010-04-09 23:00:41 +0200 (Fri, 09 Apr 2010) | 1 line Docs for MultiMap done. Review by community.p ........ r21433 | prokopec | 2010-04-10 00:09:47 +0200 (Sat, 10 Apr 2010) | 1 line Docs. No review. ........ r21434 | prokopec | 2010-04-10 14:39:48 +0200 (Sat, 10 Apr 2010) | 1 line docs. no review ........ r21435 | prokopec | 2010-04-10 17:20:46 +0200 (Sat, 10 Apr 2010) | 1 line More docs. No review. ........ r21436 | plocinic | 2010-04-10 22:56:07 +0200 (Sat, 10 Apr 2010) | 1 line Fix windows build. In partest we use UNIX file separators to verify the results. No review. ........ r21437 | prokopec | 2010-04-10 23:29:20 +0200 (Sat, 10 Apr 2010) | 1 line Docs. No review. ........ r21438 | extempore | 2010-04-11 02:32:00 +0200 (Sun, 11 Apr 2010) | 14 lines Introduces scala.tools.cmd providing command line tool infrastructure. For a quick look at what can be done, see scala.tools.cmd.Demo For a more involved, potentially eye-straining look, see scala.tools.partest.PartestSpec To experience it through the eyes of Joe Partest User, run test/partest Review by community. ........ r21439 | extempore | 2010-04-11 02:32:20 +0200 (Sun, 11 Apr 2010) | 6 lines Restores the passing of scalac.args and javac.args from ant to partest for use on all tests, which rytz had astutely pointed out I made disappear. Long term I think one ought to be able to specify different arguments for building the compiler and for partest, but now is not the moment for such grand ambition. No review. ........ r21441 | extempore | 2010-04-11 07:58:32 +0200 (Sun, 11 Apr 2010) | 2 lines Temporarily reverted r21421 so the build will build again and hopefully the auxjvm nightly will run. Review by odersky. ........ r21442 | extempore | 2010-04-11 17:45:08 +0200 (Sun, 11 Apr 2010) | 1 line Some overdue cleanups on Exception. Review by community. ........ r21443 | ilyas | 2010-04-11 17:56:55 +0200 (Sun, 11 Apr 2010) | 1 line ScalaSigPrinter fixed for multiline string values in annotations ........ r21444 | dubochet | 2010-04-11 18:28:16 +0200 (Sun, 11 Apr 2010) | 1 line [scaladoc] Refactors Paul's refactorings from r21353 to fit Scaladoc's design. No review. ........ r21445 | dubochet | 2010-04-11 18:28:39 +0200 (Sun, 11 Apr 2010) | 1 line [scaladoc] UI tweak: definition classes list is separated by a different arrow. No review. ........ r21446 | phaller | 2010-04-11 18:30:56 +0200 (Sun, 11 Apr 2010) | 1 line Completed scaladoc for Reactor and Combinators. ........ r21447 | dubochet | 2010-04-11 18:38:58 +0200 (Sun, 11 Apr 2010) | 1 line [scaladoc] Fixes efficiency issue in the way pages are generated. This issue can lead to the same page being generated a very large number of times and probably explains why building Scaladoc had been so slow previously. Donna helped identifying the issue, review by malayeri. ........ r21448 | phaller | 2010-04-11 19:43:54 +0200 (Sun, 11 Apr 2010) | 1 line Scaladoc clean-ups for various actor and channel types. Actor now extends InputChannel. Channel now extends CanReply. Review by plocinic. ........ r21450 | phaller | 2010-04-11 20:09:46 +0200 (Sun, 11 Apr 2010) | 1 line Made use of random number generator in ForkJoinScheduler's fair mode thread safe. Review by plocinic. ........ r21451 | dragos | 2010-04-11 20:51:45 +0200 (Sun, 11 Apr 2010) | 1 line Fixed some position issues and build manager test. No review. ........ r21452 | rytz | 2010-04-11 21:11:40 +0200 (Sun, 11 Apr 2010) | 1 line moved plugin folder back to 'misc/scala-devel/plugins'. moved bash completion to scala-tool-support (see r21449). include continuations in compiler sbaz package. replaced some tabs by spaces. review by extempore. ........ r21453 | extempore | 2010-04-11 21:45:08 +0200 (Sun, 11 Apr 2010) | 16 lines Added --update-check option to partest. Now you can automatically update all the checkfiles with whatever output the tests are producing. I suppose it goes without saying that this would be easy to misuse, so let the record show that I accept no responsibility when someone overwrites all the checkfiles in trunk with their shopping list and checks it in. Recommended usage: See some tests fail. Run partest --failed --show-diff Verify that all output differs in the expected fashion. Then run partest --failed --update-check Mission accomplished. No review. ........ r21455 | extempore | 2010-04-12 00:24:21 +0200 (Mon, 12 Apr 2010) | 2 lines Reverting r21442 the Exception patch because I think it is the cause of the deadlocking. Not my greatest weekend. No review. ........ r21456 | extempore | 2010-04-12 05:30:26 +0200 (Mon, 12 Apr 2010) | 1 line Disabled the test which is hanging the -optimise run. No review. ........ r21459 | extempore | 2010-04-12 08:46:53 +0200 (Mon, 12 Apr 2010) | 1 line Disabling some more tests which crash under -optimise. No review. ........
Diffstat (limited to 'src/partest')
-rw-r--r--src/partest/scala/tools/partest/Actions.scala24
-rw-r--r--src/partest/scala/tools/partest/Compilable.scala4
-rw-r--r--src/partest/scala/tools/partest/Config.scala3
-rw-r--r--src/partest/scala/tools/partest/Partest.scala14
-rw-r--r--src/partest/scala/tools/partest/PartestSpec.scala135
-rw-r--r--src/partest/scala/tools/partest/Runner.scala5
-rw-r--r--src/partest/scala/tools/partest/ant/JavaTask.scala12
-rw-r--r--src/partest/scala/tools/partest/ant/PartestTask.scala90
-rw-r--r--src/partest/scala/tools/partest/package.scala6
9 files changed, 103 insertions, 190 deletions
diff --git a/src/partest/scala/tools/partest/Actions.scala b/src/partest/scala/tools/partest/Actions.scala
index 3e745714cb..48b80cface 100644
--- a/src/partest/scala/tools/partest/Actions.scala
+++ b/src/partest/scala/tools/partest/Actions.scala
@@ -136,7 +136,7 @@ trait Actions {
/** The default cleanup normalizes paths relative to sourcesDir.
*/
- def diffCleanup(f: File) = safeLines(f) map normalizePaths mkString "\n"
+ def diffCleanup(f: File) = safeLines(f) map normalizePaths mkString ("", "\n", "\n")
/** If optional is true, a missing check file is considered
* a successful diff. Necessary since many categories use
@@ -146,19 +146,23 @@ trait Actions {
def arg1 = tracePath(check)
def arg2 = tracePath(log)
def noCheck = !check.exists && returning(true)(_ => trace("diff %s %s [unchecked]".format(arg1, arg2)))
+ def output = diffCleanup(log)
+ def matches = safeSlurp(check).trim == output.trim
+
+ def traceMsg =
+ if (isDryRun) "diff %s %s".format(arg1, arg2)
+ else "diff %s %s [%s]".format(arg1, arg2, (if (matches) "passed" else "failed"))
noCheck || {
- def result = safeSlurp(check).trim == diffCleanup(log).trim
- def msg = if (result) "passed" else "failed"
+ trace(traceMsg)
- if (isDryRun) {
- trace("diff %s %s".format(arg1, arg2))
+ isDryRun || matches || (isUpdateCheck && {
+ normal("** diff %s %s failed:\n".format(arg1, arg2))
+ normal(diffOutput())
+ normal("** updating %s and marking as passed.\n".format(arg1))
+ check writeAll output
true
- }
- else {
- trace("diff %s %s [%s]".format(arg1, arg2, msg))
- result
- }
+ })
}
}
diff --git a/src/partest/scala/tools/partest/Compilable.scala b/src/partest/scala/tools/partest/Compilable.scala
index a1d987ad6d..c11532f278 100644
--- a/src/partest/scala/tools/partest/Compilable.scala
+++ b/src/partest/scala/tools/partest/Compilable.scala
@@ -27,8 +27,10 @@ trait PartestCompilation {
// }
def javac(args: List[String]): Boolean = {
+ val allArgString = fromArgs(javacpArg :: javacOpts :: args)
+
// javac -d outdir -classpath <basepath> <files>
- val cmd = "%s -d %s %s %s".format(javacCmd, outDir, javacpArg, fromArgs(args))
+ val cmd = "%s -d %s %s".format(javacCmd, outDir, allArgString)
def traceMsg =
if (isVerbose) cmd
else "%s -d %s %s".format(tracePath(Path(javacCmd)), tracePath(outDir), fromArgs(args))
diff --git a/src/partest/scala/tools/partest/Config.scala b/src/partest/scala/tools/partest/Config.scala
index 7d8bb80835..288a3034e9 100644
--- a/src/partest/scala/tools/partest/Config.scala
+++ b/src/partest/scala/tools/partest/Config.scala
@@ -23,8 +23,6 @@ trait Config {
* run we only allocate one worker so the output isn't interspersed.
*/
def workerTimeout = 3600 // 1 hour, probably overly generous
- def testTimeout = testTimeout_ flatMap safeToInt getOrElse 900 // test timeout
- def testWarning = testWarning_ flatMap safeToInt getOrElse (testTimeout / 10) // test warning
def numWorkers = if (isDryRun) 1 else propOrElse("partest.actors", "8").toInt
def expectedErrors = propOrElse("partest.errors", "0").toInt
def poolSize = (wrapAccessControl(propOrNone("actors.corePoolSize")) getOrElse "16").toInt
@@ -121,6 +119,7 @@ trait Config {
"Java binaries in: " + javaBin,
"Java runtime is: " + javaInfoString,
"Java runtime options: " + (Process.javaVmArguments mkString " "),
+ "Javac options are: " + universe.javacOpts,
"Java options are: " + universe.javaOpts,
"Source directory is: " + src,
"Selected categories: " + (selectedCategories mkString " "),
diff --git a/src/partest/scala/tools/partest/Partest.scala b/src/partest/scala/tools/partest/Partest.scala
index 019ed270e5..d6adcc6053 100644
--- a/src/partest/scala/tools/partest/Partest.scala
+++ b/src/partest/scala/tools/partest/Partest.scala
@@ -6,7 +6,7 @@ package scala.tools
package partest
import nsc.io._
-import nsc.util.CommandLine
+import nsc.util._
import category.AllCategories
/** Global object for a Partest run. It is completely configured by the list
@@ -15,10 +15,15 @@ import category.AllCategories
* for the complete list.
*/
class Partest(args: List[String]) extends {
- val parsed = PartestSpecReference(args: _*)
-} with Universe with PartestSpec with AllCategories {
+ val parsed = PartestSpec(args: _*)
+} with Universe with PartestSpec with cmd.Instance with AllCategories {
- debug("Partest object created with args: " + (args mkString " "))
+ if (parsed.propertyArgs.nonEmpty)
+ debug("Partest property args: " + fromArgs(parsed.propertyArgs))
+
+ debug("Partest created with args: " + fromArgs(args))
+
+ def helpMsg = PartestSpec.helpMsg
// The abstract values from Universe.
lazy val testBuildDir = searchForDir(buildDir)
@@ -30,7 +35,6 @@ class Partest(args: List[String]) extends {
// Coarse validation of partest directory: holds a file called partest.
(partestDir / "partest").isFile || error("'%s' is not a valid partest directory." format partestDir)
- def runSets = toArgs(parsed.getOrElse("--runsets", ""))
def specifiedTests = parsed.residualArgs map (x => Path(x).normalize)
def specifiedKinds = testKinds filter (x => isSet(x) || (runSets contains x))
def specifiedCats = specifiedKinds flatMap (x => allCategories find (_.kind == x))
diff --git a/src/partest/scala/tools/partest/PartestSpec.scala b/src/partest/scala/tools/partest/PartestSpec.scala
index a8a1d9b0cb..50c82fb783 100644
--- a/src/partest/scala/tools/partest/PartestSpec.scala
+++ b/src/partest/scala/tools/partest/PartestSpec.scala
@@ -6,9 +6,8 @@
package scala.tools
package partest
-import Properties._
import nsc.io._
-import nsc.util.{ CommandLine, CommandLineSpec, CommandLineReferenceSpec }
+import cmd._
/** 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
@@ -16,93 +15,91 @@ import nsc.util.{ CommandLine, CommandLineSpec, CommandLineReferenceSpec }
* a private accumulator. What emerges is a full list of the valid unary
* and binary arguments, as well as autogenerated help.
*/
-trait PartestSpec extends CommandLineSpec {
- override def isPassthroughProperty(key: String) = key == "partest.options"
- override def isSysPropOption(key: String) = {
- val segments = (key split '.').toList
- if (segments.size == 2 && segments.head == "partest") Some(segments.last)
- else None
- }
-
- private var _testKinds: List[String] = Nil
- private def kind(s: String) = returning(s)(_testKinds +:= _)
+trait PartestSpec extends Spec with Meta.StdOpts with Interpolation {
+ def referenceSpec = PartestSpec
+ def programInfo = Spec.Names("partest", "scala.tools.partest.Runner")
+ private val kind = new Spec.Accumulator[String]()
+ protected def testKinds = kind.get
- def testKinds = _testKinds
- def versionMsg = Properties.versionMsg
+ private implicit val tokenizeString = FromString.ArgumentsFromString // String => List[String]
help("""
+ |# Pro Tip! Instant bash completion: `partest --bash` (note backticks)
|Usage: partest [<options>] [<test> <test> ...]
| <test>: a path to a test designator, typically a .scala file or a directory.
- | Examples: files/pos/test1.scala, files/res/bug785""")
-
- heading ("Test categories:")
- val isAll = ("all" / "run all tests (default, unless no options given)" ?)
- (kind("pos") / "Compile files that are expected to build" ?)
- (kind("neg") / "Compile files that are expected to fail" ?)
- (kind("run") / "Test JVM backend" ?)
- (kind("jvm") / "Test JVM backend" ?)
- (kind("res") / "Run resident compiler scenarii" ?)
- (kind("buildmanager") / "Run Build Manager scenarii" ?)
- (kind("scalacheck") / "Run Scalacheck tests" ?)
- (kind("script") / "Run script files" ?)
- (kind("shootout") / "Run shootout tests" ?)
- (kind("scalap") / "Run scalap tests" ?)
+ | Examples: files/pos/test1.scala, files/res/bug785
+ |
+ | Test categories:""".stripMargin)
+
+ val isAll = ("all" / "run all tests (default, unless no options given)" --?)
+ (kind("pos") / "Compile files that are expected to build" --?)
+ (kind("neg") / "Compile files that are expected to fail" --?)
+ (kind("run") / "Test JVM backend" --?)
+ (kind("jvm") / "Test JVM backend" --?)
+ (kind("res") / "Run resident compiler scenarii" --?)
+ (kind("buildmanager") / "Run Build Manager scenarii" --?)
+ (kind("scalacheck") / "Run Scalacheck tests" --?)
+ (kind("script") / "Run script files" --?)
+ (kind("shootout") / "Run shootout tests" --?)
+ (kind("scalap") / "Run scalap tests" --?)
heading ("""Test "smart" categories:""")
- val grepExpr = "grep" / "run all tests with a source file containing <expr>" >>
- val isFailed = "failed" / "run all tests which failed on the last run" ?
+ val grepExpr = "grep" / "run all tests with a source file containing <expr>" --|
+ val isFailed = "failed" / "run all tests which failed on the last run" --?
heading ("Specifying paths and additional flags, ~ means repository root:")
- val rootDir = "rootdir" / "path from ~ to partest (default: test)" |> "test"
- val buildDir = "builddir" / "path from ~ to test build (default: build/pack)" |> "build/pack"
- val srcDir = "srcdir" / "path from --rootdir to sources (default: files)" |> "files"
- 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") ?+> List("--builddir", "build/pack")
- ("quick" / "alias for --builddir build/quick") ?+> List("--builddir", "build/quick")
+ val rootDir = "rootdir" / "path from ~ to partest" defaultTo "test"
+ val buildDir = "builddir" / "path from ~ to test build" defaultTo "build/pack"
+ val srcDir = "srcdir" / "path from --rootdir to sources" defaultTo "files"
+ val javaOpts = "javaopts" / "flags to java on all runs" defaultToEnv "JAVA_OPTS"
+ val javacOpts = "javacopts" / "flags to javac on all runs" defaultToEnv "JAVAC_OPTS"
+ val scalacOpts = "scalacopts" / "flags to scalac on all tests" defaultToEnv "SCALAC_OPTS"
+
+ "pack" / "" expandTo ("--builddir", "build/pack")
+ "quick" / "" expandTo ("--builddir", "build/quick")
heading ("Options influencing output:")
- val isTrace = "trace" / "show the individual steps taken by each test" ?
- val isShowDiff = "show-diff" / "show diff between log and check file" ?
- val isShowLog = "show-log" / "show log on failures" ?
- val isDryRun = "dry-run" / "do not run tests, only show their traces." ?
- val isTerse = "terse" / "be less verbose (almost silent except for failures)" ?
- val isVerbose = "verbose" / "be more verbose (additive with --trace)" ?
- val isDebug = "debug" / "maximum debugging output" ?
- val isAnsi = "ansi" / "print output in color" ?
+ val isTrace = "trace" / "show the individual steps taken by each test" --?
+ val isShowDiff = "show-diff" / "show diff between log and check file" --?
+ val isShowLog = "show-log" / "show log on failures" --?
+ val isDryRun = "dry-run" / "do not run tests, only show their traces." --?
+ val isTerse = "terse" / "be less verbose (almost silent except for failures)" --?
+ val isVerbose = "verbose" / "be more verbose (additive with --trace)" --?
+ val isDebug = "debug" / "maximum debugging output" --?
+ val isAnsi = "ansi" / "print output in color" --?
heading ("Other options:")
- val timeout_ = "timeout" / "Overall timeout in seconds" |> "14400"
- val testWarning_ = "test-warning" / "Test warning in seconds" >> ; // defaults to testTimeout / 10
- val testTimeout_ = "test-timeout" / "Test timeout in seconds" >> ; // defaults to 900
- val isCleanup = "cleanup" / "delete all stale files and dirs before run" ?
- val isNoCleanup = "nocleanup" / "do not delete any logfiles or object dirs" ?
- val isStats = "stats" / "collect and print statistics about the tests" ?
- val isValidate = "validate" / "examine test filesystem for inconsistencies" ?
- val isVersion = "version" / "print version" ?
+ val timeout = "timeout" / "Overall timeout in seconds" defaultTo 14400
+ val testWarning = "test-warning" / "Test warning in seconds" defaultTo 90
+ val testTimeout = "test-timeout" / "Test timeout in seconds" defaultTo 900
+ val isCleanup = "cleanup" / "delete all stale files and dirs before run" --?
+ val isNoCleanup = "nocleanup" / "do not delete any logfiles or object dirs" --?
+ val isStats = "stats" / "collect and print statistics about the tests" --?
+ val isValidate = "validate" / "examine test filesystem for inconsistencies" --?
+ val isUpdateCheck = "update-check" / "overwrite checkFile if diff fails" --?
+
+ "version" / "print version" --> runAndExit(println(Properties.versionMsg))
// no help for anything below this line - secret options
// mostly intended for property configuration.
- val runsets = "runsets" |> ""
- val isNoAlarms = ("noalarms" ?)
- val isInsideAnt = ("is-in-ant" ?)
+ val runSets = ("runsets" --^) getOrElse Nil
+ val isNoAlarms = "noalarms" --?
+ val isInsideAnt = "is-in-ant" --?
}
-object PartestSpecReference extends PartestSpec with CommandLineReferenceSpec {
- import CommandLineSpec._
+object PartestSpec extends PartestSpec with Property {
+ lazy val propMapper = new PropertyMapper(PartestSpec) {
+ override def isPassThrough(key: String) = key == "partest.options"
+ }
- def parsed: CommandLine = null
- override def creator(args: List[String]) =
- new ThisCommandLine(args) {
- override def onlyKnownOptions = true
- override def errorFn(msg: String) = printAndExit("Error: " + msg)
- }
+ type ThisCommandLine = PartestCommandLine
+ class PartestCommandLine(args: List[String]) extends SpecCommandLine(args) {
+ override def onlyKnownOptions = true
+ override def errorFn(msg: String) = printAndExit("Error: " + msg)
- def main(args: Array[String]): Unit = println(bashCompletion("partest"))
+ def propertyArgs = PartestSpec.propertyArgs
+ }
- /** Append bash completion for partest to the given file.
- */
- def appendCompletionTo(f: File) = f appendAll bashCompletion("partest")
+ override def creator(args: List[String]): PartestCommandLine = new PartestCommandLine(args)
}
-
diff --git a/src/partest/scala/tools/partest/Runner.scala b/src/partest/scala/tools/partest/Runner.scala
index 7f67c93478..1a28e60896 100644
--- a/src/partest/scala/tools/partest/Runner.scala
+++ b/src/partest/scala/tools/partest/Runner.scala
@@ -9,13 +9,10 @@ package partest
import nsc.io._
object Runner {
- def main(mainArgs: Array[String]) {
- val propArgs = PartestSpecReference.sysPropsAsOptions()
- val args = (propArgs ++ mainArgs).toList
+ def main(args: Array[String]) {
val runner = Partest(args: _*)
import runner._
- if (isVersion) return println(versionMsg)
if (args.isEmpty) return println(helpMsg)
if (isValidate) return validateAll()
diff --git a/src/partest/scala/tools/partest/ant/JavaTask.scala b/src/partest/scala/tools/partest/ant/JavaTask.scala
index 0bebf91368..6740554dd8 100644
--- a/src/partest/scala/tools/partest/ant/JavaTask.scala
+++ b/src/partest/scala/tools/partest/ant/JavaTask.scala
@@ -12,19 +12,21 @@ package ant
import org.apache.tools.ant.Task
import org.apache.tools.ant.taskdefs.Java
-import org.apache.tools.ant.types.{ EnumeratedAttribute, Commandline, Environment, PropertySet }
+import org.apache.tools.ant.types.Environment
import scala.tools.nsc.io._
-import scala.tools.nsc.util.{ ClassPath, CommandLineSpec }
-import CommandLineSpec._
+import scala.tools.nsc.util.ClassPath
+import cmd.Spec._
class JavaTask extends Java {
override def getTaskName() = "partest"
private val scalaRunnerClass = "scala.tools.nsc.MainGenericRunner"
+ private val partestRunnerClass = "scala.tools.partest.Runner"
+ def defaultJvmArgs = "-Xms64M -Xmx768M -Xss768K -XX:MaxPermSize=96M"
protected def rootDir = prop("partest.rootdir") getOrElse (baseDir / "test").path
- protected def partestJVMArgs = prop("partest.jvm.args") getOrElse "-Xms64M -Xmx768M -Xss768K -XX:MaxPermSize=96M"
- protected def runnerArgs = List("-usejavacp", "scala.tools.partest.Runner", "--javaopts", partestJVMArgs)
+ protected def partestJVMArgs = prop("partest.jvm.args") getOrElse defaultJvmArgs
+ protected def runnerArgs = List("-usejavacp", partestRunnerClass, "--javaopts", partestJVMArgs)
private def baseDir = Directory(getProject.getBaseDir)
private def prop(s: String) = Option(getProject getProperty s)
diff --git a/src/partest/scala/tools/partest/ant/PartestTask.scala b/src/partest/scala/tools/partest/ant/PartestTask.scala
deleted file mode 100644
index 65848fabb0..0000000000
--- a/src/partest/scala/tools/partest/ant/PartestTask.scala
+++ /dev/null
@@ -1,90 +0,0 @@
-/* __ *\
-** ________ ___ / / ___ Scala Parallel Testing **
-** / __/ __// _ | / / / _ | (c) 2007-2010, LAMP/EPFL **
-** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ **
-** /____/\___/_/ |_/____/_/ | | **
-** |/ **
-\* */
-
-/**** Note -- this isn't used anymore, but I left it in for the moment. ****/
-
-package scala.tools
-package partest
-package ant
-
-import java.io.{ File => JFile }
-
-import org.apache.tools.ant.Task
-import org.apache.tools.ant.types.{ Reference, FileSet}
-
-import scala.reflect.BeanProperty
-import scala.tools.ant.sabbus.CompilationPathProperty
-import scala.tools.nsc.io
-import scala.tools.nsc.util.CommandLineSpec._
-
-class PartestTask extends Task with CompilationPathProperty {
- /** Used only in ant task */
- @BeanProperty protected var errorOnFailed: Boolean = _
- @BeanProperty protected var jUnitReportDir: JFile = _
-
- /** Propagated to partest run via system properties */
- @BeanProperty protected var debug: Boolean = _
- @BeanProperty protected var javaOpts: String = _
- @BeanProperty protected var partestOpts: String = _
- @BeanProperty protected var runSets: String = _
- @BeanProperty protected var scalacOpts: String = _
- @BeanProperty protected var showDiff: Boolean = _
- @BeanProperty protected var showLog: Boolean = _
- @BeanProperty protected var srcDir: String = _
- @BeanProperty protected var timeout: Int = _
-
- /** Translating ant information into command line arguments. */
- private def notEmpty(s: String) = s != null && s.length > 0
- private def quoted(s: String) = if (s exists (_.isWhitespace)) "\"" + s.trim + "\"" else s
- private def optionCollection = List[(Boolean, () => List[String])](
- debug -> (() => List("--debug")),
- showLog -> (() => List("--show-log")),
- showDiff -> (() => List("--show-diff")),
- (timeout > 0) -> (() => List("--timeout", timeout.toString)),
- notEmpty(javaOpts) -> (() => List("--javaopts", javaOpts)),
- notEmpty(scalacOpts) -> (() => List("--scalacopts", scalacOpts)),
- notEmpty(srcDir) -> (() => List("--srcdir", srcDir)),
- notEmpty(partestOpts) -> (() => toArgs(partestOpts))
- )
-
- private def antPropOrNone(name: String) = Option(getProject getProperty name)
- private def antPropsToCommandLine() = {
- setProp("partest.isInAnt", "true")
- val partestDir = antPropOrNone("partest.dir") getOrElse error("Mandatory attribute 'partest.dir' is not set.")
-
- val root = List("--rootdir", io.Path(partestDir).path)
- val opts = optionCollection collect { case (true, f) => f() } flatten
- val sets = Option(runSets).toList flatMap toArgs map toOpt
-
- root ++ opts ++ sets
- }
- private def antRunTests() = {
- val args = antPropsToCommandLine()
- val runner = Partest(args: _*)
- import runner._
-
- normal("Ant options translate to command line: partest " + fromArgs(args))
- printConfigBanner()
-
- val result = launchTestSuite()
- val msg = result.toString
-
- if (result.hasFailures && errorOnFailed) error(msg)
- else log(msg)
- }
-
- override def execute() {
- try antRunTests()
- catch {
- case x =>
- System.err.println("Uncaught exception %s in partest ant ask: aborting." format x)
- x.printStackTrace()
- throw x
- }
- }
-}
diff --git a/src/partest/scala/tools/partest/package.scala b/src/partest/scala/tools/partest/package.scala
index 3ef4db7cd8..f6d216e379 100644
--- a/src/partest/scala/tools/partest/package.scala
+++ b/src/partest/scala/tools/partest/package.scala
@@ -5,7 +5,6 @@
package scala.tools
import nsc.io.{ File, Path, Process, Directory }
-import nsc.util.CommandLineSpec
import java.nio.charset.CharacterCodingException
package object partest {
@@ -18,13 +17,12 @@ package object partest {
private[partest] def safeLines(f: File) = safeSlurp(f) split """\r\n|\r|\n""" toList
private[partest] def safeArgs(f: File) = toArgs(safeSlurp(f))
- private[partest] def safeToInt(s: String) = try Some(s.toInt) catch { case _: NumberFormatException => None }
private[partest] def isJava(f: Path) = f.isFile && (f hasExtension "java")
private[partest] def isScala(f: Path) = f.isFile && (f hasExtension "scala")
private[partest] def isJavaOrScala(f: Path) = isJava(f) || isScala(f)
- private[partest] def toArgs(line: String) = CommandLineSpec toArgs line
- private[partest] def fromArgs(args: List[String]) = CommandLineSpec fromArgs args
+ private[partest] def toArgs(line: String) = cmd toArgs line
+ private[partest] def fromArgs(args: List[String]) = cmd fromArgs args
/** Strings, argument lists, etc. */