diff options
author | Paul Phillips <paulp@improving.org> | 2013-12-15 10:35:16 -0800 |
---|---|---|
committer | Paul Phillips <paulp@improving.org> | 2013-12-15 10:51:58 -0800 |
commit | e3cedb7e84f70a1529a20c8603bcc0016ead0ef0 (patch) | |
tree | 4d598db53c66f003b2717b1138c62521137a5a2e /tools/partest-paths | |
parent | dc8854e059f3a75b2d95a1826ff61ed6c5b5eba8 (diff) | |
download | scala-e3cedb7e84f70a1529a20c8603bcc0016ead0ef0.tar.gz scala-e3cedb7e84f70a1529a20c8603bcc0016ead0ef0.tar.bz2 scala-e3cedb7e84f70a1529a20c8603bcc0016ead0ef0.zip |
Improvements to partest-ack, plus partest-paths.
I noticed partest-ack was not finding all matching tests, and
fixed that. Also cleaned up the ack options so they're understood
by the latest version of ack.
Along the way I broke the canonicalization functionality out into its
own script so it can easily be used from other places.
Diffstat (limited to 'tools/partest-paths')
-rwxr-xr-x | tools/partest-paths | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/tools/partest-paths b/tools/partest-paths new file mode 100755 index 0000000000..6ce403a04e --- /dev/null +++ b/tools/partest-paths @@ -0,0 +1,27 @@ +#!/bin/sh +# +# Given a list of files on stdin, translates them into a set +# of tests covering those files. That means paths which aren't +# part of a test are dropped and the rest are rewritten to the +# primary test path, with duplicates dropped. + +cd "$(dirname "$0")/.." + +# We have to enumerate good test dirs since partest chokes and fails +# on continuations, bench, etc. tests +pathRegex="test/files/(pos|neg|jvm|run|scalap|presentation)/[^/.]+([.]scala)?\$" + +# Echo the argument only if it matches our idea of a test and exists. +isPath () { [[ "$1" =~ $pathRegex ]] && [[ -e "$1" ]]; } + +# Filter stdin down to actual test paths. +asTestPaths() { + while read -r p; do + # Matched file at the standard test depth + p1="${p%.*}" && isPath "$p1.scala" && echo "$p1.scala" && continue + # Or, matched file may be in a test subdirectory, so strip the last path segment and check + p2="${p1%/*}" && isPath "$p2" && echo "$p2" && continue + done +} + +asTestPaths | sort -u |