From 72de12edc3428f2e51db4ff560b5ab112345e03c Mon Sep 17 00:00:00 2001 From: Paul Phillips Date: Mon, 20 May 2013 07:32:01 -0700 Subject: 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. --- .../scala/tools/partest/nest/ConsoleRunner.scala | 19 +++++++++++++------ .../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 -- cgit v1.2.3