File: partest-paths

package info (click to toggle)
scala 2.11.12-5
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, sid
  • size: 62,828 kB
  • sloc: javascript: 28,808; java: 13,415; xml: 3,250; sh: 1,620; python: 756; makefile: 38; awk: 36; ansic: 6
file content (27 lines) | stat: -rwxr-xr-x 972 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
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