5
5
declare quiet failed update partest_debug
6
6
declare cotouched since sortCommand
7
7
declare -a ack_args partest_args scalac_args
8
+ declare -r standard_ack_args=" --noenv -s --java --scala --type-add=scala:ext:flags,check --files-with-matches"
8
9
9
10
partest_args=( --show-diff )
10
- base=" $( cd " $( dirname " $0 " ) " /.. && pwd) "
11
+ bindir=" $( cd " $( dirname " $0 " ) " && pwd) "
12
+ base=" $bindir /.."
11
13
cd " $base " || { echo " Could not change to base directory $base " && exit 1; }
12
14
filesdir=" test/files"
13
15
sortCommand=" sort -u"
16
+ partestPaths=" $bindir /partest-paths"
14
17
15
- # have to enumerate good test dirs since partest chokes and fails
16
- # on continuations, bench, etc. tests
17
- pathRegex=" $filesdir /(pos|neg|jvm|run|scalap|presentation)/[^/.]+([.]scala)?\$ "
18
+ [[ -x " $partestPaths " ]] || { echo " Cannot find partest-paths in $partestPaths " && exit 1; }
18
19
19
20
[[ $# -gt 0 ]] || {
20
21
cat << EOM
@@ -32,7 +33,7 @@ runs all the tests for which any associated file matches the regex. Associated
32
33
files include .check and .flags files. Tests in directories will match if any
33
34
file matches. A file can match the regex by its contents or by its name.
34
35
35
- You must have ack installed: http://betterthangrep .com/ack-standalone
36
+ You must have ack version 2.12+ installed: http://beyondgrep .com/ack-2.12-single-file
36
37
37
38
Examples:
38
39
79
80
shift $(( OPTIND- 1 ))
80
81
ack_args=( " ${ack_args[@]} " " $@ " )
81
82
82
- # Echo the argument only if it matches our idea of a test and exists.
83
- isPath () { [[ " $1 " =~ $pathRegex ]] && [[ -e " $1 " ]]; }
84
-
85
- # Filter stdin down to actual test paths.
86
- asTestPaths () {
87
- while read p; do
88
- p1=" ${p% .* } "
89
- isPath " $p1 " && echo " $p1 "
90
- isPath " $p1 .scala" && echo " $p1 .scala"
91
- done
92
- }
93
-
94
83
# These methods all just create paths which may or may not be tests
95
- # all are filtered through "asTestPaths" which limits the output to actual tests
84
+ # all are filtered through partest-paths which limits the output to actual tests
96
85
regexPathTests () { find " $filesdir " | ack --noenv " $@ " ; }
97
86
failedTests () { for p in $( find " $filesdir " -name ' *.log' ) ; do p1=${p% .log} && p2=${p1% -* } && echo " $p2 " ; done ; }
98
87
sinceTests () { git log --since=" $@ " --name-only --pretty=" format:" -- " $filesdir " ; }
99
- regexCodeTests () { ack --noenv --text --files-with-matches " $@ " -- " $filesdir " ; }
88
+ regexCodeTests () { ack $standard_ack_args " $@ " -- " $filesdir " ; }
100
89
sameCommitTests () { for rev in $( git rev-list HEAD -- " $@ " ) ; do git --no-pager show --pretty=" format:" --name-only " $rev " -- " $filesdir " ; done ; }
101
90
102
91
countStdout () {
@@ -115,7 +104,7 @@ randomSort () {
115
104
testRun () {
116
105
local description=" $1 " && shift
117
106
printf >&2 " %% tests %-25s ... " " $description "
118
- " $@ " | asTestPaths | sort -u | countStdout | egrep -v ' ^[ ]*$'
107
+ " $@ " | " $partestPaths " | countStdout | egrep -v ' ^[ ]*$'
119
108
}
120
109
121
110
allMatches () {
0 commit comments