diff options
author | Paul Phillips <paulp@improving.org> | 2013-05-20 07:32:01 -0700 |
---|---|---|
committer | Paul Phillips <paulp@improving.org> | 2013-05-20 07:37:22 -0700 |
commit | 72de12edc3428f2e51db4ff560b5ab112345e03c (patch) | |
tree | b83732cd388722aaa32aec32c4617b188e7b509d /src | |
parent | 2da0576017c05bd07d3d1f1c773119adc4c7876b (diff) | |
download | scala-72de12edc3428f2e51db4ff560b5ab112345e03c.tar.gz scala-72de12edc3428f2e51db4ff560b5ab112345e03c.tar.bz2 scala-72de12edc3428f2e51db4ff560b5ab112345e03c.zip |
Harden partest against duplicate paths.
A serious issue: partest would launch the same test multiple
times if a test path was given in multiple forms (e.g. absolute
and relative paths.) Unfortunately all those tests would share
the same logfile, output directory, etc. which would predictably
lead to explosions.
Since overwriting classfiles while being loaded can lead to
jvm core dumps, it's possible this is involved in recent jvm
crashes and other test breakdowns.
This commit also alters the default partest verbosity to only
full print test transcripts under --verbose.
Diffstat (limited to 'src')
-rw-r--r-- | src/partest/scala/tools/partest/nest/ConsoleRunner.scala | 19 | ||||
-rw-r--r-- | src/reflect/scala/reflect/internal/util/Collections.scala | 2 |
2 files changed, 15 insertions, 6 deletions
diff --git a/src/partest/scala/tools/partest/nest/ConsoleRunner.scala b/src/partest/scala/tools/partest/nest/ConsoleRunner.scala index 5717aabb6a..8161e53bf9 100644 --- a/src/partest/scala/tools/partest/nest/ConsoleRunner.scala +++ b/src/partest/scala/tools/partest/nest/ConsoleRunner.scala @@ -13,6 +13,7 @@ import scala.tools.nsc.util.CommandLineParser import scala.collection.{ mutable, immutable } import PathSettings.srcDir import TestKinds._ +import scala.reflect.internal.util.Collections.distinctBy class ConsoleRunner extends DirectRunner { import NestUI._ @@ -67,11 +68,17 @@ class ConsoleRunner extends DirectRunner { val message = passFail + elapsed if (failed0.nonEmpty) { - echo(bold(cyan("##### Transcripts from failed tests #####\n"))) - failed0 foreach { state => - comment("partest " + state.testFile) - echo(state.transcriptString + "\n") + if (isPartestVerbose) { + echo(bold(cyan("##### Transcripts from failed tests #####\n"))) + failed0 foreach { state => + comment("partest " + state.testFile) + echo(state.transcriptString + "\n") + } } + + def files_s = failed0.map(_.testFile).mkString(""" \""" + "\n ") + echo("# Failed test paths (this command will update checkfiles)") + echo("test/partest --update-check \\\n " + files_s + "\n") } echo(message) @@ -185,8 +192,8 @@ class ConsoleRunner extends DirectRunner { chatty(banner) - val allTests = (miscTests ++ (kinds flatMap testsFor)).distinct - val grouped = (allTests groupBy kindOf).toList sortBy (x => standardKinds indexOf x._1) + val allTests: List[Path] = distinctBy(miscTests ++ kindsTests)(_.toCanonical) sortBy (_.toString) + val grouped = (allTests groupBy kindOf).toList sortBy (x => standardKinds indexOf x._1) totalTests = allTests.size expectedFailures = propOrNone("partest.errors") match { diff --git a/src/reflect/scala/reflect/internal/util/Collections.scala b/src/reflect/scala/reflect/internal/util/Collections.scala index 51b2f9f4e4..e127d577e1 100644 --- a/src/reflect/scala/reflect/internal/util/Collections.scala +++ b/src/reflect/scala/reflect/internal/util/Collections.scala @@ -209,3 +209,5 @@ trait Collections { case _: IllegalArgumentException => None } } + +object Collections extends Collections |