summaryrefslogtreecommitdiff
path: root/src/partest
diff options
context:
space:
mode:
authorSom Snytt <som.snytt@gmail.com>2013-05-25 15:09:35 -0700
committerSom Snytt <som.snytt@gmail.com>2013-05-25 17:12:58 -0700
commite037c9a3c12e21104a5aaf15d2bf27779cc3fd12 (patch)
tree807be2951a7e49608f09fc3a3e1c98b59d852432 /src/partest
parent99b4d95fe6c908ce3170ff4d090420f8e47efa1d (diff)
downloadscala-e037c9a3c12e21104a5aaf15d2bf27779cc3fd12.tar.gz
scala-e037c9a3c12e21104a5aaf15d2bf27779cc3fd12.tar.bz2
scala-e037c9a3c12e21104a5aaf15d2bf27779cc3fd12.zip
SI-7198 Par-Test uses filters files
Partest will also read files/filters and files/kind/filters for filter expressions (one per line, trimmed, leading #comments) which are taken as regexes. A test/files/filters is provided which attempts to quell HotSpot warnings; the test for this commit requires it. The elided lines can be revealed using the lemon juice of verbosity: apm@mara:~/projects/snytt/test$ ./partest --verbose --show-diff files/run/t7198.scala [snip] >>>>> Transcripts from failed tests >>>>> > partest files/run/t7198.scala % scalac t7198.scala [snip] % filtering t7198-run.log --Over the moon --Java HotSpot(TM) 64-Bit Server VM warning: Failed to reserve shared memory (errno = 28). The filtering operation is part of the transcript, which is printed on failure. No attempt is made to be clever about not slurping the filters file a thousand times. Previous literal patterns had to be updated because there's parens in them thar strings. Future feature: pattern aliases, define once globally and invoke in test filters.
Diffstat (limited to 'src/partest')
-rw-r--r--src/partest/scala/tools/partest/nest/Runner.scala21
1 files changed, 19 insertions, 2 deletions
diff --git a/src/partest/scala/tools/partest/nest/Runner.scala b/src/partest/scala/tools/partest/nest/Runner.scala
index b7cc42322b..1034d724d2 100644
--- a/src/partest/scala/tools/partest/nest/Runner.scala
+++ b/src/partest/scala/tools/partest/nest/Runner.scala
@@ -368,10 +368,27 @@ class Runner(val testFile: File, fileManager: FileManager, val testRunParams: Te
pathFinder replaceAllIn (s, m => ellipsis + squashSlashes(m group 1))
)
- val filters = toolArgs("filter", split = false)
- def lineFilter(s: String): Boolean = !(filters exists (s contains _))
+ def masters = {
+ val files = List(new File(parentFile, "filters"), new File(PathSettings.srcDir.path, "filters"))
+ files filter (_.exists) flatMap (_.fileLines) map (_.trim) filter (s => !(s startsWith "#"))
+ }
+ val filters = toolArgs("filter", split = false) ++ masters
+ val elisions = ListBuffer[String]()
+ //def lineFilter(s: String): Boolean = !(filters exists (s contains _))
+ def lineFilter(s: String): Boolean = (
+ filters map (_.r) forall { r =>
+ val res = (r findFirstIn s).isEmpty
+ if (!res) elisions += s
+ res
+ }
+ )
logFile.mapInPlace(canonicalize)(lineFilter)
+ if (isPartestVerbose && elisions.nonEmpty) {
+ import NestUI.color._
+ val emdash = bold(yellow("--"))
+ pushTranscript(s"filtering ${logFile.getName}$EOL${elisions mkString (emdash, EOL + emdash, EOL)}")
+ }
}
def diffIsOk: Boolean = {