Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #3273 from paulp/pr/ack
Improvements to partest-ack, plus partest-paths.
- Loading branch information
Showing
2 changed files
with
36 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |