diff options
author | Som Snytt <som.snytt@gmail.com> | 2013-08-08 19:09:52 -0700 |
---|---|---|
committer | Som Snytt <som.snytt@gmail.com> | 2013-08-08 19:09:52 -0700 |
commit | a9927445a3033fef56d802595ee3423de33765f1 (patch) | |
tree | c4e87bb0600ea57a5c7b0106a57c8399f0bb44c8 | |
parent | 3dd0dd480e7464e316f283fdd84b62314e47db68 (diff) | |
download | scala-a9927445a3033fef56d802595ee3423de33765f1.tar.gz scala-a9927445a3033fef56d802595ee3423de33765f1.tar.bz2 scala-a9927445a3033fef56d802595ee3423de33765f1.zip |
SI-7729 Does Par-Test work? Absolutely!
Testicolor just passed file arguments through; this commit does
either toAbsolute or getAbsoluteFile (depending on the File API
impedance mismatch) at ConsoleRunner (command line) and Runner
(ant supplies absolute paths, but in case sbt runner doesn't,
and who knows). It also sprinkles toAbsolute internally, where
it may be redundant. Do I mean redundant or redolent?
I noticed that my branch from last year relativized to test root
always; so this is one of those choices one commits to.
The point of breakage in this case was, if a path is not absolute,
use test root / path, which only works (of course) if the relative
path is relative to test root, which is no longer the case.
Because all paths are now calculated with respect to the test file
path, the "out" dir would change its relative path depending on
the invocation.
-rw-r--r-- | src/partest/scala/tools/partest/nest/ConsoleRunner.scala | 4 | ||||
-rw-r--r-- | src/partest/scala/tools/partest/nest/FileManager.scala | 2 | ||||
-rw-r--r-- | src/partest/scala/tools/partest/nest/Runner.scala | 2 | ||||
-rwxr-xr-x | test/partest | 30 |
4 files changed, 16 insertions, 22 deletions
diff --git a/src/partest/scala/tools/partest/nest/ConsoleRunner.scala b/src/partest/scala/tools/partest/nest/ConsoleRunner.scala index 332131ca3a..3e28d4e4ad 100644 --- a/src/partest/scala/tools/partest/nest/ConsoleRunner.scala +++ b/src/partest/scala/tools/partest/nest/ConsoleRunner.scala @@ -138,7 +138,7 @@ class ConsoleRunner(argstr: String) extends { val rerunTests = if (isRerun) TestKinds.failedTests else Nil def miscTests = partestTests ++ individualTests ++ greppedTests ++ rerunTests - val givenKinds = standardKinds filter parsed.isSet + val givenKinds = standardKinds filter (parsed isSet "--" + _) val kinds = ( if (optAll) standardKinds else if (givenKinds.nonEmpty) givenKinds @@ -197,7 +197,7 @@ class ConsoleRunner(argstr: String) extends { val num = paths.size val ss = if (num == 1) "" else "s" comment(s"starting $num test$ss in $kind") - val results = runTestsForFiles(paths map (_.jfile), kind) + val results = runTestsForFiles(paths map (_.jfile.getAbsoluteFile), kind) val (passed, failed) = results partition (_.isOk) passedTests ++= passed diff --git a/src/partest/scala/tools/partest/nest/FileManager.scala b/src/partest/scala/tools/partest/nest/FileManager.scala index 7bfa8c6e77..208418047c 100644 --- a/src/partest/scala/tools/partest/nest/FileManager.scala +++ b/src/partest/scala/tools/partest/nest/FileManager.scala @@ -148,7 +148,7 @@ trait FileManager extends FileUtil { val srcpath = Path(srcdir.path) val pd = (srcpath / plugxml).toFile if (pd.exists) pd copyTo (pout / plugxml) - pout + pout.toAbsolute } else Path(p) def absolutize(path: String) = pathOrCwd(path) match { case x if x.isAbsolute => x.path diff --git a/src/partest/scala/tools/partest/nest/Runner.scala b/src/partest/scala/tools/partest/nest/Runner.scala index d9a6234949..b64c2bc8ab 100644 --- a/src/partest/scala/tools/partest/nest/Runner.scala +++ b/src/partest/scala/tools/partest/nest/Runner.scala @@ -780,7 +780,7 @@ trait DirectRunner { //val parentClassLoader = ScalaClassLoader fromURLs (List(scalaCheck.toURL), getClass().getClassLoader) val pool = Executors newFixedThreadPool numThreads val manager = new RunnerManager(kind, fileManager, TestRunParams(parentClassLoader)) - val futures = kindFiles map (f => pool submit callable(manager runTest f)) + val futures = kindFiles map (f => pool submit callable(manager runTest f.getAbsoluteFile)) pool.shutdown() Try (pool.awaitTermination(waitTime) { diff --git a/test/partest b/test/partest index 0259cdb791..b74e04a208 100755 --- a/test/partest +++ b/test/partest @@ -1,6 +1,5 @@ #!/usr/bin/env bash # - ############################################################################## # Scala test runner 2.10.0 ############################################################################## @@ -11,6 +10,17 @@ # PARTICULAR PURPOSE. ############################################################################## +findScalaHome () { + # see SI-2092 and SI-5792 + local source="${BASH_SOURCE[0]}" + while [ -h "$source" ] ; do + local linked="$(readlink "$source")" + local dir="$( cd -P $(dirname "$source") && cd -P $(dirname "$linked") && pwd )" + source="$dir/$(basename "$linked")" + done + ( ( cd -P "$(dirname "$source")/.." > /dev/null ) && pwd ) +} + # Use tput to detect color-capable terminal. term_colors=$(tput colors 2>/dev/null) if [[ $? == 0 ]] && [[ $term_colors -gt 2 ]]; then @@ -29,23 +39,7 @@ case "`uname`" in esac # Finding the root folder for this Scala distribution -SOURCE=$0; -SCRIPT=`basename "$SOURCE"`; -while [ -h "$SOURCE" ]; do - SCRIPT=`basename "$SOURCE"`; - LOOKUP=`ls -ld "$SOURCE"`; - TARGET=`expr "$LOOKUP" : '.*-> \(.*\)$'`; - if expr "${TARGET:-.}/" : '/.*/$' > /dev/null; then - SOURCE=${TARGET:-.}; - else - SOURCE=`dirname "$SOURCE"`/${TARGET:-.}; - fi; -done; - -# see #2092 -SCALA_HOME=`dirname "$SOURCE"` -SCALA_HOME=`cd "$SCALA_HOME"; pwd -P` -SCALA_HOME=`cd "$SCALA_HOME"/..; pwd` +SCALA_HOME="$(findScalaHome)" if $cygwin; then SCALA_HOME=`cygpath --windows --short-name "$SCALA_HOME"` |