summaryrefslogtreecommitdiff
path: root/src/partest
diff options
context:
space:
mode:
authorAntonio Cunei <antonio.cunei@epfl.ch>2010-04-07 13:59:44 +0000
committerAntonio Cunei <antonio.cunei@epfl.ch>2010-04-07 13:59:44 +0000
commitc64117400e17cceb1b6e489167a71261297a7b4c (patch)
treeb942bbc7350b26f202312f0ba35f942b197d0618 /src/partest
parent88bcc5c05b3abca7c2f09c59cbeceff0ab892fca (diff)
downloadscala-c64117400e17cceb1b6e489167a71261297a7b4c.tar.gz
scala-c64117400e17cceb1b6e489167a71261297a7b4c.tar.bz2
scala-c64117400e17cceb1b6e489167a71261297a7b4c.zip
Merged revisions 20582,20586,20597-20603,20607-...
Merged revisions 20582,20586,20597-20603,20607-20615,20619,20623-20625,20629-20631,20634- 20635,20639-20640,20644-20646,20649-20651,20654-20664,20672-20673,20675- 20678,20681-20683,20687-20690,20692-20693,20704-20705,20707,20710-20714, 20716,20718,20720,20723-20724,20727-20730,20734-20735,20738-20740,20744- 20745,20748,20750-20753,20756-20757,20761,20763,20767-20769,20771-20772, 20776-20781,20783,20785,20787-20791,20793-20798,20802-20803,20805-20807, 20812,20816,20818,20826,20828-20832,20834-20835,20840,20842-20844,20849- 20852,20854-20858,20862-20864,20866-20867,20869,20872-20874,20878-20881, 20884-20889,20894-20901,20905-20909,20911-20913,20917-20918,20920-20922, 20928-20929,20932-20938,20941-20942,20944-20945,20949-20970,20972-20974, 20976-21001,21003-21024,21027-21029,21031,21043-21045,21053-21054,21058- 21060,21062-21068,21071,21073-21081,21083-21088,21091-21094,21098-21103, 21105-21111,21113,21115,21121,21123-21131,21135-21142,21148-21151,21156- 21160,21162-21165,21167-21168,21171,21174-21181,21184,21186-21190,21193, 21195-21196,21199-21201,21205-21207,21210,21214-21220,21222-21250,21252- 21254,21256-21266,21269,21271,21273-21276,21278-21292,21294-21297,21299, 21303-21305,21307,21309,21313,21322-21333,21341-21351,21353-21354,21356 via svnmerge from https://lampsvn.epfl.ch/svn-repos/scala/scala/trunk ........ r20582 | extempore | 2010-01-18 22:18:36 +0100 (Mon, 18 Jan 2010) | 3 lines More work consolidating the XML code needlessly duplicated between the compiler and the library. Having to fix #2354 in two completely different places was I found very motivating. ........ r20586 | extempore | 2010-01-19 04:15:07 +0100 (Tue, 19 Jan 2010) | 14 lines Digging into why the repl is so slow, discovered that fsc is once again never reusing compiler instances (but for a different reason than #1683.) Small changes break equality and the little troopers are so darn quiet about it. Steady state, hot fsc repl startup times before this patch: 0m1.747s 0m1.789s 0m1.842s 0m1.690s After this patch: 0m1.139s 0m1.148s 0m1.090s 0m1.091s No review. Could use a test case but I have trouble coaxing partest this far outside the box. ........ r20597 | dubochet | 2010-01-19 11:52:43 +0100 (Tue, 19 Jan 2010) | 1 line [scaladoc] Search tool will ignore case for lowercase-only queries. Type return when search tool is active to immediately search and display the first result. Contributed by Johannes Rudolph. Also: removed useless `DocProvider` class. No review, checked by dubochet. ........ r20598 | dragos | 2010-01-19 14:21:03 +0100 (Tue, 19 Jan 2010) | 2 lines Fixed isClosureClass in inliner and removed it from CopyPropagation (was dead code). See #2893. ........ r20599 | odersky | 2010-01-19 17:44:20 +0100 (Tue, 19 Jan 2010) | 1 line more performance improvements; eliminated mk...Type function in Types. ........ r20600 | extempore | 2010-01-19 19:04:23 +0100 (Tue, 19 Jan 2010) | 2 lines Added test to pending with extensive exploration of behaviors of instanceOf as compared with type matching. ........ r20601 | extempore | 2010-01-19 19:24:29 +0100 (Tue, 19 Jan 2010) | 2 lines Iterators created with duplicate compare equal if they are positioned at the same element. Review by community. ........ r20602 | extempore | 2010-01-19 20:28:17 +0100 (Tue, 19 Jan 2010) | 4 lines Until now all scala builds performed not in an svn tree were given no version number, because the version was extracted from "svn info". Now it tries git style if svn info is unrevealing. Review by community. ........ r20603 | extempore | 2010-01-19 20:41:41 +0100 (Tue, 19 Jan 2010) | 1 line Test case for #2148. Closes #2148, no review. ........ r20607 | extempore | 2010-01-20 01:27:53 +0100 (Wed, 20 Jan 2010) | 5 lines Made some cosmetic but clarity-increasing changes to a few files. Primarily, used corresponds where possible rather than zipped.forall. Added isImplicit and isJava to MethodType so the relevant subtypes could be determined without the hideous isInstanceOf checks. Review by odersky. ........ r20608 | extempore | 2010-01-20 01:28:09 +0100 (Wed, 20 Jan 2010) | 1 line Fix for #2927. No review. ........ r20609 | extempore | 2010-01-20 03:36:37 +0100 (Wed, 20 Jan 2010) | 1 line Un-overloaded StringLike.format. Closes #2898. No review. ........ r20610 | extempore | 2010-01-20 03:36:51 +0100 (Wed, 20 Jan 2010) | 1 line Removed some debugging echoes I let slip through. ........ r20611 | extempore | 2010-01-20 05:38:32 +0100 (Wed, 20 Jan 2010) | 2 lines Took a slightly different tack on parsing the svn version. No review. ........ r20612 | extempore | 2010-01-20 06:50:37 +0100 (Wed, 20 Jan 2010) | 6 lines No longer are there more IDE-specific junk files in the root directory of the official scala repository than actual scala files and directories put together. It's a truly awful first impression to give potential developers so I'm interpreting the non-response regarding the need for them as quiet encouragement to put them in src/intellij. Review by ilyas. ........ r20613 | extempore | 2010-01-20 06:50:51 +0100 (Wed, 20 Jan 2010) | 2 lines Bringing README up to date and filling in some of the info gaps. Review by cunei. ........ r20614 | extempore | 2010-01-20 06:51:12 +0100 (Wed, 20 Jan 2010) | 4 lines Removed static state from global object ClassPath object, and some minor repositioning while in there. Closes #2928, but the intentions behind -optimise being intertwined with ClassPath could really use some source comments. Review by rytz. ........ r20615 | milessabin | 2010-01-20 10:12:10 +0100 (Wed, 20 Jan 2010) | 1 line Renamed new bin directory to "tools" to avoid conflict with Eclipse incremental build output directory. ........ r20619 | rytz | 2010-01-20 11:55:56 +0100 (Wed, 20 Jan 2010) | 1 line fixed bugs in .NET bytecode generation (branching out of try / catch / finally blocks is not allowed). predef.dll now almost passes PEVerify. no review ........ r20623 | dubochet | 2010-01-20 15:41:58 +0100 (Wed, 20 Jan 2010) | 1 line [scaladoc] Default values of parameters are documented. Tags "@author", "@see", "@since", "@version", and "@deprecated" are displayed in documentation. Contributed by Pedro Furlanetto, checked by dubochet, no review. ........ r20624 | plocinic | 2010-01-20 18:15:49 +0100 (Wed, 20 Jan 2010) | 1 line Closes #2653, #2652, #2556. The last one required more sophisticated mechanism for detecting invalid references to inherited members, but at least it doesn't seem to cause unnecessary recompilations. ........ r20625 | odersky | 2010-01-20 19:29:13 +0100 (Wed, 20 Jan 2010) | 2 lines Attempt to fix #2926 (companion object of case class problem in Eclipse) ........ r20629 | odersky | 2010-01-21 20:27:39 +0100 (Thu, 21 Jan 2010) | 1 line Fix for #2867 undone, review by extempore. ........ r20630 | extempore | 2010-01-21 21:52:32 +0100 (Thu, 21 Jan 2010) | 1 line Moved test case for just-reverted patch to pending. No review. ........ r20631 | extempore | 2010-01-21 22:00:08 +0100 (Thu, 21 Jan 2010) | 17 lines It's a big REPL patch. And it contains: * Eliminated a bug which was causing all repl lines to be parsed twice * Removed reference to JLine from InterpreterLoop which was causing someone trouble in eclipse * Enriched the repl compile/reflect mechanism to allow retrieving the value as well as the String describing it * Utilized said enrichment to write an eval[T] method which is exposed in the repl in :power mode * Added ability to turn off string unwrapping in repl: settings.unwrapStrings = false * Created interface presently called Completion.Special which lets objects define their own contents * As minor demonstration of above, in :power mode variable "repl" implements Special and completes with all repl identifiers * As more interesting demonstration of above, try a repl session like... import scala.tools.nsc.interpreter.Completion.Special import scala.tools.nsc.io.Process val connections = new Special { def tabCompletions() = Process("netstat -p tcp").toList drop 2 map (_ split "\\s+" apply 4) } connections.<tab> Review by community! ........ r20634 | odersky | 2010-01-22 17:50:55 +0100 (Fri, 22 Jan 2010) | 1 line Second attempt to fix #2926. Reverted first attempt. review by milessabin. ........ r20635 | rytz | 2010-01-22 17:55:23 +0100 (Fri, 22 Jan 2010) | 1 line fix several issues in .net backend / type parsing. allow re-building forkjoin.jar separately. no review ........ r20639 | odersky | 2010-01-23 18:44:20 +0100 (Sat, 23 Jan 2010) | 2 lines Closes 2926. Review by milesabin. ........ r20640 | extempore | 2010-01-23 21:30:01 +0100 (Sat, 23 Jan 2010) | 9 lines Another big REPL patch. Lacking the time right now to write a proper commit message, I will just say it adds a couple of pretty frabjous features, in addition to cleaning up a whole bunch of questionable code. * Tab-completion now chains through intermediate results on fields and 0-arg methods * You can now define custom Completors which define their own contents. Details and demos to come in a wiki document about the repl. ........ r20644 | extempore | 2010-01-24 01:31:38 +0100 (Sun, 24 Jan 2010) | 2 lines Some minor polishing to the previous repl completion patch, plus a few new features and improvements. ........ r20645 | odersky | 2010-01-24 16:05:46 +0100 (Sun, 24 Jan 2010) | 2 lines renamed notCompiles ==> canRedefine. Made code completion more robust. ........ r20646 | extempore | 2010-01-24 16:19:55 +0100 (Sun, 24 Jan 2010) | 1 line Removing a stray paren to unbreak build. No review. ........ r20649 | dragos | 2010-01-24 19:15:23 +0100 (Sun, 24 Jan 2010) | 2 lines Fixed dead code elimination to satisfy YourKit's instrumentation: a drop for a newly initialized object is always added after the constructor call, instead of immediately after a DUP ........ r20650 | plocinic | 2010-01-24 23:57:30 +0100 (Sun, 24 Jan 2010) | 1 line Added new target for partest for testing Build Manager behaviour. Updated Refined Build Manager for consistency. --buildmanager requires the test file that describes actions to be done on the refined build manager (compiling files, making changes to the classes), sources of changes, the check file and the initial scala source files. Cleaned up some code in partest, refactored some obvious code duplication. Tests to follow... Review by phaller. ........ r20651 | plocinic | 2010-01-25 00:00:02 +0100 (Mon, 25 Jan 2010) | 1 line First test for buildmanager. No review necessary ........ r20654 | plocinic | 2010-01-25 11:28:11 +0100 (Mon, 25 Jan 2010) | 1 line Fix ant task for build manager partest. no review. ........ r20655 | rytz | 2010-01-25 11:44:16 +0100 (Mon, 25 Jan 2010) | 1 line small improvements in building newlibs / newforkjoin. no review. ........ r20656 | dubochet | 2010-01-25 12:31:44 +0100 (Mon, 25 Jan 2010) | 1 line [scaladoc] Deprecated methods are striked-out. There is an `implict` keyword in front of implicit parameters. Fixed an issue with inherited constructors printed in documentation. Contributed by Pedro Furlanetto, checked by dubochet, no review. ........ r20657 | dragos | 2010-01-25 13:43:40 +0100 (Mon, 25 Jan 2010) | 2 lines Fixed #2497: replaceInstruction now uses reference equality. No review necessary. ........ r20658 | rytz | 2010-01-25 15:20:52 +0100 (Mon, 25 Jan 2010) | 1 line close #2929. review by community (see typedValDef in Typers.scala, the BYNAMEPARAM flag was missing). ........ r20659 | dubochet | 2010-01-25 15:23:36 +0100 (Mon, 25 Jan 2010) | 1 line [scaladoc] Classes `FunctionX`, `ProductX`, and `TupleX`, for `X` greater than 2, are not listed. Contributed by Pedro Furlanetto, checked by dubochet, no review. ........ r20660 | milessabin | 2010-01-25 17:14:02 +0100 (Mon, 25 Jan 2010) | 1 line Use file paths for equality and hashCode to deal with mixed-type file equality test issues in the IDE. Fixes #2931. ........ r20661 | prokopec | 2010-01-25 19:21:04 +0100 (Mon, 25 Jan 2010) | 2 lines Replacement in matching can now be done by providing function arguments for replacement. Fixes #2761. Review by phaller. ........ r20662 | prokopec | 2010-01-25 19:21:32 +0100 (Mon, 25 Jan 2010) | 1 line Test file for matching with replace. ........ r20663 | odersky | 2010-01-25 19:32:56 +0100 (Mon, 25 Jan 2010) | 1 line Fixed stability problem with build. ........ r20664 | prokopec | 2010-01-25 20:22:06 +0100 (Mon, 25 Jan 2010) | 1 line Fixes #2766. Review by phaller. ........ r20672 | plocinic | 2010-01-26 11:03:04 +0100 (Tue, 26 Jan 2010) | 1 line Changed the info statements in refined build manager to print the information in more consistent way, so that we can test it using partest. Added more tests for build manager, more to follow... No review. ........ r20673 | plocinic | 2010-01-26 11:33:10 +0100 (Tue, 26 Jan 2010) | 1 line More tests, plus missing file. No review. ........ r20675 | plocinic | 2010-01-26 14:38:38 +0100 (Tue, 26 Jan 2010) | 1 line Hack for the refined build manager to print info in a deterministic way. No review. ........ r20676 | prokopec | 2010-01-26 15:03:19 +0100 (Tue, 26 Jan 2010) | 1 line Access modifiers added for certain members and some refactoring in Regex. ........ r20677 | dubochet | 2010-01-26 15:03:24 +0100 (Tue, 26 Jan 2010) | 1 line Fixed a number of faulty Scaladoc comments in library and compiler sources. No review. ........ r20678 | plocinic | 2010-01-26 15:21:58 +0100 (Tue, 26 Jan 2010) | 1 line Another batch of tests. No review. ........ r20681 | extempore | 2010-01-26 23:14:15 +0100 (Tue, 26 Jan 2010) | 13 lines Refinements to the recent repl patches. You can now complete on a few more things, like literals (1.<tab>, "abc".<tab>). A completion aware case class walker which leverages the names of the case fields for completion. For instance: :power val x = new ProductCompletion(mkTree("def f(x: Int, y: Int) = f(5, 10) + f(10, 20)") x.<tab> mods name rhs tparams tpt vparamss x.rhs.fun.<tab> name qualifier scala> x.rhs.fun.qualifier res3: scala.tools.nsc.ast.Trees$Apply = f(5, 10) ........ r20682 | plocinic | 2010-01-27 00:01:41 +0100 (Wed, 27 Jan 2010) | 1 line Refactored some of the code from r20624 thanks to Iulian's review. ........ r20683 | plocinic | 2010-01-27 00:08:20 +0100 (Wed, 27 Jan 2010) | 1 line Cleaning up. No review. ........ r20687 | phaller | 2010-01-27 10:07:56 +0100 (Wed, 27 Jan 2010) | 1 line Made actor-receivewithin test deterministic. ........ r20688 | rytz | 2010-01-27 11:23:31 +0100 (Wed, 27 Jan 2010) | 1 line close #2868. problem was: when the same constant is used in a ConstantType and a LiteralAnnotArg, it is stored inside the unpickle cache 'entries' (see 'def at' in UnPickler) once as Constant, once as LiteralAnnotArg, resulting in a CCE for the second read. review by extempore. ........ r20689 | rytz | 2010-01-27 11:28:52 +0100 (Wed, 27 Jan 2010) | 1 line fix pickle format doc. no review ........ r20690 | rytz | 2010-01-27 12:08:54 +0100 (Wed, 27 Jan 2010) | 1 line reverting r20688 for now, no review ........ r20692 | plocinic | 2010-01-27 13:56:24 +0100 (Wed, 27 Jan 2010) | 1 line Closes #2966. Review by milessabin. ........ r20693 | plocinic | 2010-01-27 14:15:16 +0100 (Wed, 27 Jan 2010) | 1 line Forgot to commit the change. No review. ........ r20704 | rytz | 2010-01-27 15:12:28 +0100 (Wed, 27 Jan 2010) | 1 line now correctly fix #2868. no review ........ r20705 | extempore | 2010-01-27 17:53:36 +0100 (Wed, 27 Jan 2010) | 1 line Fix for #2563. Review by mharrah. ........ r20707 | extempore | 2010-01-27 22:27:22 +0100 (Wed, 27 Jan 2010) | 1 line Some hardening of repl generated code. No review. ........ r20710 | extempore | 2010-01-28 06:46:06 +0100 (Thu, 28 Jan 2010) | 6 lines One of those "$.05 for the bolt, $50,000 for knowing where to put it" commits. Closes #425, #816, #2310, #2691. All credit for this patch goes to me for having the genius to know when new eyes were needed (although if you're feeling generous some could also go to walter korman for the actual debugging and code writing part.) ........ r20711 | extempore | 2010-01-28 06:46:36 +0100 (Thu, 28 Jan 2010) | 5 lines Moved some test cases from pending to files since the bugs they were watching for seem to be fixed. Moved some other test cases from pending to disabled because they deceptively claim to pass while investigation reveals the ticket needs to remain open. Closes #1996, #2660. ........ r20712 | rytz | 2010-01-28 11:26:00 +0100 (Thu, 28 Jan 2010) | 1 line close #2886 (applied patch). no review ........ r20713 | dubochet | 2010-01-28 11:48:38 +0100 (Thu, 28 Jan 2010) | 6 lines [scaladoc] Comment parsing is improved: * tags in code blocks no longer confuse the parser; * `@note` and `@example` are recognised tags; * Empty comments no longer generate "must start with a sentence" warnings; * `@usecase` parsing works better in some situations with blank comment lines above or below. No review. ........ r20714 | dubochet | 2010-01-28 11:48:53 +0100 (Thu, 28 Jan 2010) | 1 line [scaladoc] In HTML documentation, `@return` tag is printed also when there is no `@param` tag present. No review. ........ r20716 | rytz | 2010-01-28 15:14:20 +0100 (Thu, 28 Jan 2010) | 1 line Removing defaultGetter field from TermSymbols. review by odersky (see 'def defaultGetter' in typechecker/NamesDefaults.scala) ........ r20718 | extempore | 2010-01-28 17:16:22 +0100 (Thu, 28 Jan 2010) | 9 lines Added :search to power mode for finding classes on the classpath by regular expression, plus a bunch of compiler hacker convenience methods to the repl. Now after :power you can: mkContext() // Context mkUnit("class Q") // CompilationUnit mkTypedTree("class A { val x = 5 }") // Tree after phase typer mkType("java.util.Map") // Type object ... and many more. No review. ........ r20720 | extempore | 2010-01-28 23:55:42 +0100 (Thu, 28 Jan 2010) | 2 lines Added a command line option for desugaring match blocks differently for debugging purposes. No review. ........ r20723 | extempore | 2010-01-29 01:37:07 +0100 (Fri, 29 Jan 2010) | 6 lines I'm sure I'm not the only one driven into paroxysms of annoyance at the fact that repl transcripts are not at all usable in the repl. No longer: now you can paste a transcript into the repl and it will automatically detect it as such, clean it up and replay it. It is triggered by the "scala> " on the first line of the transcript. Review by community. ........ r20724 | plocinic | 2010-01-29 12:23:52 +0100 (Fri, 29 Jan 2010) | 1 line Closes #2650. Dependency on type alias requires analysis before uncurry phase. Added tests. Review by dragos. ........ r20727 | odersky | 2010-01-29 15:04:06 +0100 (Fri, 29 Jan 2010) | 1 line new starr to bag performance improvements and fixes to companion objects ........ r20728 | extempore | 2010-01-29 16:43:41 +0100 (Fri, 29 Jan 2010) | 2 lines Added hashCode implementations to Manifest types where necessary. Closes #2838. No review. ........ r20729 | extempore | 2010-01-29 20:11:20 +0100 (Fri, 29 Jan 2010) | 3 lines Implemented rompf's suggested improvement to the tail recursive combinators, avoiding re-evaluation of by-name argument. Score one for code review. No review. (Ironic.) ........ r20730 | extempore | 2010-01-29 20:11:38 +0100 (Fri, 29 Jan 2010) | 3 lines A few compiler IO lib bits I have been needing: some basic conveniences for directories and sockets, and some cleanups in CompileSocket. Review by community. ........ r20734 | extempore | 2010-01-30 07:30:57 +0100 (Sat, 30 Jan 2010) | 6 lines A compact tree printer, for primitives like myself who do all their debugging in the console and need extraneous information filtered out. New option: -Ycompact-trees. Supply that in conjunction with -Xprint:all and suddenly the output is a (relative) masterpiece of concision. Review by anyone who is game to review such a thing. Community? ........ r20735 | plocinic | 2010-01-30 18:06:34 +0100 (Sat, 30 Jan 2010) | 1 line Better test for checking existential types, where symbols not necessarily have the same name. Added test for that. The problem manifested itself in Globals.scala for variable classpath causing execissive compilation without any reason. No review. ........ r20738 | extempore | 2010-01-31 06:39:25 +0100 (Sun, 31 Jan 2010) | 2 lines Band-aid for #3004. No review unless you want to take on name mangling and forwarders, in which case review away. ........ r20739 | extempore | 2010-01-31 17:34:24 +0100 (Sun, 31 Jan 2010) | 4 lines Great moments in typos: somehow the "decodeUni" in CharArrayReader had transmogrified into "decodeUnit" in UnitScanner, thus causing -Xno-uescape to be ignored. Also, removed a now unused -X option. Review by community. ........ r20740 | extempore | 2010-01-31 17:59:19 +0100 (Sun, 31 Jan 2010) | 2 lines Solidified the logic of stringOf for repl results printing. Closes #726. Review by community. ........ r20744 | extempore | 2010-02-01 02:24:11 +0100 (Mon, 01 Feb 2010) | 2 lines Unbroke the build. Remember kids, "Node extends NodeSeq extends Seq[Node]" means never having to meet your base case. No review. ........ r20745 | plocinic | 2010-02-01 10:34:28 +0100 (Mon, 01 Feb 2010) | 1 line Check recursively the type aliases. Closes #2650. Review by dragos. ........ r20748 | odersky | 2010-02-01 16:10:26 +0100 (Mon, 01 Feb 2010) | 1 line lifted out core compiler data structures into reflect.generic package. Made Unpickler work on generic data. ........ r20750 | odersky | 2010-02-01 16:49:33 +0100 (Mon, 01 Feb 2010) | 1 line missing bits of r20746. For some reasons smartsvn did not show these before. review by dubochet, extempore. ........ r20751 | extempore | 2010-02-01 17:06:14 +0100 (Mon, 01 Feb 2010) | 3 lines Removed scala.util.NameTransformer (it moved to reflect.) We don't have to @deprecate it since it's never been in a released version. No review. ........ r20752 | plocinic | 2010-02-01 17:16:11 +0100 (Mon, 01 Feb 2010) | 1 line Exclude anonymous function classes from the definitions in dependency analysis. This was causing spurious errors in for example Global.scala and Interpreter.scala because of fresh names numbering. Also cleanup up some code. No review. ........ r20753 | odersky | 2010-02-01 18:15:05 +0100 (Mon, 01 Feb 2010) | 1 line suppresses generation of manifests for abstract type members. ........ r20756 | extempore | 2010-02-01 23:35:12 +0100 (Mon, 01 Feb 2010) | 2 lines Quite a lot more work on completion. The main bit is that file completion is now avilable, with some caveats. Review by community. ........ r20757 | extempore | 2010-02-02 00:19:33 +0100 (Tue, 02 Feb 2010) | 3 lines Continuing the fine work creating an abstract interface to the compiler in scala.reflect.generic, promoted Trees#Traverser and made the associated changes. Review by odersky. ........ r20761 | plocinic | 2010-02-02 11:36:38 +0100 (Tue, 02 Feb 2010) | 1 line Cleaned up the code slightly. No review. ........ r20763 | plocinic | 2010-02-02 12:28:56 +0100 (Tue, 02 Feb 2010) | 1 line Fixed tests. No review. ........ r20767 | phaller | 2010-02-02 13:40:38 +0100 (Tue, 02 Feb 2010) | 1 line Closes #3009. ........ r20768 | plocinic | 2010-02-02 15:51:03 +0100 (Tue, 02 Feb 2010) | 1 line Correctly check annotated types. Problem showed up for example in Interpreter.scala. No review. ........ r20769 | extempore | 2010-02-02 17:46:23 +0100 (Tue, 02 Feb 2010) | 5 lines Hid some AST nodes from the prying eyes of reflectors. Now Parens, AssignOrNamedArg, and DocDef are known only to scalac. Also some cosmetic arranging in the new reflect.generic package, because there's never a better time than when the code is still warm from the compiler. Review by odersky. ........ r20771 | extempore | 2010-02-02 20:43:07 +0100 (Tue, 02 Feb 2010) | 9 lines Took a swing at sorting out sorting. The major components are rewriting the Sorting methods to accept Orderings and adding a sorted method to SeqLike, because we should all be pretty tired of writing ".sortWith(_ < _)" by now. I think it should be called "sort", not "sorted", but that refuses to coexist gracefully with the deprecated sort in List. Review by moors (chosen pretty arbitrarily, someone at epfl should review it but I don't know who deserves the nomination.) ........ r20772 | extempore | 2010-02-02 21:13:28 +0100 (Tue, 02 Feb 2010) | 5 lines It was pointed out that sorted and the 1-arg version of sortWith are the same method, one with implicit argument, one without. Since sortWith has never exist in a release, we can un-overload it (which is a win anyway) and route everything through sorted. Review by moors. ........ r20776 | plocinic | 2010-02-03 11:22:27 +0100 (Wed, 03 Feb 2010) | 1 line Fixes the problem mentioned in #2882, which seems to be the reason for #2280 - allow simple ananlysis on java sources. Review by dragos ........ r20777 | extempore | 2010-02-03 16:52:25 +0100 (Wed, 03 Feb 2010) | 2 lines Made sliding/grouped throw an exception when read past the end. Closes #3017. ........ r20778 | dubochet | 2010-02-03 18:03:58 +0100 (Wed, 03 Feb 2010) | 1 line [scaladoc] Optional link to source (set parameter "-doc-source-url"). Support for commenting packages (using package objects). Contributed by Perdo Furlanetto. Also: small performance improvements, short comment extraction is more robust (but no HTML tags allowed in first sentence), small code clean-ups. Checked by dubochet, no review. ........ r20779 | extempore | 2010-02-03 18:34:31 +0100 (Wed, 03 Feb 2010) | 5 lines Striking while the iron is hot, renamed removeDuplicates to unique and deprecated removeDuplicates. The debate between distinct and unique was vigorous but unique won by a freckle. (Dark horse 'nub' was disqualified for taking performance enhancers.) The only thing which might need review is the choice of name, but review by odersky. ........ r20780 | dpp | 2010-02-03 19:04:50 +0100 (Wed, 03 Feb 2010) | 1 line Fixed XML Utility.escape method to conform to XML spec. Closes #3014 ........ r20781 | dragos | 2010-02-03 19:17:17 +0100 (Wed, 03 Feb 2010) | 2 lines Preserve source order for class members in generated bytecode. No review necessary. ........ r20783 | extempore | 2010-02-03 22:12:56 +0100 (Wed, 03 Feb 2010) | 2 lines Created MSILGlobal to start breaking the dependency on msil.jar for those platforms which don't use msil. Review by rytz. ........ r20785 | extempore | 2010-02-04 00:51:49 +0100 (Thu, 04 Feb 2010) | 7 lines A big push to make the interpreter easier to instantiate without having to dodge bullets. It shouldn't have to be any harder than this: scala> new scala.tools.nsc.Interpreter().evalExpr[Int]("5*5") res0: Int = 25 ...and now it isn't. Review by community. ........ r20787 | extempore | 2010-02-04 13:26:02 +0100 (Thu, 04 Feb 2010) | 3 lines Noticed that all the system properties were being read into vals so they didn't notice changes. Determined this was not correct, and changed them into defs. No review. ........ r20788 | extempore | 2010-02-04 13:26:42 +0100 (Thu, 04 Feb 2010) | 2 lines Unique's seeming victory is overruled by committee. It is "distinct", not "unique", wherein lies the nub. No review. ........ r20789 | extempore | 2010-02-04 14:33:06 +0100 (Thu, 04 Feb 2010) | 5 lines The remainder of isolating MSIL from the rest of the classpath code. To accomplish this I made ClassRep an inner class of ClassPath (which given the broad definition of ClassPath already in place, it conceptually is already) and as a bonus this allowed dropping its type parameter. Review by rytz. ........ r20790 | extempore | 2010-02-04 16:22:03 +0100 (Thu, 04 Feb 2010) | 3 lines Some minor cleanups in reflect. Moved the apply on Traverser back into the compiler so Traversers can define whatever apply is relevant to them. No review. ........ r20791 | phaller | 2010-02-04 18:03:57 +0100 (Thu, 04 Feb 2010) | 1 line Fixed issue in partest where result of tests that timed out was not printed. Improved reporting. Added support for JUnit report files. ........ r20793 | extempore | 2010-02-04 18:15:18 +0100 (Thu, 04 Feb 2010) | 2 lines Some hardening in the repl, and removing some functions which now exist in the standard library. No review. ........ r20794 | extempore | 2010-02-04 19:50:47 +0100 (Thu, 04 Feb 2010) | 6 lines Raised the level of abstraction (slightly, not enough) on ClassPath by defining the difference between optimized and regular classpaths in terms of an arbitrary name filter instead of in terms of settings.XO. Altered the decision logic to look at the value of -Yinline instead of -optimise. Closes #2950. Review by rytz. ........ r20795 | rompf | 2010-02-04 20:02:16 +0100 (Thu, 04 Feb 2010) | 1 line Added byval mode and annotation checker hook for weak lub. Review by odersky. ........ r20796 | extempore | 2010-02-04 21:21:44 +0100 (Thu, 04 Feb 2010) | 9 lines Made a whole WithFilter class for Option after discovering this bug: scala> def f(x: AnyRef) = for (p <- Option(x)) yield p f: (x: AnyRef)Option[AnyRef] scala> def f(x: AnyRef) = for (p <- Option(x) ; if true) yield p f: (x: AnyRef)Iterable[AnyRef] The for comprehension logic apparently prefers to convert Option to Iterable to get at the withFilter method over using Option's filter. ........ r20797 | rompf | 2010-02-04 21:52:03 +0100 (Thu, 04 Feb 2010) | 1 line fixed previous commit. No review. ........ r20798 | extempore | 2010-02-05 00:08:44 +0100 (Fri, 05 Feb 2010) | 1 line Taking a swing at fixing -optimise. No review. ........ r20802 | dubochet | 2010-02-05 14:12:34 +0100 (Fri, 05 Feb 2010) | 1 line [scaladoc] Fixed issue with failing Windows build. Code by Pedro Furlanetto, no review. ........ r20803 | ilyas | 2010-02-05 17:53:41 +0100 (Fri, 05 Feb 2010) | 1 line some scalap tweaks ........ r20805 | extempore | 2010-02-05 19:33:09 +0100 (Fri, 05 Feb 2010) | 2 lines Discovered that List's deprecated removeDuplicates didn't survive the renaming of unique to distinct. No review. ........ r20806 | ilyas | 2010-02-05 21:06:07 +0100 (Fri, 05 Feb 2010) | 1 line scalap output bug fixed ........ r20807 | ilyas | 2010-02-05 21:54:40 +0100 (Fri, 05 Feb 2010) | 1 line testdata changed ........ r20812 | extempore | 2010-02-06 05:15:08 +0100 (Sat, 06 Feb 2010) | 4 lines A more MSIL-aware attempt at isolating the platform dependent pieces of Global and ClassPath so we don't introduce unwanted dependencies. Introduces a small interface backend.Platform which encapsulates that data. Review by rytz, odersky. ........ r20816 | extempore | 2010-02-07 01:13:55 +0100 (Sun, 07 Feb 2010) | 2 lines Some code duplication removal as I inch us toward consistent classpath handling. No review. ........ r20818 | milessabin | 2010-02-07 23:14:40 +0100 (Sun, 07 Feb 2010) | 1 line IntelliJ project metadata updated for new location. Thanks to Tony Coates for the patch. ........ r20826 | rytz | 2010-02-08 16:37:34 +0100 (Mon, 08 Feb 2010) | 1 line fix msil build (nested classes in particular). no review. ........ r20828 | phaller | 2010-02-08 18:15:22 +0100 (Mon, 08 Feb 2010) | 1 line Re-added deprecated member to scala.actors.Future. No review necessary. ........ r20829 | dubochet | 2010-02-08 22:28:30 +0100 (Mon, 08 Feb 2010) | 5 lines [scaladoc] Many improvements in the UI for Scaladoc's entity index (left-pane): - It is possible to "focus" on a package to restrict searches on it. - Filtering in left pane no longer blocks the UI. - The filter tool for packages is easily recognizable for what it is, not just an empty, mysterious space. Review by community. ........ r20830 | dubochet | 2010-02-08 22:28:47 +0100 (Mon, 08 Feb 2010) | 1 line [scaladoc] Fully qualified names are displayed in tooltips instead of using in-place growth. All inherited members can be filtered in a single operation. Contributed by Pedro Furlanetto, checked by dubochet, no review. ........ r20831 | extempore | 2010-02-08 23:28:17 +0100 (Mon, 08 Feb 2010) | 20 lines Some work on classpaths. This implements the specification at https://lampsvn.epfl.ch/trac/scala/wiki/Classpath modulo some minor details which remain to be investigated. It is not entirely integrated, and should not involve any behavioral changes. The patch also contains a number of small improvements targetting widely duplicated code. PathResolver offers a main method. If run with no arguments it will output a pile of information about classpath relevant environment vars and properties. If given arguments, it will output the classpath info that any scala runner script would use if given the same args. There is a wrapper in the tools directory. Example: tools/pathResolver -extdirs /foo -sourcepath /bar | egrep "sourcePath|scalaExtDirs" scalaExtDirs = /foo sourcePath = /bar There is also a (probably temporary) command line option -Ylog-classpath which will print out the settings.classpath value anytime it changes. Review by community. ........ r20832 | extempore | 2010-02-09 00:09:49 +0100 (Tue, 09 Feb 2010) | 8 lines Until now directories on the classpath were not considered for repl completion because of the risk of accidentally traversing large chunks of the filesystem (e.g. "." in the path, run from /). Some low hanging fruit was available - at least SCALA_HOME can be considered safe, and then we get the scala classes. The main impact of this is that completion now works for the built-in classes when you run build/quick/bin/scala. Review by community. ........ r20834 | milessabin | 2010-02-09 10:58:24 +0100 (Tue, 09 Feb 2010) | 1 line Export missing package. ........ r20835 | milessabin | 2010-02-09 11:15:16 +0100 (Tue, 09 Feb 2010) | 1 line Compiler part of fix for #2767: provide hooks to allow the presentation compiler to add sources to the run to resolve top-level symbols which cannot be found via the Java naming convention. Review by odersky. ........ r20840 | prokopec | 2010-02-09 16:31:11 +0100 (Tue, 09 Feb 2010) | 1 line `replaceSomeIn` method added. Removed `replaceAllIN` taking a String to String. ........ r20842 | extempore | 2010-02-09 19:37:44 +0100 (Tue, 09 Feb 2010) | 1 line No double-processing format strings. Closes #3040. No review. ........ r20843 | rompf | 2010-02-09 20:08:07 +0100 (Tue, 09 Feb 2010) | 1 line some small byval mode changes. review by odersky. ........ r20844 | dragos | 2010-02-09 20:21:34 +0100 (Tue, 09 Feb 2010) | 1 line Fixed partially specialized classes. Closes #2880. No review. ........ r20849 | rytz | 2010-02-10 10:03:13 +0100 (Wed, 10 Feb 2010) | 1 line close #3003. no review, already done by dragos. ........ r20850 | prokopec | 2010-02-10 12:12:55 +0100 (Wed, 10 Feb 2010) | 1 line fixes #3046 ........ r20851 | rompf | 2010-02-10 15:21:57 +0100 (Wed, 10 Feb 2010) | 1 line modified typing of while loops to allow other types than Unit (e.g. Unit @cps). review by odersky. ........ r20852 | rytz | 2010-02-10 15:48:58 +0100 (Wed, 10 Feb 2010) | 1 line close #2984. review by community. ........ r20854 | plocinic | 2010-02-10 17:51:13 +0100 (Wed, 10 Feb 2010) | 1 line Closes #2651 ........ r20855 | phaller | 2010-02-10 18:11:11 +0100 (Wed, 10 Feb 2010) | 1 line partest no longer treats remaining .log files as tests. No review necessary. ........ r20856 | extempore | 2010-02-10 20:51:38 +0100 (Wed, 10 Feb 2010) | 5 lines More work on classpaths. This commit should restore the ability to have command line options following source files, at the price of temporarily breaking tools/pathResolver. Working my way through all the usages of classpath in trunk zeroing in on fully consistent handling. Review by community. ........ r20857 | extempore | 2010-02-11 00:20:02 +0100 (Thu, 11 Feb 2010) | 1 line Disabled failing test. Review by plocinic. ........ r20858 | plocinic | 2010-02-11 00:29:54 +0100 (Thu, 11 Feb 2010) | 1 line Fixes #3045. No review. ........ r20862 | plocinic | 2010-02-11 11:14:59 +0100 (Thu, 11 Feb 2010) | 1 line Removed leftovers of r20857, added test for #3045 ........ r20863 | extempore | 2010-02-11 14:47:13 +0100 (Thu, 11 Feb 2010) | 2 lines Trying to get when "." is added to the classpath under control. Band-aid for an obscure bit of fallout closes #3049. No review. ........ r20864 | dubochet | 2010-02-11 14:55:34 +0100 (Thu, 11 Feb 2010) | 1 line [scaladoc] Fixed popup content lookup so that it works on all browsers. Speed-up in entity index search (according to jQuery manual, observed no notable difference). Some small aesthetic cleanups in the way index initialization and filtering behaves. No review. ........ r20866 | extempore | 2010-02-11 16:10:45 +0100 (Thu, 11 Feb 2010) | 6 lines More work on classpaths. This commit also unbreaks fsc, for which we must have no test cases at all. In the short term there will probably be a few more minor disruptions since with classpaths constructed a half dozen different ways, achieving consistency requires flushing out the undocumented accidents upon which any given island might depend. Review by community. ........ r20867 | rompf | 2010-02-11 17:58:12 +0100 (Thu, 11 Feb 2010) | 1 line added annotation checker hook for Types.isWithinBounds. needed to allow functions of type T => A @cps[B,C] even though A @cps[B,C] is not a subtype of Any. review by odersky. ........ r20869 | extempore | 2010-02-12 00:37:15 +0100 (Fri, 12 Feb 2010) | 8 lines The non-intrusive bits of my hopefully pending "use the static type of the scrutinee to rule out some type/extractor patterns" patch. Includes a cleanup of the (still inadequate) type-parameter-ignoring match test which had been interfering with martin's digestion. Also: implicit search is disabled when typing a pattern, because the matcher never invokes implicits to satisfy a pattern. At worst maybe we'll get a performance bump. No review. ........ r20872 | dubochet | 2010-02-12 16:53:39 +0100 (Fri, 12 Feb 2010) | 1 line [scaladoc] Fixes for IE 8 compatibility. Partially contributed by Pedro Furlanetto, no review. ........ r20873 | prokopec | 2010-02-12 19:20:26 +0100 (Fri, 12 Feb 2010) | 1 line Fixes #3046 once more. No review is necessary. ........ r20874 | dubochet | 2010-02-12 19:43:49 +0100 (Fri, 12 Feb 2010) | 1 line [scaladoc] Added "display packages only" filter to entity index. No review. ........ r20878 | extempore | 2010-02-14 01:08:01 +0100 (Sun, 14 Feb 2010) | 7 lines Some change to classpath handling in r20866 has left quick in a condition where it won't load Array. After a fair bit of beating my head against the wall as to why, I determined that everything works if I simply don't throw the exception it used to throw. In the short term I am committing this so quick works, and I will continue the investigation. Review by dragos (2 line patch to minimize reviewer burden.) ........ r20879 | extempore | 2010-02-14 02:00:37 +0100 (Sun, 14 Feb 2010) | 2 lines Reducing the amount of low-level classpath manipulation going on around town. No review. ........ r20880 | extempore | 2010-02-14 07:52:11 +0100 (Sun, 14 Feb 2010) | 2 lines Added some error logic so if #2956 strikes again we'll have a better idea why. No review. ........ r20881 | extempore | 2010-02-14 09:47:18 +0100 (Sun, 14 Feb 2010) | 4 lines More classpath work, and cleanups in the vicinities of everything manipulating classpaths. Review by anyone willing to slog through the approximately dozen different ways the classpath can be influenced. ........ r20884 | extempore | 2010-02-15 07:32:50 +0100 (Mon, 15 Feb 2010) | 3 lines Restored the disabled exception in classfileparser. Strange quick behavior was being caused by multiple occurrences of some classpath elements. No review. ........ r20885 | dragos | 2010-02-15 11:12:00 +0100 (Mon, 15 Feb 2010) | 1 line Merge branch 'fix-specialized' ........ r20886 | extempore | 2010-02-15 17:41:17 +0100 (Mon, 15 Feb 2010) | 6 lines Disabled JavaInteraction test. This test has been costing me a lot of time because it fails if you can't connect to the screen of the test machine. And then if any test fails, the stability test doesn't run. We badly a separate testing area for tests which are prone to failure for reasons which are unrelated to the quality ostensibly being tested. No review. ........ r20887 | extempore | 2010-02-15 17:55:21 +0100 (Mon, 15 Feb 2010) | 1 line Fix for the out-of-date showpickled. No review. ........ r20888 | extempore | 2010-02-15 21:00:36 +0100 (Mon, 15 Feb 2010) | 18 lines Some new tools for the tools directory. Everything in this commit amounts to a yak shaving expedition to enable this, which now works: tools/diffPickled scala.Either and since stability is presently broken you will see the following. (When it's not broken you will see nothing.) 541,544c541,544 < 538,4090: EXTref 3: 539(Left) 2 < 539,4095: TYPEname 4: Left < 540,4101: EXTref 3: 541(Right) 2 < 541,4106: TYPEname 5: Right --- > 538,4090: EXTref 3: 539(Right) 2 > 539,4095: TYPEname 5: Right > 540,4102: EXTref 3: 541(Left) 2 > 541,4107: TYPEname 4: Left ........ r20889 | extempore | 2010-02-15 22:44:28 +0100 (Mon, 15 Feb 2010) | 2 lines Rewrote my own submitted code of a year ago from trac and added scalawhich to the tools dir. Closes #657. ........ r20894 | extempore | 2010-02-16 17:31:29 +0100 (Tue, 16 Feb 2010) | 1 line Some minor bugfixing/refining to completion. No review. ........ r20895 | extempore | 2010-02-16 20:57:44 +0100 (Tue, 16 Feb 2010) | 2 lines Some prestidigitation improving the repl startup time. The prompt is quicker than the eye! No review. ........ r20896 | extempore | 2010-02-16 20:59:22 +0100 (Tue, 16 Feb 2010) | 1 line Last minute change broke the last commit. Fixing. No review. ........ r20897 | extempore | 2010-02-16 22:03:43 +0100 (Tue, 16 Feb 2010) | 1 line Trying again to unbreak the repl patch. No review. ........ r20898 | extempore | 2010-02-16 22:22:10 +0100 (Tue, 16 Feb 2010) | 2 lines Unix scripts pass -D options to the underlying JVM invocation. Closes #1222. Review by community. ........ r20899 | extempore | 2010-02-16 22:41:01 +0100 (Tue, 16 Feb 2010) | 2 lines Made partest stop crashing on test directories without a lib directory. No review. ........ r20900 | extempore | 2010-02-16 23:28:27 +0100 (Tue, 16 Feb 2010) | 3 lines Altered Symbol.isLess to sort on initName before id. No longer will slightly different classpaths break the stability test. Review by odersky. ........ r20901 | extempore | 2010-02-17 00:48:32 +0100 (Wed, 17 Feb 2010) | 5 lines Took a less ambitious approach to restoring stability. Leave isLess as it was and have the pickler sort without using isLess. Interestingly this approach still leaves a class failing the stability test (scala/actors/remote/Apply0.class) so a little more will be needed. Review by odersky. ........ r20905 | milessabin | 2010-02-17 01:47:55 +0100 (Wed, 17 Feb 2010) | 1 line Fix and test case for #3031. Review by odersky. ........ r20906 | plocinic | 2010-02-17 12:34:35 +0100 (Wed, 17 Feb 2010) | 1 line Checking the symbols of parameters in overloaded methods didn't seem to work in all cases. Apparently the enclosing class of the owner of the parameter was changing during the compilations from trait to the implementation class. This was causing annoying excessive compilation for Types.scala. ........ r20907 | prokopec | 2010-02-17 13:22:37 +0100 (Wed, 17 Feb 2010) | 1 line Array copy method fixed, Fixes #3065. Review by community. ........ r20908 | prokopec | 2010-02-17 13:23:13 +0100 (Wed, 17 Feb 2010) | 1 line Test file for last commit. ........ r20909 | milessabin | 2010-02-17 18:15:51 +0100 (Wed, 17 Feb 2010) | 1 line Fix for silly mistake in [20835]. No review. ........ r20911 | extempore | 2010-02-17 20:01:22 +0100 (Wed, 17 Feb 2010) | 1 line Added a copy() method to Settings. No review. ........ r20912 | extempore | 2010-02-17 22:26:02 +0100 (Wed, 17 Feb 2010) | 5 lines A variety of changes to partest made in a quest to get it to reveal the classpaths it is using. No longer will partest actively sabotage your efforts to pass -Dpartest.debug=true by inserting "-Dpartest.debug=" after yours! And etc. Review by haller (if so inclined.) ........ r20913 | extempore | 2010-02-17 22:37:08 +0100 (Wed, 17 Feb 2010) | 2 lines ...and managed to miss the key file in getting past partest. No review. ........ r20917 | extempore | 2010-02-18 06:39:18 +0100 (Thu, 18 Feb 2010) | 4 lines Fix for recent stability issue with Apply0. Look, shuffling classpaths flushes out bugs, we should do this all the time. Review by odersky even though he authored it, because reliving one's own patches is the key to a long and healthy life. ........ r20918 | extempore | 2010-02-18 06:40:27 +0100 (Thu, 18 Feb 2010) | 10 lines Tighter pattern matching hits the street. If the scrutinee is final and does not conform to the pattern, it will no longer compile. See all the exciting things you can no longer do: "bob".reverse match { case Seq('b', 'o', 'b') => true } // denied! "bob".toArray match { case Seq('b', 'o', 'b') => true } // rejected! final class Dunk def f3(x: Dunk) = x match { case Seq('b', 'o', 'b') => true } // uh-uh! And so forth. Review by odersky. ........ r20920 | extempore | 2010-02-18 19:49:21 +0100 (Thu, 18 Feb 2010) | 2 lines The first reasonably satisfying classpath commit. We are 90% there with this one. Documentation to come. Review by community. ........ r20921 | extempore | 2010-02-18 20:00:46 +0100 (Thu, 18 Feb 2010) | 1 line Made NumericRange invariant again, plus test case. Closes #2518. ........ r20922 | milessabin | 2010-02-18 22:51:39 +0100 (Thu, 18 Feb 2010) | 1 line Patch from Mirko Stocker correcting start postions of import AST nodes for refactoring and other tools. Review by community. ........ r20928 | milessabin | 2010-02-19 16:31:36 +0100 (Fri, 19 Feb 2010) | 1 line Fixed #3043 and #3043; fixed a regression with hover/hyperlinks on import statements; don't attempt to parse out top-level types from non-Scala sources. Review by community. ........ r20929 | extempore | 2010-02-19 22:43:35 +0100 (Fri, 19 Feb 2010) | 1 line Some script fixes tied up with classpaths. No review. ........ r20932 | extempore | 2010-02-20 05:47:43 +0100 (Sat, 20 Feb 2010) | 2 lines Temporarily reverting r20928 as it is leading to ant dist crashing. Review by milessabin. ........ r20933 | extempore | 2010-02-20 06:38:34 +0100 (Sat, 20 Feb 2010) | 3 lines Some cleanups on the scalacfork ant task since I'm clearly going to have to go through everything which touches classpaths in any way shape or form. No review. ........ r20934 | extempore | 2010-02-20 07:48:29 +0100 (Sat, 20 Feb 2010) | 3 lines Altered the ant task to generate a -Dscala.home= property, which now acts as signal to scalac to ignore the java classpath and use only the scala classpath. No review. ........ r20935 | extempore | 2010-02-20 21:00:46 +0100 (Sat, 20 Feb 2010) | 2 lines Band-aid for #3081, issue should receive more comprehensive treatment. Review by imaier. ........ r20936 | milessabin | 2010-02-20 21:32:40 +0100 (Sat, 20 Feb 2010) | 1 line Another attempt at retaining ill-typed trees for the IDE, this time without breaking scaladoc. Review by extempore. ........ r20937 | extempore | 2010-02-20 22:16:49 +0100 (Sat, 20 Feb 2010) | 3 lines Having some challenges confirming the validity of the bootstrap process given starr's slightly dated classpath code, so this is a new starr based on r20934. No review. ........ r20938 | extempore | 2010-02-20 23:50:20 +0100 (Sat, 20 Feb 2010) | 4 lines Lowering the noise level in the classpath debugging output. Try ant -Dscalac.args="-Ylog-classpath" if you would like the rare joy of having a fair idea what is being used to compile what. No review. ........ r20941 | extempore | 2010-02-21 06:01:55 +0100 (Sun, 21 Feb 2010) | 1 line Some repl cleanups and debugging conveniences. No review. ........ r20942 | extempore | 2010-02-21 22:56:56 +0100 (Sun, 21 Feb 2010) | 2 lines Some more code for seeing what's going on in in scalac's mind with respect to who to load when and from where. No review. ........ r20944 | extempore | 2010-02-22 01:15:32 +0100 (Mon, 22 Feb 2010) | 2 lines More laboring on Settings, ClassPaths, Ant Tasks, Partest, and similar epicenters of thrilldom. No review. ........ r20945 | extempore | 2010-02-22 01:16:03 +0100 (Mon, 22 Feb 2010) | 1 line Some deprecation patrol and minor cleanups. No review. ........ r20949 | dragos | 2010-02-22 14:11:49 +0100 (Mon, 22 Feb 2010) | 1 line Specialized types are not substituted inside type arguments. Closes #3085, no review. ........ r20950 | phaller | 2010-02-22 18:43:40 +0100 (Mon, 22 Feb 2010) | 4 lines - Added fair mode to ForkJoinScheduler, which submits tasks to global queue with a 2% chance - Reactor uses ForkJoinScheduler by default - Moved ActorGC to scheduler package - Various clean-ups ........ r20951 | extempore | 2010-02-22 22:47:41 +0100 (Mon, 22 Feb 2010) | 3 lines A simple command line parser to consolidate a bunch of different implementations floating around trunk. And rolled it out in partest's ConsoleRunner. Review by community. ........ r20952 | milessabin | 2010-02-23 00:39:10 +0100 (Tue, 23 Feb 2010) | 1 line Yet another attempt at retaining ill-typed trees for the IDE ... this time docs.comp should be unbroken. ........ r20953 | extempore | 2010-02-23 01:27:39 +0100 (Tue, 23 Feb 2010) | 5 lines Some much needed housecleaning regarding system properties. If you can possibly resist the temptation, it'd be great if people could try to go through the properties classes to get and set them, and also to set property values somewhere fixed rather than using strings directly. Review by community. ........ r20954 | extempore | 2010-02-23 04:49:01 +0100 (Tue, 23 Feb 2010) | 2 lines More fun with ClassPaths. Could that be the home stretch I see? Review by community. ........ r20955 | extempore | 2010-02-23 05:42:53 +0100 (Tue, 23 Feb 2010) | 1 line Oops, I broke jline in r20953. Fixed. No review. ........ r20956 | extempore | 2010-02-23 07:57:53 +0100 (Tue, 23 Feb 2010) | 2 lines Abstracting out a few more platform specific elements now that we have a facility for doing so. Review by rytz. ........ r20957 | extempore | 2010-02-23 09:21:00 +0100 (Tue, 23 Feb 2010) | 1 line Introducing partest to the idea of code reuse. No review. ........ r20958 | extempore | 2010-02-23 09:32:53 +0100 (Tue, 23 Feb 2010) | 11 lines Added productElementName to Product. Now you can access all the case class field names your heart desires. Review by odersky. scala> case class Foo[T](kilroy: String, burma: List[T], shave: Seq[Int]) defined class Foo scala> Foo("was here", List('myanmar), Seq(25, 25)) res0: Foo[Symbol] = Foo(was here,List('myanmar),List(25, 25)) scala> 0 to 2 map (res0 productElementName _) res1: IndexedSeq[String] = IndexedSeq(kilroy, burma, shave) ........ r20959 | imaier | 2010-02-23 12:18:34 +0100 (Tue, 23 Feb 2010) | 1 line Added TextComponent.paste, made some accidentially public publisher methods protected. ........ r20960 | imaier | 2010-02-23 12:33:50 +0100 (Tue, 23 Feb 2010) | 1 line Fix for #3084 ........ r20961 | dubochet | 2010-02-23 15:19:20 +0100 (Tue, 23 Feb 2010) | 1 line [scaladoc] Updated jQuery to version 1.4.2. No review. ........ r20962 | phaller | 2010-02-23 18:34:50 +0100 (Tue, 23 Feb 2010) | 1 line Control-flow combinators do not require thread-local variable in Reactor. Review by plocinic. ........ r20963 | extempore | 2010-02-23 19:15:37 +0100 (Tue, 23 Feb 2010) | 3 lines After the compiler refactor, we ended up with identical copies of PickleBuffer and PickleFormat in the library and compiler. Deleted the compiler versions and updated references. No review. ........ r20964 | extempore | 2010-02-23 19:15:59 +0100 (Tue, 23 Feb 2010) | 1 line Removed now redundant function splitParams. No review. ........ r20965 | prokopec | 2010-02-23 19:57:52 +0100 (Tue, 23 Feb 2010) | 1 line Fixes #3018. Review by extempore. ........ r20966 | phaller | 2010-02-23 20:36:38 +0100 (Tue, 23 Feb 2010) | 1 line Fixed tests to unbreak build. No review. ........ r20967 | extempore | 2010-02-23 22:16:51 +0100 (Tue, 23 Feb 2010) | 4 lines The initial results of running a basic cut and paste detector over trunk and trying to undo some of it. I can live with history but if I see Cutty McPastington in new commits I will get all finger waggly. Don't make me cross that ocean. No review. ........ r20968 | milessabin | 2010-02-23 22:59:14 +0100 (Tue, 23 Feb 2010) | 1 line Improved fix for #2767. Review by community. ........ r20969 | extempore | 2010-02-23 23:15:38 +0100 (Tue, 23 Feb 2010) | 1 line Fixed a little command line partest bug I introduced. No review. ........ r20970 | milessabin | 2010-02-23 23:34:17 +0100 (Tue, 23 Feb 2010) | 1 line Removed stray debugging code. ........ r20972 | extempore | 2010-02-24 02:59:44 +0100 (Wed, 24 Feb 2010) | 1 line Another update for ShowPickled. No review. ........ r20973 | extempore | 2010-02-24 03:27:03 +0100 (Wed, 24 Feb 2010) | 6 lines Updated scalacheck jar to current trunk. Tracked down why it's not being used. Updated partest with a --scalacheck option. Added scalacheck tests to the ant build target. Still struggling with ant/partest/classpaths so it's not on by default yet, but at least ./partest --scalacheck works. We... will... use... scalacheck. And we will like it! No review. ........ r20974 | phaller | 2010-02-24 13:18:45 +0100 (Wed, 24 Feb 2010) | 1 line Fixed problem with daemon actor termination. No review. ........ r20976 | dubochet | 2010-02-24 16:51:10 +0100 (Wed, 24 Feb 2010) | 1 line [scaladoc] Preliminary support for links and lists in wiki syntax, as well as printing of lists. Fix to display of "inherits" classes. Contributed by Pedro Furlanetto, no review. Member names in signature are more contrasted and are aligned. ........ r20977 | prokopec | 2010-02-24 17:55:31 +0100 (Wed, 24 Feb 2010) | 1 line Fixes #3088. No review. ........ r20978 | extempore | 2010-02-25 00:17:30 +0100 (Thu, 25 Feb 2010) | 22 lines Bash completion! The file is automatically created as part of the build process and placed in $pack/etc. % scala -Xprint -Xprint-icode -Xprint-pos -Xprint-types -Xprint: % scala -Xprint: all flatten mixin tailcalls cleanup icode namer terminal closelim inliner packageobjects typer constructors jvm parser uncurry dce lambdalift pickler erasure lazyvals refchecks explicitouter liftcode superaccessors % scala -g: line none notailcalls source vars % scala -Ystruct-dispatch: invoke-dynamic mono-cache no-cache poly-cache Review by community. ........ r20979 | extempore | 2010-02-25 01:14:04 +0100 (Thu, 25 Feb 2010) | 4 lines The build file wasn't quite all the way on the bash completion commit. Now it should work, and also be copied into the distribution. Review by anyone who may be cruel enough to oppose including completion in the distribution. ........ r20980 | extempore | 2010-02-25 02:35:46 +0100 (Thu, 25 Feb 2010) | 8 lines Created -Yfatal-warnings, as otherwise I can't see how to make partest fail on the presence of an unchecked warning. It'll come in handy anyway. Now we have a real tough guy's command line for those who want it: % scalac -unchecked -deprecation -Yfatal-warnings `find . -name '*.scala'` Not for the timid. Review by community. ........ r20981 | extempore | 2010-02-25 03:36:06 +0100 (Thu, 25 Feb 2010) | 1 line Fix for a king-sized last-minute thinko. No review. ........ r20982 | extempore | 2010-02-25 03:53:35 +0100 (Thu, 25 Feb 2010) | 3 lines Some debugging code for partest. If --debug is given it collects timings on all the individual tests and prints it sorted by glacialness. Review by community. ........ r20983 | extempore | 2010-02-25 03:54:04 +0100 (Thu, 25 Feb 2010) | 4 lines Tweaking the sealed logic in light of #3097. Closes #3097. Reorganizes children a little so they always come back sorted the same way the pickler does. Taking advantage of -Yfatal-warnings in the test case. Review by community. ........ r20984 | extempore | 2010-02-25 04:15:34 +0100 (Thu, 25 Feb 2010) | 1 line Trying to fix svn props on scalacheck jar. No review. ........ r20985 | extempore | 2010-02-25 07:08:27 +0100 (Thu, 25 Feb 2010) | 5 lines It turns out some of the weirdness lately is because changes to classpath handling have a way of not taking effect until they're installed via starr, and presently we have a starr with different logic than trunk. No choice but to roll up one more starr based on r20984. No review. ........ r20986 | prokopec | 2010-02-25 16:16:24 +0100 (Thu, 25 Feb 2010) | 1 line Fixes #3088. No review. ........ r20987 | dragos | 2010-02-25 16:53:13 +0100 (Thu, 25 Feb 2010) | 1 line Made the squeezer worthy of its name: a block with an empty list of stats and another block as the result expression is rewritten to the inner block (recursively). This makes the output from the pattern matcher nicer, eliminating loads of empty nested blocks. Review by extempore. ........ r20988 | phaller | 2010-02-25 17:20:25 +0100 (Thu, 25 Feb 2010) | 1 line Physically moved ActorGC to scheduler directory. ........ r20989 | phaller | 2010-02-25 17:26:05 +0100 (Thu, 25 Feb 2010) | 1 line Made doc comment consistent. No review. ........ r20990 | extempore | 2010-02-25 19:24:58 +0100 (Thu, 25 Feb 2010) | 2 lines Working on making the bootstrap process transparent and consistent. And removed a bunch of what is now cruft in partest. No review. ........ r20991 | extempore | 2010-02-25 20:49:25 +0100 (Thu, 25 Feb 2010) | 3 lines Looking at iulian's patch to the squeezer sent me off looking at equalsStructure, which clearly was written in a bygone era. Rewritten with modern tools. No review. ........ r20992 | extempore | 2010-02-25 20:50:28 +0100 (Thu, 25 Feb 2010) | 2 lines More partest cleanups, and putting back a couple lines in build.xml which were left a little too commented out. No review. ........ r20993 | extempore | 2010-02-25 21:50:43 +0100 (Thu, 25 Feb 2010) | 2 lines What appears to be a workaround for #3082, which I am hitting literally 20 times a day. Will detail in ticket. Review by odersky. ........ r20994 | extempore | 2010-02-25 22:20:59 +0100 (Thu, 25 Feb 2010) | 2 lines More return type annotation to work around my other frequent guest in the world of #3082-connected pickler bugs. No review. ........ r20995 | extempore | 2010-02-25 23:09:37 +0100 (Thu, 25 Feb 2010) | 2 lines Added a --bare option to ShowPickled so I can diff signatures without all the explicit indices blowing any points of similarity. No review. ........ r20996 | moors | 2010-02-26 10:16:22 +0100 (Fri, 26 Feb 2010) | 5 lines closes #2797 -- no review (already done in ticket by Martin) 1) isHigherKindedType is now false for singletontype 2) toInstance recurses when pre is a typevar: the problem is that pre.widen.typeSymbol isNonBottomSubClass symclazz is true while pre.baseType(symclazz) is NoType ........ r20997 | moors | 2010-02-26 10:42:50 +0100 (Fri, 26 Feb 2010) | 4 lines closes #2956 the problem was that corresponds on Seq's does not check length of sequences before testing the predicate, whereas in some cases that predicate relied on this invariant (when it was doing substitution) ........ r20998 | moors | 2010-02-26 11:00:49 +0100 (Fri, 26 Feb 2010) | 1 line see #2634: updated docs to indicate zipped is strict ........ r20999 | moors | 2010-02-26 11:50:32 +0100 (Fri, 26 Feb 2010) | 2 lines closes #2421 -- now also deals with chained implicits no review ........ r21000 | moors | 2010-02-26 12:04:02 +0100 (Fri, 26 Feb 2010) | 2 lines closes #2741 closes #3079 no review worksforme ........ r21001 | rytz | 2010-02-26 13:49:02 +0100 (Fri, 26 Feb 2010) | 1 line close #3071. look at owner.info only later in type completer, not during namer. review by odersky ........ r21003 | extempore | 2010-02-26 18:03:22 +0100 (Fri, 26 Feb 2010) | 3 lines Undid my awful code which had broken the thread scheduler selection. Further unbroke it beyond that unbreaking hopefully to the point where java 1.6 on OSX is recognized as such. Review by haller. ........ r21004 | odersky | 2010-02-26 19:31:35 +0100 (Fri, 26 Feb 2010) | 1 line closes #3082, review by rytz ........ r21005 | extempore | 2010-02-26 23:24:46 +0100 (Fri, 26 Feb 2010) | 14 lines Quite a lot more work on XML equality than I can properly justify spending time on, but you know how it is once you get started on something. This commit will likely break some code out there in the world but this is impossible to avoid if we are to achieve sane equality in trunk. For anyone who was relying upon the 2.7 equality behavior for scala.xml.* classes, using "xml_==" instead of "==" for comparisons will restore the old behavior. The standard == on xml elements now attempts to behave in such a way that symmetry and hashCode contracts will be preserved. It's probably not 100% there yet, but I can tell you this: it is closer today than it was yesterday. Review by community. ........ r21006 | extempore | 2010-02-27 04:46:48 +0100 (Sat, 27 Feb 2010) | 17 lines Removed the partest restriction that individual files must be in the same set. Haven't you always wanted to do this? Now you can. Review by phaller. % ./partest `ack --type=scala -l HashSet | head -6` Testing individual files testing: [...]/files/jvm/serialization.scala [ OK ] testing: [...]/files/jvm/t1600.scala [ OK ] Testing individual files testing: [...]/files/pos/collections.scala [ OK ] testing: [...]/files/pos/t2183.scala [ OK ] Testing individual files testing: [...]/files/run/bug1074.scala [ OK ] testing: [...]/files/run/bug2512.scala [ OK ] ........ r21007 | extempore | 2010-02-27 06:47:03 +0100 (Sat, 27 Feb 2010) | 1 line Some library reorganization I discussed with martin. No review. ........ r21008 | extempore | 2010-02-27 21:10:48 +0100 (Sat, 27 Feb 2010) | 2 lines Special cased an error message for the common situation of calling AnyRef methods on Any or AnyVal. Review by odersky. ........ r21009 | extempore | 2010-02-28 00:49:51 +0100 (Sun, 28 Feb 2010) | 2 lines Expanded the check from #1392 to enclose #3123 as well so that "case Int => " doesn't crash. Closes #3123. Review by odersky. ........ r21010 | extempore | 2010-02-28 01:30:21 +0100 (Sun, 28 Feb 2010) | 13 lines While working on Any.## I ran across some interesting tests being made in TreeBuilder: val buf = new ListBuffer[(Name, Tree, Position)] [...] if (buf.iterator forall (name !=)) ... This is always true because a Name will never equal a Tuple3. Oh universal equality, will you never tire of toying with us? Given that this bug has existed since r12886 one might reasonably question the necessity of the conditionals falling prey to this, but leaving that for another day, it should at least check what it's trying to check. No review. ........ r21011 | extempore | 2010-02-28 15:35:50 +0100 (Sun, 28 Feb 2010) | 10 lines Added ## method to Any as our scala hashCode method which provides consistent answers for primitive types. And I'm sure we're all tired of new starrs, but it's hard to add a method to Any without one. This patch only brings ## into existence, but nothing calls it yet. // some true assertions scala> assert(5.5f.## == 5.5f.hashCode) scala> assert(5.0f.## != 5.0f.hashCode && 5.0f.## == 5L.##) No review. (Already reviewed by odersky.) ........ r21012 | extempore | 2010-02-28 17:52:03 +0100 (Sun, 28 Feb 2010) | 2 lines Modification to r21009 to preserve that classic invariant, (x || !x) && !(x && !x). No review. ........ r21013 | dragos | 2010-02-28 22:09:06 +0100 (Sun, 28 Feb 2010) | 2 lines Fixed specialized pattern matches. Incompatible cases are removed from specialized implementations. ........ r21014 | extempore | 2010-03-01 06:59:11 +0100 (Mon, 01 Mar 2010) | 6 lines Enabled scalacheck tests. Renamed the super confusing and what must be legacy scalatest.* properties to partest.*, boldly assuming that the fact that partest is pretty much unusable outside of scalac means there are no users outside of scalac who might be disrupted by eliminating old property names. Review by community. ........ r21015 | ilyas | 2010-03-01 11:25:59 +0100 (Mon, 01 Mar 2010) | 1 line Minor printer fix for singleton types ........ r21016 | odersky | 2010-03-01 11:59:46 +0100 (Mon, 01 Mar 2010) | 1 line Added one previously overlooked case for computing the right tparams of glbs of polytypes. This is a postscript to the fix of #3082. ........ r21017 | odersky | 2010-03-01 12:00:15 +0100 (Mon, 01 Mar 2010) | 1 line closed #3101. Review by community. ........ r21018 | odersky | 2010-03-01 12:02:12 +0100 (Mon, 01 Mar 2010) | 1 line Following a suggestion of jrudolph, made filterKeys and mapValues transform abstract maps, and duplicated functionality for immutable maps. Moved transform and filterNot from immutable to general maps. Review by phaller. ........ r21019 | odersky | 2010-03-01 12:11:25 +0100 (Mon, 01 Mar 2010) | 1 line Closes #3076. Review by community. ........ r21020 | ilyas | 2010-03-01 15:17:44 +0100 (Mon, 01 Mar 2010) | 1 line #3060 fixed ........ r21021 | odersky | 2010-03-01 15:35:58 +0100 (Mon, 01 Mar 2010) | 1 line Added missing file that broke the build. ........ r21022 | ilyas | 2010-03-01 15:51:38 +0100 (Mon, 01 Mar 2010) | 1 line #2885 fixed ........ r21023 | ilyas | 2010-03-01 15:52:00 +0100 (Mon, 01 Mar 2010) | 1 line typo in test fixed ........ r21024 | extempore | 2010-03-01 17:37:01 +0100 (Mon, 01 Mar 2010) | 3 lines Undeprecated Function.tupled based on the type inference issues documented at: http://stackoverflow.com/questions/2354277/function-tupled-and-placehold er-syntax We should revisit if anon function inference improves. Review by community. ........ r21027 | ilyas | 2010-03-01 19:37:55 +0100 (Mon, 01 Mar 2010) | 1 line scalap tests fixed ........ r21028 | ilyas | 2010-03-01 20:27:20 +0100 (Mon, 01 Mar 2010) | 1 line trailing spaces in decompiled annotations are trimmed ........ r21029 | extempore | 2010-03-01 20:47:48 +0100 (Mon, 01 Mar 2010) | 6 lines Whipped ShowPickled until it would print out private[scope] from the signature, and infrastructure created along the way. Only now at this late hour do I realize that this work would be a lot better aimed at creating a fake Universe and then adapting UnPickler.Scan so you can reuse the real logic. My advice to the next guy: do that instead. No review. ........ r21031 | ilyas | 2010-03-02 02:02:55 +0100 (Tue, 02 Mar 2010) | 1 line #3128 fixed ........ r21043 | extempore | 2010-03-02 20:44:01 +0100 (Tue, 02 Mar 2010) | 16 lines Improved equality for Manifests. Implements symmetry via canEquals, and has ClassManifests compare according to erasure but full manifests also compare type arguments. Preserving symmetry means that some things you might expect to be equal are not: val m1 = scala.reflect.ClassManifest.fromClass(classOf[List[String]]) val m2 = manifest[List[String]] (m1 == m2) // false However you can always compare the erasures. (m1.erasure == m2.erasure) // true Review by dpp. ........ r21044 | extempore | 2010-03-02 21:28:45 +0100 (Tue, 02 Mar 2010) | 2 lines Removed the symlinks between scalacheck jars to satisfy windows. Tweaked partest to accomodate. No review. ........ r21045 | extempore | 2010-03-02 23:28:45 +0100 (Tue, 02 Mar 2010) | 6 lines Added --grep command line option to partest. If you want to run every test with the string "Manifest" in the source file, you may now do: ./partest --grep Manifest No review. ........ r21053 | odersky | 2010-03-03 18:33:51 +0100 (Wed, 03 Mar 2010) | 1 line Closes #3130. No review necessary. ........ r21054 | odersky | 2010-03-03 18:36:42 +0100 (Wed, 03 Mar 2010) | 1 line Attempt to fix the typing-a-whileloop problem. ........ r21058 | extempore | 2010-03-04 06:22:57 +0100 (Thu, 04 Mar 2010) | 7 lines A few yards short of the goal posts attempt at making our usage of Throwable subclasses more consistent. This patch eliminates a lot of ad hoc Exception/Error/etc. creation and various arbitrary choices are rendered slightly less arbitrary. From now on let's try not to use the word "Exception" or "Error" in the names of Throwable subclasses unless they actually derive (and make sense to derive) from Exception or Error. Review by community. ........ r21059 | extempore | 2010-03-04 06:23:21 +0100 (Thu, 04 Mar 2010) | 2 lines Obeyed source comment to make some classes private, since the problem described seems to be gone. No review. ........ r21060 | phaller | 2010-03-04 12:40:16 +0100 (Thu, 04 Mar 2010) | 1 line Clean-ups in scheduler hierarchy. Restricted visibility of several traits. Added tests exercising cleaned-up interface. ........ r21062 | rompf | 2010-03-04 14:17:39 +0100 (Thu, 04 Mar 2010) | 1 line fixed while loop performance. label def rhs re-check only done if first typing produces a different type than the initially assumed one (which is alsways Unit, so the recheck only happens if some AnnotationChecker says the type is not Unit but Unit @something). ........ r21063 | phaller | 2010-03-04 14:28:12 +0100 (Thu, 04 Mar 2010) | 1 line Fixed actors.enableForkJoin property. Fixed build. Review by extempore. ........ r21064 | odersky | 2010-03-04 15:06:18 +0100 (Thu, 04 Mar 2010) | 1 line Closes #3118. review by extempore ........ r21065 | phaller | 2010-03-04 16:05:47 +0100 (Thu, 04 Mar 2010) | 1 line Removed obsolete SimpleExecutorScheduler, ThreadPoolScheduler, DefaultThreadPoolScheduler, and SchedulerService. Made ThreadPoolConfig private. No review necessary. ........ r21066 | extempore | 2010-03-04 19:05:39 +0100 (Thu, 04 Mar 2010) | 4 lines Added a comment to Symbols after one too many times forgetting what I was in that file for while I traced which of the linked* functions I wanted. Review by odersky (only because there's also a renaming proposal in there for which I solicit your yea or nay.) ........ r21067 | extempore | 2010-03-04 21:18:41 +0100 (Thu, 04 Mar 2010) | 2 lines Renamed the linkedFooOfBar methods in Symbol to be internally consistent and in line with modern nomenclature. No review. ........ r21068 | extempore | 2010-03-04 22:06:08 +0100 (Thu, 04 Mar 2010) | 2 lines Making sure the interpreter always uses the designated output stream rather than unwittingly falling back on predef. No review. ........ r21071 | extempore | 2010-03-05 07:01:19 +0100 (Fri, 05 Mar 2010) | 8 lines Added -Xmigration option and @migration annotation. At present it will warn about the following changes from 2.7 to 2.8: Stack iterator order reversed mutable.Set.map returns a Set and thus discards duplicates A case 'x @ Pattern' matches differently than 'Pattern' Review by odersky. ........ r21073 | extempore | 2010-03-05 15:30:44 +0100 (Fri, 05 Mar 2010) | 2 lines Removed quotes from quoted tokens in command line parser to soothe Windows. Review by community. ........ r21074 | odersky | 2010-03-05 16:31:40 +0100 (Fri, 05 Mar 2010) | 1 line Closes #3037. Review by extempore. ........ r21075 | odersky | 2010-03-05 16:32:03 +0100 (Fri, 05 Mar 2010) | 1 line Closes #3026. Review by extempore. ........ r21076 | odersky | 2010-03-05 16:32:24 +0100 (Fri, 05 Mar 2010) | 1 line Mixing test case. No review. ........ r21077 | odersky | 2010-03-05 16:58:27 +0100 (Fri, 05 Mar 2010) | 1 line Closes #3015. Review by moors (it's his patch). ........ r21078 | extempore | 2010-03-05 19:17:26 +0100 (Fri, 05 Mar 2010) | 1 line Cleaning up some redundancy martin noticed. No review. ........ r21079 | extempore | 2010-03-05 20:19:17 +0100 (Fri, 05 Mar 2010) | 2 lines ScalaRunTime method to perform sameElements as fix for #2867. Review by odersky. ........ r21080 | extempore | 2010-03-05 21:14:13 +0100 (Fri, 05 Mar 2010) | 1 line Test case for case class equality. Closes #1332. No review. ........ r21081 | extempore | 2010-03-05 22:06:58 +0100 (Fri, 05 Mar 2010) | 5 lines Fix for #3136 by reverting the line in r18184 which caused this and other regressions. The downside is that the #1697 test case no longer passes, but protracted shrug because it wasn't entirely fixed anyway. Review by moors. (Can you triangulate your way to a patch where both work simultaneously? It's today's bonus challenge!) ........ r21083 | dcaoyuan | 2010-03-06 05:54:15 +0100 (Sat, 06 Mar 2010) | 1 line escape source file path with space chars ........ r21084 | extempore | 2010-03-06 14:26:30 +0100 (Sat, 06 Mar 2010) | 3 lines Fixes for #3126. Case class unapply methods now guard against null, and thrown MatchErrors don't NPE trying to stringify null. No review. ........ r21085 | extempore | 2010-03-06 14:45:23 +0100 (Sat, 06 Mar 2010) | 2 lines Modification to the last patch to return None/false rather than throwing the MatchError. No review. ........ r21086 | extempore | 2010-03-07 06:24:00 +0100 (Sun, 07 Mar 2010) | 5 lines One minute too many trying to figure out where some partest classpath mutation was disappearing on me, and I snapped and started the process of creating an immutable Settings. This commit is for the most part infrastructure to enable its smooth and uneventful entrance. Review by community. ........ r21087 | extempore | 2010-03-07 07:02:38 +0100 (Sun, 07 Mar 2010) | 2 lines Still working my way through all the classpath manipulations in partest. No review. ........ r21088 | extempore | 2010-03-07 19:53:07 +0100 (Sun, 07 Mar 2010) | 2 lines Removed unnecessary DebugSetting, folding the small extra functionality back into ChoiceSetting. No review. ........ r21091 | rompf | 2010-03-07 21:52:45 +0100 (Sun, 07 Mar 2010) | 4 lines - new immutable HashMap implementation based on a hash trie. this is the first iteration, more optimizations will be added later. - updated test cases to reflect new ordering of elements - made Map.empty and Set.empty singletons, deprecating classes Map.EmptyMap and Set.EmptySet Review by extempore, odersky. ........ r21092 | extempore | 2010-03-08 07:06:36 +0100 (Mon, 08 Mar 2010) | 2 lines More progress toward immutable Settings, and various cleanups encountered along the way. No review. ........ r21093 | extempore | 2010-03-08 07:24:23 +0100 (Mon, 08 Mar 2010) | 6 lines Created directory for code which is most likely dead but we want to keep around a while in case someone else is using it. It's called src/attic and now it holds four files. Motivations: such files cloud my attempts to figure out what code in the compiler is really being used, they require effort to maintain across changes, and they slow down every build a fraction. Revew by community. ........ r21094 | milessabin | 2010-03-08 11:20:05 +0100 (Mon, 08 Mar 2010) | 1 line Unbreak the IDE build following [21086]. No review. ........ r21098 | dragos | 2010-03-08 14:14:59 +0100 (Mon, 08 Mar 2010) | 1 line Recursively transform 'new' arguments in specialized programs. Closes #3149, no review. ........ r21099 | odersky | 2010-03-08 14:34:57 +0100 (Mon, 08 Mar 2010) | 1 line Closes #3026. Review by extempore. ........ r21100 | odersky | 2010-03-08 14:40:32 +0100 (Mon, 08 Mar 2010) | 1 line Closes #3115. Reviw by rytz ........ r21101 | odersky | 2010-03-08 14:43:12 +0100 (Mon, 08 Mar 2010) | 1 line Closes #3006. Review by milessabin because this could be a good basis for shwoing implicits in the IDE. ........ r21102 | odersky | 2010-03-08 14:45:36 +0100 (Mon, 08 Mar 2010) | 1 line Avoids two unchecked warnings. Review by extempore. ........ r21103 | odersky | 2010-03-08 14:46:13 +0100 (Mon, 08 Mar 2010) | 1 line new tests ........ r21105 | moors | 2010-03-08 15:27:48 +0100 (Mon, 08 Mar 2010) | 4 lines closes #2994 make normalize slightly more aggressive in loading symbol info, while tolerating the righteous cycle (use sym.info.typeParameters instead of unsafeParams) this is needed to make sure higher-kinded types have their type parameters (otherwise we'd get a PolyType with NoSymbol for typeParams) ........ r21106 | phaller | 2010-03-08 16:01:53 +0100 (Mon, 08 Mar 2010) | 1 line Reactor now has type parameter. Added Reactor.getState. Made Reactor.start idempotent. Moved Actor.reactWithin to ReplyReactor. Renamed Replyable to CanReply. ........ r21107 | odersky | 2010-03-08 19:12:11 +0100 (Mon, 08 Mar 2010) | 1 line Refined fix for #2946. Review by extempore. ........ r21108 | phaller | 2010-03-08 19:17:50 +0100 (Mon, 08 Mar 2010) | 1 line Closes #3102. ........ r21109 | extempore | 2010-03-08 19:46:35 +0100 (Mon, 08 Mar 2010) | 2 lines Changed partest ant task not to use reflection, instead using the path with which scala was invoked. No review. ........ r21110 | extempore | 2010-03-08 19:57:01 +0100 (Mon, 08 Mar 2010) | 2 lines Fixed failing test t3115 via judicious application of -Yfatal-warnings. No review. ........ r21111 | extempore | 2010-03-08 20:58:10 +0100 (Mon, 08 Mar 2010) | 8 lines Added test.debug target to build.xml. This will run whatever tests you have placed in the test/debug directories - critically for those of us stuck debugging ant, this lets one run a small selection of tests by way of ant instead of the console runner. (Sorry about the empty .gitignore files, but one of git's quirks is that it won't acknowledge the existence of an empty directory.) No review. ........ r21113 | extempore | 2010-03-09 01:46:20 +0100 (Tue, 09 Mar 2010) | 2 lines Temporarily disabling failing test until I can finish my partest work. No review. ........ r21115 | phaller | 2010-03-09 11:35:13 +0100 (Tue, 09 Mar 2010) | 1 line Made actor-getstate test more robust. No review. ........ r21121 | phaller | 2010-03-09 15:03:02 +0100 (Tue, 09 Mar 2010) | 1 line New attempt at fixing the tests. No review. ........ r21123 | extempore | 2010-03-10 16:33:14 +0100 (Wed, 10 Mar 2010) | 1 line Some windows oriented fixes for build.xml. No review. ........ r21124 | extempore | 2010-03-10 16:57:10 +0100 (Wed, 10 Mar 2010) | 1 line Removed a couple infinite loops in XML. No review. ........ r21125 | extempore | 2010-03-10 17:21:56 +0100 (Wed, 10 Mar 2010) | 2 lines Some minor compiler support bits for my upcoming partest patch. No review. ........ r21126 | extempore | 2010-03-10 17:30:51 +0100 (Wed, 10 Mar 2010) | 2 lines ...and a line from partest I didn't notice the absence of which would break the build. No review. ........ r21127 | dubochet | 2010-03-10 17:32:10 +0100 (Wed, 10 Mar 2010) | 1 line FatalError needs a stack trace. No review (was discussed at Scala meeting). ........ r21128 | moors | 2010-03-10 18:43:20 +0100 (Wed, 10 Mar 2010) | 5 lines closes #3152: refactored adjustTypeArgs and methTypeArgs so that tparams are correctly split into ones that were inferred successfully, and that thus have a corresponding type argument, and those that weren't determined I didn't investigate the exact cause of the final error message in the bug report, but Jason Zaugg's observations seems correct and I never liked that uninstantiated buffer in the first place. review by odersky ........ r21129 | moors | 2010-03-10 18:50:15 +0100 (Wed, 10 Mar 2010) | 1 line slight (syntactic) cleanup of patch for see #3152 -- sorry, only realised when looking over my patch again ........ r21130 | extempore | 2010-03-10 20:18:43 +0100 (Wed, 10 Mar 2010) | 2 lines Small syntactic adjustment so that last patch from adriaan will build. (Big thumsb up to the aesthetics though.) No review. ........ r21131 | extempore | 2010-03-11 07:00:37 +0100 (Thu, 11 Mar 2010) | 1 line Some IO conveniences. No review. ........ r21135 | odersky | 2010-03-11 15:21:21 +0100 (Thu, 11 Mar 2010) | 1 line Closes #2940. Review by extempore. My original idea to replace existrentialAbstraction by existentialType in ClassfileParsers was correct after all. However this change triggered another landmine in Definitions, where ClassType queried unsafeTypeParams. I think that was only needed for the migration to Java generics in 2.7, so it can safely go away now. Because the change in classfile parsers forces less of a type, unsafeTtpeParams returned the wrong result, which caused the build to fail. The modifications in Erasure and Implicits were attempts to isolate the problem before. They seem to be unnecessary to make the build go through, but are cleaner than the previous versions they replace. ........ r21136 | odersky | 2010-03-11 15:22:29 +0100 (Thu, 11 Mar 2010) | 1 line Fixed doc comment. No review. ........ r21137 | odersky | 2010-03-11 17:34:44 +0100 (Thu, 11 Mar 2010) | 1 line Closes #3157 by overriding +: in List. Review by rompf ........ r21138 | rompf | 2010-03-11 17:44:06 +0100 (Thu, 11 Mar 2010) | 1 line implemented handling of 32-bit collisions in immutable.HashMap. review by community. ........ r21139 | odersky | 2010-03-11 17:53:54 +0100 (Thu, 11 Mar 2010) | 1 line Closes #3158. No review necessary. ........ r21140 | rompf | 2010-03-11 17:55:38 +0100 (Thu, 11 Mar 2010) | 2 lines moved the continuations plugin into trunk. it is now part of the distributions under /plugins/continuations.jar which should make scalac load it by default. actual use however must be enabled by passing -P:continuations:enable as command line arg. supporting library code is in package scala.util.continuations and is compiled into scala-library.jar. review by rytz, cunei, odersky. ........ r21141 | odersky | 2010-03-11 18:11:24 +0100 (Thu, 11 Mar 2010) | 1 line Partially reverted r21018. Closes #3153. No review. ........ r21142 | rompf | 2010-03-11 21:36:43 +0100 (Thu, 11 Mar 2010) | 1 line added missing file from last commit. no review. ........ r21148 | Joshua.Suereth | 2010-03-12 14:34:05 +0100 (Fri, 12 Mar 2010) | 1 line Added continuations to maven deployment. review by rompf ........ r21149 | plocinic | 2010-03-12 16:21:25 +0100 (Fri, 12 Mar 2010) | 1 line do not set the type of the implementation method to be the type of the original one as this is done properly in cloneSymbol. no review (already done by Martin) ........ r21150 | odersky | 2010-03-12 16:38:33 +0100 (Fri, 12 Mar 2010) | 1 line Closes #3143. Review by moors. ........ r21151 | odersky | 2010-03-12 19:39:40 +0100 (Fri, 12 Mar 2010) | 1 line Added an object to mangle byte arrays into Java classfile's version of UTF8. ........ r21156 | odersky | 2010-03-13 18:32:19 +0100 (Sat, 13 Mar 2010) | 2 lines Disabled failing test ........ r21157 | odersky | 2010-03-13 18:33:33 +0100 (Sat, 13 Mar 2010) | 2 lines Closes #3120. Review by extempore. ........ r21158 | odersky | 2010-03-13 18:34:13 +0100 (Sat, 13 Mar 2010) | 2 lines Improved version where bumping and zero-encoding are rolled into one. ........ r21159 | extempore | 2010-03-13 20:24:43 +0100 (Sat, 13 Mar 2010) | 2 lines More support code for the big partest patch I'm working on to finally finish classpaths for good. No review. ........ r21160 | odersky | 2010-03-13 21:21:13 +0100 (Sat, 13 Mar 2010) | 2 lines Closes #2918. Review by moors. ........ r21162 | extempore | 2010-03-14 07:57:36 +0100 (Sun, 14 Mar 2010) | 1 line Test case closes #751. No review. ........ r21163 | extempore | 2010-03-14 07:58:02 +0100 (Sun, 14 Mar 2010) | 1 line Test case for #2940. No review. ........ r21164 | extempore | 2010-03-14 08:25:15 +0100 (Sun, 14 Mar 2010) | 1 line Tighten update check in cleanup. Closes #3175. No review. ........ r21165 | rompf | 2010-03-14 18:39:56 +0100 (Sun, 14 Mar 2010) | 1 line improved immutable HashMap iterator. review by community. ........ r21167 | extempore | 2010-03-15 05:45:47 +0100 (Mon, 15 Mar 2010) | 20 lines Leveraged -Xmigration to burn off some warts which arose in the new collections. Warnings put in place for behavioral changes, allowing the following. 1) Buffers: create new collections on ++ and -- like all the other collections. 2) Maps: eliminated never-shipped redundant method valuesIterable and supplied these return types: def keys: Iterable[A] def keysIterator: Iterator[A] def values: Iterable[B] def valuesIterator: Iterator[B] def keySet: Set[A] I concluded that keys should return Iterable because keySet also exists on Map, and is not solely in the province of Maps even if we wanted to change it: it's defined on Sorted and also appears in some Sets. So it seems sensible to have keySet return a Set and keys return the more general type. Closes #3089, #3145. Review by odersky. ........ r21168 | extempore | 2010-03-15 06:19:53 +0100 (Mon, 15 Mar 2010) | 2 lines Reverting a couple replacements from that last patch which don't look so safe on re-examination. No review. ........ r21171 | rytz | 2010-03-15 11:25:34 +0100 (Mon, 15 Mar 2010) | 1 line Fix for msil compiler. Unlike java.lang.Class, System.Type does not take a type parameter. Related to r21135. review by odersky. ........ r21174 | prokopec | 2010-03-15 11:44:27 +0100 (Mon, 15 Mar 2010) | 1 line Fixes #3155. No review is necessary. ........ r21175 | prokopec | 2010-03-15 12:03:03 +0100 (Mon, 15 Mar 2010) | 1 line Fixes #3132. No review necessary. ........ r21176 | prokopec | 2010-03-15 13:44:32 +0100 (Mon, 15 Mar 2010) | 1 line Fixes #3086. Review by community. ........ r21177 | rompf | 2010-03-15 14:44:53 +0100 (Mon, 15 Mar 2010) | 1 line new immutable.HashSet. review by community. ........ r21178 | rytz | 2010-03-15 14:54:23 +0100 (Mon, 15 Mar 2010) | 1 line minor cleanup to build.xml. review by rompf ........ r21179 | prokopec | 2010-03-15 15:45:33 +0100 (Mon, 15 Mar 2010) | 1 line Fixes #3091. Review by community. ........ r21180 | rompf | 2010-03-15 16:48:28 +0100 (Mon, 15 Mar 2010) | 1 line fixed treatment of annotated types in isNumericSubType. re-enabled test case. review by odersky ........ r21181 | extempore | 2010-03-15 18:08:16 +0100 (Mon, 15 Mar 2010) | 3 lines Tracked down docs.lib build issue from the dentist's chair while waiting for my teeth to numb. Checking in over open wireless access point. This is dedication. No review. ........ r21184 | rompf | 2010-03-16 09:19:59 +0100 (Tue, 16 Mar 2010) | 1 line added support for continuations in try/catch blocks. review by community. ........ r21186 | prokopec | 2010-03-16 10:59:37 +0100 (Tue, 16 Mar 2010) | 1 line Changed `!=` to `ne` for #3086. No review. ........ r21187 | prokopec | 2010-03-16 14:10:45 +0100 (Tue, 16 Mar 2010) | 1 line Fixes #3091. Review by community. ........ r21188 | prokopec | 2010-03-16 15:23:13 +0100 (Tue, 16 Mar 2010) | 1 line Fixes infinite streams in #3091. No review. ........ r21189 | odersky | 2010-03-16 15:40:43 +0100 (Tue, 16 Mar 2010) | 1 line Closes #3180. No review. ........ r21190 | odersky | 2010-03-16 15:42:09 +0100 (Tue, 16 Mar 2010) | 1 line Fixes nitpicks by Adriaan in his review. No review necessary. ........ r21193 | odersky | 2010-03-16 16:26:33 +0100 (Tue, 16 Mar 2010) | 2 lines Closes #2913. Review by rytz. (The error was that too few/too many argument errors had a position different from the other errors, so no second try was done for them.) ........ r21195 | odersky | 2010-03-16 17:12:46 +0100 (Tue, 16 Mar 2010) | 1 line new tests ........ r21196 | odersky | 2010-03-16 17:22:44 +0100 (Tue, 16 Mar 2010) | 1 line Closes #2688 by disallowing call-by-name implicit parameters. No review. ........ r21199 | odersky | 2010-03-16 22:07:16 +0100 (Tue, 16 Mar 2010) | 2 lines Fixed build problem by eliminiating a redundant implicit in scalap. Review by extempore. ........ r21200 | rompf | 2010-03-16 22:53:07 +0100 (Tue, 16 Mar 2010) | 1 line added test case for #2417. no review ........ r21201 | rompf | 2010-03-17 00:06:10 +0100 (Wed, 17 Mar 2010) | 1 line closes #3112. no review. ........ r21205 | phaller | 2010-03-17 12:07:50 +0100 (Wed, 17 Mar 2010) | 1 line Closes #3185. Review by plocinic. ........ r21206 | milessabin | 2010-03-17 14:16:09 +0100 (Wed, 17 Mar 2010) | 1 line Continuations support classes are included in scala-library.jar so their sources should be in scala-library-src.jar. Also export scala.util.continuations from the scala-library bundle. ........ r21207 | plocinic | 2010-03-17 17:02:42 +0100 (Wed, 17 Mar 2010) | 1 line Closes #3133. Review by community. ........ r21210 | prokopec | 2010-03-18 11:23:26 +0100 (Thu, 18 Mar 2010) | 1 line Reverse didn't work for empty ranges. Review by extempore. ........ r21214 | plocinic | 2010-03-19 10:09:00 +0100 (Fri, 19 Mar 2010) | 1 line Fixes #3054. No review. ........ r21215 | dubochet | 2010-03-19 14:29:42 +0100 (Fri, 19 Mar 2010) | 1 line Updated SVN ignore patterns. No review. ........ r21216 | phaller | 2010-03-19 18:03:14 +0100 (Fri, 19 Mar 2010) | 1 line Closes #2827. Review by community. ........ r21217 | odersky | 2010-03-19 18:35:58 +0100 (Fri, 19 Mar 2010) | 2 lines Spring cleaning of collection libraries. Closes #3117 by forcing a view when nothing else can be done. If people think some operations can be more lazy, please provide patches/do changes. Also brought proxies and forwarders into line. ........ r21218 | odersky | 2010-03-19 18:36:46 +0100 (Fri, 19 Mar 2010) | 1 line new version of decode that does not need a length. Moved test code to tests. ........ r21219 | extempore | 2010-03-19 20:38:24 +0100 (Fri, 19 Mar 2010) | 15 lines More fun with -Xmigration. Followed through on the changes to BufferLike (++ and similar now create a new collection.) Removed MapLikeBase. Annotated all the methods in mutable.{ Map, Set } which mutated in-place in 2.7 to note that they create new collections, and implemented same. At this point the only +/- like method which mutates in place which I am aware of is BufferLike.+ (see source comment for my observations.) Also tweaked some collections return types as necessitated by these changes, such as mutable.Set.clone() now returning "This" rather than mutable.Set[A]. References #3089, closes #3179. Review by odersky. ........ r21220 | milessabin | 2010-03-19 22:34:32 +0100 (Fri, 19 Mar 2010) | 1 line Added a tryToSetFromPropertyValue implementation for MultiStringSetting. ........ r21222 | extempore | 2010-03-19 22:48:42 +0100 (Fri, 19 Mar 2010) | 5 lines Returning to the thrilling world of equality and hashCodes now that Any.## is a reality. Moved the hash functions from Predef to ScalaRunTime, and made what appears to be an optimization to equals by not losing the result of an instanceof test. Review by community. ........ r21223 | extempore | 2010-03-19 23:37:13 +0100 (Fri, 19 Mar 2010) | 3 lines Half-disabled productElementName until I have time to reimplement it more to martin's liking. ("Half" because full disabling is not possible until starr has forgotten about it.) No review. ........ r21224 | extempore | 2010-03-20 05:24:39 +0100 (Sat, 20 Mar 2010) | 3 lines Some work on the Array methods as they manifest in refinement types: tightening when Array code is generated and also what code is generated. Review by dubochet. ........ r21225 | extempore | 2010-03-21 01:21:54 +0100 (Sun, 21 Mar 2010) | 6 lines Some minor changes in scala.swing.* which I was glancing through because of #3196. I noticed the Font object was in package scala instead of scala.swing, which looks sure to be a mistake (an easy one to make, and one others have made as well, because we're not entirely used to package objects.) I didn't want to accidentally ship a scala.Font so I moved it into swing. Review by imaier. ........ r21226 | extempore | 2010-03-21 01:22:22 +0100 (Sun, 21 Mar 2010) | 5 lines During my last look at r21224 I noticed what must be a long standing bug in Array.update handling. Fixing this probably never to be noticed corner case (see bug3175.scala) seduced me into drumming out some duplication. At least we got some nice commenting out of it. Review by dubochet. ........ r21227 | extempore | 2010-03-22 00:00:14 +0100 (Mon, 22 Mar 2010) | 1 line Some support code related to partest changes. No review. ........ r21228 | rompf | 2010-03-22 17:52:10 +0100 (Mon, 22 Mar 2010) | 1 line closes #3199. review by community. ........ r21229 | extempore | 2010-03-22 23:09:58 +0100 (Mon, 22 Mar 2010) | 4 lines Consistency work on Addable and Growable. Deprecated '+' on all Seq-derived classes. Creating GrowingBuilder to complement AddingBuilder on classes with += but not +. Fixed some inconsistencies I came across in the process. No review. ........ r21230 | extempore | 2010-03-23 00:02:50 +0100 (Tue, 23 Mar 2010) | 5 lines Noticed we still have a bunch of collection classes which are rather lacking. Did some integration, added some companion objects. Not thrilled with the overall picture in there, there's still a lot which should be done. Updated a deprecation message, closes #3202. No review. ........ r21231 | extempore | 2010-03-23 05:17:59 +0100 (Tue, 23 Mar 2010) | 17 lines Went ahead and implemented classpaths as described in email to scala-internals on the theory that at this point I must know what I'm doing. ** PUBLIC SERVICE ANNOUNCEMENT ** If your code of whatever kind stopped working with this commit (most likely the error is something like "object scala not found") you can get it working again with either of: passing -usejavacp on the command line set system property "scala.usejavacp" to "true" Either of these will alert scala that you want the java application classpath to be utilized by scala as well. Review by community. ........ r21232 | extempore | 2010-03-23 07:08:55 +0100 (Tue, 23 Mar 2010) | 4 lines Fix for #3204. This is a really good example of the issues that can arise when return types of public facing methods are inferred. We eventually need some mechanism to make such issues easier to avoid. No review. ........ r21233 | extempore | 2010-03-23 07:26:08 +0100 (Tue, 23 Mar 2010) | 3 lines You try to get away with one little line of uncompiled patch... reverting last patch since I'm too tired to see why it broke the build. No review. ........ r21234 | dubochet | 2010-03-23 15:38:11 +0100 (Tue, 23 Mar 2010) | 7 lines Scala signature is generated as an annotation (that is accessible through Java reflection). - compiler generates all pickled Scala signatures as annotations to class files. - compiler can read class files with signature as annotations or old-style signatures as attributes. - Scalap has also been updated to new signatures (contributed by Ilya Sergey: thanks a lot). - FJBG updated to allow entering constant pool strings as byte arrays. - ByteCodecs decode method returns the length of the decoded array. Review by ilyas. Already mostly reviewed by odersky. ........ r21235 | phaller | 2010-03-23 16:11:05 +0100 (Tue, 23 Mar 2010) | 1 line Fixes #3186. Closes #2214. ........ r21236 | phaller | 2010-03-23 16:23:39 +0100 (Tue, 23 Mar 2010) | 1 line Added test case for #3186. Closes #3186. ........ r21237 | dragos | 2010-03-23 17:29:38 +0100 (Tue, 23 Mar 2010) | 1 line Closed #3195. Review by extempore. ........ r21238 | extempore | 2010-03-23 17:52:51 +0100 (Tue, 23 Mar 2010) | 2 lines Although it was working fine, a test case for @elidable to make sure that state of affairs continues. No review. ........ r21239 | extempore | 2010-03-23 18:26:23 +0100 (Tue, 23 Mar 2010) | 2 lines Added some documentation to the methods in Predef which utilize @elidable. No review. ........ r21240 | extempore | 2010-03-23 19:51:08 +0100 (Tue, 23 Mar 2010) | 1 line Fix and test case for #3169. ........ r21241 | extempore | 2010-03-23 20:13:43 +0100 (Tue, 23 Mar 2010) | 13 lines You know Cutty McPastington is having a good time when you can find this logic in two different files: ('A' <= c && c <= 'Z') || ('a' <= c && c <= 'a') || How could that possibly work, you might ask. After a series of ||s, the last condition subsumes most of the previous ones: Character.isUnicodeIdentifierStart(c) thereby saving us from a world where the only legal lower case identifiers are a, aa, aaa, aaaa, and a few others. No review. ........ r21242 | extempore | 2010-03-23 21:16:51 +0100 (Tue, 23 Mar 2010) | 2 lines Remedied accidental obscuring of -X, -Y, and -P in the standard help output. No review. ........ r21243 | dubochet | 2010-03-23 21:23:49 +0100 (Tue, 23 Mar 2010) | 1 line Fixed build. Partial revert of r21234. All the infrastructure to read new-style signatures is still in, but the compiler again generates old-style signatures. ........ r21244 | extempore | 2010-03-23 22:58:49 +0100 (Tue, 23 Mar 2010) | 2 lines Removed ArgumentsExpander in favor of having all arguments parsed the same way. No review. ........ r21245 | phaller | 2010-03-24 10:58:24 +0100 (Wed, 24 Mar 2010) | 1 line Fixed the serialization test. Restored the test to use the semantics of Enumeration#equals in 2.7. Made caching of Enumeration objects thread safe. See #3186. Review by extempore. ........ r21246 | odersky | 2010-03-24 15:23:40 +0100 (Wed, 24 Mar 2010) | 1 line Fixes problematic equality of En umeration values. ........ r21247 | odersky | 2010-03-24 15:29:04 +0100 (Wed, 24 Mar 2010) | 1 line Fixes problematic equality of Enumeration values. ........ r21248 | odersky | 2010-03-24 15:43:45 +0100 (Wed, 24 Mar 2010) | 1 line Closes #3187. No review. ........ r21249 | extempore | 2010-03-24 16:37:50 +0100 (Wed, 24 Mar 2010) | 3 lines Reverted a presumably unintentional reincarnation of old predef (these functions are in ScalaRunTime now.) Review by odersky just in case there was a secret plan. ........ r21250 | dubochet | 2010-03-24 16:54:21 +0100 (Wed, 24 Mar 2010) | 1 line Scala signature is generated as an annotation, second try. Review by dragos. ........ r21252 | odersky | 2010-03-24 17:20:32 +0100 (Wed, 24 Mar 2010) | 1 line new readme. no review. ........ r21253 | extempore | 2010-03-24 17:23:48 +0100 (Wed, 24 Mar 2010) | 2 lines Fixed an issue with no-parameter-list methods not being elided. No review. ........ r21254 | dubochet | 2010-03-24 17:59:22 +0100 (Wed, 24 Mar 2010) | 5 lines [scaladoc] Improved Scaladoc comment syntax, contributed by Pedro Furlanetto. - Wiki syntax supports nested, numbered and unnumbered lists; - Wiki syntax supports links (entity links currently require fully qualified names); - Stars no longer are mandatory to start comment lines. Already reviewed by dubochet; no review. ........ r21256 | extempore | 2010-03-24 18:18:03 +0100 (Wed, 24 Mar 2010) | 6 lines Renamed partialMap to collect. There was a deprecated no-argument method on Iterator called collect which I had to remove, because if the method is overloaded it puts a bullet in the type inference, an intolerable result for a function which takes a partial function as its argument. I don't think there's much chance of confusion, but I put a migration warning on collect just in case. No review. ........ r21257 | phaller | 2010-03-24 18:29:59 +0100 (Wed, 24 Mar 2010) | 1 line Addresses see #2017. Documents class scala.actors.Exit. Review by community. ........ r21258 | phaller | 2010-03-24 18:31:37 +0100 (Wed, 24 Mar 2010) | 1 line Adds tests for see #2017. ........ r21259 | extempore | 2010-03-24 18:34:54 +0100 (Wed, 24 Mar 2010) | 1 line Fixed a test case I broke with the collect rename. No review. ........ r21260 | rompf | 2010-03-24 18:55:15 +0100 (Wed, 24 Mar 2010) | 1 line continuations plugin will now report a nice error message if it is not enabled and encounters an @cps expression. review by rytz ........ r21261 | extempore | 2010-03-24 20:47:41 +0100 (Wed, 24 Mar 2010) | 1 line Apparently I can't fix a test case to save my life. No review. ........ r21262 | rompf | 2010-03-24 23:43:44 +0100 (Wed, 24 Mar 2010) | 1 line reverting changes from r21260. there is a deeper problem that causes the plugin to be loaded twice but only one instance receives the enable flag (hence, the other one complains). no review ........ r21263 | phaller | 2010-03-25 09:52:08 +0100 (Thu, 25 Mar 2010) | 1 line Makes two actor tests deterministic. No review. ........ r21264 | phaller | 2010-03-25 13:46:01 +0100 (Thu, 25 Mar 2010) | 1 line Removed obsolete version numbers. No review. ........ r21265 | phaller | 2010-03-25 14:14:28 +0100 (Thu, 25 Mar 2010) | 1 line Renamed Replyable* types to *CanReply. No review. ........ r21266 | phaller | 2010-03-25 14:18:23 +0100 (Thu, 25 Mar 2010) | 1 line Renamed Replyable* source files to the types they define. No review. ........ r21269 | dragos | 2010-03-25 15:22:30 +0100 (Thu, 25 Mar 2010) | 1 line Fixed order of fields in the generated code. No review. ........ r21271 | rompf | 2010-03-25 17:14:56 +0100 (Thu, 25 Mar 2010) | 1 line fixed double-loading of plugins. reinstated not-enabled error msg for cps plugin. review by community. ........ r21273 | extempore | 2010-03-25 17:59:14 +0100 (Thu, 25 Mar 2010) | 2 lines New scalacheck jar because recent Actor changes broke binary compatibility. No review. ........ r21274 | extempore | 2010-03-25 20:55:53 +0100 (Thu, 25 Mar 2010) | 15 lines While working on partest discovered that CompilerCommand ignores half its constructor arguments and a couple dozen places blithely pass it those arguments as if they're being used. Then there were setups like this: class OfflineCompilerCommand( arguments: List[String], settings: Settings, error: String => Unit, interactive: Boolean) extends CompilerCommand(arguments, new Settings(error), error, false) Hey offline compiler command, why throw away the perfectly good settings you were given? Ever heard 'reduce, reuse, recycle'? How did you ever work... or do you? No review. ........ r21275 | odersky | 2010-03-25 21:21:45 +0100 (Thu, 25 Mar 2010) | 2 lines I think this closes #2433. Only verified by synthetic test case t2433 which crashed before and compiles now. Review by extempore. ........ r21276 | extempore | 2010-03-25 22:53:58 +0100 (Thu, 25 Mar 2010) | 7 lines Altered classpath behavior when no default is given. Now in that case the contents of environment variable CLASSPATH will be used as the scala user classpath, and only if that is not present will "." be used. Be advised that there are still various "hand assembled" sorts of classpaths in trunk, and there's not yet any way to ensure they honor this; things which use the normal Settings object should do the right thing. No review. ........ r21278 | extempore | 2010-03-26 05:26:03 +0100 (Fri, 26 Mar 2010) | 1 line Some minor I/O changes. No review. ........ r21279 | extempore | 2010-03-26 05:59:58 +0100 (Fri, 26 Mar 2010) | 2 lines Tweaked help output a little further so -Y isn't visible except to those who consider themselves advanced. No review. ........ r21280 | extempore | 2010-03-26 13:20:18 +0100 (Fri, 26 Mar 2010) | 1 line Fix for #3204. No review. ........ r21281 | dubochet | 2010-03-26 15:34:34 +0100 (Fri, 26 Mar 2010) | 1 line Unparsed Scala signature annotations are not added to the symbol table. Review by dragos. ........ r21282 | ilyas | 2010-03-26 16:53:05 +0100 (Fri, 26 Mar 2010) | 1 line missing quotes for annotation values added ........ r21283 | ilyas | 2010-03-26 17:07:39 +0100 (Fri, 26 Mar 2010) | 1 line some output polishing ........ r21284 | rompf | 2010-03-26 18:35:31 +0100 (Fri, 26 Mar 2010) | 1 line improvements to cps exception handling. among other things, finally clauses are now illegal for cps try/catch blocks. transforming them correctly is prohibitively tricky. review by community. review by community. ........ r21285 | extempore | 2010-03-27 06:41:47 +0100 (Sat, 27 Mar 2010) | 1 line TraversableOnce. Review by odersky. ........ r21286 | imaier | 2010-03-28 13:34:48 +0200 (Sun, 28 Mar 2010) | 1 line Fixed #3090 ........ r21287 | imaier | 2010-03-28 14:28:39 +0200 (Sun, 28 Mar 2010) | 1 line Fixed #2803. Added warning for UIElement.cachedWrapper. ........ r21288 | imaier | 2010-03-28 15:01:28 +0200 (Sun, 28 Mar 2010) | 1 line Fix for #2980. No review. ........ r21289 | imaier | 2010-03-28 15:15:31 +0200 (Sun, 28 Mar 2010) | 1 line Fixed #2753. No review. ........ r21290 | imaier | 2010-03-28 15:27:42 +0200 (Sun, 28 Mar 2010) | 1 line Fixed #3219. No review. ........ r21291 | imaier | 2010-03-28 15:56:18 +0200 (Sun, 28 Mar 2010) | 1 line Fixed #2242. No review. ........ r21292 | rompf | 2010-03-29 11:55:44 +0200 (Mon, 29 Mar 2010) | 1 line closes 2864. closes 2934. closes 3223. closes 3225. review by community. ........ r21294 | dubochet | 2010-03-29 14:40:39 +0200 (Mon, 29 Mar 2010) | 1 line Fix to the way Scalap decodes ScalaSignature annotations. Contributed by ilyas. Already reviewed by dubochet, no review. ........ r21295 | odersky | 2010-03-29 14:53:07 +0200 (Mon, 29 Mar 2010) | 1 line Closes #2386 by requiring class manifests for an array element type if a class manifaest for the array type is demanded. Review by dubochet. ........ r21296 | dubochet | 2010-03-29 15:14:10 +0200 (Mon, 29 Mar 2010) | 1 line Reverted file that was unintentionally committed as part of r21294. ........ r21297 | milessabin | 2010-03-29 15:38:11 +0200 (Mon, 29 Mar 2010) | 1 line Patch from Mirko Stocker to add position information to val/var modifiers on ctor params for use by tools. Review by odersky. ........ r21299 | rompf | 2010-03-29 21:22:50 +0200 (Mon, 29 Mar 2010) | 1 line fixes the unfounded "name clash between inherited members" error. review by dragos. ........ r21303 | dubochet | 2010-03-30 20:37:25 +0200 (Tue, 30 Mar 2010) | 1 line [scaladoc] Fixed the nightly build. Wiki parser correctly handles lists with unknown bullet kind. No review. ........ r21304 | extempore | 2010-03-30 23:25:16 +0200 (Tue, 30 Mar 2010) | 3 lines Noticed that the implementation of toArray Iterator had acquired via TraversableOnce called "size" to allocate the array, leaving a nice empty iterator to actually populate it. Fixed. No review. ........ r21305 | rompf | 2010-03-31 14:20:41 +0200 (Wed, 31 Mar 2010) | 1 line closes #3203, overriding more of the TraversableLike methods. also tightened access privileges to internal fields and methods. review by community. ........ r21307 | rytz | 2010-03-31 16:00:09 +0200 (Wed, 31 Mar 2010) | 1 line close #3222. review by community ........ r21309 | rytz | 2010-03-31 18:56:40 +0200 (Wed, 31 Mar 2010) | 1 line close #3183. review by community ........ r21313 | rytz | 2010-04-01 10:39:11 +0200 (Thu, 01 Apr 2010) | 1 line close #3178. review by community ........ r21322 | rompf | 2010-04-02 15:11:23 +0200 (Fri, 02 Apr 2010) | 1 line closes #3242. review by community. ........ r21323 | extempore | 2010-04-02 23:09:34 +0200 (Fri, 02 Apr 2010) | 5 lines Mostly IO tweaks related to my upcoming partest patch, which to my chagrin is being held up by windows. Also updates the default ANT_OPTS to be the same as the ones the nightlies override it with. (If we know you can't build scala with those settings it seems kind of uncool to leave them for everyone else.) No review. ........ r21324 | rompf | 2010-04-03 18:07:58 +0200 (Sat, 03 Apr 2010) | 1 line improved cps transform of partial functions. no review. ........ r21325 | dubochet | 2010-04-03 22:13:19 +0200 (Sat, 03 Apr 2010) | 1 line [scaladoc] Considerably reduced size of documentation by not generating certain strange inner classes. Scaladoc is much much faster (more than 10x on library); not exactly clear why. Protected members are printed in documentation and displayed on demand. Review by malayeri. ........ r21326 | extempore | 2010-04-04 04:58:11 +0200 (Sun, 04 Apr 2010) | 2 lines Nipped the infinite loop which is presently launched by an attempt to run test.continuations.suite with -optimise. No review. ........ r21327 | rompf | 2010-04-04 15:14:44 +0200 (Sun, 04 Apr 2010) | 1 line workaround for #3252. review by extempore. ........ r21328 | extempore | 2010-04-04 18:59:25 +0200 (Sun, 04 Apr 2010) | 1 line Removing a class cast exception. Closes #2843, no review. ........ r21329 | extempore | 2010-04-05 08:24:22 +0200 (Mon, 05 Apr 2010) | 13 lines If I work on this patch any longer without checking in I will go stark raving mad. It is broken up into a couple pieces. This one is the changes to test/. It includes fixing a bunch of tests, removing deprecated constructs, moving jars used by tests to the most specific plausible location rather than having all jars on the classpath of all tests, and some filesystem layout change (continuations get their whole own srcpath.) This would be the world's most tedious review, so let's say no review. [Note: after this commit, I doubt things will build very smoothly until the rest of the partest changes follow. Which should only be seconds, but just in case.] ........ r21330 | extempore | 2010-04-05 08:25:16 +0200 (Mon, 05 Apr 2010) | 7 lines The code part of the partest patch. If anyone wants to review it they can be my guest (reviewbot: review by community!) More realistically: more than likely I have unwittingly altered or impaired some piece of functionality used by someone somewhere. Please alert me if this is the case and I will remedy it. I have to call it at this point as the best interests of 2.8 cannot be served by me nursing this patch along any further. ........ r21331 | odersky | 2010-04-05 15:47:27 +0200 (Mon, 05 Apr 2010) | 2 lines Rearranging IndexedSeq/LinearSeq and related work ........ r21332 | odersky | 2010-04-05 18:53:53 +0200 (Mon, 05 Apr 2010) | 2 lines Made Vector the standard impl of IndexedSeq. Review by rompf. ........ r21333 | extempore | 2010-04-05 19:40:59 +0200 (Mon, 05 Apr 2010) | 1 line Typo patrol, no review. ........ r21341 | extempore | 2010-04-06 02:40:25 +0200 (Tue, 06 Apr 2010) | 1 line A removal that didn't take. No review. ........ r21342 | extempore | 2010-04-06 02:42:50 +0200 (Tue, 06 Apr 2010) | 4 lines Fix for the partest task to fail the build when a test fails, and fixes for 2/3 of the quietly failing tests. I'm not quite sure what to do about the view ones, it doesn't look like a simple rename is going to cut it, so: review by odersky. ........ r21343 | extempore | 2010-04-06 03:26:31 +0200 (Tue, 06 Apr 2010) | 5 lines As a brief diversion from real work, implemented Damerau–Levenshtein and ran it on trunk to elicit obvious misspellings. Unfortunately they're mostly in places like compiler comments which real people never see, but I fixed them anyway. All those English Lit majors who peruse our sources are sure to be pleased. No review. ........ r21344 | extempore | 2010-04-06 04:05:20 +0200 (Tue, 06 Apr 2010) | 1 line Noticed a bug with test obj dirs not getting deleted. No review. ........ r21345 | extempore | 2010-04-06 07:18:46 +0200 (Tue, 06 Apr 2010) | 2 lines A couple more bits of partest I discovered weren't doing their jobs. Some of my classiest messages were going unheard! No review. ........ r21346 | extempore | 2010-04-06 07:19:19 +0200 (Tue, 06 Apr 2010) | 2 lines Some tweaks to classpath handling I had left over from trying to figure out the continuations plugin issue. No review. ........ r21347 | imaier | 2010-04-06 13:43:00 +0200 (Tue, 06 Apr 2010) | 1 line Fixed #3257 ........ r21348 | odersky | 2010-04-06 15:53:39 +0200 (Tue, 06 Apr 2010) | 1 line Optimized toArray for ArrayOps and WrappedArrays. Changed printing of Views. Fixed IndexedseqView problems. Review by extempore. ........ r21349 | prokopec | 2010-04-06 16:39:51 +0200 (Tue, 06 Apr 2010) | 1 line Fixes #2535. Review by community. ........ r21350 | prokopec | 2010-04-06 16:56:14 +0200 (Tue, 06 Apr 2010) | 1 line Forgot to add scalacheck test for #2535. Review by community. ........ r21351 | extempore | 2010-04-06 17:09:02 +0200 (Tue, 06 Apr 2010) | 1 line Final methods should appear in scaladoc. Closes #3067, no review. ........ r21353 | extempore | 2010-04-06 20:27:29 +0200 (Tue, 06 Apr 2010) | 1 line Removing some code duplication from scaladoc. Review by dubochet. ........ r21354 | extempore | 2010-04-07 00:46:22 +0200 (Wed, 07 Apr 2010) | 5 lines Fixed another partest feature I'd managed to break at the very last minute. When a test is too slow finishing, there will be messages identifying the test. It defaults to 90 seconds before the first warning because I know some machines are slow, but it'd be nice if that was more like 30. No review. ........ r21356 | extempore | 2010-04-07 01:57:11 +0200 (Wed, 07 Apr 2010) | 2 lines And another partest gap is filled. Now if you pass --quick to partest it really will use quick as the build dir. No review. ........
Diffstat (limited to 'src/partest')
-rw-r--r--src/partest/README75
-rw-r--r--src/partest/scala/tools/partest/Actions.scala168
-rw-r--r--src/partest/scala/tools/partest/Alarms.scala85
-rw-r--r--src/partest/scala/tools/partest/BuildContributors.scala102
-rw-r--r--src/partest/scala/tools/partest/Categories.scala69
-rw-r--r--src/partest/scala/tools/partest/Compilable.scala103
-rw-r--r--src/partest/scala/tools/partest/Config.scala130
-rw-r--r--src/partest/scala/tools/partest/Dispatcher.scala161
-rw-r--r--src/partest/scala/tools/partest/Entities.scala77
-rw-r--r--src/partest/scala/tools/partest/Housekeeping.scala187
-rw-r--r--src/partest/scala/tools/partest/Partest.scala72
-rw-r--r--src/partest/scala/tools/partest/PartestSpec.scala108
-rw-r--r--src/partest/scala/tools/partest/PartestTask.scala250
-rw-r--r--src/partest/scala/tools/partest/Properties.scala (renamed from src/partest/scala/tools/partest/utils/Properties.scala)4
-rw-r--r--src/partest/scala/tools/partest/Results.scala113
-rw-r--r--src/partest/scala/tools/partest/Runner.scala39
-rw-r--r--src/partest/scala/tools/partest/Statistics.scala46
-rw-r--r--src/partest/scala/tools/partest/Universe.scala101
-rw-r--r--src/partest/scala/tools/partest/ant/JavaTask.scala55
-rw-r--r--src/partest/scala/tools/partest/ant/PartestTask.scala90
-rw-r--r--src/partest/scala/tools/partest/antlib.xml3
-rw-r--r--src/partest/scala/tools/partest/category/AllCategories.scala20
-rw-r--r--src/partest/scala/tools/partest/category/Analysis.scala65
-rw-r--r--src/partest/scala/tools/partest/category/Compiler.scala142
-rw-r--r--src/partest/scala/tools/partest/category/Runner.scala108
-rw-r--r--src/partest/scala/tools/partest/io/ANSIWriter.scala58
-rw-r--r--src/partest/scala/tools/partest/io/Diff.java (renamed from src/partest/scala/tools/partest/nest/Diff.java)2
-rw-r--r--src/partest/scala/tools/partest/io/DiffPrint.java (renamed from src/partest/scala/tools/partest/nest/DiffPrint.java)2
-rw-r--r--src/partest/scala/tools/partest/io/JUnitReport.scala38
-rw-r--r--src/partest/scala/tools/partest/io/Logging.scala132
-rw-r--r--src/partest/scala/tools/partest/nest/AntRunner.scala32
-rw-r--r--src/partest/scala/tools/partest/nest/CompileManager.scala218
-rw-r--r--src/partest/scala/tools/partest/nest/ConsoleFileManager.scala314
-rw-r--r--src/partest/scala/tools/partest/nest/ConsoleRunner.scala237
-rw-r--r--src/partest/scala/tools/partest/nest/DirectRunner.scala78
-rw-r--r--src/partest/scala/tools/partest/nest/FileManager.scala79
-rw-r--r--src/partest/scala/tools/partest/nest/NestRunner.scala16
-rw-r--r--src/partest/scala/tools/partest/nest/NestUI.scala108
-rw-r--r--src/partest/scala/tools/partest/nest/ReflectiveRunner.scala80
-rw-r--r--src/partest/scala/tools/partest/nest/RunnerUtils.scala42
-rw-r--r--src/partest/scala/tools/partest/nest/StreamAppender.scala90
-rw-r--r--src/partest/scala/tools/partest/nest/TestFile.scala109
-rw-r--r--src/partest/scala/tools/partest/nest/Worker.scala1000
-rw-r--r--src/partest/scala/tools/partest/package.scala47
-rw-r--r--src/partest/scala/tools/partest/util/package.scala61
-rw-r--r--src/partest/scala/tools/partest/utils/PrintMgr.scala52
46 files changed, 2429 insertions, 2739 deletions
diff --git a/src/partest/README b/src/partest/README
index 430a2987f8..c7673fe2f8 100644
--- a/src/partest/README
+++ b/src/partest/README
@@ -1,31 +1,50 @@
-How partest choses the compiler / library:
+If you're looking for something to read, I suggest running ../test/partest
+with no arguments, which at this moment prints this:
- * ''-Dscalatest.build=build/four-pack'' -> will search for libraries in
- ''lib'' directory of given path
- * ''--pack'' -> will set ''scalatest.build=build/pack'', and run all tests.
- add ''--[kind]'' to run a selected set of tests.
- * auto detection:
- - scalatest.build property -> ''bin'' / ''lib'' directories
- - distribution (''dists/latest'')
- - supersabbus pack (''build/pack'')
- - sabbus quick (''build/quick'')
- - installed dist (test files in ''misc/scala-test/files'')
+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
-How partest choses test files: the test files must be accessible from
-the directory on which partest is run. So the test files must be either
-at:
- * ./test/files
- * ./files (cwd is "test")
- * ./misc/scala-test/files (installed scala distribution)
+ Test categories:
+ --all run all tests (default, unless no options given)
+ --pos Compile files that are expected to build
+ --neg Compile files that are expected to fail
+ --run Test JVM backend
+ --jvm Test JVM backend
+ --res Run resident compiler scenarii
+ --buildmanager Run Build Manager scenarii
+ --scalacheck Run Scalacheck tests
+ --script Run script files
+ --shootout Run shootout tests
+ --scalap Run scalap tests
-Other arguments:
- * --pos next files test a compilation success
- * --neg next files test a compilation failure
- * --run next files test the interpreter and all backends
- * --jvm next files test the JVM backend
- * --res next files test the resident compiler
- * --shootout next files are shootout tests
- * --script next files test the script runner
- * ''-Dscalatest.scalac_opts=...'' -> add compiler options
- * ''--verbose'' -> print verbose messages
- * ''-Dpartest.debug=true'' -> print debug messages
+ Test "smart" categories:
+ --grep run all tests with a source file containing <expr>
+ --failed run all tests which failed on the last run
+
+ Specifying paths and additional flags, ~ means repository root:
+ --rootdir path from ~ to partest (default: test)
+ --builddir path from ~ to test build (default: build/pack)
+ --srcdir path from --rootdir to sources (default: files)
+ --javaopts flags to java on all runs (overrides JAVA_OPTS)
+ --scalacopts flags to scalac on all tests (overrides SCALAC_OPTS)
+ --pack alias for --builddir build/pack
+ --quick alias for --builddir build/quick
+
+ Options influencing output:
+ --trace show the individual steps taken by each test
+ --show-diff show diff between log and check file
+ --show-log show log on failures
+ --dry-run do not run tests, only show their traces.
+ --terse be less verbose (almost silent except for failures)
+ --verbose be more verbose (additive with --trace)
+ --debug maximum debugging output
+ --ansi print output in color
+
+ Other options:
+ --timeout Timeout in seconds
+ --cleanup delete all stale files and dirs before run
+ --nocleanup do not delete any logfiles or object dirs
+ --stats collect and print statistics about the tests
+ --validate examine test filesystem for inconsistencies
+ --version print version
diff --git a/src/partest/scala/tools/partest/Actions.scala b/src/partest/scala/tools/partest/Actions.scala
new file mode 100644
index 0000000000..3e745714cb
--- /dev/null
+++ b/src/partest/scala/tools/partest/Actions.scala
@@ -0,0 +1,168 @@
+/* __ *\
+** ________ ___ / / ___ Scala Parallel Testing **
+** / __/ __// _ | / / / _ | (c) 2007-2010, LAMP/EPFL **
+** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ **
+** /____/\___/_/ |_/____/_/ | | **
+** |/ **
+\* */
+
+package scala.tools
+package partest
+
+import util._
+import nsc.io._
+
+trait Actions {
+ partest: Universe =>
+
+ class TestSequence(val actions: List[TestStep]) extends AbsTestSequence {
+ }
+
+ implicit def createSequence(xs: List[TestStep]) = new TestSequence(xs)
+
+ trait ExecSupport {
+ self: TestEntity =>
+
+ def execEnv: Map[String, String] = {
+ val map = assembleEnvironment()
+ val cwd = execCwd.toList map ("CWD" -> _.path)
+
+ map ++ cwd
+ }
+ def execCwd = if (commandFile.isFile) Some(sourcesDir) else None
+
+ def runExec(args: List[String]): Boolean = {
+ val cmd = fromArgs(args)
+
+ if (isVerbose) {
+ trace(execEnv.mkString("ENV(", "\n", "\n)"))
+ execCwd foreach (x => trace("CWD(" + x + ")"))
+ }
+
+ trace(cmd)
+ isDryRun || execAndLog(cmd)
+ }
+
+ /** Exec a process to run a command. Assumes 0 exit value is success.
+ * Of necessity, also treats no available exit value as success.
+ */
+ protected def execAndLog(cmd: String): Boolean = {
+ var proc: Process = null
+
+ val result = interruptMeIn(testTimeout) {
+ loggingResult {
+ proc = Process.exec(toArgs(cmd), execEnv, execCwd.orNull, true)
+ proc.slurp()
+ }
+ proc.waitFor() == 0
+ }
+ result getOrElse {
+ warning("Process never terminated: '%s'" format cmd)
+ if (proc != null)
+ proc.destroy()
+
+ false
+ }
+ }
+ }
+
+ trait ScriptableTest {
+ self: TestEntity =>
+
+ // def customTestStep(line: String): TestStep
+
+ /** Translates a line from a .cmds file into a teststep.
+ */
+ def customTestStep(line: String): TestStep = {
+ val (cmd, rest) = line span (x => !Character.isWhitespace(x))
+ val args = toArgs(rest)
+ def fail: TestStep = (_: TestEntity) => error("Parse error: did not understand '%s'" format line)
+
+ val f: TestEntity => Boolean = cmd match {
+ case "scalac" => _ scalac args
+ case "javac" => _ javac args
+ case "scala" => _ runScala args
+ case "diff" => if (args.size != 2) fail else _ => diffFiles(File(args(0)), File(args(1))) == ""
+ case _ => fail
+ }
+ f
+ }
+ }
+
+ trait CompilableTest extends CompileExecSupport {
+ self: TestEntity =>
+
+ def sourceFiles = location.walk collect { case f: File if isJavaOrScala(f) => f } toList
+ def allSources = sourceFiles map (_.path)
+ def scalaSources = sourceFiles filter isScala map (_.path)
+ def javaSources = sourceFiles filter isJava map (_.path)
+
+ /** If there are mixed java and scala files, the standard compilation
+ * sequence is:
+ *
+ * scalac with all files
+ * javac with only java files
+ * scalac with only scala files
+ *
+ * This should be expanded to encompass other strategies so we know how
+ * well they're working or not working - notably, it would be very useful
+ * to know exactly when and how two-pass compilation fails.
+ */
+ def compile() = {
+ def compileJava() = javac(javaSources)
+ def compileScala() = scalac(scalaSources)
+ def compileAll() = scalac(allSources)
+ def compileMixed() = compileAll() && compileJava() && compileScala()
+
+ if (scalaSources.nonEmpty && javaSources.nonEmpty) compileMixed()
+ else compileScala()
+ }
+ }
+
+ trait DiffableTest {
+ self: TestEntity =>
+
+ def checkFile: File = withExtension("check").toFile
+
+ def normalizePaths(s: String) = {
+ /** This accomodates slash/backslash issues by noticing when a given
+ * line was altered, which means it held a path, and only then converting any
+ * backslashes to slashes. It's not foolproof but it's as close as we
+ * can get in one line.
+ */
+ val s2 = s.replaceAll("""(?m)\Q%s\E""" format (sourcesDir + File.separator), "")
+ if (s != s2) s2.replaceAll("""\\""", "/") else s2
+ }
+
+ /** The default cleanup normalizes paths relative to sourcesDir.
+ */
+ def diffCleanup(f: File) = safeLines(f) map normalizePaths mkString "\n"
+
+ /** If optional is true, a missing check file is considered
+ * a successful diff. Necessary since many categories use
+ * checkfiles in an ad hoc manner.
+ */
+ def runDiff(check: File, log: File) = {
+ def arg1 = tracePath(check)
+ def arg2 = tracePath(log)
+ def noCheck = !check.exists && returning(true)(_ => trace("diff %s %s [unchecked]".format(arg1, arg2)))
+
+ noCheck || {
+ def result = safeSlurp(check).trim == diffCleanup(log).trim
+ def msg = if (result) "passed" else "failed"
+
+ if (isDryRun) {
+ trace("diff %s %s".format(arg1, arg2))
+ true
+ }
+ else {
+ trace("diff %s %s [%s]".format(arg1, arg2, msg))
+ result
+ }
+ }
+ }
+
+ private def cleanedLog = returning(File makeTemp "partest-diff")(_ writeAll diffCleanup(logFile))
+ def diffOutput(): String = checkFile ifFile (f => diffFiles(f, cleanedLog)) getOrElse ""
+ }
+}
diff --git a/src/partest/scala/tools/partest/Alarms.scala b/src/partest/scala/tools/partest/Alarms.scala
new file mode 100644
index 0000000000..72afc232e5
--- /dev/null
+++ b/src/partest/scala/tools/partest/Alarms.scala
@@ -0,0 +1,85 @@
+/* NEST (New Scala Test)
+ * Copyright 2007-2010 LAMP/EPFL
+ * @author Paul Phillips
+ */
+
+package scala.tools
+package partest
+
+import java.util.{ Timer, TimerTask }
+
+trait Alarms {
+ self: Universe =>
+
+ def interruptMeIn[T](seconds: Int)(body: => T): Option[T] = {
+ val thisThread = currentThread
+ val alarm = new SimpleAlarm(seconds * 1000) set thisThread.interrupt()
+
+ try { Some(body) }
+ catch { case _: InterruptedException => None }
+ finally { alarm.cancel() ; Thread.interrupted() }
+ }
+
+ case class AlarmerAction(secs: Int, action: () => Unit) extends Runnable {
+ override def run() = action()
+ }
+
+ /** Set any number of alarms up with tuples of the form:
+ * seconds to alarm -> Function0[Unit] to execute
+ */
+ class Alarmer(alarms: AlarmerAction*) {
+ import java.util.concurrent._
+
+ val exec = Executors.newSingleThreadScheduledExecutor()
+ alarms foreach (x => exec.schedule(x, x.secs, TimeUnit.SECONDS))
+ exec.shutdown()
+
+ def cancelAll() = exec.shutdownNow()
+ }
+
+ class SimpleAlarm(timeout: Long) {
+ private val alarm = new Timer
+
+ /** Start a timer, running the given body if it goes off.
+ */
+ def set(body: => Unit) = returning(new TimerTask { def run() = body })(alarm.schedule(_, timeout))
+
+ /** Cancel the timer.
+ */
+ def cancel() = alarm.cancel()
+ }
+
+ trait TestAlarms {
+ test: TestEntity =>
+
+ private def warning1 = AlarmerAction(testWarning, () => warning(
+ """|I've been waiting %s seconds for this to complete:
+ | %s
+ |It may be stuck, or if not, it should be broken into smaller tests.
+ |""".stripMargin.format(testWarning, test))
+ )
+ private def warning2 = AlarmerAction(testWarning * 2, () => warning(
+ """|Now I've been waiting %s seconds for this to complete:
+ | %s
+ |If partest seems hung it would be a good place to look.
+ |""".stripMargin.format(testWarning * 2, test))
+ )
+
+ def startAlarms(onTimeout: => Unit) =
+ if (isNoAlarms) new Alarmer() // for alarm debugging
+ else new Alarmer(Seq(warning1, warning2, AlarmerAction(testTimeout, () => onTimeout)): _*)
+ }
+
+ // Thread.setDefaultUncaughtExceptionHandler(new UncaughtException)
+ // class UncaughtException extends Thread.UncaughtExceptionHandler {
+ // def uncaughtException(t: Thread, e: Throwable) {
+ // Console.println("Uncaught in %s: %s".format(t, e))
+ // }
+ // }
+ //
+ // lazy val logger = File("/tmp/partest.log").bufferedWriter()
+ // def flog(msg: String) = logger synchronized {
+ // logger write (msg + "\n")
+ // logger.flush()
+ // }
+}
diff --git a/src/partest/scala/tools/partest/BuildContributors.scala b/src/partest/scala/tools/partest/BuildContributors.scala
new file mode 100644
index 0000000000..64c7e07bc3
--- /dev/null
+++ b/src/partest/scala/tools/partest/BuildContributors.scala
@@ -0,0 +1,102 @@
+/* NEST (New Scala Test)
+ * Copyright 2007-2010 LAMP/EPFL
+ */
+
+package scala.tools
+package partest
+
+import nsc.io._
+import nsc.util.ClassPath
+
+trait BuildContributors {
+ universe: Universe =>
+
+ /** A trait mixed into types which contribute a portion of the values.
+ * The basic mechanism is the TestBuild, TestCategory, and TestEntity
+ * can each contribute to each value. They are assembled at the last
+ * moment by the ContributorAssembler (presently the TestEntity.)
+ */
+ trait BuildContributor {
+ def javaFlags: List[String]
+ def scalacFlags: List[String]
+ def classpathPaths: List[Path]
+ def buildProperties: List[(String, Any)]
+ def buildEnvironment: Map[String, String]
+ }
+
+ trait ContributorAssembler {
+ def contributors: List[BuildContributor]
+ def assemble[T](what: BuildContributor => List[T]): List[T] = contributors flatMap what
+
+ /** !!! This will need work if we want to achieve real composability,
+ * but it can wait for the demand.
+ */
+ def assembleScalacArgs(args: List[String]) = assemble(_.scalacFlags) ++ args
+ def assembleJavaArgs(args: List[String]) = assemble(_.javaFlags) ++ args
+ def assembleProperties() = assemble(_.buildProperties)
+ def assembleClasspaths(paths: List[Path]) = assemble(_.classpathPaths) ++ paths
+ def assembleEnvironment() = assemble(_.buildEnvironment.toList).toMap
+
+ def createClasspathString() = ClassPath fromPaths (assembleClasspaths(Nil) : _*)
+ def createPropertyString() = assembleProperties() map { case (k, v) => "-D%s=%s".format(k, v.toString) }
+ }
+
+ trait BuildContribution extends BuildContributor {
+ self: TestBuild =>
+
+ /** The base classpath and system properties.
+ * !!! 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) ++ forkJoinPath
+ def buildProperties = List(
+ "scala.home" -> testBuildDir,
+ "partest.lib" -> library, // used in jvm/inner
+ "java.awt.headless" -> true,
+ "user.language" -> "en",
+ "user.country" -> "US",
+ "partest.debug" -> isDebug,
+ "partest.verbose" -> isVerbose
+ // Disabled because there are no natives tests.
+ // "java.library.path" -> srcLibDir
+ )
+ def javaFlags: List[String] = toArgs(javaOpts)
+ def scalacFlags: List[String] = toArgs(scalacOpts)
+
+ /** We put the build being tested's /bin directory in the front of the
+ * path so the scripts and such written to execute "scala" will use this
+ * build and not whatever happens to be on their path.
+ */
+ private def modifiedPath = ClassPath.join(scalaBin.path, Properties.envOrElse("PATH", ""))
+ def buildEnvironment = Map("PATH" -> modifiedPath)
+ }
+
+ trait CategoryContribution extends BuildContributor {
+ self: DirBasedCategory =>
+
+ /** Category-wide classpath additions placed in <category>/lib. */
+ private def libContents = root / "lib" ifDirectory (_.list.toList)
+
+ def classpathPaths = libContents getOrElse Nil
+ def buildProperties = Nil
+ def javaFlags = Nil
+ def scalacFlags = Nil
+ def buildEnvironment = Map()
+ }
+
+ trait TestContribution extends BuildContributor with ContributorAssembler {
+ self: TestEntity =>
+
+ def jarsInTestDir = location.walk collect { case f: File if f hasExtension "jar" => f } toList
+
+ def contributors = List(build, category, self)
+ def javaFlags = safeArgs(javaOptsFile)
+ def scalacFlags = safeArgs(scalaOptsFile)
+ def classpathPaths = jarsInTestDir :+ outDir
+ def buildProperties = List(
+ "partest.output" -> outDir.toAbsolute, // used in jvm/inner
+ "partest.cwd" -> outDir.parent.toAbsolute // used in shootout tests
+ )
+ def buildEnvironment = Map("JAVA_OPTS" -> fromArgs(assembleJavaArgs(Nil)))
+ }
+} \ No newline at end of file
diff --git a/src/partest/scala/tools/partest/Categories.scala b/src/partest/scala/tools/partest/Categories.scala
new file mode 100644
index 0000000000..1d5a21153f
--- /dev/null
+++ b/src/partest/scala/tools/partest/Categories.scala
@@ -0,0 +1,69 @@
+/* __ *\
+** ________ ___ / / ___ Scala Parallel Testing **
+** / __/ __// _ | / / / _ | (c) 2007-2010, LAMP/EPFL **
+** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ **
+** /____/\___/_/ |_/____/_/ | | **
+** |/ **
+\* */
+
+package scala.tools
+package partest
+
+import nsc.Settings
+import nsc.io._
+import nsc.util.{ ClassPath }
+
+trait Categories {
+ self: Universe =>
+
+ trait TestCategory extends AbsTestCategory {
+ def kind: String
+ def startMessage: String = "Executing test group"
+ def testSequence: TestSequence
+
+ class TestSettings(entity: TestEntity, error: String => Unit) extends Settings(error) {
+ def this(entity: TestEntity) = this(entity, Console println _)
+
+ deprecation.value = false
+ encoding.value = "ISO-8859-1"
+ classpath.value = entity.testClasspath
+ outdir.value = entity.outDir.path
+ }
+
+ def createSettings(entity: TestEntity): TestSettings = new TestSettings(entity)
+ def createTest(location: Path): TestEntity =
+ if (location.isFile) TestFile(this, location.toFile)
+ else if (location.isDirectory) TestDirectory(this, location.toDirectory)
+ else error("Failed to create test at '%s'" format location)
+
+ /** Category test identification.
+ */
+ def denotesTestFile(p: Path) = p.isFile && (p hasExtension "scala")
+ def denotesTestDir(p: Path) = p.isDirectory && !ignorePath(p)
+ def denotesTest(p: Path) = denotesTestDir(p) || denotesTestFile(p)
+
+ /** This should verify that all necessary files are present.
+ * By default it delegates to denotesTest.
+ */
+ def denotesValidTest(p: Path) = denotesTest(p)
+ }
+
+ abstract class DirBasedCategory(val kind: String) extends TestCategory with CategoryContribution {
+ lazy val root = Directory(src / kind).normalize
+ def enumerate = root.list filter denotesTest map createTest toList
+
+ /** Standard actions. These can be overridden either on the
+ * Category level or by individual tests.
+ */
+ def compile: TestStep = (_: TestEntity).compile()
+ def diff: TestStep = (_: TestEntity).diff()
+ def run: TestStep = (_: TestEntity).run()
+ def exec: TestStep = (_: TestEntity).exec()
+
+ /** Combinators.
+ */
+ def not(f: TestStep): TestStep = !f(_: TestEntity)
+
+ override def toString = kind
+ }
+} \ No newline at end of file
diff --git a/src/partest/scala/tools/partest/Compilable.scala b/src/partest/scala/tools/partest/Compilable.scala
new file mode 100644
index 0000000000..a1d987ad6d
--- /dev/null
+++ b/src/partest/scala/tools/partest/Compilable.scala
@@ -0,0 +1,103 @@
+/* NEST (New Scala Test)
+ * Copyright 2007-2010 LAMP/EPFL
+ */
+
+package scala.tools
+package partest
+
+import scala.tools.nsc.io._
+import scala.tools.nsc.{ Global, Settings, CompilerCommand, FatalError }
+import scala.tools.nsc.util.{ ClassPath }
+import scala.tools.nsc.reporters.{ Reporter, ConsoleReporter }
+
+trait PartestCompilation {
+ self: Universe =>
+
+ trait CompileExecSupport extends ExecSupport {
+ self: TestEntity =>
+
+ def javacpArg = "-classpath " + testClasspath
+ def scalacpArg = "-usejavacp"
+
+ /** Not used, requires tools.jar.
+ */
+ // def javacInternal(args: List[String]) = {
+ // import com.sun.tools.javac.Main
+ // Main.compile(args.toArray, logWriter)
+ // }
+
+ def javac(args: List[String]): Boolean = {
+ // javac -d outdir -classpath <basepath> <files>
+ val cmd = "%s -d %s %s %s".format(javacCmd, outDir, javacpArg, fromArgs(args))
+ def traceMsg =
+ if (isVerbose) cmd
+ else "%s -d %s %s".format(tracePath(Path(javacCmd)), tracePath(outDir), fromArgs(args))
+
+ trace(traceMsg)
+
+ isDryRun || execAndLog(cmd)
+ }
+
+ def scalac(args: List[String]): Boolean = {
+ val allArgs = assembleScalacArgs(args)
+ val (global, files) = newGlobal(allArgs)
+ val foundFiles = execCwd match {
+ case Some(cwd) => files map (x => File(cwd / x))
+ case _ => files map (x => File(x))
+ }
+ def nonFileArgs = if (isVerbose) global.settings.recreateArgs else assembleScalacArgs(Nil)
+ def traceArgs = fromArgs(nonFileArgs ++ (foundFiles map tracePath))
+ def traceMsg =
+ if (isVerbose) "%s %s".format(build.scalaBin / "scalac", traceArgs)
+ else "scalac " + traceArgs
+
+ trace(traceMsg)
+ isDryRun || global.partestCompile(foundFiles map (_.path), true)
+ }
+
+ /** Actually running the test, post compilation.
+ * Normally args will be List("Test", "jvm"), main class and arg to it.
+ */
+ def runScala(args: List[String]): Boolean = {
+ val scalaRunnerClass = "scala.tools.nsc.MainGenericRunner"
+
+ // java $JAVA_OPTS <javaopts> -classpath <cp>
+ val javaCmdAndOptions = javaCmd +: assembleJavaArgs(List(javacpArg))
+ // MainGenericRunner -usejavacp <scalacopts> Test jvm
+ val scalaCmdAndOptions = List(scalaRunnerClass, scalacpArg) ++ assembleScalacArgs(args)
+ // Assembled
+ val cmd = fromArgs(javaCmdAndOptions ++ createPropertyString() ++ scalaCmdAndOptions)
+
+ def traceMsg = if (isVerbose) cmd else fromArgs(javaCmd :: args)
+ trace(traceMsg)
+
+ isDryRun || execAndLog(cmd)
+ }
+
+ def newReporter(settings: Settings) = new ConsoleReporter(settings, Console.in, logWriter)
+
+ class PartestGlobal(settings: Settings, val creporter: ConsoleReporter) extends Global(settings, creporter) {
+ def partestCompile(files: List[String], printSummary: Boolean): Boolean = {
+ try { new Run compile files }
+ catch { case FatalError(msg) => creporter.error(null, "fatal error: " + msg) }
+
+ if (printSummary)
+ creporter.printSummary
+
+ creporter.flush()
+ !creporter.hasErrors
+ }
+ }
+
+ def newGlobal(args: List[String]): (PartestGlobal, List[String]) = {
+ val settings = category createSettings self
+ val command = new CompilerCommand(args, settings)
+ val reporter = newReporter(settings)
+
+ if (!command.ok)
+ debug("Error parsing arguments: '%s'".format(args mkString ", "))
+
+ (new PartestGlobal(command.settings, reporter), command.files)
+ }
+ }
+} \ No newline at end of file
diff --git a/src/partest/scala/tools/partest/Config.scala b/src/partest/scala/tools/partest/Config.scala
new file mode 100644
index 0000000000..7d8bb80835
--- /dev/null
+++ b/src/partest/scala/tools/partest/Config.scala
@@ -0,0 +1,130 @@
+/* NEST (New Scala Test)
+ * Copyright 2007-2010 LAMP/EPFL
+ */
+
+package scala.tools
+package partest
+
+import io._
+import nsc.io._
+import Properties._
+
+trait Config {
+ universe: Universe =>
+
+ lazy val src = absolutize(srcDir).toDirectory
+ lazy val build = new TestBuild()
+
+ def javaHomeEnv = envOrElse("JAVA_HOME", null)
+ def javaCmd = envOrElse("JAVACMD", "java")
+ def javacCmd = Option(javaHomeEnv) map (x => Path(x) / "bin" / "javac" path) getOrElse "javac"
+
+ /** Values related to actors. The timeouts are in seconds. On a dry
+ * 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
+
+ def allScalaFiles = src.deepFiles filter (_ hasExtension "scala")
+ def allObjDirs = src.deepDirs filter (_ hasExtension "obj")
+ def allLogFiles = src.deepFiles filter (_ hasExtension "log")
+ def allClassFiles = src.deepFiles filter (_ hasExtension "class")
+
+ class TestBuild() extends BuildContribution {
+ import nsc.util.ClassPath
+
+ /** Scala core libs.
+ */
+ val library = pathForComponent("library")
+ val compiler = pathForComponent("compiler")
+ val partest = pathForComponent("partest")
+ val scalap = pathForComponent("scalap", "%s.jar")
+
+ /** Scala supplementary libs - these are not all needed for all build targets,
+ * and some of them are copied inside other jars in later targets. However quick
+ * for instance cannot be run without some of these.
+ */
+ val fjbg = pathForLibrary("fjbg")
+ val msil = pathForLibrary("msil")
+ val forkjoin = pathForLibrary("forkjoin")
+ val scalacheck = pathForLibrary("scalacheck")
+
+ /** Other interesting paths.
+ */
+ 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?
+ //
+ // private val pluginOptionString = "-Xplugin:"
+ // private def updatedPluginPath(options: String): String = {
+ // val (pluginArgs, rest) = toArgs(options) partition (_ startsWith pluginOptionString)
+ // // join all plugin paths as one classpath
+ // val pluginPaths = ClassPath.join(pluginArgs map (_ stripPrefix pluginOptionString): _*)
+ // // map all paths to absolute
+ // val newPath = ClassPath.map(pluginPaths, x => absolutize(x).path)
+ // // recreate option
+ // val pluginOption = if (newPath == "") None else Some(pluginOptionString + newPath)
+ //
+ // fromArgs(rest ::: pluginOption.toList)
+ // }
+
+ private def pathForComponent(what: String, jarFormat: String = "scala-%s.jar"): Path = {
+ def asDir = testBuildDir / "classes" / what
+ def asJar = testBuildDir / "lib" / jarFormat.format(what)
+
+ if (asDir.isDirectory) asDir
+ else if (asJar.isFile) asJar
+ else ""
+ }
+ private def pathForLibrary(what: String) = File(repo / "lib" / (what + ".jar"))
+ }
+
+ def printConfigBanner() = {
+ debug("Java VM started with arguments: '%s'" format fromArgs(Process.javaVmArguments))
+ debug("System Properties:\n" + util.allPropertiesString())
+
+ normal(configBanner())
+ }
+
+ /** Treat an access control failure as None. */
+ private def wrapAccessControl[T](body: => Option[T]): Option[T] =
+ try body catch { case _: java.security.AccessControlException => None }
+
+ private def configBanner() = {
+ val javaBin = Path(javaHome) / "bin"
+ val javaInfoString = "%s (build %s, %s)".format(javaVmName, javaVmVersion, javaVmInfo)
+
+ List(
+ "Scala compiler classes in: " + testBuildDir,
+ "Scala version is: " + nsc.Properties.versionMsg,
+ "Scalac options are: " + universe.scalacOpts,
+ "Java binaries in: " + javaBin,
+ "Java runtime is: " + javaInfoString,
+ "Java runtime options: " + (Process.javaVmArguments mkString " "),
+ "Java options are: " + universe.javaOpts,
+ "Source directory is: " + src,
+ "Selected categories: " + (selectedCategories mkString " "),
+ ""
+ ) mkString "\n"
+ }
+}
diff --git a/src/partest/scala/tools/partest/Dispatcher.scala b/src/partest/scala/tools/partest/Dispatcher.scala
new file mode 100644
index 0000000000..2c7d9d6a2f
--- /dev/null
+++ b/src/partest/scala/tools/partest/Dispatcher.scala
@@ -0,0 +1,161 @@
+/* NEST (New Scala Test)
+ * Copyright 2007-2010 LAMP/EPFL
+ * @author Philipp Haller
+ */
+
+package scala.tools
+package partest
+
+import scala.tools.nsc.io._
+import scala.actors.{ Actor, TIMEOUT }
+import scala.actors.Actor._
+import scala.collection.immutable
+import scala.util.control.Exception.ultimately
+
+/** The machinery for concurrent execution of tests. Each Worker
+ * is given a bundle of tests, which it runs sequentially and then
+ * sends a report back to the dispatcher.
+ */
+trait Dispatcher {
+ partest: Universe =>
+
+ /** The public entry point. The given filter narrows down the list of
+ * tests to run.
+ */
+ def runSelection(categories: List[TestCategory], filt: TestEntity => Boolean = _ => true): CombinedTestResults = {
+ // Setting scala.home informs tests where to obtain their jars.
+ setProp("scala.home", testBuildDir.path)
+
+ val allTests = allCategories flatMap (_.enumerate)
+ val selected = allTests filter filt
+ val groups = selected groupBy (_.category)
+ val count = selected.size
+
+ if (count == 0) return CombinedTestResults(0, 0, 0)
+ else if (count == allTests.size) verbose("Running all %d tests." format count)
+ else verbose("Running %d/%d tests: %s".format(count, allTests.size, toStringTrunc(selected map (_.label) mkString ", ")))
+
+ allCategories collect { case x if groups contains x => runCategory(x, groups(x)) } reduceLeft (_ ++ _)
+ }
+
+ private def parallelizeTests(tests: List[TestEntity]): immutable.Map[TestEntity, Int] = {
+ // propagate verbosity
+ if (isDebug) scala.actors.Debug.level = 3
+
+ // "If elected, I guarantee a slice of tests for every worker!"
+ val groups = tests grouped ((tests.size / numWorkers) + 1) toList
+
+ // "Workers, line up for assignments!"
+ val workers =
+ for ((slice, workerNum) <- groups.zipWithIndex) yield {
+ returning(new Worker(workerNum)) { worker =>
+ worker.start()
+ worker ! TestsToRun(slice)
+ }
+ }
+
+ normal("Started %d workers with ~%d tests each.\n".format(groups.size, groups.head.size))
+
+ /** Listening for news from the proletariat.
+ */
+ (workers map { w =>
+ receiveWithin(workerTimeout * 1000) {
+ case ResultsOfRun(resultMap) => resultMap
+ case TIMEOUT =>
+ warning("Worker %d timed out." format w.workerNum)
+ immutable.Map[TestEntity, Int]()
+ // mark all the worker's tests as having timed out - should be hard to miss
+ groups(w.workerNum) map (_ -> 2) toMap
+ }
+ }) reduceLeft (_ ++ _)
+ }
+
+ private def runCategory(category: TestCategory, tests: List[TestEntity]): CombinedTestResults = {
+ val kind = category.kind
+ normal("%s (%s tests in %s)\n".format(category.startMessage, tests.size, category))
+
+ val (milliSeconds, resultMap) = timed2(parallelizeTests(tests))
+ val (passed, failed) = resultsToStatistics(resultMap)
+
+ CombinedTestResults(passed, failed, milliSeconds)
+ }
+
+ /** A Worker is given a bundle of tests and runs them all sequentially.
+ */
+ class Worker(val workerNum: Int) extends Actor {
+ def act() {
+ react { case TestsToRun(tests) =>
+ val master = sender
+ runTests(tests)(results => master ! ResultsOfRun(results))
+ }
+ }
+
+ /** Runs the tests. Passes the result Map to onCompletion when done.
+ */
+ private def runTests(tests: List[TestEntity])(onCompletion: immutable.Map[TestEntity, Int] => Unit) {
+ var results = new immutable.HashMap[TestEntity, Int] // maps tests to results
+ val numberOfTests = tests.size
+ val testIterator = tests.iterator
+ def processed = results.size
+ def isComplete = testIterator.isEmpty
+
+ def atThreshold(num: Double) = {
+ require(num >= 0 && num <= 1.0)
+ ((processed - 1).toDouble / numberOfTests <= num) && (processed.toDouble / numberOfTests >= num)
+ }
+
+ def extraMessage = {
+ // for now quiet for normal people
+ if (isVerbose || isTrace || isDebug) {
+ if (isComplete) "(#%d 100%%)" format workerNum
+ else if (isVerbose) "(#%d %d/%d)".format(workerNum, processed, numberOfTests)
+ else if (isTrace && atThreshold(0.5)) "(#%d 50%%)" format workerNum
+ else ""
+ }
+ else ""
+ }
+
+ def countAndReport(result: TestResult) {
+ val TestResult(test, state) = result
+ // refuse to count an entity twice
+ if (results contains test)
+ return warning("Received duplicate result for %s: was %s, now %s".format(test, results(test), state))
+
+ // increment the counter for this result state
+ results += (test -> state)
+
+ // show on screen
+ if (isDryRun) normal("\n") // blank line between dry run traces
+ else result show extraMessage
+
+ // remove log if successful
+ if (result.passed)
+ test.deleteLog()
+
+ // Respond to master if this Worker is complete
+ if (isComplete)
+ onCompletion(results)
+ }
+
+ Actor.loopWhile(testIterator.hasNext) {
+ val parent = self
+ // pick a test and set some alarms
+ val test = testIterator.next
+ val alarmer = test startAlarms (parent ! new Timeout(test))
+
+ actor {
+ ultimately(alarmer.cancelAll()) {
+ // Calling isSuccess forces the lazy val "process" inside the test, running it.
+ val res = test.isSuccess
+ // Cancel the alarms and alert the media.
+ parent ! TestResult(test, res)
+ }
+ }
+
+ react {
+ case x: TestResult => countAndReport(x)
+ }
+ }
+ }
+ }
+} \ No newline at end of file
diff --git a/src/partest/scala/tools/partest/Entities.scala b/src/partest/scala/tools/partest/Entities.scala
new file mode 100644
index 0000000000..658cfdee12
--- /dev/null
+++ b/src/partest/scala/tools/partest/Entities.scala
@@ -0,0 +1,77 @@
+/* NEST (New Scala Test)
+ * Copyright 2007-2010 LAMP/EPFL
+ * @author Philipp Haller
+ */
+
+package scala.tools
+package partest
+
+import nsc.io._
+
+trait Entities {
+ self: Universe =>
+
+ abstract class TestEntity extends AbsTestEntity
+ with TestContribution
+ with TestHousekeeping
+ with TestAlarms
+ with EntityLogging
+ with CompilableTest
+ with ScriptableTest
+ with DiffableTest {
+ def location: Path
+ def category: TestCategory
+
+ lazy val label = location.stripExtension
+ 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.
+ */
+ def isSuccess = process
+
+ /** Some standard files, which may or may not be present.
+ */
+ def scalaOptsFile = withExtension("flags").toFile // opts to scalac
+ def javaOptsFile = withExtension("javaopts").toFile // opts to java (but not javac)
+ def commandFile = withExtension("cmds").toFile // sequence of commands to execute
+ def logFile = withExtension("log").toFile // collected output
+
+ /** Some standard directories.
+ */
+ def outDir = withExtension("obj").toDirectory // output dir, e.g. files/pos/t14.obj
+ def categoryDir = location.parent.normalize // category dir, e.g. files/pos/
+ def sourcesDir = location ifDirectory (_.normalize) getOrElse categoryDir
+
+ /** Standard arguments for run, exec, diff.
+ */
+ def argumentsToRun = List("Test", "jvm")
+ def argumentsToExec = List(location.path)
+ def argumentsToDiff = ((checkFile, logFile))
+
+ /** Using a .cmds file for a custom test sequence.
+ */
+ def commandList = safeLines(commandFile)
+ def testSequence =
+ if (commandFile.isFile && commandList.nonEmpty) commandList map customTestStep
+ else category.testSequence
+
+ def run() = runScala(argumentsToRun)
+ def exec() = runExec(argumentsToExec)
+ def diff() = runDiff(argumentsToDiff._1, argumentsToDiff._2)
+
+ /** The memoized result of the test run.
+ */
+ private lazy val process = {
+ def preCheck = precondition || returning(false)(_ => trace("precondition failed"))
+ def allSteps = testSequence.actions forall (f => f(this))
+ val outcome = runWrappers(preCheck && allSteps)
+
+ // an empty outcome means we've been interrupted and are shutting down.
+ outcome getOrElse false
+ }
+ }
+
+ case class TestDirectory(category: TestCategory, location: Directory) extends TestEntity { }
+ case class TestFile(category: TestCategory, location: File) extends TestEntity { }
+}
diff --git a/src/partest/scala/tools/partest/Housekeeping.scala b/src/partest/scala/tools/partest/Housekeeping.scala
new file mode 100644
index 0000000000..a624ca8adb
--- /dev/null
+++ b/src/partest/scala/tools/partest/Housekeeping.scala
@@ -0,0 +1,187 @@
+/* NEST (New Scala Test)
+ * Copyright 2007-2010 LAMP/EPFL
+ */
+
+package scala.tools
+package partest
+
+import scala.util.control.Exception.catching
+import util._
+import nsc.io._
+import Process.runtime
+import Properties._
+
+/** An agglomeration of code which is low on thrills. Hopefully
+ * it operates so quietly in the background that you never have to
+ * look at this file.
+ */
+trait Housekeeping {
+ self: Universe =>
+
+ /** Orderly shutdown on ctrl-C. */
+ @volatile private var _shuttingDown = false
+ protected def setShuttingDown() = {
+ /** Whatever we want to do as shutdown begins goes here. */
+ if (!_shuttingDown) {
+ warning("Received shutdown signal, partest is cleaning up...\n")
+ _shuttingDown = true
+ }
+ }
+ def isShuttingDown = _shuttingDown
+
+ /** Execute some code with a shutdown hook in place. This is
+ * motivated by the desire not to leave the filesystem full of
+ * junk when someone ctrl-Cs a test run.
+ */
+ def withShutdownHook[T](hook: => Unit)(body: => T): Option[T] =
+ /** Java doesn't like it if you keep adding and removing shutdown
+ * hooks after shutdown has begun, so we trap the failure.
+ */
+ catching(classOf[IllegalStateException]) opt {
+ val t = new Thread() {
+ override def run() = {
+ setShuttingDown()
+ hook
+ }
+ }
+ runtime addShutdownHook t
+
+ try body
+ finally runtime removeShutdownHook t
+ }
+
+ /** Search for a directory, possibly given only a name, by starting
+ * at the current dir and walking upward looking for it at each level.
+ */
+ protected def searchForDir(name: String): Directory = {
+ val result = Path(name) ifDirectory (x => x.normalize) orElse {
+ val cwd = Directory.Current getOrElse error("user.dir property not set")
+ val dirs = cwd :: cwd.parents map (_ / name)
+
+ Path onlyDirs dirs map (_.normalize) headOption
+ }
+
+ result getOrElse error("Fatal: could not find directory '%s'" format name)
+ }
+
+ /** Paths we ignore for most purposes.
+ */
+ def ignorePath(x: Path) = {
+ (x.name startsWith ".") ||
+ (x.isDirectory && ((x.name == "lib") || x.hasExtension("obj", "svn")))
+ }
+ /** Make a possibly relative path absolute using partestDir as the base.
+ */
+ def absolutize(path: String) = Path(path) toAbsoluteWithRoot partestDir
+
+ /** Go on a deleting binge.
+ */
+ def cleanupAll() {
+ if (isNoCleanup)
+ return
+
+ val (dirCount, fileCount) = (cleanupObjDirs(), cleanupLogs() + cleanupJunk())
+ if (dirCount + fileCount > 0)
+ normal("Cleaned up %d directories and %d files.\n".format(dirCount, fileCount))
+ }
+
+ def cleanupObjDirs() = countTrue(allObjDirs collect { case x if x.exists => x.deleteRecursively() })
+ def cleanupJunk() = countTrue(allClassFiles collect { case x if x.exists => x.delete() })
+ def cleanupLogs() = countTrue(allLogFiles collect { case x if x.exists => x.delete() })
+
+ /** Look through every file in the partest directory and ask around
+ * to make sure someone knows him. Complain about strangers.
+ */
+ def validateAll() {
+ def denotesTest(p: Path) = allCategories exists (_ denotesTest p)
+ def isMSILcheck(p: Path) = p.name endsWith "-msil.check"
+
+ def analyzeCategory(cat: DirBasedCategory) = {
+ val allTests = cat.enumerate
+ val otherPaths = cat.root walkFilter (x => !ignorePath(x)) filterNot (cat denotesTest _) filterNot isMSILcheck toList
+ val count = otherPaths.size
+
+ println("Validating %d non-test paths in %s.".format(count, cat.kind))
+
+ for (path <- otherPaths) {
+ (allTests find (_ acknowledges path)) match {
+ case Some(test) => if (isVerbose) println(" OK: '%s' is claimed by '%s'".format(path, test.label))
+ case _ => println(">> Unknown path '%s'" format path)
+ }
+ }
+ }
+
+ allCategories collect { case x: DirBasedCategory => analyzeCategory(x) }
+ }
+
+ trait TestHousekeeping {
+ self: TestEntity =>
+
+ /** Calculating derived files. Given a test like
+ * files/run/foo.scala or files/run/foo/
+ * This creates paths like foo.check, foo.flags, etc.
+ */
+ def withExtension(extension: String) = categoryDir / "%s.%s".format(label, extension)
+
+ /** True for a path if this test acknowledges it belongs to this test.
+ * Overridden by some categories.
+ */
+ def acknowledges(path: Path): Boolean = {
+ val loc = location.normalize
+ val knownPaths = List(scalaOptsFile, javaOptsFile, commandFile, logFile, checkFile) ++ jarsInTestDir
+ def isContainedSource = location.isDirectory && isJavaOrScala(path) && (path.normalize startsWith loc)
+
+ (knownPaths exists (_ isSame path)) || isContainedSource
+ }
+
+ /** This test "responds to" this String. This could mean anything -- it's a
+ * way of specifying ad-hoc collections of tests to exercise only a subset of tests.
+ * At present it looks for the given String in all the test sources.
+ */
+ def respondsToString(str: String) = containsString(str)
+ def containsString(str: String) = {
+ debug("Checking %s for \"%s\"".format(sourceFiles mkString ", ", str))
+ sourceFiles map safeSlurp exists (_ contains str)
+ }
+
+ def possiblyTimed[T](body: => T): T = {
+ if (isStats) timed(recordTestTiming(label, _))(body)
+ else body
+ }
+
+ private def prepareForTestRun() = {
+ // make sure we have a clean slate
+ deleteLog(force = true)
+ if (outDir.exists)
+ outDir.deleteRecursively()
+
+ // recreate object dir
+ outDir createDirectory true
+ }
+ def deleteOutDir() = outDir.deleteRecursively()
+ def deleteShutdownHook() = { debug("Shutdown hook deleting " + outDir) ; deleteOutDir() }
+
+ protected def runWrappers[T](body: => T): Option[T] = {
+ prepareForTestRun()
+
+ withShutdownHook(deleteShutdownHook()) {
+ loggingOutAndErr {
+ val result = possiblyTimed { body }
+ if (!isNoCleanup)
+ deleteOutDir()
+
+ result
+ }
+ }
+ }
+
+ override def toString = location.path
+ override def equals(other: Any) = other match {
+ case x: TestEntity => location.normalize == x.location.normalize
+ case _ => false
+ }
+ override def hashCode = location.normalize.hashCode
+ }
+
+ private def countTrue(f: => Iterator[Boolean]) = f filter (_ == true) length
+} \ No newline at end of file
diff --git a/src/partest/scala/tools/partest/Partest.scala b/src/partest/scala/tools/partest/Partest.scala
new file mode 100644
index 0000000000..019ed270e5
--- /dev/null
+++ b/src/partest/scala/tools/partest/Partest.scala
@@ -0,0 +1,72 @@
+/* NEST (New Scala Test)
+ * Copyright 2007-2010 LAMP/EPFL
+ */
+
+package scala.tools
+package partest
+
+import nsc.io._
+import nsc.util.CommandLine
+import category.AllCategories
+
+/** Global object for a Partest run. It is completely configured by the list
+ * of arguments passed to the constructor (although there are a few properties
+ * and environment variables which can influence matters.) See PartestSpec.scala
+ * for the complete list.
+ */
+class Partest(args: List[String]) extends {
+ val parsed = PartestSpecReference(args: _*)
+} with Universe with PartestSpec with AllCategories {
+
+ debug("Partest object created with args: " + (args mkString " "))
+
+ // The abstract values from Universe.
+ lazy val testBuildDir = searchForDir(buildDir)
+ lazy val partestDir = searchForDir(rootDir)
+ lazy val allCategories = List(Pos, Neg, Run, Jvm, Res, Shootout, Scalap, Scalacheck, BuildManager, Script)
+
+ lazy val selectedCategories = if (isAllImplied) allCategories else specifiedCats
+
+ // 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))
+ def isAllImplied = isAll || (specifiedTests.isEmpty && specifiedKinds.isEmpty)
+
+ /** Assembles a filter based on command line options which restrict the test set
+ * --grep limits to only matching tests
+ * --failed limits to only recently failed tests (log file is present)
+ * --<category> limits to only the given tests and categories (but --all overrides)
+ * path/to/Test limits to only the given tests and categories
+ */
+ lazy val filter = {
+ def indivFilter(test: TestEntity) = specifiedTests contains test.location.normalize
+ def categoryFilter(test: TestEntity) = specifiedCats contains test.category
+ def indivOrCat(test: TestEntity) = isAllImplied || indivFilter(test) || categoryFilter(test) // combines previous two
+
+ def failedFilter(test: TestEntity) = !isFailed || (test.logFile exists)
+ def grepFilter(test: TestEntity) = grepExpr.isEmpty || (test containsString grepExpr.get)
+ def combinedFilter(x: TestEntity) = indivOrCat(x) && failedFilter(x) && grepFilter(x) // combines previous three
+
+ combinedFilter _
+ }
+
+ def launchTestSuite() = runSelection(selectedCategories, filter)
+}
+
+object Partest {
+ def fromBuild(dir: String, args: String*): Partest = apply("--builddir" +: dir +: args: _*)
+ def apply(args: String*): Partest = new Partest(args.toList)
+
+ // builds without partest jars won't actually work
+ def starr() = fromBuild("")
+ def locker() = fromBuild("build/locker")
+ def quick() = fromBuild("build/quick")
+ def pack() = fromBuild("build/pack")
+ def strap() = fromBuild("build/strap")
+ def dist() = fromBuild("dists/latest")
+}
+
diff --git a/src/partest/scala/tools/partest/PartestSpec.scala b/src/partest/scala/tools/partest/PartestSpec.scala
new file mode 100644
index 0000000000..a8a1d9b0cb
--- /dev/null
+++ b/src/partest/scala/tools/partest/PartestSpec.scala
@@ -0,0 +1,108 @@
+/* NEST (New Scala Test)
+ * Copyright 2007-2010 LAMP/EPFL
+ * @author Paul Phillips
+ */
+
+package scala.tools
+package partest
+
+import Properties._
+import nsc.io._
+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
+ * is created, the vals are evaluated in order and each of them side effects
+ * 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 +:= _)
+
+ def testKinds = _testKinds
+ def versionMsg = Properties.versionMsg
+
+ help("""
+ |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" ?)
+
+ 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" ?
+
+ 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")
+
+ 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" ?
+
+ 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" ?
+
+ // 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" ?)
+}
+
+object PartestSpecReference extends PartestSpec with CommandLineReferenceSpec {
+ import CommandLineSpec._
+
+ 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)
+ }
+
+ def main(args: Array[String]): Unit = println(bashCompletion("partest"))
+
+ /** Append bash completion for partest to the given file.
+ */
+ def appendCompletionTo(f: File) = f appendAll bashCompletion("partest")
+}
+
diff --git a/src/partest/scala/tools/partest/PartestTask.scala b/src/partest/scala/tools/partest/PartestTask.scala
deleted file mode 100644
index 59781b0aa2..0000000000
--- a/src/partest/scala/tools/partest/PartestTask.scala
+++ /dev/null
@@ -1,250 +0,0 @@
-/* __ *\
-** ________ ___ / / ___ Scala Parallel Testing **
-** / __/ __// _ | / / / _ | (c) 2007-2010, LAMP/EPFL **
-** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ **
-** /____/\___/_/ |_/____/_/ | | **
-** |/ **
-\* */
-
-// $Id$
-
-package scala.tools.partest
-
-import scala.actors.Actor._
-
-import java.io.File
-import java.net.URLClassLoader
-
-import org.apache.tools.ant.Task
-import org.apache.tools.ant.types.{Path, Reference, FileSet}
-
-class PartestTask extends Task {
-
- def addConfiguredPosTests(input: FileSet) {
- posFiles = Some(input)
- }
-
- def addConfiguredNegTests(input: FileSet) {
- negFiles = Some(input)
- }
-
- def addConfiguredRunTests(input: FileSet) {
- runFiles = Some(input)
- }
-
- def addConfiguredJvmTests(input: FileSet) {
- jvmFiles = Some(input)
- }
-
- def addConfiguredResidentTests(input: FileSet) {
- residentFiles = Some(input)
- }
-
- def addConfiguredScriptTests(input: FileSet) {
- scriptFiles = Some(input)
- }
-
- def addConfiguredShootoutTests(input: FileSet) {
- shootoutFiles = Some(input)
- }
-
- def addConfiguredScalapTests(input: FileSet) {
- scalapFiles = Some(input)
- }
-
- def setClasspath(input: Path) {
- if (classpath.isEmpty)
- classpath = Some(input)
- else
- classpath.get.append(input)
- }
-
- def createClasspath(): Path = {
- if (classpath.isEmpty) classpath = Some(new Path(getProject()))
- classpath.get.createPath()
- }
-
- def setClasspathref(input: Reference) {
- createClasspath().setRefid(input)
- }
-
- def setShowLog(input: Boolean) {
- showLog = input
- }
-
- def setShowDiff(input: Boolean) {
- showDiff = input
- }
-
- def setErrorOnFailed(input: Boolean) {
- errorOnFailed = input
- }
-
- def setJavaCmd(input: File) {
- javacmd = Some(input)
- }
-
- def setJavacCmd(input: File) {
- javaccmd = Some(input)
- }
-
- def setScalacOpts(opts: String) {
- scalacOpts = Some(opts)
- }
-
- def setTimeout(delay: String) {
- timeout = Some(delay)
- }
-
- def setDebug(input: Boolean) {
- debug = input
- }
-
- private var classpath: Option[Path] = None
- private var javacmd: Option[File] = None
- private var javaccmd: Option[File] = None
- private var showDiff: Boolean = false
- private var showLog: Boolean = false
- private var runFailed: Boolean = false
- private var posFiles: Option[FileSet] = None
- private var negFiles: Option[FileSet] = None
- private var runFiles: Option[FileSet] = None
- private var jvmFiles: Option[FileSet] = None
- private var residentFiles: Option[FileSet] = None
- private var scriptFiles: Option[FileSet] = None
- private var shootoutFiles: Option[FileSet] = None
- private var scalapFiles: Option[FileSet] = None
- private var errorOnFailed: Boolean = false
- private var scalacOpts: Option[String] = None
- private var timeout: Option[String] = None
- private var debug = false
-
- private def getFiles(fileSet: Option[FileSet]): Array[File] =
- if (fileSet.isEmpty) Array()
- else {
- val files = fileSet.get
- files.getDirectoryScanner(getProject).getIncludedFiles map {
- fs => new File(files.getDir(getProject), fs)
- }
- }
-
- private def getFilesAndDirs(fileSet: Option[FileSet]): Array[File] =
- if (!fileSet.isEmpty) {
- val files = fileSet.get
- val fileTests = getFiles(fileSet)
- val dir = files.getDir(getProject)
- val dirTests = dir.listFiles(new java.io.FileFilter {
- def accept(file: File) =
- file.isDirectory &&
- (!file.getName().equals(".svn")) &&
- (!file.getName().endsWith(".obj"))
- })
- (dirTests ++ fileTests).toArray
- }
- else
- Array()
-
- private def getPosFiles = getFilesAndDirs(posFiles)
- private def getNegFiles = getFilesAndDirs(negFiles)
- private def getRunFiles = getFiles(runFiles)
- private def getJvmFiles = getFilesAndDirs(jvmFiles)
- private def getResidentFiles = getFiles(residentFiles)
- private def getScriptFiles = getFiles(scriptFiles)
- private def getShootoutFiles = getFiles(shootoutFiles)
- private def getScalapFiles = getFiles(scalapFiles)
-
- override def execute() {
- if (debug)
- System.setProperty("partest.debug", "true")
-
- if (classpath.isEmpty)
- error("Mandatory attribute 'classpath' is not set.")
-
- val scalaLibrary =
- (classpath.get.list map { fs => new File(fs) }) find { f =>
- f.getName match {
- case "scala-library.jar" => true
- case "library" if (f.getParentFile.getName == "classes") => true
- case _ => false
- }
- }
-
- if (scalaLibrary.isEmpty)
- error("Provided classpath does not contain a Scala library.")
-
- val classloader = this.getClass.getClassLoader
-
- val antRunner: AnyRef =
- classloader.loadClass("scala.tools.partest.nest.AntRunner").newInstance().asInstanceOf[AnyRef]
- val antFileManager: AnyRef =
- antRunner.getClass.getMethod("fileManager", Array[Class[_]](): _*).invoke(antRunner, Array[Object](): _*)
-
- val runMethod =
- antRunner.getClass.getMethod("reflectiveRunTestsForFiles", Array(classOf[Array[File]], classOf[String]): _*)
-
- def runTestsForFiles(kindFiles: Array[File], kind: String): (Int, Int) = {
- val result = runMethod.invoke(antRunner, Array(kindFiles, kind): _*).asInstanceOf[Int]
- (result >> 16, result & 0x00FF)
- }
-
- def setFileManagerBooleanProperty(name: String, value: Boolean) {
- val setMethod =
- antFileManager.getClass.getMethod(name+"_$eq", Array(classOf[Boolean]): _*)
- setMethod.invoke(antFileManager, Array(java.lang.Boolean.valueOf(value)).asInstanceOf[Array[Object]]: _*)
- }
-
- def setFileManagerStringProperty(name: String, value: String) {
- val setMethod =
- antFileManager.getClass.getMethod(name+"_$eq", Array(classOf[String]): _*)
- setMethod.invoke(antFileManager, Array(value).asInstanceOf[Array[Object]]: _*)
- }
-
- setFileManagerBooleanProperty("showDiff", showDiff)
- setFileManagerBooleanProperty("showLog", showLog)
- setFileManagerBooleanProperty("failed", runFailed)
- if (!javacmd.isEmpty)
- setFileManagerStringProperty("JAVACMD", javacmd.get.getAbsolutePath)
- if (!javaccmd.isEmpty)
- setFileManagerStringProperty("JAVAC_CMD", javaccmd.get.getAbsolutePath)
- setFileManagerStringProperty("CLASSPATH", classpath.get.list.mkString(File.pathSeparator))
- setFileManagerStringProperty("LATEST_LIB", scalaLibrary.get.getAbsolutePath)
- if (!scalacOpts.isEmpty)
- setFileManagerStringProperty("SCALAC_OPTS", scalacOpts.get)
- if (!timeout.isEmpty)
- setFileManagerStringProperty("timeout", timeout.get)
-
- type TFSet = (Array[File], String, String)
- val testFileSets = List(
- (getPosFiles, "pos", "Compiling files that are expected to build"),
- (getNegFiles, "neg", "Compiling files that are expected to fail"),
- (getRunFiles, "run", "Compiling and running files"),
- (getJvmFiles, "jvm", "Compiling and running files"),
- (getResidentFiles, "res", "Running resident compiler scenarii"),
- (getScriptFiles, "script", "Running script files"),
- (getShootoutFiles, "shootout", "Running shootout tests"),
- (getScalapFiles, "scalap", "Running scalap tests")
- )
-
- def runSet(set: TFSet): (Int, Int) = {
- val (files, name, msg) = set
- if (files.isEmpty) (0, 0)
- else {
- log(msg)
- runTestsForFiles(files, name)
- }
- }
-
- val _results = testFileSets map runSet
- val allSuccesses = _results map (_._1) sum
- val allFailures = _results map (_._2) sum
-
- def f = if (errorOnFailed && allFailures > 0) error(_) else log(_: String)
- def s = if (allFailures > 1) "s" else ""
- val msg =
- if (allFailures > 0) "Test suite finished with %d case%s failing.".format(allFailures, s)
- else if (allSuccesses == 0) "There were no tests to run."
- else "Test suite finished with no failures."
-
- f(msg)
- }
-}
diff --git a/src/partest/scala/tools/partest/utils/Properties.scala b/src/partest/scala/tools/partest/Properties.scala
index 237ddea14e..4eeb0359ec 100644
--- a/src/partest/scala/tools/partest/utils/Properties.scala
+++ b/src/partest/scala/tools/partest/Properties.scala
@@ -8,8 +8,8 @@
// $Id$
-package scala.tools.partest
-package utils
+package scala.tools
+package partest
/** Loads partest.properties from the jar. */
object Properties extends scala.util.PropertiesTrait {
diff --git a/src/partest/scala/tools/partest/Results.scala b/src/partest/scala/tools/partest/Results.scala
new file mode 100644
index 0000000000..4e0c446788
--- /dev/null
+++ b/src/partest/scala/tools/partest/Results.scala
@@ -0,0 +1,113 @@
+/* NEST (New Scala Test)
+ * Copyright 2007-2010 LAMP/EPFL
+ */
+
+package scala.tools
+package partest
+
+import scala.collection.immutable
+
+trait Results {
+ self: Universe =>
+
+ /** A collection of tests for a Worker.
+ */
+ case class TestsToRun(entities: List[TestEntity])
+
+ /** The response from a Worker who has been given TestsToRun.
+ */
+ case class ResultsOfRun(results: immutable.Map[TestEntity, Int])
+
+ /** The result of a single test. (0: OK, 1: FAILED, 2: TIMEOUT)
+ */
+ sealed abstract class TestResult(val state: Int, val description: String) {
+ def entity: TestEntity
+
+ def passed = state == 0
+ def colorize(s: String): String
+ def show(msg: String) =
+ if (!isShuttingDown)
+ showResult(colorize(description), msg)
+
+ private def outputPrefix = if (isInsideAnt) "" else markNormal("partest: ")
+ private def name = src relativize entity.location // e.g. "neg/test.scala"
+ private def showResult(status: String, extraMsg: String) =
+ normal(outputPrefix + "[...]/%-40s [%s] %s\n".format(name, status, extraMsg))
+
+ override def equals(other: Any) = other match {
+ case x: TestResult => entity == x.entity
+ case _ => false
+ }
+ override def hashCode = entity.hashCode
+ override def toString = "%s (%s)".format(entity, if (passed) "passed" else "failed")
+ }
+
+ class Success(val entity: TestEntity) extends TestResult(0, " OK ") {
+ def colorize(s: String) = markSuccess(s)
+ override def show(msg: String) = if (!isTerse) super.show(msg)
+ }
+ class Failure(val entity: TestEntity) extends TestResult(1, " FAILED ") {
+ def colorize(s: String) = markFailure(s)
+
+ override def show(msg: String) = {
+ super.show(msg)
+
+ if (isShowDiff || isTrace)
+ normal(entity.diffOutput())
+
+ if (isShowLog || isTrace)
+ normal(toStringTrunc(entity.failureMessage(), 1600))
+ }
+ }
+ class Timeout(val entity: TestEntity) extends TestResult(2, "TIME OUT") {
+ def colorize(s: String) = markFailure(s)
+ }
+
+ object TestResult {
+ def apply(entity: TestEntity, success: Boolean) =
+ if (success) new Success(entity)
+ else new Failure(entity)
+
+ def apply(entity: TestEntity, state: Int) = state match {
+ case 0 => new Success(entity)
+ case 1 => new Failure(entity)
+ case 2 => new Timeout(entity)
+ }
+ def unapply(x: Any) = x match {
+ case x: TestResult => Some((x.entity, x.state))
+ case _ => None
+ }
+ }
+
+ /** The combined results of any number of tests.
+ */
+ case class CombinedTestResults(
+ passed: Int,
+ failed: Int,
+ elapsedMilliseconds: Long
+ ) {
+ // housekeeping
+ val elapsedSecs = elapsedMilliseconds / 1000
+ val elapsedMins = elapsedSecs / 60
+ val elapsedHrs = elapsedMins / 60
+ val dispMins = elapsedMins - elapsedHrs * 60
+ val dispSecs = elapsedSecs - elapsedMins * 60
+
+ def total = passed + failed
+ def hasFailures = failed > 0
+ def exitCode = if (expectedErrors == failed) 0 else 1
+
+ def ++(x: CombinedTestResults) = CombinedTestResults(
+ passed + x.passed,
+ failed + x.failed,
+ elapsedMilliseconds + x.elapsedMilliseconds
+ )
+
+ def elapsedString = "%02d:%02d:%02d".format(elapsedHrs, dispMins, dispSecs)
+ override def toString =
+ if (total == 0) "There were no tests to run."
+ else if (isDryRun) "%d tests would be run." format total
+ else if (hasFailures) "%d of %d tests failed (elapsed time: %s)".format(failed, total, elapsedString)
+ else "All %d tests were successful (elapsed time: %s)".format(total, elapsedString)
+ }
+} \ No newline at end of file
diff --git a/src/partest/scala/tools/partest/Runner.scala b/src/partest/scala/tools/partest/Runner.scala
new file mode 100644
index 0000000000..7f67c93478
--- /dev/null
+++ b/src/partest/scala/tools/partest/Runner.scala
@@ -0,0 +1,39 @@
+/* NEST (New Scala Test)
+ * Copyright 2007-2010 LAMP/EPFL
+ * @author Philipp Haller
+ */
+
+package scala.tools
+package partest
+
+import nsc.io._
+
+object Runner {
+ def main(mainArgs: Array[String]) {
+ val propArgs = PartestSpecReference.sysPropsAsOptions()
+ val args = (propArgs ++ mainArgs).toList
+ val runner = Partest(args: _*)
+ import runner._
+
+ if (isVersion) return println(versionMsg)
+ if (args.isEmpty) return println(helpMsg)
+ if (isValidate) return validateAll()
+
+ printConfigBanner()
+
+ if (isCleanup)
+ cleanupAll()
+
+ val result = launchTestSuite()
+ val exitCode = result.exitCode
+ val message = "\n" + result + "\n"
+
+ if (exitCode == 0) success(message)
+ else failure(message)
+
+ if (isStats)
+ showTestStatistics()
+
+ System exit exitCode
+ }
+}
diff --git a/src/partest/scala/tools/partest/Statistics.scala b/src/partest/scala/tools/partest/Statistics.scala
new file mode 100644
index 0000000000..2ea3c6e8f0
--- /dev/null
+++ b/src/partest/scala/tools/partest/Statistics.scala
@@ -0,0 +1,46 @@
+/* NEST (New Scala Test)
+ * Copyright 2007-2010 LAMP/EPFL
+ * @author Philipp Haller
+ */
+
+package scala.tools
+package partest
+
+import scala.collection.mutable.HashMap
+
+trait Statistics {
+ /** Only collected when --stats is given. */
+ lazy val testStatistics = new HashMap[String, Long]
+
+ /** Given function and block of code, evaluates code block,
+ * calls function with milliseconds elapsed, and returns block result.
+ */
+ def timed[T](f: Long => Unit)(body: => T): T = {
+ val start = System.currentTimeMillis
+ val result = body
+ val end = System.currentTimeMillis
+
+ f(end - start)
+ result
+ }
+ /** Times body and returns both values.
+ */
+ def timed2[T](body: => T): (Long, T) = {
+ var milliSeconds = 0L
+ val result = timed(x => milliSeconds = x)(body)
+
+ (milliSeconds, result)
+ }
+
+ def resultsToStatistics(results: Iterable[(_, Int)]): (Int, Int) =
+ (results partition (_._2 == 0)) match {
+ case (winners, losers) => (winners.size, losers.size)
+ }
+
+ def recordTestTiming(name: String, milliseconds: Long) =
+ synchronized { testStatistics(name) = milliseconds }
+
+ def showTestStatistics() {
+ testStatistics.toList sortBy (-_._2) foreach { case (k, v) => println("%s: %.2f seconds".format(k, (v.toDouble / 1000))) }
+ }
+}
diff --git a/src/partest/scala/tools/partest/Universe.scala b/src/partest/scala/tools/partest/Universe.scala
new file mode 100644
index 0000000000..557d48fe54
--- /dev/null
+++ b/src/partest/scala/tools/partest/Universe.scala
@@ -0,0 +1,101 @@
+/* __ *\
+** ________ ___ / / ___ Scala Parallel Testing **
+** / __/ __// _ | / / / _ | (c) 2007-2010, LAMP/EPFL **
+** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ **
+** /____/\___/_/ |_/____/_/ | | **
+** |/ **
+\* */
+
+package scala.tools
+package partest
+
+import nsc.io._
+import category.AllCategories
+import io.Logging
+
+/** The high level view of the partest infrastructure.
+ */
+abstract class Universe
+ extends Entities
+ with BuildContributors
+ with Logging
+ with Dispatcher
+ with Statistics
+ with Housekeeping
+ with Results
+ with PartestCompilation
+ with PartestSpec
+ with Config
+ with Alarms
+ with Actions
+ with Categories {
+
+ /** The abstract values from which all else is derived. */
+ def partestDir: Directory
+ def testBuildDir: Directory
+ def allCategories: List[TestCategory]
+ def selectedCategories: List[TestCategory]
+
+ /** Some plausibly abstract types. */
+ type TestBuild <: BuildContributor // e.g. quick, pack
+ type TestCategory <: AbsTestCategory // e.g. pos, neg, run
+ type TestEntity <: AbsTestEntity // e.g. files/pos/test25.scala
+ type TestSequence <: AbsTestSequence // e.g. compile, run, diff
+
+ /** Although TestStep isn't much more than Function1 right now,
+ * it exists this way so it can become more capable.
+ */
+ implicit def f1ToTestStep(f: TestEntity => Boolean): TestStep =
+ new TestStep { def apply(test: TestEntity) = f(test) }
+
+ abstract class TestStep extends (TestEntity => Boolean) {
+ def apply(test: TestEntity): Boolean
+ }
+
+ /** An umbrella category of tests, such as "pos" or "run".
+ */
+ trait AbsTestCategory extends BuildContributor {
+ type TestSettings
+
+ def kind: String
+ def testSequence: TestSequence
+ def denotesTest(location: Path): Boolean
+
+ def createTest(location: Path): TestEntity
+ def createSettings(entity: TestEntity): TestSettings
+ def enumerate: List[TestEntity]
+ }
+
+ /** A single test. It may involve multiple files, but only a
+ * single path is used to designate it.
+ */
+ trait AbsTestEntity extends BuildContributor {
+ def category: TestCategory
+ def location: Path
+ def onException(x: Throwable): Unit
+ def testClasspath: String
+
+ /** Any preconditions before running the test. Test fails
+ * immediately if this returns false.
+ */
+ def precondition: Boolean = true
+
+ /** Most tests will use the sequence defined by the category,
+ * but the test can override and define a custom sequence.
+ */
+ def testSequence: TestSequence
+
+ /** True if this test recognizes the given path as a piece of it.
+ * For validation purposes.
+ */
+ def acknowledges(path: Path): Boolean
+ }
+
+ /** Every TestEntity is partly characterized by a series of actions
+ * which are applied to the TestEntity in the given order. The test
+ * passes if all those actions return true, fails otherwise.
+ */
+ trait AbsTestSequence {
+ def actions: List[TestStep]
+ }
+} \ No newline at end of file
diff --git a/src/partest/scala/tools/partest/ant/JavaTask.scala b/src/partest/scala/tools/partest/ant/JavaTask.scala
new file mode 100644
index 0000000000..0bebf91368
--- /dev/null
+++ b/src/partest/scala/tools/partest/ant/JavaTask.scala
@@ -0,0 +1,55 @@
+/* __ *\
+** ________ ___ / / ___ Scala Parallel Testing **
+** / __/ __// _ | / / / _ | (c) 2007-2010, LAMP/EPFL **
+** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ **
+** /____/\___/_/ |_/____/_/ | | **
+** |/ **
+\* */
+
+package scala.tools
+package partest
+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 scala.tools.nsc.io._
+import scala.tools.nsc.util.{ ClassPath, CommandLineSpec }
+import CommandLineSpec._
+
+class JavaTask extends Java {
+ override def getTaskName() = "partest"
+ private val scalaRunnerClass = "scala.tools.nsc.MainGenericRunner"
+
+ 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)
+
+ private def baseDir = Directory(getProject.getBaseDir)
+ private def prop(s: String) = Option(getProject getProperty s)
+ private def jvmline(s: String) = returning(createJvmarg())(_ setLine s)
+ private def addArg(s: String) = returning(createArg())(_ setValue s)
+
+ private def newKeyValue(key: String, value: String) =
+ returning(new Environment.Variable)(x => { x setKey key ; x setValue value })
+
+ def setDefaults() {
+ setFork(true)
+ setFailonerror(true)
+ getProject.setSystemProperties()
+ setClassname(scalaRunnerClass)
+ addSysproperty(newKeyValue("partest.is-in-ant", "true"))
+ jvmline(partestJVMArgs)
+ runnerArgs foreach addArg
+
+ // do we want basedir or rootDir to be the cwd?
+ // setDir(Path(rootDir).jfile)
+ }
+
+ override def init() = {
+ super.init()
+ setDefaults()
+ }
+}
+
diff --git a/src/partest/scala/tools/partest/ant/PartestTask.scala b/src/partest/scala/tools/partest/ant/PartestTask.scala
new file mode 100644
index 0000000000..65848fabb0
--- /dev/null
+++ b/src/partest/scala/tools/partest/ant/PartestTask.scala
@@ -0,0 +1,90 @@
+/* __ *\
+** ________ ___ / / ___ 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/antlib.xml b/src/partest/scala/tools/partest/antlib.xml
index b3b98e853f..af36f11368 100644
--- a/src/partest/scala/tools/partest/antlib.xml
+++ b/src/partest/scala/tools/partest/antlib.xml
@@ -1,4 +1,3 @@
<antlib>
- <taskdef name="partest"
- classname="scala.tools.partest.PartestTask"/>
+ <taskdef name="partest" classname="scala.tools.partest.ant.JavaTask"/>
</antlib>
diff --git a/src/partest/scala/tools/partest/category/AllCategories.scala b/src/partest/scala/tools/partest/category/AllCategories.scala
new file mode 100644
index 0000000000..ce6573123a
--- /dev/null
+++ b/src/partest/scala/tools/partest/category/AllCategories.scala
@@ -0,0 +1,20 @@
+/* __ *\
+** ________ ___ / / ___ Scala Parallel Testing **
+** / __/ __// _ | / / / _ | (c) 2007-2010, LAMP/EPFL **
+** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ **
+** /____/\___/_/ |_/____/_/ | | **
+** |/ **
+\* */
+
+package scala.tools
+package partest
+package category
+
+trait AllCategories extends Compiler with Analysis with Runner {
+ self: Universe =>
+
+ object Pos extends DirBasedCategory("pos") { lazy val testSequence: TestSequence = List(compile) }
+ object Neg extends DirBasedCategory("neg") { lazy val testSequence: TestSequence = List(not(compile), diff) }
+ object Run extends DirBasedCategory("run") { lazy val testSequence: TestSequence = List(compile, run, diff) }
+ object Jvm extends DirBasedCategory("jvm") { lazy val testSequence: TestSequence = List(compile, run, diff) }
+}
diff --git a/src/partest/scala/tools/partest/category/Analysis.scala b/src/partest/scala/tools/partest/category/Analysis.scala
new file mode 100644
index 0000000000..f2b43ebf6d
--- /dev/null
+++ b/src/partest/scala/tools/partest/category/Analysis.scala
@@ -0,0 +1,65 @@
+/* NEST (New Scala Test)
+ * Copyright 2007-2010 LAMP/EPFL
+ */
+
+package scala.tools
+package partest
+package category
+
+import java.lang.{ ClassLoader => JavaClassLoader }
+import java.net.URL
+import nsc.util.ScalaClassLoader
+import nsc.io._
+
+class PartestClassLoader(urls: Array[URL], parent: JavaClassLoader) extends ScalaClassLoader.URLClassLoader(urls, parent) {
+ def this(urls: Array[URL]) = this(urls, null)
+ def bytes(path: String) = findBytesForClassName(path)
+ def singleton(path: String) = tryToInitializeClass(path).get getField "MODULE$" get null
+
+ /** Calls a method in an object via reflection.
+ */
+ def apply[T](className: String, methodName: String)(args: Any*): T = {
+ def fail = error("Reflection failed on %s.%s".format(className, methodName))
+ val clazz = tryToLoadClass(className) getOrElse fail
+ val obj = singleton(className)
+ val m = clazz.getMethods find (x => x.getName == methodName && x.getParameterTypes.size == args.size) getOrElse fail
+
+ m.invoke(obj, args map (_.asInstanceOf[AnyRef]): _*).asInstanceOf[T]
+ }
+}
+
+trait Analysis {
+ self: Universe =>
+
+ object Scalap extends DirBasedCategory("scalap") {
+ val testSequence: TestSequence = List(compile, run, diff)
+ override def denotesTest(p: Path) = p.isDirectory && (p.toDirectory.files exists (_.name == "result.test"))
+ override def createTest(location: Path) = new ScalapTest(location)
+
+ class ScalapTest(val location: Path) extends TestEntity {
+ val category = Scalap
+ val scalapMain = "scala.tools.scalap.Main$"
+ val scalapMethod = "decompileScala"
+
+ override def classpathPaths = super.classpathPaths :+ build.scalap
+ override def checkFile = File(location / "result.test")
+ override def precondition = checkFile.isFile && super.precondition
+
+ private def runnerURLs = build.classpathPaths ::: classpathPaths map (_.toURL)
+ private def createClassLoader = new PartestClassLoader(runnerURLs.toArray, this.getClass.getClassLoader)
+
+ val isPackageObject = containsString("package object")
+ val suffix = if (isPackageObject) ".package" else ""
+ val className = location.name.capitalize + suffix
+
+ override def run() = loggingResult {
+ def loader = createClassLoader
+ def bytes = loader.bytes(className)
+
+ trace("scalap %s".format(className))
+ if (isDryRun) ""
+ else loader[String](scalapMain, scalapMethod)(bytes, isPackageObject)
+ }
+ }
+ }
+}
diff --git a/src/partest/scala/tools/partest/category/Compiler.scala b/src/partest/scala/tools/partest/category/Compiler.scala
new file mode 100644
index 0000000000..58fd8230e2
--- /dev/null
+++ b/src/partest/scala/tools/partest/category/Compiler.scala
@@ -0,0 +1,142 @@
+/* NEST (New Scala Test)
+ * Copyright 2007-2010 LAMP/EPFL
+ */
+
+package scala.tools
+package partest
+package category
+
+import nsc.io._
+import nsc.reporters._
+import nsc.{ Settings, CompilerCommand }
+import scala.tools.nsc.interactive.RefinedBuildManager
+import util.copyPath
+
+trait Compiler {
+ self: Universe =>
+
+ /** Resident Compiler.
+ * $SCALAC -d dir.obj -Xresident -sourcepath . "$@"
+ */
+ object Res extends DirBasedCategory("res") {
+ lazy val testSequence: TestSequence = List(compile, diff)
+
+ override def denotesTest(p: Path) = p.isDirectory && resFile(p).isFile
+ override def createTest(location: Path) = new ResidentTest(location.toDirectory)
+
+ override def createSettings(entity: TestEntity): TestSettings =
+ returning(super.createSettings(entity)) { settings =>
+ settings.resident.value = true
+ settings.sourcepath.value = entity.sourcesDir.path
+ }
+
+ class ResidentTest(val location: Directory) extends TestEntity {
+ val category = Res
+ override def precondition = checkFile.isFile && super.precondition
+ override def sourcesDir = categoryDir
+
+ override def acknowledges(p: Path) =
+ super.acknowledges(p) || (resFile(location) isSame p)
+
+ private def residentCompilerCommands = safeLines(resFile(location))
+ private def compileResident(global: PartestGlobal, lines: List[String]) = {
+ def printPrompt = global inform "nsc> "
+ val results =
+ lines map { line =>
+ printPrompt
+ trace("compile " + line)
+ isDryRun || global.partestCompile(toArgs(line) map (categoryDir / _ path), false)
+ }
+
+ printPrompt
+
+ /** Note - some res tests are really "neg" style tests, so we can't
+ * use the return value of the compile. The diff catches failures.
+ */
+ true // results forall (_ == true)
+ }
+
+ override def compile() = compileResident(newGlobal(Nil)._1, residentCompilerCommands)
+ }
+ private[Res] def resFile(p: Path) = p.toFile addExtension "res"
+ }
+
+ object BuildManager extends DirBasedCategory("buildmanager") {
+ lazy val testSequence: TestSequence = List(compile, diff)
+ override def denotesTest(p: Path) = p.isDirectory && testFile(p).isFile
+ override def createTest(location: Path) = new BuildManagerTest(location.toDirectory)
+
+ override def createSettings(entity: TestEntity): TestSettings =
+ returning[TestSettings](super.createSettings(entity)) { settings =>
+ settings.Ybuildmanagerdebug.value = true
+ settings.sourcepath.value = entity.sourcesDir.path
+ }
+
+ class PartestBuildManager(settings: Settings, val reporter: ConsoleReporter) extends RefinedBuildManager(settings) {
+ def errorFn(msg: String) = Console println msg
+
+ override protected def newCompiler(newSettings: Settings) =
+ new BuilderGlobal(newSettings, reporter)
+
+ private def filesToSet(pre: String, fs: List[String]): Set[AbstractFile] =
+ fs flatMap (s => Option(AbstractFile getFile (Path(settings.sourcepath.value) / s path))) toSet
+
+ def buildManagerCompile(line: String): Boolean = {
+ val prompt = "builder > "
+ reporter printMessage (prompt + line)
+ val command = new CompilerCommand(toArgs(line), settings)
+ val files = filesToSet(settings.sourcepath.value, command.files)
+
+ update(files, Set.empty)
+ true
+ }
+ }
+
+ private[BuildManager] def testFile(p: Path) = (p / p.name addExtension "test").toFile
+
+ class BuildManagerTest(val location: Directory) extends TestEntity {
+ val category = BuildManager
+
+ override def sourcesDir = outDir
+ override def sourceFiles = Path onlyFiles (location walkFilter (_ != changesDir) filter isJavaOrScala toList)
+ override def checkFile = File(location / location.name addExtension "check")
+ override def precondition = checkFile.isFile && super.precondition
+
+ override def acknowledges(p: Path) = super.acknowledges(p) || (p isSame testFile(location))
+
+ def buildManagerCommands = safeLines(testFile(location))
+ def changesDir = Directory(location / (location.name + ".changes"))
+
+ override def compile() = {
+ val settings = createSettings(this)
+ val pbm = new PartestBuildManager(settings, newReporter(settings))
+
+ // copy files
+ for (source <- sourceFiles) {
+ val target = outDir / (location.normalize relativize source)
+ copyPath(source, target.toFile)
+ }
+
+ def runUpdate(line: String) = {
+ val Array(srcName, replacement) = line split "=>"
+ copyPath(File(changesDir / replacement), File(outDir / srcName))
+ }
+
+ def sendCommand(line: String): Boolean = {
+ val compileRegex = """^>>compile (.*)$""".r
+ val updateRegex = """^>>update\s+(.*)""".r
+ trace(line drop 2)
+
+ isDryRun || (line match {
+ case compileRegex(xs) => pbm.buildManagerCompile(xs)
+ case updateRegex(line) => runUpdate(line)
+ })
+ }
+
+ // send each line to the build manager
+ buildManagerCommands forall sendCommand
+ }
+ }
+ }
+}
+
diff --git a/src/partest/scala/tools/partest/category/Runner.scala b/src/partest/scala/tools/partest/category/Runner.scala
new file mode 100644
index 0000000000..a7713d7dbe
--- /dev/null
+++ b/src/partest/scala/tools/partest/category/Runner.scala
@@ -0,0 +1,108 @@
+/* __ *\
+** ________ ___ / / ___ Scala Parallel Testing **
+** / __/ __// _ | / / / _ | (c) 2007-2010, LAMP/EPFL **
+** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ **
+** /____/\___/_/ |_/____/_/ | | **
+** |/ **
+\* */
+
+package scala.tools
+package partest
+package category
+
+import nsc.io._
+
+trait Runner {
+ self: Universe =>
+
+ /** Shootout.
+ */
+ object Shootout extends DirBasedCategory("shootout") {
+ lazy val testSequence: TestSequence = List(compile, run, diff)
+
+ override def denotesTest(p: Path) = isScala(p) && runner(p).isFile
+ override def createTest(location: Path) = new ShootoutTest(location.toFile)
+
+ class ShootoutTest(val location: File) extends TestEntity {
+ val category = Shootout
+ // The files in shootout are very free form, so acknowledge anything close.
+ override def acknowledges(p: Path) =
+ (p.parent.normalize isSame Shootout.root) && (p.name startsWith label)
+
+ private def generated = File(outDir / "test.scala")
+ private def runnerFile = runner(location)
+ override def sourceFiles = List(generated)
+
+ override def compile() = {
+ trace("generate %s from %s, %s".format(tracePath(generated), tracePath(location), tracePath(runnerFile)))
+ // generate source file (even on dry run, we need the path)
+ generated.writeAll(location.slurp(), runnerFile.slurp())
+
+ // compile generated file
+ super.compile()
+ }
+ }
+
+ private[Shootout] def runner(p: Path) = p addExtension "runner" toFile
+ }
+
+ object Scalacheck extends DirBasedCategory("scalacheck") {
+ lazy val testSequence: TestSequence = List(compile, run)
+ override def createTest(location: Path) = new ScalacheckTest(location)
+
+ class ScalacheckTest(val location: Path) extends TestEntity {
+ val category = Scalacheck
+
+ import build.{ scalacheck, forkjoin }
+ import org.scalacheck.Properties
+ import org.scalacheck.Test.{ checkProperties, defaultParams, Result }
+
+ override def classpathPaths = super.classpathPaths ::: List(scalacheck, forkjoin)
+ private def arrayURLs = Array(scalacheck, outDir) map (_.toURL)
+
+ /** For reasons I'm not entirely clear on, I've written all this
+ * to avoid a source dependency on scalacheck.
+ */
+ class ScalacheckClassLoader extends PartestClassLoader(arrayURLs, this.getClass.getClassLoader) {
+ type ScalacheckResult = { def passed: Boolean }
+
+ def propCallback(name: String, passed: Int, discarded: Int): Unit = ()
+ def testCallback(name: String, result: AnyRef): Unit = ()
+
+ val test = singleton("Test$")
+ val params = apply[AnyRef]("org.scalacheck.Test$", "defaultParams")()
+ val result = apply[Seq[(String, AnyRef)]]("org.scalacheck.Test$", "checkProperties")(test, params, propCallback _, testCallback _)
+
+ def allResults() =
+ for ((prop, res) <- result) yield {
+ ScalacheckTest.this.trace("scalacheck result for %s: %s".format(prop, res))
+ res.asInstanceOf[ScalacheckResult].passed
+ }
+
+ def check() = allResults forall (_ == true)
+ }
+
+ override def run() = {
+ trace("scalacheck runs via classloader with: %s".format(arrayURLs mkString ", "))
+ isDryRun || (new ScalacheckClassLoader check)
+ }
+ }
+ }
+
+ object Script extends DirBasedCategory("script") {
+ val testSequence: TestSequence = List(exec, diff)
+ override def createTest(location: Path) = new ScriptTest(location)
+
+ class ScriptTest(val location: Path) extends TestEntity {
+ val category = Script
+ val scriptFile = if (location.isDirectory) location / (label + ".scala") else location
+ val argsFile = withExtension("args").toFile
+ def batFile = scriptFile changeExtension "bat"
+ def script = if (Properties.isWin) batFile else scriptFile
+
+ override def acknowledges(p: Path) = super.acknowledges(p) || (List(argsFile, batFile) exists (_ isSame p))
+ override def execCwd = Some(sourcesDir)
+ override def argumentsToExec = script.path :: safeArgs(argsFile)
+ }
+ }
+} \ No newline at end of file
diff --git a/src/partest/scala/tools/partest/io/ANSIWriter.scala b/src/partest/scala/tools/partest/io/ANSIWriter.scala
new file mode 100644
index 0000000000..0ddcd97a5f
--- /dev/null
+++ b/src/partest/scala/tools/partest/io/ANSIWriter.scala
@@ -0,0 +1,58 @@
+/* NEST (New Scala Test)
+ * Copyright 2007-2010 LAMP/EPFL
+ * @author Philipp Haller
+ */
+
+package scala.tools
+package partest
+package io
+
+import java.io.{ Writer, PrintWriter, OutputStream, OutputStreamWriter }
+
+object ANSIWriter {
+ val NONE = 0
+ val SOME = 1
+ val MANY = 2
+
+ def apply(isAnsi: Boolean) = if (isAnsi) MANY else NONE
+}
+import ANSIWriter._
+
+class ANSIWriter(writer: Writer) extends PrintWriter(writer, true) {
+ def this(out: OutputStream) = this(new OutputStreamWriter(out))
+ def colorful: Int = NONE
+
+ protected val manyColors = List(
+ Console.BOLD + Console.BLACK,
+ Console.BOLD + Console.GREEN,
+ Console.BOLD + Console.RED,
+ Console.BOLD + Console.YELLOW,
+ Console.RESET
+ )
+ protected val someColors = List(
+ Console.BOLD + Console.BLACK,
+ Console.RESET,
+ Console.BOLD + Console.BLACK,
+ Console.BOLD + Console.BLACK,
+ Console.RESET
+ )
+ protected val noColors = List("", "", "", "", "")
+
+ lazy val List(_outline, _success, _failure, _warning, _default) = colorful match {
+ case NONE => noColors
+ case SOME => someColors
+ case MANY => manyColors
+ case _ => noColors
+ }
+
+ private def wrprint(msg: String): Unit = synchronized {
+ print(msg)
+ flush()
+ }
+
+ def outline(msg: String) = wrprint(_outline + msg + _default)
+ def success(msg: String) = wrprint(_success + msg + _default)
+ def failure(msg: String) = wrprint(_failure + msg + _default)
+ def warning(msg: String) = wrprint(_warning + msg + _default)
+ def normal(msg: String) = wrprint(_default + msg)
+}
diff --git a/src/partest/scala/tools/partest/nest/Diff.java b/src/partest/scala/tools/partest/io/Diff.java
index abd09d0293..c7a3d42f30 100644
--- a/src/partest/scala/tools/partest/nest/Diff.java
+++ b/src/partest/scala/tools/partest/io/Diff.java
@@ -1,6 +1,6 @@
// $Id$
-package scala.tools.partest.nest;
+package scala.tools.partest.io;
import java.util.Hashtable;
diff --git a/src/partest/scala/tools/partest/nest/DiffPrint.java b/src/partest/scala/tools/partest/io/DiffPrint.java
index 494bc06e4a..2b2ad93ec7 100644
--- a/src/partest/scala/tools/partest/nest/DiffPrint.java
+++ b/src/partest/scala/tools/partest/io/DiffPrint.java
@@ -1,6 +1,6 @@
// $Id$
-package scala.tools.partest.nest;
+package scala.tools.partest.io;
import java.io.*;
import java.util.Vector;
diff --git a/src/partest/scala/tools/partest/io/JUnitReport.scala b/src/partest/scala/tools/partest/io/JUnitReport.scala
new file mode 100644
index 0000000000..63ae200020
--- /dev/null
+++ b/src/partest/scala/tools/partest/io/JUnitReport.scala
@@ -0,0 +1,38 @@
+/* NEST (New Scala Test)
+ * Copyright 2007-2010 LAMP/EPFL
+ */
+
+package scala.tools
+package partest
+package io
+
+/** This is disabled for the moment but I can fix it up if anyone
+ * is using it.
+ */
+class JUnitReport {
+ // create JUnit Report xml files if directory was specified
+ // def junitReport(dir: Directory) = {
+ // dir.mkdir()
+ // val report = testReport(set.kind, results, succs, fails)
+ // XML.save("%s/%s.xml".format(d.toAbsolute.path, set.kind), report)
+ // }
+
+ // def oneResult(res: (TestEntity, Int)) =
+ // <testcase name={res._1.path}>{
+ // res._2 match {
+ // case 0 => scala.xml.NodeSeq.Empty
+ // case 1 => <failure message="Test failed"/>
+ // case 2 => <failure message="Test timed out"/>
+ // }
+ // }</testcase>
+ //
+ // def testReport(kind: String, results: Iterable[(TestEntity, Int)], succs: Int, fails: Int) = {
+ // <testsuite name={kind} tests={(succs + fails).toString} failures={fails.toString}>
+ // <properties/>
+ // {
+ // results.map(oneResult(_))
+ // }
+ // </testsuite>
+ // }
+ //
+} \ No newline at end of file
diff --git a/src/partest/scala/tools/partest/io/Logging.scala b/src/partest/scala/tools/partest/io/Logging.scala
new file mode 100644
index 0000000000..3d1b0fa0b4
--- /dev/null
+++ b/src/partest/scala/tools/partest/io/Logging.scala
@@ -0,0 +1,132 @@
+package scala.tools
+package partest
+package io
+
+import java.io.{ StringWriter, PrintWriter, Writer }
+import scala.tools.nsc.io._
+import scala.util.control.ControlThrowable
+
+trait Logging {
+ universe: Universe =>
+
+ class PartestANSIWriter extends ANSIWriter(Console.out) {
+ override def colorful: Int = ANSIWriter(universe.isAnsi)
+ private def printIf(cond: Boolean, msg: String) =
+ if (cond) { outline("debug: ") ; println(msg) }
+
+ val verbose = printIf(isVerbose || isDebug, _: String)
+ val debug = printIf(isDebug, _: String)
+ }
+
+ lazy val NestUI = new PartestANSIWriter()
+
+ import NestUI.{ _outline, _success, _failure, _warning, _default }
+
+ def markOutline(msg: String) = _outline + msg + _default
+ def markSuccess(msg: String) = _success + msg + _default
+ def markFailure(msg: String) = _failure + msg + _default
+ def markWarning(msg: String) = _warning + msg + _default
+ def markNormal(msg: String) = _default + msg
+
+ def outline(msg: String) = NestUI outline msg
+ def success(msg: String) = NestUI success msg
+ def failure(msg: String) = NestUI failure msg
+ def warning(msg: String) = NestUI warning msg
+ def normal(msg: String) = NestUI normal msg
+
+ def verbose(msg: String) = NestUI verbose msg
+ def debug(msg: String) = NestUI debug msg
+
+ trait EntityLogging {
+ self: TestEntity =>
+
+ lazy val logWriter = new LogWriter(logFile)
+
+ /** Redirect stdout and stderr to logFile, run body, return result.
+ */
+ def loggingOutAndErr[T](body: => T): T = {
+ val log = logFile.printStream(append = true)
+
+ try Console.withOut(log) {
+ Console.withErr(log) {
+ body
+ }
+ }
+ finally log.close()
+ }
+
+ /** XXX needs attention.
+ */
+ def failureMessage() = safeSlurp(logFile)
+
+ /** For tracing. Outputs a line describing the next action. tracePath
+ * is a path wrapper which prints name or full path depending on verbosity.
+ */
+ 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.
+ */
+ def loggingResult(body: => String) =
+ try returning(true)(_ => logFile writeAll body)
+ catch {
+ case x: ControlThrowable => throw x
+ case x: Throwable => logException(x)
+ }
+
+ def throwableToString(x: Throwable): String = {
+ val w = new StringWriter
+ x.printStackTrace(new PrintWriter(w))
+ w.toString
+ }
+
+ def warnAndLogException(msg: String, ex: Throwable) = {
+ val str = msg + throwableToString(ex)
+ warning(toStringTrunc(str, 800))
+ logWriter append str
+ }
+
+ def deleteLog(force: Boolean = false) =
+ if (universe.isNoCleanup && !force) debug("Not cleaning up " + logFile)
+ else logFile.deleteIfExists()
+
+ def onException(x: Throwable) { logException(x) }
+ def logException(x: Throwable) = {
+ val msg = throwableToString(x)
+ if (!isTerse)
+ normal(msg)
+
+ logWriter append msg
+ false
+ }
+ }
+
+ /** A writer which doesn't create the file until a write comes in.
+ */
+ class LazilyCreatedWriter(log: File) extends Writer {
+ @volatile private var isCreated = false
+ private lazy val underlying = {
+ isCreated = true
+ log.bufferedWriter()
+ }
+
+ def flush() = if (isCreated) underlying.flush()
+ def close() = if (isCreated) underlying.close()
+ def write(chars: Array[Char], off: Int, len: Int) = {
+ underlying.write(chars, off, len)
+ underlying.flush()
+ }
+ }
+
+ class LogWriter(log: File) extends PrintWriter(new LazilyCreatedWriter(log), true) {
+ override def print(s: String) = {
+ super.print(s)
+ flush()
+ }
+ }
+} \ No newline at end of file
diff --git a/src/partest/scala/tools/partest/nest/AntRunner.scala b/src/partest/scala/tools/partest/nest/AntRunner.scala
deleted file mode 100644
index cdc6961d3d..0000000000
--- a/src/partest/scala/tools/partest/nest/AntRunner.scala
+++ /dev/null
@@ -1,32 +0,0 @@
-/* __ *\
-** ________ ___ / / ___ Scala Parallel Testing **
-** / __/ __// _ | / / / _ | (c) 2007-2010, LAMP/EPFL **
-** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ **
-** /____/\___/_/ |_/____/_/ | | **
-** |/ **
-\* */
-
-// $Id$
-
-package scala.tools.partest
-package nest
-
-import java.io.File
-
-class AntRunner extends DirectRunner {
-
- val fileManager = new FileManager {
- var JAVACMD: String = "java"
- var JAVAC_CMD: String = "javac"
- var CLASSPATH: String = _
- var EXT_CLASSPATH: String = _
- var LATEST_LIB: String = _
- val TESTROOT: String = ""
- }
-
- def reflectiveRunTestsForFiles(kindFiles: Array[File], kind: String): Int = {
- val (succs, fails) = runTestsForFiles(kindFiles.toList, kind)
- succs << 16 | fails
- }
-
-}
diff --git a/src/partest/scala/tools/partest/nest/CompileManager.scala b/src/partest/scala/tools/partest/nest/CompileManager.scala
deleted file mode 100644
index b67653d900..0000000000
--- a/src/partest/scala/tools/partest/nest/CompileManager.scala
+++ /dev/null
@@ -1,218 +0,0 @@
-/* NEST (New Scala Test)
- * Copyright 2007-2010 LAMP/EPFL
- * @author Philipp Haller
- */
-
-// $Id$
-
-package scala.tools.partest
-package nest
-
-import scala.tools.nsc.{Global, Settings, CompilerCommand, FatalError}
-import scala.tools.nsc.reporters.{Reporter, ConsoleReporter}
-
-import java.io.{File, BufferedReader, PrintWriter, FileReader, FileWriter, StringWriter}
-
-class ExtConsoleReporter(override val settings: Settings, reader: BufferedReader, var writer: PrintWriter) extends ConsoleReporter(settings, reader, writer) {
- def this(settings: Settings) = {
- this(settings, Console.in, new PrintWriter(new FileWriter("/dev/null")))
- }
- def hasWarnings: Boolean = WARNING.count != 0
-}
-
-abstract class SimpleCompiler {
- def compile(out: Option[File], files: List[File], kind: String, log: File): Boolean
-}
-
-class TestSettings(fileMan: FileManager) extends {
- override val bootclasspathDefault =
- System.getProperty("sun.boot.class.path", "") + File.pathSeparator +
- fileMan.LATEST_LIB
- override val extdirsDefault =
- System.getProperty("java.ext.dirs", "")
-} with Settings(x => ())
-
-class DirectCompiler(val fileManager: FileManager) extends SimpleCompiler {
- def newGlobal(settings: Settings, reporter: Reporter): Global =
- new Global(settings, reporter)
-
- def newGlobal(settings: Settings, logWriter: FileWriter): Global = {
- val rep = new ExtConsoleReporter(settings,
- Console.in,
- new PrintWriter(logWriter))
- rep.shortname = true
- newGlobal(settings, rep)
- }
-
- def newSettings = {
- val settings = new TestSettings(fileManager)
- settings.deprecation.value = true
- settings.nowarnings.value = false
- settings.encoding.value = "iso-8859-1"
- settings
- }
-
- def newReporter(sett: Settings) = new ExtConsoleReporter(sett,
- Console.in,
- new PrintWriter(new StringWriter))
-
- private def updatePluginPath(options: String): String = {
- val (opt1, opt2) =
- (options split "\\s").toList partition (_ startsWith "-Xplugin:")
- (opt2 mkString " ")+(
- if (opt1.isEmpty) ""
- else {
- def absolutize(path: String): List[String] = {
- val args = (path substring 9 split File.pathSeparator).toList
- val plugins = args map (arg =>
- if (new File(arg).isAbsolute) arg
- else fileManager.TESTROOT+File.separator+arg
- )
- plugins
- }
- " -Xplugin:"+((opt1 flatMap absolutize) mkString File.pathSeparator)
- }
- )
- }
-
- def compile(out: Option[File], files: List[File], kind: String, log: File): Boolean = {
- val testSettings = newSettings
- val logWriter = new FileWriter(log)
-
- // check whether there is a ".flags" file
- val testBase = {
- val logBase = fileManager.basename(log.getName)
- logBase.substring(0, logBase.length-4)
- }
- val argsFile = new File(log.getParentFile, testBase+".flags")
- val argString = if (argsFile.exists) {
- val fileReader = new FileReader(argsFile)
- val reader = new BufferedReader(fileReader)
- val options = updatePluginPath(reader.readLine())
- reader.close()
- options
- } else ""
- val allOpts = fileManager.SCALAC_OPTS+" "+argString
- NestUI.verbose("scalac options: "+allOpts)
- val args = (allOpts split "\\s").toList
- val command = new CompilerCommand(args, testSettings, x => {}, false)
- val global = newGlobal(command.settings, logWriter)
- val testRep: ExtConsoleReporter = global.reporter.asInstanceOf[ExtConsoleReporter]
-
- val test: TestFile = kind match {
- case "pos" => PosTestFile(files(0), fileManager, out.isEmpty)
- case "neg" => NegTestFile(files(0), fileManager, out.isEmpty)
- case "run" => RunTestFile(files(0), fileManager, out.isEmpty)
- case "jvm" => JvmTestFile(files(0), fileManager, out.isEmpty)
- case "shootout" => ShootoutTestFile(files(0), fileManager, out.isEmpty)
- case "scalap" => ScalapTestFile(files(0), fileManager, out.isEmpty)
- case "scalacheck" =>
- ScalaCheckTestFile(files(0), fileManager, out.isEmpty)
- }
- test.defineSettings(command.settings)
- out match {
- case Some(outDir) =>
- command.settings.outdir.value = outDir.getAbsolutePath
- command.settings.classpath.value = command.settings.classpath.value+
- File.pathSeparator+outDir.getAbsolutePath
- case None =>
- // do nothing
- }
-
- val toCompile = files.map(_.getPath)
- try {
- NestUI.verbose("compiling "+toCompile)
- try {
- (new global.Run) compile toCompile
- } catch {
- case FatalError(msg) =>
- testRep.error(null, "fatal error: " + msg)
- }
- testRep.printSummary
- testRep.writer.flush
- testRep.writer.close
- } catch {
- case e =>
- e.printStackTrace()
- return false
- } finally {
- logWriter.close()
- }
- !testRep.hasErrors
- }
-}
-
-class ReflectiveCompiler(val fileManager: ConsoleFileManager) extends SimpleCompiler {
- import fileManager.{latestCompFile, latestPartestFile}
-
- val sepUrls = Array(latestCompFile.toURI.toURL, latestPartestFile.toURI.toURL)
- //NestUI.verbose("constructing URLClassLoader from URLs "+latestCompFile+" and "+latestPartestFile)
-
- val sepLoader = new java.net.URLClassLoader(sepUrls, null)
-
- val sepCompilerClass =
- sepLoader.loadClass("scala.tools.partest.nest.DirectCompiler")
- val sepCompiler = sepCompilerClass.newInstance()
-
- // needed for reflective invocation
- val fileClass = Class.forName("java.io.File")
- val stringClass = Class.forName("java.lang.String")
- val sepCompileMethod =
- sepCompilerClass.getMethod("compile", fileClass, stringClass)
- val sepCompileMethod2 =
- sepCompilerClass.getMethod("compile", fileClass, stringClass, fileClass)
-
- /* This method throws java.lang.reflect.InvocationTargetException
- * if the compiler crashes.
- * This exception is handled in the shouldCompile and shouldFailCompile
- * methods of class CompileManager.
- */
- def compile(out: Option[File], files: List[File], kind: String, log: File): Boolean = {
- val res = sepCompileMethod2.invoke(sepCompiler, out, files, kind, log).asInstanceOf[java.lang.Boolean]
- res.booleanValue()
- }
-}
-
-class CompileManager(val fileManager: FileManager) {
- var compiler: SimpleCompiler = new /*ReflectiveCompiler*/ DirectCompiler(fileManager)
-
- var numSeparateCompilers = 1
- def createSeparateCompiler() = {
- numSeparateCompilers += 1
- compiler = new /*ReflectiveCompiler*/ DirectCompiler(fileManager)
- }
-
- /* This method returns true iff compilation succeeds.
- */
- def shouldCompile(files: List[File], kind: String, log: File): Boolean = {
- createSeparateCompiler()
- compiler.compile(None, files, kind, log)
- }
-
- /* This method returns true iff compilation succeeds.
- */
- def shouldCompile(out: File, files: List[File], kind: String, log: File): Boolean = {
- createSeparateCompiler()
- compiler.compile(Some(out), files, kind, log)
- }
-
- /* This method returns true iff compilation fails
- * _and_ the compiler does _not_ crash or loop.
- *
- * If the compiler crashes, this method returns false.
- */
- def shouldFailCompile(files: List[File], kind: String, log: File): Boolean = {
- createSeparateCompiler()
- !compiler.compile(None, files, kind, log)
- }
-
- /* This method returns true iff compilation fails
- * _and_ the compiler does _not_ crash or loop.
- *
- * If the compiler crashes, this method returns false.
- */
- def shouldFailCompile(out: File, files: List[File], kind: String, log: File): Boolean = {
- createSeparateCompiler()
- !compiler.compile(Some(out), files, kind, log)
- }
-}
diff --git a/src/partest/scala/tools/partest/nest/ConsoleFileManager.scala b/src/partest/scala/tools/partest/nest/ConsoleFileManager.scala
deleted file mode 100644
index 27cd36e3e7..0000000000
--- a/src/partest/scala/tools/partest/nest/ConsoleFileManager.scala
+++ /dev/null
@@ -1,314 +0,0 @@
-/* NEST (New Scala Test)
- * Copyright 2007-2010 LAMP/EPFL
- * @author Philipp Haller
- */
-
-// $Id$
-
-package scala.tools.partest
-package nest
-
-import java.io.{File, FilenameFilter, IOException, StringWriter}
-import java.net.URI
-
-class ConsoleFileManager extends FileManager {
-
- var testBuild = System.getProperty("scalatest.build")
- var testClasses: Option[String] = None
-
- val debug: Boolean =
- (System.getProperty("partest.debug", "false") equals "true") ||
- (System.getProperty("scalatest.debug", "false") equals "true")
-
- def this(buildPath: String, rawClasses: Boolean) = {
- this()
- if (rawClasses)
- testClasses = Some(buildPath)
- else
- testBuild = buildPath
- // re-run because initialization of default
- // constructor must be updated
- findLatest()
- }
-
- def this(buildPath: String) = {
- this(buildPath, false)
- }
-
- def this(buildPath: String, rawClasses: Boolean, moreOpts: String) = {
- this(buildPath, rawClasses)
- SCALAC_OPTS = SCALAC_OPTS+" "+moreOpts
- }
-
- var CLASSPATH = System.getProperty("java.class.path", ".")
- NestUI.verbose("CLASSPATH: "+CLASSPATH)
-
- var JAVACMD = System.getProperty("scalatest.javacmd", "java")
- var JAVAC_CMD = System.getProperty("scalatest.javac_cmd", "javac")
-
- val prefixFile = {
- val cwd = System.getProperty("user.dir")
- if (cwd != null)
- (new File(cwd)).getCanonicalFile
- else
- error("user.dir property not set")
- }
- val PREFIX = prefixFile.getAbsolutePath
-
-/*
-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 testRootFile = {
- val testRootProp = System.getProperty("scalatest.root")
- val testroot =
- if (testRootProp != null)
- new File(testRootProp)
- else {
- // case 1: cwd is `test`
- if (prefixFile.getName == "test" && (new File(prefixFile, "files")).exists)
- prefixFile
- else {
- // case 2: cwd is `test/..`
- val test = new File(prefixFile, "test")
- val scalaTest = new File(new File(prefixFile, "misc"), "scala-test")
- if (test.isDirectory)
- test
- else if (scalaTest.isDirectory)
- scalaTest
- else
- error("Test directory not found")
- }
- }
- testroot.getCanonicalFile
- }
- val TESTROOT = testRootFile.getAbsolutePath
-
- 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
- else {
- val path = TESTROOT + File.separator + "files"
- NestUI.failure("Source directory \"" + path + "\" not found")
- exit(1)
- }
- }
-
- LIB_DIR = (new File(testRootFile.getParentFile, "lib")).getCanonicalFile.getAbsolutePath
-
- CLASSPATH = CLASSPATH + File.pathSeparator + {
- val libs = new File(srcDir, "lib")
- // add all jars in libs
- (libs.listFiles(new FilenameFilter {
- def accept(dir: File, name: String) = name endsWith ".jar"
- }) map {file => file.getCanonicalFile.getAbsolutePath}).mkString(""+File.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)
-
- 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")
- latestActFile = prefixFileWith(testClassesFile, "library")
- latestCompFile = prefixFileWith(testClassesFile, "compiler")
- latestPartestFile = prefixFileWith(testClassesFile, "partest")
- latestFjbgFile = prefixFile("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")
- latestActFile = prefixFile(testBuild+"/lib/scala-library.jar")
- latestCompFile = prefixFile(testBuild+"/lib/scala-compiler.jar")
- latestPartestFile = prefixFile(testBuild+"/lib/scala-partest.jar")
- } else {
- def setupQuick() {
- NestUI.verbose("Running build/quick")
- latestFile = prefixFile("build/quick/bin")
- latestLibFile = prefixFile("build/quick/classes/library")
- latestActFile = prefixFile("build/quick/classes/library")
- latestCompFile = prefixFile("build/quick/classes/compiler")
- latestPartestFile = prefixFile("build/quick/classes/partest")
- }
-
- def setupInst() {
- NestUI.verbose("Running dist (installed)")
- val p = testParent.getParentFile
- latestFile = prefixFileWith(p, "bin")
- latestLibFile = prefixFileWith(p, "lib/scala-library.jar")
- latestActFile = prefixFileWith(p, "lib/scala-library.jar")
- latestCompFile = prefixFileWith(p, "lib/scala-compiler.jar")
- latestPartestFile = prefixFileWith(p, "lib/scala-partest.jar")
- }
-
- def setupDist() {
- NestUI.verbose("Running dists/latest")
- latestFile = prefixFile("dists/latest/bin")
- latestLibFile = prefixFile("dists/latest/lib/scala-library.jar")
- latestActFile = prefixFile("dists/latest/lib/scala-library.jar")
- latestCompFile = prefixFile("dists/latest/lib/scala-compiler.jar")
- latestPartestFile = prefixFile("dists/latest/lib/scala-partest.jar")
- }
-
- def setupPack() {
- NestUI.verbose("Running build/pack")
- latestFile = prefixFile("build/pack/bin")
- latestLibFile = prefixFile("build/pack/lib/scala-library.jar")
- latestActFile = prefixFile("build/pack/lib/scala-library.jar")
- latestCompFile = prefixFile("build/pack/lib/scala-compiler.jar")
- latestPartestFile = prefixFile("build/pack/lib/scala-partest.jar")
- }
-
- def max(a: Long, b: Long) = if (a > b) a else b
-
- val dists = new File(testParent, "dists")
- val build = new File(testParent, "build")
- // in case of an installed dist, testRootFile is one level deeper
- val bin = new File(testParent.getParentFile, "bin")
-
- // detect most recent build
- val quickTime =
- max(prefixFile("build/quick/classes/compiler/compiler.properties").lastModified,
- prefixFile("build/quick/classes/library/library.properties").lastModified)
- val packTime =
- max(prefixFile("build/pack/lib/scala-compiler.jar").lastModified,
- prefixFile("build/pack/lib/scala-library.jar").lastModified)
- val distTime =
- max(prefixFile("dists/latest/lib/scala-compiler.jar").lastModified,
- prefixFile("dists/latest/lib/scala-library.jar").lastModified)
- val instTime = {
- val p = testParent.getParentFile
- max(prefixFileWith(p, "lib/scala-compiler.jar").lastModified,
- prefixFileWith(p, "lib/scala-library.jar").lastModified)
- }
-
- if (quickTime > packTime) { // pack ruled out
- if (quickTime > distTime) { // dist ruled out
- if (quickTime > instTime) // inst ruled out
- setupQuick()
- else
- setupInst()
- } else { // quick ruled out
- if (distTime > instTime) // inst ruled out
- setupDist()
- else
- setupInst()
- }
- } else { // quick ruled out
- if (packTime > distTime) { // dist ruled out
- if (packTime > instTime) // inst ruled out
- setupPack()
- else
- setupInst()
- } else { // pack ruled out
- if (distTime > instTime) // inst ruled out
- setupDist()
- else
- setupInst()
- }
- }
- latestFjbgFile = prefixFile("lib/fjbg.jar")
- }
-
- BIN_DIR = latestFile.getAbsolutePath
- LATEST_LIB = latestLibFile.getAbsolutePath
- LATEST_COMP = latestCompFile.getAbsolutePath
- LATEST_PARTEST = latestPartestFile.getAbsolutePath
-
- // detect whether we are running on Windows
- val osName = System.getProperty("os.name")
- NestUI.verbose("OS: "+osName)
-
- val scalaCommand = if (osName startsWith "Windows")
- "scala.bat" else "scala"
- val scalacCommand = if (osName startsWith "Windows")
- "scalac.bat" else "scalac"
-
- SCALA = (new File(latestFile, scalaCommand)).getAbsolutePath
- SCALAC_CMD = (new File(latestFile, scalacCommand)).getAbsolutePath
- }
-
- 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 = _
- var latestActFile: File = _
- var latestCompFile: File = _
- var latestPartestFile: File = _
- var latestFjbgFile: File = _
- var testBuildFile: File = _
- var testClassesFile: File = _
- // 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) {
- if (!testFiles.isEmpty) {
- val dirpath = dir.getAbsolutePath
- testFiles filter { _.getParentFile.getAbsolutePath == dirpath }
- } else if (doCheck) filter match {
- case Some((ending, enableDirs)) =>
- val filter = new FilenameFilter {
- def accept(dir: File, name: String) =
- name.endsWith(ending) ||
- (enableDirs && (name != ".svn") && (!name.endsWith(".obj")) &&
- (new File(dir, name)).isDirectory)
- }
- dir.listFiles(filter).toList
- case None =>
- val filter = new FilenameFilter {
- def accept(dir: File, name: String) = name != ".svn"
- }
- dir.listFiles(filter).toList
- } else // skip
- Nil
- } else {
- NestUI.failure("Directory \"" + dir.getPath + "\" not found")
- Nil
- }
- if (failed)
- files filter { logFileExists(_, kind) }
- else
- files
- }
-
- def getFiles(kind: String, doCheck: Boolean): List[File] =
- getFiles(kind, doCheck, Some((".scala", true)))
-
-}
diff --git a/src/partest/scala/tools/partest/nest/ConsoleRunner.scala b/src/partest/scala/tools/partest/nest/ConsoleRunner.scala
deleted file mode 100644
index 574cc70762..0000000000
--- a/src/partest/scala/tools/partest/nest/ConsoleRunner.scala
+++ /dev/null
@@ -1,237 +0,0 @@
-/* NEST (New Scala Test)
- * Copyright 2007-2010 LAMP/EPFL
- * @author Philipp Haller
- */
-
-// $Id$
-
-package scala.tools.partest
-package nest
-
-import java.io.{File, PrintStream, FileOutputStream, BufferedReader,
- InputStreamReader, StringWriter, PrintWriter}
-import utils.Properties._
-
-class ConsoleRunner extends DirectRunner with RunnerUtils {
-
- case class TestSet(loc: String,
- filter: Option[(String, Boolean)],
- kind: String,
- msg: String)
-
- val testSets = {
- val fileFilter = Some((".scala", true))
- List(
- TestSet("pos", fileFilter, "pos",
- "Testing compiler (on files whose compilation should succeed)"),
- TestSet("neg", fileFilter, "neg",
- "Testing compiler (on files whose compilation should fail)"),
- TestSet("run", fileFilter, "run", "Testing JVM backend"),
- TestSet("jvm", fileFilter, "jvm", "Testing JVM backend"),
- TestSet("res", Some((".res", false)), "res",
- "Testing resident compiler"),
- TestSet("shootout", fileFilter, "shootout", "Testing shootout tests"),
- TestSet("script", fileFilter, "script", "Testing script tests"),
- TestSet("scalacheck", fileFilter, "scalacheck", "Testing ScalaCheck tests"),
- TestSet("scalap", fileFilter, "scalap", "Run scalap decompiler tests"))
- }
-
- var fileManager: ConsoleFileManager = _
-
- private val isJava5 = javaVersion matches "1.[5|6|7].*"
- private var runAll = false
- private var testFiles: List[File] = List()
- private val errors =
- Integer.parseInt(System.getProperty("scalatest.errors", "0"))
-
- def denotesTestSet(arg: String) =
- testSets exists { set => arg == "--" + set.loc }
-
- def denotesTestFile(arg: String) =
- arg.endsWith(".scala") || arg.endsWith(".res")
-
- def denotesTestDir(arg: String) =
- (new File(arg)).isDirectory
-
- private def printVersion { NestUI outline (versionMsg + "\n") }
-
- def main(argstr: String) {
- // tokenize args. filter: "".split("\\s") yields Array("")
- var args = (argstr split "\\s").toList.filterNot(_ == "")
-
- if (args.length == 0)
- NestUI.usage()
- else {
- // find out which build to test
- val (buildPath, args1) = searchAndRemovePath("--buildpath", args)
- val (classPath, args2) = searchAndRemovePath("--classpath", args1)
- val (srcPath, args3) = searchAndRemovePath("--srcpath", args2)
- args = args3
-
- if (!srcPath.isEmpty)
- System.setProperty("partest.srcdir", srcPath.get)
-
- fileManager =
- if (!buildPath.isEmpty)
- new ConsoleFileManager(buildPath.get)
- else if (!classPath.isEmpty)
- new ConsoleFileManager(classPath.get, true)
- else if (args contains "--pack") {
- args = args.filterNot(_ == "--pack") // will create a result file '--pack' otherwise
- new ConsoleFileManager("build/pack")
- } else // auto detection, see ConsoleFileManager.findLatest
- new ConsoleFileManager
-
- if (!args.exists(denotesTestSet(_)) &&
- !args.exists(denotesTestFile(_)) &&
- !args.exists(denotesTestDir(_)))
- runAll = true
-
- var enabled = List[TestSet]()
- var readTimeout = false
- for (arg <- args) {
- (testSets find { set => arg == "--" + set.loc }) match {
- case Some(set) => enabled = set :: enabled
- case None => arg match {
- case "--all" => runAll = true
- case "--verbose" => NestUI._verbose = true
- case "--show-diff" => fileManager.showDiff = true
- case "--show-log" => fileManager.showLog = true
- case "--failed" => fileManager.failed = true
- case "--version" => printVersion; return
- case "--ansi" => NestUI.initialize(NestUI.MANY)
- case "--timeout" => readTimeout = true
- case s: String if readTimeout =>
- fileManager.timeout = s
- readTimeout = false
- case _ =>
- if (denotesTestFile(arg) || denotesTestDir(arg)) {
- val file = new File(arg)
- if (file.exists) {
- NestUI.verbose("adding test file "+file)
- testFiles = file :: testFiles
- } else {
- NestUI.failure("File \"" + arg + "\" not found\n")
- System.exit(1)
- }
- } else {
- NestUI.failure("Invalid option \""+arg+"\"\n")
- NestUI.usage()
- }
- }
- }
- }
- NestUI.verbose("enabled test sets: "+enabled)
- NestUI.verbose("runAll: "+runAll)
-
- val dir =
- if (!fileManager.testClasses.isEmpty)
- fileManager.testClassesFile
- else if (fileManager.testBuild != null)
- fileManager.testBuildFile
- else
- fileManager.latestCompFile.getParentFile.getParentFile.getCanonicalFile
- NestUI.outline("Scala compiler classes in: "+dir+"\n")
-
- NestUI.outline("Scala version is: "+scala.tools.nsc.Properties.versionMsg+"\n")
- NestUI.outline("Scalac options are: "+fileManager.SCALAC_OPTS+"\n")
-
- val vmBin = javaHome + File.separator + "bin"
- val vmName = "%s (build %s, %s)".format(javaVmName, javaVmVersion, javaVmInfo)
- val vmOpts = fileManager.JAVA_OPTS
-
- 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")
-
- val start = System.currentTimeMillis
-
- val (successes, failures) = testCheckAll(enabled)
-
- val end = System.currentTimeMillis
- val total = successes + failures
-
- val elapsedSecs = (end - start)/1000
- val elapsedMins = elapsedSecs/60
- val elapsedHrs = elapsedMins/60
- val dispMins = elapsedMins - elapsedHrs * 60
- val dispSecs = elapsedSecs - elapsedMins * 60
- val dispElapsed = {
- def form(num: Long) = if (num < 10) "0"+num else ""+num
- form(elapsedHrs)+":"+form(dispMins)+":"+form(dispSecs)
- }
-
- println
- if (failures == 0)
- NestUI.success("All of "+total+" tests were successful (elapsed time: "+dispElapsed+")\n")
- else
- NestUI.failure(failures+" of "+total+" tests failed (elapsed time: "+dispElapsed+")\n")
-
- if (failures == errors)
- System.exit(0)
- else
- System.exit(1)
- }
- }
-
- def runTests(testSet: TestSet): (Int, Int) = {
- val TestSet(loc, filter, kind, msg) = testSet
- val files = fileManager.getFiles(loc, true, filter)
- if (!files.isEmpty) {
- NestUI.verbose("test files: "+files)
- NestUI.outline("\n"+msg+"\n")
- runTestsForFiles(files, kind)
- } else {
- NestUI.verbose("test dir empty\n")
- (0, 0)
- }
- }
-
- /**
- * @return (success count, failure count)
- */
- 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")
- Predef.exit(1)
- } else {
- val short = firstName.substring(filesPos+len+1, filesPos+len+1+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"
- }
- }
- }
-
- val fstKind = kindOf(testFiles.head)
- NestUI.verbose("all test files expected to have kind "+fstKind)
- if (!testFiles.forall(kindOf(_) equals fstKind)) {
- NestUI.failure("test files have different kinds\n")
- Predef.exit(1)
- } else {
- NestUI.outline("\nTesting individual files\n")
- runTestsForFiles(testFiles, fstKind)
- }
- } else (0, 0)
-
- val runSets =
- if (runAll) testSets // run all test sets
- else enabledSets
- NestUI.verbose("run sets: "+runSets)
-
- val results = List(runTestsFiles) ::: (runSets map runTests)
- results reduceLeft { (p: (Int, Int), q: (Int, Int)) =>
- (p._1+q._1, p._2+q._2) }
- }
-}
diff --git a/src/partest/scala/tools/partest/nest/DirectRunner.scala b/src/partest/scala/tools/partest/nest/DirectRunner.scala
deleted file mode 100644
index 7ea74424fc..0000000000
--- a/src/partest/scala/tools/partest/nest/DirectRunner.scala
+++ /dev/null
@@ -1,78 +0,0 @@
-/* NEST (New Scala Test)
- * Copyright 2007-2010 LAMP/EPFL
- * @author Philipp Haller
- */
-
-// $Id$
-
-package scala.tools.partest
-package nest
-
-import java.io.{File, PrintStream, FileOutputStream, BufferedReader,
- InputStreamReader, StringWriter, PrintWriter}
-import java.util.StringTokenizer
-import scala.tools.nsc.io.Directory
-
-import scala.actors.Actor._
-import scala.actors.TIMEOUT
-
-trait DirectRunner {
-
- def fileManager: FileManager
-
- 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"))
- scala.actors.Debug.level = 3
-
- private val coreProp = try {
- System.getProperty("actors.corePoolSize")
- } catch {
- case ace: java.security.AccessControlException =>
- null
- }
- if (coreProp == null) {
- scala.actors.Debug.info("actors.corePoolSize not defined")
- System.setProperty("actors.corePoolSize", "16")
- }
-
- def runTestsForFiles(kindFiles: List[File], kind: String): (Int, Int) = {
- val len = kindFiles.length
- val (testsEach, lastFrag) = (len/numActors, len%numActors)
- val last = numActors-1
- val workers = for (i <- List.range(0, numActors)) yield {
- val toTest = kindFiles.slice(i*testsEach, (i+1)*testsEach)
- val worker = new Worker(fileManager)
- worker.start()
- if (i == last)
- worker ! RunTests(kind, (kindFiles splitAt (last*testsEach))._2)
- else
- worker ! RunTests(kind, toTest)
- worker
- }
- var succs = 0; var fails = 0
- var logsToDelete: List[File] = List()
- var outdirsToDelete: List[File] = List()
- workers foreach { w =>
- receiveWithin(3600 * 1000) {
- case Results(s, f, logs, outdirs) =>
- logsToDelete = logsToDelete ::: logs.filter(_.toDelete)
- outdirsToDelete = outdirsToDelete ::: outdirs
- succs += s
- fails += f
- case TIMEOUT =>
- // add at least one failure
- NestUI.verbose("worker timed out; adding failed test")
- fails += 1
- }
- }
- for (x <- logsToDelete ::: outdirsToDelete) {
- NestUI.verbose("deleting "+x)
- Directory(x).deleteRecursively()
- }
-
- (succs, fails)
- }
-
-}
diff --git a/src/partest/scala/tools/partest/nest/FileManager.scala b/src/partest/scala/tools/partest/nest/FileManager.scala
deleted file mode 100644
index 637999cc36..0000000000
--- a/src/partest/scala/tools/partest/nest/FileManager.scala
+++ /dev/null
@@ -1,79 +0,0 @@
-/* NEST (New Scala Test)
- * Copyright 2007-2010 LAMP/EPFL
- * @author Philipp Haller
- */
-
-// $Id$
-
-package scala.tools.partest
-package nest
-
-import java.io.{File, FilenameFilter, IOException, StringWriter}
-import java.net.URI
-import scala.tools.nsc.io.Directory
-
-trait FileManager {
-
- def basename(name: String): String = {
- val inx = name.lastIndexOf(".")
- if (inx < 0) name else name.substring(0, inx)
- }
-
- def deleteRecursive(dir: File) { Directory(dir).deleteRecursively() }
-
- /**
- * Compares two files using a Java implementation of the GNU diff
- * available at http://www.bmsi.com/java/#diff.
- *
- * @param f1 the first file to be compared
- * @param f2 the second file to be compared
- * @return the text difference between the compared files
- */
- def compareFiles(f1: File, f2: File): String = {
- var res = ""
- try {
- val diffWriter = new StringWriter
- val args = Array(f1.getCanonicalPath(), f2.getCanonicalPath())
- DiffPrint.doDiff(args, diffWriter)
- res = diffWriter.toString
- if (res startsWith "No")
- res = ""
- } catch {
- case e: IOException =>
- e.printStackTrace()
- }
- res
- }
-
- var JAVACMD: String
- var JAVAC_CMD: String
-
- var CLASSPATH: String
- var LATEST_LIB: String
- var LIB_DIR: String = ""
-
- val TESTROOT: String
-
- var showDiff = false
- var showLog = false
- var failed = false
-
- var SCALAC_OPTS = System.getProperty("scalatest.scalac_opts", "-deprecation")
- var JAVA_OPTS = System.getProperty("scalatest.java_opts", "")
-
- var timeout = "1200000"
-
- def getLogFile(dir: File, fileBase: String, kind: String): LogFile =
- new LogFile(dir, fileBase + "-" + kind + ".log")
-
- def getLogFile(file: File, kind: String): LogFile = {
- val dir = file.getParentFile
- val fileBase = basename(file.getName)
- getLogFile(dir, fileBase, kind)
- }
-
- def logFileExists(file: File, kind: String): Boolean = {
- val logFile = getLogFile(file, kind)
- logFile.exists && logFile.canRead
- }
-}
diff --git a/src/partest/scala/tools/partest/nest/NestRunner.scala b/src/partest/scala/tools/partest/nest/NestRunner.scala
deleted file mode 100644
index 158521875e..0000000000
--- a/src/partest/scala/tools/partest/nest/NestRunner.scala
+++ /dev/null
@@ -1,16 +0,0 @@
-/* NEST (New Scala Test)
- * Copyright 2007-2010 LAMP/EPFL
- * @author Philipp Haller
- */
-
-// $Id$
-
-package scala.tools.partest
-package nest
-
-object NestRunner {
- def main(args: Array[String]) {
- val argstr = args.mkString(" ")
- (new ReflectiveRunner).main(argstr)
- }
-}
diff --git a/src/partest/scala/tools/partest/nest/NestUI.scala b/src/partest/scala/tools/partest/nest/NestUI.scala
deleted file mode 100644
index b8d77bc704..0000000000
--- a/src/partest/scala/tools/partest/nest/NestUI.scala
+++ /dev/null
@@ -1,108 +0,0 @@
-/* NEST (New Scala Test)
- * Copyright 2007-2010 LAMP/EPFL
- * @author Philipp Haller
- */
-
-// $Id$
-
-package scala.tools.partest
-package nest
-
-import java.io.PrintWriter
-
-object NestUI {
-
- val NONE = 0
- val SOME = 1
- val MANY = 2
-
- private var _outline = ""
- private var _success = ""
- private var _failure = ""
- private var _warning = ""
- private var _default = ""
-
- def initialize(number: Int) = number match {
- case MANY =>
- _outline = Console.BOLD + Console.BLACK
- _success = Console.BOLD + Console.GREEN
- _failure = Console.BOLD + Console.RED
- _warning = Console.BOLD + Console.YELLOW
- _default = Console.RESET
- case SOME =>
- _outline = Console.BOLD + Console.BLACK
- _success = Console.RESET
- _failure = Console.BOLD + Console.BLACK
- _warning = Console.BOLD + Console.BLACK
- _default = Console.RESET
- case _ =>
- }
-
- def outline(msg: String) = print(_outline + msg + _default)
- def outline(msg: String, wr: PrintWriter) = synchronized {
- wr.print(_outline + msg + _default)
- }
-
- def success(msg: String) = print(_success + msg + _default)
- def success(msg: String, wr: PrintWriter) = synchronized {
- wr.print(_success + msg + _default)
- }
-
- def failure(msg: String) = print(_failure + msg + _default)
- def failure(msg: String, wr: PrintWriter) = synchronized {
- wr.print(_failure + msg + _default)
- }
-
- def warning(msg: String) = print(_warning + msg + _default)
- def warning(msg: String, wr: PrintWriter) = synchronized {
- wr.print(_warning + msg + _default)
- }
-
- def normal(msg: String) = print(_default + msg)
- def normal(msg: String, wr: PrintWriter) = synchronized {
- wr.print(_default + msg)
- }
-
- def usage() {
- println("Usage: NestRunner [<options>] [<testfile> ..] [<resfile>]")
- println(" <testfile>: list of files ending in '.scala'")
- println(" <resfile>: a file not ending in '.scala'")
- println(" <options>:")
- println
- println(" Test categories:")
- println(" --all run all tests")
- println(" --pos run compilation tests (success)")
- println(" --neg run compilation tests (failure)")
- println(" --run run interpreter and backend tests")
- println(" --jvm run JVM backend tests")
- println(" --res run resident compiler tests")
- println(" --script run script runner tests")
- println(" --shootout run shootout tests")
- println
- println(" Other options:")
- println(" --pack pick compiler/library in build/pack, and run all tests")
- println(" --show-log show log")
- println(" --show-diff show diff between log and check file")
- println(" --failed run only those tests that failed during the last run")
- println(" --verbose show progress information")
- println(" --buildpath set (relative) path to build jars")
- println(" ex.: --buildpath build/pack")
- println(" --classpath set (absolute) path to build classes")
- println(" --srcpath set (relative) path to test source files")
- println(" ex.: --srcpath pending")
- println
- println(utils.Properties.versionString)
- println("maintained by Philipp Haller (EPFL)")
- exit(1)
- }
-
- var _verbose = false
-
- def verbose(msg: String) {
- if (_verbose) {
- outline("debug: ")
- println(msg)
- }
- }
-
-}
diff --git a/src/partest/scala/tools/partest/nest/ReflectiveRunner.scala b/src/partest/scala/tools/partest/nest/ReflectiveRunner.scala
deleted file mode 100644
index bcedaa38be..0000000000
--- a/src/partest/scala/tools/partest/nest/ReflectiveRunner.scala
+++ /dev/null
@@ -1,80 +0,0 @@
-/* NEST (New Scala Test)
- * Copyright 2007-2010 LAMP/EPFL
- * @author Philipp Haller
- */
-
-// $Id$
-
-package scala.tools.partest
-package nest
-
-/* This class is used to load an instance of DirectRunner using
- * a custom class loader.
- * The purpose is to "auto-detect" a good classpath for the
- * rest of the classes (Worker, CompileManager etc.), so that
- * the main NestRunner can be started merely by putting its
- * class on the classpath (ideally).
- */
-class ReflectiveRunner extends RunnerUtils {
- // TODO: we might also use fileManager.CLASSPATH
- // to use the same classes as used by `scala` that
- // was used to start the runner.
-
- import java.net.URLClassLoader
- import java.io.File.pathSeparator
- import utils.Properties.{ sysprop, syspropset }
-
- val sepRunnerClassName = "scala.tools.partest.nest.ConsoleRunner"
-
- def main(args: String) {
- val argList = (args.split("\\s")).toList
-
- // find out which build to test
- val buildPath = searchPath("--buildpath", argList)
- val classPath = searchPath("--classpath", argList)
- val fileManager =
- if (!buildPath.isEmpty)
- new ConsoleFileManager(buildPath.get)
- else if (!classPath.isEmpty)
- new ConsoleFileManager(classPath.get, true)
- else if (argList contains "--pack")
- new ConsoleFileManager("build/pack")
- else // auto detection
- new ConsoleFileManager
-
- import fileManager.
- { latestCompFile, latestLibFile, latestActFile, latestPartestFile, latestFjbgFile }
- val files =
- Array(latestCompFile, latestLibFile, latestActFile, latestPartestFile, latestFjbgFile)
-
- val sepUrls = files map { _.toURI.toURL }
- val sepLoader = new URLClassLoader(sepUrls, null)
-
- if (fileManager.debug)
- println("Loading classes from:\n" + sepUrls.mkString("\n"))
-
- val paths = (if (classPath.isEmpty) files.slice(0, 4) else files) map { _.getPath }
- val newClasspath = paths mkString pathSeparator
-
- syspropset("java.class.path", newClasspath)
- syspropset("scala.home", "")
-
- if (fileManager.debug)
- for (prop <- List("java.class.path", "sun.boot.class.path", "java.ext.dirs"))
- println(prop + ": " + sysprop(prop))
-
- try {
- val sepRunnerClass = sepLoader loadClass sepRunnerClassName
- val sepRunner = sepRunnerClass.newInstance()
- val sepMainMethod = sepRunnerClass.getMethod("main", Array(classOf[String]): _*)
- val cargs: Array[AnyRef] = Array(args)
- sepMainMethod.invoke(sepRunner, cargs: _*)
- }
- catch {
- case cnfe: ClassNotFoundException =>
- cnfe.printStackTrace()
- NestUI.failure(sepRunnerClassName +" could not be loaded from:\n")
- sepUrls foreach (x => NestUI.failure(x + "\n"))
- }
- }
-}
diff --git a/src/partest/scala/tools/partest/nest/RunnerUtils.scala b/src/partest/scala/tools/partest/nest/RunnerUtils.scala
deleted file mode 100644
index 4e41d00bf1..0000000000
--- a/src/partest/scala/tools/partest/nest/RunnerUtils.scala
+++ /dev/null
@@ -1,42 +0,0 @@
-/* NEST (New Scala Test)
- * Copyright 2007-2010 LAMP/EPFL
- * @author Philipp Haller
- */
-
-// $Id$
-
-package scala.tools.partest
-package nest
-
-trait RunnerUtils {
-
- def searchPath(option: String, as: List[String]): Option[String] = {
- val Option = option
- as match {
- case Option :: r :: rs => Some(r)
- case other :: rest => searchPath(option, rest)
- case List() => None
- }
- }
-
- def searchAndRemovePath(option: String, as: List[String]): (Option[String], List[String]) = {
- val Option = option
- def search(before: List[String], after: List[String]): (Option[String], List[String]) = after match {
- case Option :: r :: rs => (Some(r), before ::: rs)
- case other :: rest => search(before ::: List(other), rest)
- case List() => (None, before)
- }
- search(List(), as)
- }
-
- def searchAndRemoveOption(option: String, as: List[String]): (Boolean, List[String]) = {
- val Option = option
- def search(before: List[String], after: List[String]): (Boolean, List[String]) = after match {
- case Option :: rest => (true, before ::: rest)
- case other :: rest => search(before ::: List(other), rest)
- case List() => (false, before)
- }
- search(List(), as)
- }
-
-}
diff --git a/src/partest/scala/tools/partest/nest/StreamAppender.scala b/src/partest/scala/tools/partest/nest/StreamAppender.scala
deleted file mode 100644
index c4636af323..0000000000
--- a/src/partest/scala/tools/partest/nest/StreamAppender.scala
+++ /dev/null
@@ -1,90 +0,0 @@
-/* NEST (New Scala Test)
- * Copyright 2007-2010 LAMP/EPFL
- * @author Philipp Haller
- */
-
-// $Id$
-
-package scala.tools.partest
-package nest
-
-import java.io.{Writer, PrintWriter, Reader, BufferedReader,
- IOException, InputStream, StringWriter, InputStreamReader,
- OutputStreamWriter, StringReader, OutputStream}
-
-object StreamAppender {
-
- def apply(reader: BufferedReader, writer: Writer): StreamAppender = {
- val pwriter = new PrintWriter(writer, true)
- new StreamAppender(reader, pwriter)
- }
-
- def apply(reader: Reader, writer: Writer): StreamAppender =
- apply(new BufferedReader(reader), writer)
-
- def appendToString(in1: InputStream, in2: InputStream): String = {
- val swriter1 = new StringWriter
- val swriter2 = new StringWriter
- val reader1 = new BufferedReader(new InputStreamReader(in1))
- val reader2 = new BufferedReader(new InputStreamReader(in2))
- val app1 = StreamAppender(reader1, swriter1)
- val app2 = StreamAppender(reader2, swriter2)
-
- val async = new Thread(app2)
- async.start()
- app1.run()
- async.join()
- swriter1.toString + swriter2.toString
- }
-/*
- private def inParallel(t1: Runnable, t2: Runnable, t3: Runnable) {
- val thr1 = new Thread(t1)
- val thr2 = new Thread(t2)
- thr1.start()
- thr2.start()
- t3.run()
- thr1.join()
- thr2.join()
- }
-*/
- private def inParallel(t1: Runnable, t2: Runnable) {
- val thr = new Thread(t2)
- thr.start()
- t1.run()
- thr.join()
- }
-
- def concat(in: InputStream, err: InputStream, out: OutputStream) = new Runnable {
- override def run() {
- val outWriter = new PrintWriter(new OutputStreamWriter(out), true)
- val inApp = new StreamAppender(new BufferedReader(new InputStreamReader(in)),
- outWriter)
- val errStringWriter = new StringWriter
- val errApp = StreamAppender(new BufferedReader(new InputStreamReader(err)),
- errStringWriter)
- inParallel(inApp, errApp)
-
- // append error string to out
- val errStrApp = new StreamAppender(new BufferedReader(new StringReader(errStringWriter.toString)),
- outWriter)
- errStrApp.run()
- }
- }
-}
-
-class StreamAppender(reader: BufferedReader, writer: PrintWriter) extends Runnable {
- override def run() = runAndMap(identity)
-
- def runAndMap(f: String => String) {
- try {
- var line = reader.readLine()
- while (line != null) {
- writer.println(f(line))
- line = reader.readLine()
- }
- } catch {
- case e: IOException =>
- e.printStackTrace()
- }
- }
-}
diff --git a/src/partest/scala/tools/partest/nest/TestFile.scala b/src/partest/scala/tools/partest/nest/TestFile.scala
deleted file mode 100644
index 7ffe11e5b6..0000000000
--- a/src/partest/scala/tools/partest/nest/TestFile.scala
+++ /dev/null
@@ -1,109 +0,0 @@
-/* NEST (New Scala Test)
- * Copyright 2007-2010 LAMP/EPFL
- * @author Philipp Haller
- */
-
-// $Id$
-
-package scala.tools.partest
-package nest
-
-import java.io.{File, BufferedReader, FileReader}
-import scala.tools.nsc.Settings
-
-class TestFile(kind: String, val file: File, val fileManager: FileManager, createOutDir: Boolean) {
- val dir = file.getParentFile
- val dirpath = dir.getAbsolutePath
- val fileBase: String = basename(file.getName)
-
- // @mutates settings
- protected def baseSettings(settings: Settings) {
- settings.classpath.value = settings.classpath.value+
- File.pathSeparator+dirpath
- if (createOutDir)
- settings.outdir.value = {
- val outDir = new File(dir, fileBase + "-" + kind + ".obj")
- if (!outDir.exists)
- outDir.mkdir()
- outDir.toString
- }
-
- // add additional flags found in 'testname.flags'
- val flagsFile = new File(dir, fileBase + ".flags")
- if (flagsFile.exists) {
- val reader = new BufferedReader(new java.io.FileReader(flagsFile))
- val flags = reader.readLine
- if (flags ne null)
- settings.parseParams(settings.splitParams(flags))
- }
- }
-
- def defineSettings(settings: Settings) {
- baseSettings(settings)
- }
-
- private def basename(name: String): String = {
- val inx = name.lastIndexOf(".")
- if (inx < 0) name else name.substring(0, inx)
- }
-
- override def toString(): String = kind+" "+file
-}
-
-case class PosTestFile(override val file: File, override val fileManager: FileManager, createOutDir: Boolean) extends TestFile("pos", file, fileManager, createOutDir) {
- override def defineSettings(settings: Settings) {
- baseSettings(settings)
- settings.classpath.value = settings.classpath.value+
- File.pathSeparator+fileManager.CLASSPATH
- }
-}
-
-case class NegTestFile(override val file: File, override val fileManager: FileManager, createOutDir: Boolean) extends TestFile("neg", file, fileManager, createOutDir) {
- override def defineSettings(settings: Settings) {
- baseSettings(settings)
- settings.classpath.value = settings.classpath.value+
- File.pathSeparator+fileManager.CLASSPATH
- }
-}
-
-case class RunTestFile(override val file: File, override val fileManager: FileManager, createOutDir: Boolean) extends TestFile("run", file, fileManager, createOutDir) {
- override def defineSettings(settings: Settings) {
- baseSettings(settings)
- settings.classpath.value = settings.classpath.value+
- File.pathSeparator+fileManager.CLASSPATH
- }
-}
-
-case class ScalaCheckTestFile(override val file: File, override val fileManager: FileManager, createOutDir: Boolean) extends TestFile("scalacheck", file, fileManager, createOutDir) {
- override def defineSettings(settings: Settings) {
- baseSettings(settings)
- settings.classpath.value = settings.classpath.value+
- File.pathSeparator+fileManager.CLASSPATH
- }
-}
-
-case class JvmTestFile(override val file: File, override val fileManager: FileManager, createOutDir: Boolean) extends TestFile("jvm", file, fileManager, createOutDir) {
- override def defineSettings(settings: Settings) {
- baseSettings(settings)
- settings.classpath.value = settings.classpath.value+
- File.pathSeparator+fileManager.CLASSPATH
- }
-}
-
-case class ShootoutTestFile(override val file: File, override val fileManager: FileManager, createOutDir: Boolean) extends TestFile("shootout", file, fileManager, createOutDir) {
- override def defineSettings(settings: Settings) {
- baseSettings(settings)
- settings.classpath.value = settings.classpath.value+
- File.pathSeparator+fileManager.CLASSPATH
- settings.outdir.value = file.getParent
- }
-}
-
-case class ScalapTestFile(override val file: File, override val fileManager: FileManager, createOutDir: Boolean) extends TestFile("scalap", file, fileManager, createOutDir) {
- override def defineSettings(settings: Settings) {
- baseSettings(settings)
- settings.classpath.value = settings.classpath.value+
- File.pathSeparator+fileManager.CLASSPATH
- settings.outdir.value = file.getParent
- }
-}
diff --git a/src/partest/scala/tools/partest/nest/Worker.scala b/src/partest/scala/tools/partest/nest/Worker.scala
deleted file mode 100644
index 37a98860ad..0000000000
--- a/src/partest/scala/tools/partest/nest/Worker.scala
+++ /dev/null
@@ -1,1000 +0,0 @@
-/* NEST (New Scala Test)
- * Copyright 2007-2010 LAMP/EPFL
- * @author Philipp Haller
- */
-
-// $Id$
-
-package scala.tools.partest
-package nest
-
-import java.io._
-import java.net.{URLClassLoader, URL}
-import java.util.{Timer, TimerTask}
-
-import scala.tools.nsc.{ObjectRunner, GenericRunnerCommand}
-import scala.tools.nsc.io
-
-import scala.actors.{Actor, Exit, TIMEOUT}
-import scala.actors.Actor._
-import scala.tools.scalap.scalax.rules.scalasig.{ByteCode, ClassFileParser, ScalaSigAttributeParsers}
-
-import scala.collection.mutable.HashMap
-
-case class RunTests(kind: String, files: List[File])
-case class Results(succ: Int, fail: Int, logs: List[LogFile], outdirs: List[File])
-case class LogContext(file: LogFile, writers: Option[(StringWriter, PrintWriter)])
-
-abstract class TestResult {
- def file: File
-}
-case class Result(override val file: File, context: LogContext) extends TestResult
-case class Timeout(override val file: File) extends TestResult
-
-class LogFile(parent: File, child: String) extends File(parent, child) {
- var toDelete = false
-}
-
-class Worker(val fileManager: FileManager) extends Actor {
- import fileManager._
- import scala.tools.nsc.{Settings, CompilerCommand, Global}
- import scala.tools.nsc.reporters.ConsoleReporter
- import scala.tools.nsc.util.FakePos
-
- var reporter: ConsoleReporter = _
- val timer = new Timer
-
- def error(msg: String) {
- reporter.error(FakePos("scalac"),
- msg + "\n scalac -help gives more information")
- }
-
- def act() {
- react {
- case RunTests(kind, files) =>
- NestUI.verbose("received "+files.length+" to test")
- val master = sender
- runTests(kind, files, (succ: Int, fail: Int) => {
- master ! Results(succ, fail, createdLogFiles, createdOutputDirs)
- })
- }
- }
-
- private def basename(name: String): String = {
- val inx = name.lastIndexOf(".")
- if (inx < 0) name else name.substring(0, inx)
- }
-
- def printInfoStart(file: File, printer: PrintWriter) {
- NestUI.outline("testing: ", printer)
- val filesdir = file.getAbsoluteFile.getParentFile.getParentFile
- val testdir = filesdir.getParentFile
- val totalWidth = 56
- val name = {
- // 1. try with [...]/files/run/test.scala
- val testPathLen = testdir.getAbsolutePath.length
- val name = file.getAbsolutePath.substring(testPathLen)
- if (name.length <= totalWidth)
- name
- // 2. try with [...]/run/test.scala
- else {
- val filesPathLen = filesdir.getAbsolutePath.length
- file.getAbsolutePath.substring(filesPathLen)
- }
- }
- NestUI.normal("[...]"+name+(List.fill(totalWidth-name.length)(' ')).mkString, printer)
- }
-
- def printInfoEnd(success: Boolean, printer: PrintWriter) {
- NestUI.normal("[", printer)
- if (success) NestUI.success(" OK ", printer)
- else NestUI.failure("FAILED", printer)
- NestUI.normal("]\n", printer)
- }
-
- def printInfoTimeout(printer: PrintWriter) {
- NestUI.normal("[", printer)
- NestUI.failure("TIMOUT", printer)
- NestUI.normal("]\n", printer)
- }
-
- var log = ""
- var createdLogFiles: List[LogFile] = List()
- var createdOutputDirs: List[File] = List()
-
- def createLogFile(file: File, kind: String): LogFile = {
- val logFile = fileManager.getLogFile(file, kind)
- createdLogFiles = logFile :: createdLogFiles
- logFile
- }
-
- def createOutputDir(dir: File, fileBase: String, kind: String): File = {
- val outDir = io.Path(dir) / io.Directory("%s-%s.obj".format(fileBase, kind))
- outDir.createDirectory()
- createdOutputDirs ::= outDir.jfile
- outDir.jfile
- }
-
- /* Note: not yet used/tested. */
- def execTestObjectRunner(file: File, outDir: File, logFile: File) {
- val consFM = new ConsoleFileManager
- import consFM.{latestCompFile, latestLibFile, latestActFile,
- latestPartestFile}
-
- val classpath: List[URL] =
- outDir.toURI.toURL ::
- //List(file.getParentFile.toURI.toURL) :::
- List(latestCompFile.toURI.toURL, latestLibFile.toURI.toURL, latestActFile.toURI.toURL, latestPartestFile.toURI.toURL) :::
- ((CLASSPATH split File.pathSeparatorChar).toList map (x => new File(x).toURI.toURL))
-
- NestUI.verbose("ObjectRunner classpath: "+classpath)
-
- try {
- // configure input/output files
- val logOut = new FileOutputStream(logFile)
- val logWriter = new PrintStream(logOut)
-
- // grab global lock
- fileManager.synchronized {
-
- val oldStdOut = System.out
- val oldStdErr = System.err
- System.setOut(logWriter)
- System.setErr(logWriter)
-
- /*
- " -Djava.library.path="+logFile.getParentFile.getAbsolutePath+
- " -Dscalatest.output="+outDir.getAbsolutePath+
- " -Dscalatest.lib="+LATEST_LIB+
- " -Dscalatest.cwd="+outDir.getParent+
- " -Djavacmd="+JAVACMD+
- */
-
- System.setProperty("java.library.path", logFile.getParentFile.getCanonicalFile.getAbsolutePath)
- System.setProperty("scalatest.output", outDir.getCanonicalFile.getAbsolutePath)
- System.setProperty("scalatest.lib", LATEST_LIB)
- System.setProperty("scalatest.cwd", outDir.getParent)
-
- ObjectRunner.run(classpath, "Test", List("jvm"))
-
- logWriter.flush()
- logWriter.close()
-
- System.setOut(oldStdOut)
- System.setErr(oldStdErr)
- }
-
- /*val out = new FileOutputStream(logFile, true)
- Console.withOut(new PrintStream(out)) {
- ObjectRunner.run(classpath, "Test", List("jvm"))
- }
- out.flush
- out.close*/
- } catch {
- case e: Exception =>
- NestUI.verbose(e+" ("+file.getPath+")")
- e.printStackTrace()
- }
- }
-
- def javac(outDir: File, files: List[File], output: File): Boolean = {
- // compile using command-line javac compiler
- val javacCmd = if ((fileManager.JAVAC_CMD.indexOf("${env.JAVA_HOME}") != -1) ||
- fileManager.JAVAC_CMD.equals("/bin/javac") ||
- fileManager.JAVAC_CMD.equals("\\bin\\javac"))
- "javac"
- else
- fileManager.JAVAC_CMD
-
- val cmd = javacCmd+
- " -d "+outDir.getAbsolutePath+
- " -classpath "+outDir+File.pathSeparator+CLASSPATH+
- " "+files.mkString(" ")
-
- val (success, msg) = try {
- val exitCode = runCommand(cmd, output)
- NestUI.verbose("javac returned exit code: "+exitCode)
- if (exitCode != 0)
- (false, "Running \"javac\" failed with exit code: "+exitCode+"\n"+cmd+"\n")
- else
- (true, "")
- } catch {
- case e: Exception =>
- val swriter = new StringWriter
- e.printStackTrace(new PrintWriter(swriter))
- (false, "Running \"javac\" failed:\n"+cmd+"\n"+swriter.toString+"\n")
- }
- if (!success) {
- val writer = new PrintWriter(new FileWriter(output, true), true)
- writer.print(msg)
- writer.close()
- }
- success
- }
-
- /** Runs <code>command</code> redirecting standard out and
- * error out to <code>output</code> file.
- */
- def runCommand(command: String, output: File): Int = {
- NestUI.verbose("running command:\n"+command)
- val proc = Runtime.getRuntime.exec(command)
- val in = proc.getInputStream
- val err = proc.getErrorStream
- val writer = new PrintWriter(new FileWriter(output), true)
- val inApp = new StreamAppender(new BufferedReader(new InputStreamReader(in)),
- writer)
- val errApp = new StreamAppender(new BufferedReader(new InputStreamReader(err)),
- writer)
- val async = new Thread(errApp)
- async.start()
- inApp.run()
- async.join()
- writer.close()
- try {
- proc.exitValue()
- } catch {
- case e: IllegalThreadStateException => 0
- }
- }
-
- def execTest(outDir: File, logFile: File, fileBase: String) {
- // check whether there is a ".javaopts" file
- val argsFile = new File(logFile.getParentFile, fileBase+".javaopts")
- val argString = if (argsFile.exists) {
- NestUI.verbose("Found javaopts file: "+argsFile)
- val fileReader = new FileReader(argsFile)
- val reader = new BufferedReader(fileReader)
- val options = reader.readLine()
- reader.close()
- NestUI.verbose("Found javaopts file '%s', using options: '%s'".format(argsFile, options))
- options
- } else ""
-
- val cp = System.getProperty("java.class.path", ".")
- NestUI.verbose("java.class.path: "+cp)
-
- def quote(path: String) = "\""+path+"\""
-
- // Note! As this currently functions, JAVA_OPTS must precede argString
- // because when an option is repeated to java only the last one wins.
- // That means until now all the .javaopts files were being ignored because
- // they all attempt to change options which are also defined in
- // scalatest.java_opts, leading to debug output like:
- //
- // debug: Found javaopts file 'files/shootout/message.scala-2.javaopts', using options: '-Xss32k'
- // debug: java -Xss32k -Xss2m -Xms256M -Xmx1024M -classpath [...]
- val cmd =
- JAVACMD+
- " "+JAVA_OPTS+
- " "+argString+
- " -classpath "+outDir+File.pathSeparator+CLASSPATH+
- " -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"
- NestUI.verbose(cmd)
-
- runCommand(cmd, logFile)
-
- if (fileManager.showLog) {
- // produce log as string in `log`
- val reader = new BufferedReader(new FileReader(logFile))
- val swriter = new StringWriter
- val pwriter = new PrintWriter(swriter, true)
- val appender = new StreamAppender(reader, pwriter)
- appender.run()
- log = swriter.toString
- }
- }
-
- def existsCheckFile(dir: File, fileBase: String, kind: String) = {
- val checkFile = {
- val chkFile = new File(dir, fileBase + ".check")
- if (chkFile.isFile)
- chkFile
- else
- new File(dir, fileBase + "-" + kind + ".check")
- }
- checkFile.exists && checkFile.canRead
- }
-
- def compareOutput(dir: File, fileBase: String, kind: String, logFile: File): String = {
- def getCheckFile(s: String) = {
- val f = io.Path(dir) / io.File("%s%s.check".format(fileBase, s))
- if (f.isFile && f.canRead) Some(f) else None
- }
-
- // if check file exists, compare with log file
- (getCheckFile("") orElse getCheckFile("-" + kind)) match {
- case Some(f) => fileManager.compareFiles(logFile, f.jfile)
- case _ => file2String(logFile)
- }
- }
-
- def file2String(logFile: File) = io.File(logFile).slurp()
-
- /** Runs a list of tests.
- *
- * @param kind The test kind (pos, neg, run, etc.)
- * @param files The list of test files
- */
- def runTests(kind: String, files: List[File], topcont: (Int, Int) => Unit) {
- val compileMgr = new CompileManager(fileManager)
- var errors = 0
- var succeeded = true
- var diff = ""
- var log = ""
-
- /** 1. Creates log file and output directory.
- * 2. Runs <code>script</code> function, providing log file and
- * output directory as arguments.
- */
- def runInContext(file: File, kind: String, script: (File, File) => Unit): LogContext = {
- // when option "--failed" is provided
- // execute test only if log file is present
- // (which means it failed before)
- val logFile = createLogFile(file, kind)
- if (!fileManager.failed || (logFile.exists && logFile.canRead)) {
- val swr = new StringWriter
- val wr = new PrintWriter(swr)
- succeeded = true
- diff = ""
- log = ""
- printInfoStart(file, wr)
-
- val fileBase: String = basename(file.getName)
- NestUI.verbose(this+" running test "+fileBase)
- val dir = file.getParentFile
- val outDir = createOutputDir(dir, fileBase, kind)
- NestUI.verbose("output directory: "+outDir)
-
- // run test-specific code
- try {
- script(logFile, outDir)
- } catch {
- case e: Exception =>
- val writer = new PrintWriter(new FileWriter(logFile), true)
- e.printStackTrace(writer)
- writer.close()
- succeeded = false
- }
-
- LogContext(logFile, Some((swr, wr)))
- } else
- LogContext(logFile, None)
- }
-
- def compileFilesIn(dir: File, kind: String, logFile: File, outDir: File) {
- val testFiles = dir.listFiles.toList
-
- val groups = for (i <- 0 to 9) yield testFiles filter { f =>
- f.getName.endsWith("_"+i+".java") ||
- f.getName.endsWith("_"+i+".scala") }
-
- val noSuffix = testFiles filter { f =>
- !groups.exists(_ contains f) && (
- f.getName.endsWith(".java") ||
- f.getName.endsWith(".scala")) }
-
- def compileGroup(g: List[File]) {
- val scalaFiles = g.filter(_.getName.endsWith(".scala"))
- val javaFiles = g.filter(_.getName.endsWith(".java"))
-
- if (!scalaFiles.isEmpty &&
- !compileMgr.shouldCompile(outDir,
- javaFiles ::: scalaFiles,
- kind, logFile)) {
- NestUI.verbose("scalac: compilation of "+g+" failed\n")
- succeeded = false
- }
-
- if (succeeded && !javaFiles.isEmpty) {
- succeeded = javac(outDir, javaFiles, logFile)
- if (succeeded && !scalaFiles.isEmpty
- && !compileMgr.shouldCompile(outDir,
- scalaFiles,
- kind, logFile)) {
- NestUI.verbose("scalac: compilation of "+scalaFiles+" failed\n")
- succeeded = false
- }
- }
- }
-
- if (!noSuffix.isEmpty)
- compileGroup(noSuffix)
- for (grp <- groups) {
- if (succeeded)
- compileGroup(grp)
- }
- }
-
- def failCompileFilesIn(dir: File, kind: String, logFile: File, outDir: File) {
- val testFiles = dir.listFiles.toList
- val javaFiles = testFiles.filter(_.getName.endsWith(".java"))
- val scalaFiles = testFiles.filter(_.getName.endsWith(".scala"))
- if (!(scalaFiles.isEmpty && javaFiles.isEmpty) &&
- !compileMgr.shouldFailCompile(outDir, javaFiles ::: scalaFiles, kind, logFile)) {
- NestUI.verbose("compilation of "+scalaFiles+" failed\n")
- succeeded = false
- }
- }
-
- def runJvmTest(file: File, kind: String): LogContext =
- runInContext(file, kind, (logFile: File, outDir: File) => {
- if (file.isDirectory) {
- compileFilesIn(file, kind, logFile, outDir)
- } else if (!compileMgr.shouldCompile(List(file), kind, logFile)) {
- NestUI.verbose("compilation of "+file+" failed\n")
- succeeded = false
- }
- if (succeeded) { // run test
- val fileBase = basename(file.getName)
- val dir = file.getParentFile
-
- //TODO: detect whether we have to use Runtime.exec
- val useRuntime = true
-
- if (useRuntime)
- execTest(outDir, logFile, fileBase)
- else
- execTestObjectRunner(file, outDir, logFile)
- NestUI.verbose(this+" finished running "+fileBase)
-
- diff = compareOutput(dir, fileBase, kind, logFile)
- if (!diff.equals("")) {
- NestUI.verbose("output differs from log file\n")
- succeeded = false
- }
- }
- })
-
- def processSingleFile(file: File): LogContext = kind match {
- case "scalacheck" =>
- runInContext(file, kind, (logFile: File, outDir: File) => {
- if (file.isDirectory) {
- compileFilesIn(file, kind, logFile, outDir)
- } else if (!compileMgr.shouldCompile(List(file), kind, logFile)) {
- NestUI.verbose("compilation of "+file+" failed\n")
- succeeded = false
- }
- if (succeeded) {
- val consFM = new ConsoleFileManager
- import consFM.{latestCompFile, latestLibFile, latestActFile,
- latestPartestFile}
-
- NestUI.verbose("compilation of "+file+" succeeded\n")
-
- val libs = new File(fileManager.LIB_DIR)
- val scalacheckURL = (new File(libs, "ScalaCheck.jar")).toURI.toURL
- val outURL = outDir.getCanonicalFile.toURI.toURL
- val classpath: List[URL] =
- List(outURL, scalacheckURL, latestCompFile.toURI.toURL, latestLibFile.toURI.toURL,
- latestActFile.toURI.toURL, latestPartestFile.toURI.toURL).removeDuplicates
-
- // XXX this is a big cut-and-paste mess, but the revamp is coming
- val logOut = new FileOutputStream(logFile)
- val logWriter = new PrintStream(logOut)
- val oldStdOut = System.out
- val oldStdErr = System.err
- System.setOut(logWriter)
- System.setErr(logWriter)
-
- ObjectRunner.run(classpath, "Test", Nil)
-
- logWriter.flush()
- logWriter.close()
- System.setOut(oldStdOut)
- System.setErr(oldStdErr)
-
- NestUI.verbose(io.File(logFile).slurp())
- // obviously this must be improved upon
- succeeded = io.File(logFile).lines() forall (_ contains " OK")
- }
- })
-
- case "pos" =>
- runInContext(file, kind, (logFile: File, outDir: File) => {
- if (file.isDirectory) {
- compileFilesIn(file, kind, logFile, outDir)
- } else if (!compileMgr.shouldCompile(List(file), kind, logFile)) {
- NestUI.verbose("compilation of "+file+" failed\n")
- succeeded = false
- }
- })
-
- case "neg" =>
- runInContext(file, kind, (logFile: File, outDir: File) => {
- if (file.isDirectory) {
- failCompileFilesIn(file, kind, logFile, outDir)
- } else if (!compileMgr.shouldFailCompile(List(file), kind, logFile)) {
- succeeded = false
- }
- if (succeeded) { // compare log file to check file
- val fileBase = basename(file.getName)
- val dir = file.getParentFile
- if (!existsCheckFile(dir, fileBase, kind)) {
- // diff is contents of logFile
- diff = file2String(logFile)
- } else
- diff = compareOutput(dir, fileBase, kind, logFile)
-
- if (!diff.equals("")) {
- NestUI.verbose("output differs from log file\n")
- succeeded = false
- }
- }
- })
-
- case "run" =>
- runJvmTest(file, kind)
-
- case "jvm" =>
- runJvmTest(file, kind)
-
- case "res" => {
- // when option "--failed" is provided
- // execute test only if log file is present
- // (which means it failed before)
-
- //val (logFileOut, logFileErr) = createLogFiles(file, kind)
- val logFile = createLogFile(file, kind)
- if (!fileManager.failed || (logFile.exists && logFile.canRead)) {
- val swr = new StringWriter
- val wr = new PrintWriter(swr)
- succeeded = true; diff = ""; log = ""
- printInfoStart(file, wr)
-
- val fileBase: String = basename(file.getName)
- NestUI.verbose(this+" running test "+fileBase)
- val dir = file.getParentFile
- val outDir = createOutputDir(dir, fileBase, kind)
- if (!outDir.exists) outDir.mkdir()
- val resFile = new File(dir, fileBase + ".res")
- NestUI.verbose("outDir: "+outDir)
- NestUI.verbose("logFile: "+logFile)
- //NestUI.verbose("logFileErr: "+logFileErr)
- NestUI.verbose("resFile: "+resFile)
-
- // run compiler in resident mode
- // $SCALAC -d "$os_dstbase".obj -Xresident -sourcepath . "$@"
-
- try {
-
- val sourcedir = logFile.getParentFile.getCanonicalFile
- val sourcepath = sourcedir.getAbsolutePath+File.separator
- NestUI.verbose("sourcepath: "+sourcepath)
-
- val argString =
- "-d "+outDir.getCanonicalFile.getAbsolutePath+
- " -Xresident"+
- " -sourcepath "+sourcepath
- val argList = argString split ' ' toList
-
- // configure input/output files
- val logOut = new FileOutputStream(logFile)
- val logWriter = new PrintStream(logOut)
- val resReader = new BufferedReader(new FileReader(resFile))
- val logConsoleWriter = new PrintWriter(new OutputStreamWriter(logOut))
-
- // create compiler
- val settings = new Settings(error)
- settings.sourcepath.value = sourcepath
- settings.classpath.value = fileManager.CLASSPATH
- reporter = new ConsoleReporter(settings, scala.Console.in, logConsoleWriter)
- val command = new CompilerCommand(argList, settings, error, false)
- object compiler extends Global(command.settings, reporter)
-
- // simulate resident compiler loop
- val prompt = "\nnsc> "
-
- val resCompile = (line: String) => {
- NestUI.verbose("compiling "+line)
- val cmdArgs = (line split ' ').toList map (fs => new File(dir, fs).getAbsolutePath)
- NestUI.verbose("cmdArgs: "+cmdArgs)
- val sett = new Settings(error)
- sett.sourcepath.value = sourcepath
- val command = new CompilerCommand(cmdArgs, sett, error, true)
- (new compiler.Run) compile command.files
- }
-
- def loop(action: (String) => Unit) {
- logWriter.print(prompt)
- val line = resReader.readLine()
- if ((line ne null) && line.length() > 0) {
-/*
- val parent = self
- self.trapExit = true
- val child = link {
- action(line)
- }
-
- receiveWithin(fileManager.timeout.toLong) {
- case TIMEOUT =>
- NestUI.verbose("action timed out")
- false
- case Exit(from, reason) if from == child => reason match {
- case 'normal => // do nothing
- case t: Throwable =>
- NestUI.verbose("while invoking compiler:")
- NestUI.verbose("caught "+t)
- t.printStackTrace
- if (t.getCause != null)
- t.getCause.printStackTrace
- false
- }
- }
-*/
- action(line)
- loop(action)
- }
- }
- val oldStdOut = System.out
- val oldStdErr = System.err
- System.setOut(logWriter)
- System.setErr(logWriter)
- loop(resCompile)
- resReader.close()
- logWriter.flush()
- logWriter.close()
-
- System.setOut(oldStdOut)
- System.setErr(oldStdErr)
-
- val tempLogFile = new File(dir, fileBase+".temp.log")
- val logFileReader = new BufferedReader(new FileReader(logFile))
- val tempLogFilePrinter = new PrintWriter(new FileWriter(tempLogFile))
- val appender =
- new StreamAppender(logFileReader, tempLogFilePrinter)
-
- // function that removes a given string from another string
- def removeFrom(line: String, path: String): String = {
- // find `path` in `line`
- val index = line.indexOf(path)
- if (index != -1) {
- line.substring(0, index) + line.substring(index + path.length, line.length)
- } else line
- }
-
- appender.runAndMap({ s =>
- val woPath = removeFrom(s, dir.getAbsolutePath/*.replace(File.separatorChar,'/')*/+File.separator)
- // now replace single '\' with '/'
- woPath.replace('\\', '/')
- })
- logFileReader.close()
- tempLogFilePrinter.close()
-
- val tempLogFileReader = new BufferedReader(new FileReader(tempLogFile))
- val logFilePrinter= new PrintWriter(new FileWriter(logFile), true)
- (new StreamAppender(tempLogFileReader, logFilePrinter)).run
- tempLogFileReader.close()
- logFilePrinter.close()
-
- tempLogFile.delete()
-
- diff = compareOutput(dir, fileBase, kind, logFile)
- if (!diff.equals("")) {
- NestUI.verbose("output differs from log file\n")
- succeeded = false
- }
-
- } catch {
- case e: Exception =>
- e.printStackTrace()
- succeeded = false
- }
-
- LogContext(logFile, Some((swr, wr)))
- } else
- LogContext(logFile, None)
- }
-
- case "shootout" => {
- // when option "--failed" is provided
- // execute test only if log file is present
- // (which means it failed before)
- val logFile = createLogFile(file, kind)
- if (!fileManager.failed || (logFile.exists && logFile.canRead)) {
- val swr = new StringWriter
- val wr = new PrintWriter(swr)
- succeeded = true; diff = ""; log = ""
- printInfoStart(file, wr)
-
- val fileBase: String = basename(file.getName)
- NestUI.verbose(this+" running test "+fileBase)
- val dir = file.getParentFile
- val outDir = createOutputDir(dir, fileBase, kind)
- if (!outDir.exists) outDir.mkdir()
-
- // 2. define file {outDir}/test.scala that contains code to compile/run
- val testFile = new File(outDir, "test.scala")
- NestUI.verbose("outDir: "+outDir)
- NestUI.verbose("logFile: "+logFile)
- NestUI.verbose("testFile: "+testFile)
-
- // 3. cat {test}.scala.runner {test}.scala > testFile
- val runnerFile = new File(dir, fileBase+".scala.runner")
- val bodyFile = new File(dir, fileBase+".scala")
- val appender = StreamAppender.concat(new FileInputStream(runnerFile),
- new FileInputStream(bodyFile),
- new FileOutputStream(testFile))
- appender.run()
-
- try { // *catch-all*
- // 4. compile testFile
- if (!compileMgr.shouldCompile(List(testFile), kind, logFile)) {
- NestUI.verbose("compilation of "+file+" failed\n")
- succeeded = false
- } else {
- NestUI.verbose("compilation of "+testFile+"succeeded")
- // -------- run test --------
-
- //TODO: detect whether we have to use Runtime.exec
- val useRuntime = true
-
- if (useRuntime)
- execTest(outDir, logFile, fileBase)
- else
- execTestObjectRunner(file, outDir, logFile)
- NestUI.verbose(this+" finished running "+fileBase)
- } // successful compile
- } catch { // *catch-all*
- case e: Exception =>
- NestUI.verbose("caught "+e)
- succeeded = false
- }
-
- diff = compareOutput(dir, fileBase, kind, logFile)
- if (!diff.equals("")) {
- NestUI.verbose("output differs from log file\n")
- succeeded = false
- }
-
- LogContext(logFile, Some((swr, wr)))
- } else
- LogContext(logFile, None)
- }
-
- case "scalap" => {
-
- def decompileFile(clazz: Class[_], packObj: Boolean) = {
- val byteCode = ByteCode.forClass(clazz)
- val classFile = ClassFileParser.parse(byteCode)
- val Some(sig) = classFile.attribute("ScalaSig").map(_.byteCode).map(ScalaSigAttributeParsers.parse)
- import scala.tools.scalap.Main._
- parseScalaSignature(sig, packObj)
- }
-
- runInContext(file, kind, (logFile: File, outDir: File) => {
- val sourceDir = file.getParentFile
- val sourceDirName = sourceDir.getName
-
- // 1. Find file with result text
- val results = sourceDir.listFiles(new FilenameFilter {
- def accept(dir: File, name: String) = name == "result.test"
- })
-
- if (results.length != 1) {
- NestUI.verbose("Result file not found in directory " + sourceDirName + " \n")
- } else {
- val resFile = results(0)
- // 2. Compile source file
- if (!compileMgr.shouldCompile(outDir, List(file), kind, logFile)) {
- NestUI.verbose("compilerMgr failed to compile %s to %s".format(file, outDir))
- succeeded = false
- } else {
-
- // 3. Decompile file and compare results
- val isPackageObject = sourceDir.getName.startsWith("package")
- val className = sourceDirName.capitalize + (if (!isPackageObject) "" else ".package")
- val url = outDir.toURI.toURL
- val loader = new URLClassLoader(Array(url), getClass.getClassLoader)
- val clazz = loader.loadClass(className)
-
- val result = decompileFile(clazz, isPackageObject)
-
- try {
- val fstream = new FileWriter(logFile);
- val out = new BufferedWriter(fstream);
- out.write(result)
- out.close();
- } catch {
- case e: IOException => NestUI.verbose(e.getMessage()); succeeded = false
- }
-
- val diff = fileManager.compareFiles(logFile, resFile)
- if (!diff.equals("")) {
- NestUI.verbose("output differs from log file\n")
- succeeded = false
- }
- }
- }
- })
- }
-
- case "script" => {
- val osName = System.getProperty("os.name", "")
- // when option "--failed" is provided
- // execute test only if log file is present
- // (which means it failed before)
- val logFile = createLogFile(file, kind)
- if (!fileManager.failed || (logFile.exists && logFile.canRead)) {
- val swr = new StringWriter
- val wr = new PrintWriter(swr)
- succeeded = true; diff = ""; log = ""
- printInfoStart(file, wr)
-
- val fileBase: String = basename(file.getName)
- NestUI.verbose(this+" running test "+fileBase)
-
- // check whether there is an args file
- val argsFile = new File(file.getParentFile, fileBase+".args")
- NestUI.verbose("argsFile: "+argsFile)
- val argString = if (argsFile.exists) {
- val swriter = new StringWriter
- val app = StreamAppender(new BufferedReader(new FileReader(argsFile)),
- swriter)
- app.run()
- " "+swriter.toString
- } else ""
-
- try {
- val cmdString =
- if (osName startsWith "Windows") {
- val batchFile = new File(file.getParentFile, fileBase+".bat")
- NestUI.verbose("batchFile: "+batchFile)
- batchFile.getAbsolutePath
- }
- else file.getAbsolutePath
- val proc = Runtime.getRuntime.exec(cmdString+argString)
- val in = proc.getInputStream
- val err = proc.getErrorStream
- val writer = new PrintWriter(new FileWriter(logFile), true)
- val inApp = new StreamAppender(new BufferedReader(new InputStreamReader(in)),
- writer)
- val errApp = new StreamAppender(new BufferedReader(new InputStreamReader(err)),
- writer)
- val async = new Thread(errApp)
- async.start()
- inApp.run()
- async.join()
-
- writer.close()
-
- diff = compareOutput(file.getParentFile, fileBase, kind, logFile)
- if (!diff.equals("")) {
- NestUI.verbose("output differs from log file\n")
- succeeded = false
- }
- } catch { // *catch-all*
- case e: Exception =>
- NestUI.verbose("caught "+e)
- succeeded = false
- }
-
- LogContext(logFile, Some((swr, wr)))
- } else
- LogContext(logFile, None)
- }
- }
-
- def reportAll(cont: (Int, Int) => Unit) {
- NestUI.verbose("finished testing "+kind+" with "+errors+" errors")
- NestUI.verbose("created "+compileMgr.numSeparateCompilers+" separate compilers")
- timer.cancel()
- cont(files.length-errors, errors)
- }
-
- def reportResult(logs: Option[LogContext]) {
- if (!succeeded) {
- errors += 1
- NestUI.verbose("incremented errors: "+errors)
- }
-
- try {
- // delete log file only if test was successful
- if (succeeded && !logs.isEmpty)
- logs.get.file.toDelete = true
-
- if (!logs.isEmpty)
- logs.get.writers match {
- case Some((swr, wr)) =>
- printInfoEnd(succeeded, wr)
- wr.flush()
- swr.flush()
- NestUI.normal(swr.toString)
- if (!succeeded && fileManager.showDiff && diff != "")
- NestUI.normal(diff)
- if (!succeeded && fileManager.showLog)
- showLog(logs.get.file)
- case None =>
- }
- } catch {
- case npe: NullPointerException =>
- }
- }
-
- val numFiles = files.size
- if (numFiles == 0)
- reportAll(topcont)
-
- // maps canonical file names to the test result (0: OK, 1: FAILED, 2: TIMOUT)
- val status = new HashMap[String, Int]
-
- var fileCnt = 1
- Actor.loopWhile(fileCnt <= numFiles) {
- val parent = self
-
- actor {
- val testFile = files(fileCnt-1)
-
- val ontimeout = new TimerTask {
- def run() = parent ! Timeout(testFile)
- }
- timer.schedule(ontimeout, fileManager.timeout.toLong)
-
- val context = try {
- processSingleFile(testFile)
- } catch {
- case t: Throwable =>
- NestUI.verbose("while invoking compiler ("+files+"):")
- NestUI.verbose("caught "+t)
- t.printStackTrace
- if (t.getCause != null)
- t.getCause.printStackTrace
- LogContext(null, None)
- }
- parent ! Result(testFile, context)
- }
-
- react {
- case res: TestResult =>
- val path = res.file.getCanonicalPath
- status.get(path) match {
- case Some(stat) => // ignore message
- case None => res match {
- case Timeout(_) =>
- status += (path -> 2)
- val swr = new StringWriter
- val wr = new PrintWriter(swr)
- printInfoStart(files(fileCnt-1), wr)
- printInfoTimeout(wr)
- wr.flush()
- swr.flush()
- NestUI.normal(swr.toString)
- succeeded = false
- reportResult(None)
- if (fileCnt == numFiles)
- reportAll(topcont)
- fileCnt += 1
- case Result(_, logs) =>
- status += (path -> (if (succeeded) 0 else 1))
- reportResult(if (logs != null) Some(logs) else None)
- if (fileCnt == numFiles)
- reportAll(topcont)
- fileCnt += 1
- }
- }
- }
- }
- }
-
- def showLog(logFile: File) {
- try {
- val logReader = new BufferedReader(new FileReader(logFile))
- val strWriter = new StringWriter
- val logWriter = new PrintWriter(strWriter, true)
- val logAppender = new StreamAppender(logReader, logWriter)
- logAppender.run()
- logReader.close()
- val log = strWriter.toString
- NestUI.normal(log)
- } catch {
- case fnfe: java.io.FileNotFoundException =>
- NestUI.failure("Couldn't open log file \""+logFile+"\".")
- }
- }
-}
diff --git a/src/partest/scala/tools/partest/package.scala b/src/partest/scala/tools/partest/package.scala
new file mode 100644
index 0000000000..3ef4db7cd8
--- /dev/null
+++ b/src/partest/scala/tools/partest/package.scala
@@ -0,0 +1,47 @@
+/* NEST (New Scala Test)
+ * Copyright 2007-2010 LAMP/EPFL
+ */
+
+package scala.tools
+
+import nsc.io.{ File, Path, Process, Directory }
+import nsc.util.CommandLineSpec
+import java.nio.charset.CharacterCodingException
+
+package object partest {
+ /** The CharacterCodingExceptions are thrown at least on windows trying
+ * to read a file like script/utf-8.scala
+ */
+ private[partest] def safeSlurp(f: File) =
+ try if (f.exists) f.slurp() else ""
+ catch { case _: CharacterCodingException => "" }
+
+ 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
+
+ /** Strings, argument lists, etc. */
+
+ private[partest] def fromAnyArgs(args: List[Any]) = args mkString " " // separate to avoid accidents
+ private[partest] def toStringTrunc(x: Any, max: Int = 240) = {
+ val s = x.toString
+ if (s.length < max) s
+ else (s take max) + " [...]"
+ }
+ private[partest] def setProp(k: String, v: String) = scala.util.Properties.setProp(k, v)
+
+ /** Pretty self explanatory. */
+ def printAndExit(msg: String): Unit = {
+ println(msg)
+ exit(1)
+ }
+
+ /** Apply a function and return the passed value */
+ def returning[T](x: T)(f: T => Unit): T = { f(x) ; x }
+} \ No newline at end of file
diff --git a/src/partest/scala/tools/partest/util/package.scala b/src/partest/scala/tools/partest/util/package.scala
new file mode 100644
index 0000000000..bc5470ba5d
--- /dev/null
+++ b/src/partest/scala/tools/partest/util/package.scala
@@ -0,0 +1,61 @@
+/* NEST (New Scala Test)
+ * Copyright 2007-2010 LAMP/EPFL
+ */
+
+package scala.tools
+package partest
+
+import java.util.{ Timer, TimerTask }
+import java.io.StringWriter
+import nsc.io._
+
+/** Misc code still looking for a good home.
+ */
+package object util {
+
+ def allPropertiesString() = javaHashtableToString(System.getProperties)
+
+ private def javaHashtableToString(table: java.util.Hashtable[_,_]) = {
+ import collection.JavaConversions._
+ (table.toList map { case (k, v) => "%s -> %s\n".format(k, v) }).sorted mkString
+ }
+
+ def filesToSet(pre: String, fs: List[String]): Set[AbstractFile] =
+ fs flatMap (x => Option(AbstractFile getFile (Path(pre) / x).path)) toSet
+
+ /** Copies one Path to another Path, trying to be sensible when one or the
+ * other is a Directory. Returns true if it believes it succeeded.
+ */
+ def copyPath(from: Path, to: Path): Boolean = {
+ if (!to.parent.isDirectory)
+ to.parent.createDirectory(force = true)
+
+ def copyDir = {
+ val sub = to / from.name createDirectory true
+ from.toDirectory.list forall (x => copyPath(x, sub))
+ }
+ (from.isDirectory, to.isDirectory) match {
+ case (true, true) => copyDir
+ case (true, false) => false
+ case (false, true) => from.toFile copyTo (to / from.name)
+ case (false, false) => from.toFile copyTo to
+ }
+ }
+
+ /**
+ * Compares two files using a Java implementation of the GNU diff
+ * available at http://www.bmsi.com/java/#diff.
+ *
+ * @param f1 the first file to be compared
+ * @param f2 the second file to be compared
+ * @return the text difference between the compared files
+ */
+ def diffFiles(f1: File, f2: File): String = {
+ val diffWriter = new StringWriter
+ val args = Array(f1.toAbsolute.path, f2.toAbsolute.path)
+
+ io.DiffPrint.doDiff(args, diffWriter)
+ val result = diffWriter.toString
+ if (result == "No differences") "" else result
+ }
+}
diff --git a/src/partest/scala/tools/partest/utils/PrintMgr.scala b/src/partest/scala/tools/partest/utils/PrintMgr.scala
deleted file mode 100644
index 10533130f1..0000000000
--- a/src/partest/scala/tools/partest/utils/PrintMgr.scala
+++ /dev/null
@@ -1,52 +0,0 @@
-/* __ *\
-** ________ ___ / / ___ Scala Parallel Testing **
-** / __/ __// _ | / / / _ | (c) 2007-2010, LAMP/EPFL **
-** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ **
-** /____/\___/_/ |_/____/_/ | | **
-** |/ **
-\* */
-
-// $Id$
-
-package scala.tools.partest
-package utils
-
-/**
- * @author Thomas Hofer
- */
-object PrintMgr {
-
- val NONE = 0
- val SOME = 1
- val MANY = 2
-
- var outline = ""
- var success = ""
- var failure = ""
- var warning = ""
- var default = ""
-
- def initialization(number: Int) = number match {
- case MANY =>
- outline = Console.BOLD + Console.BLACK
- success = Console.BOLD + Console.GREEN
- failure = Console.BOLD + Console.RED
- warning = Console.BOLD + Console.YELLOW
- default = Console.RESET
- case SOME =>
- outline = Console.BOLD + Console.BLACK
- success = Console.RESET
- failure = Console.BOLD + Console.BLACK
- warning = Console.BOLD + Console.BLACK
- default = Console.RESET
- case _ =>
- }
-
- def printOutline(msg: String) = print(outline + msg + default)
-
- def printSuccess(msg: String) = print(success + msg + default)
-
- def printFailure(msg: String) = print(failure + msg + default)
-
- def printWarning(msg: String) = print(warning + msg + default)
-}