File: run-tests.sh

package info (click to toggle)
fonttools 3.0-1
  • links: PTS
  • area: main
  • in suites: stretch
  • size: 1,784 kB
  • ctags: 3,121
  • sloc: python: 26,261; xml: 103; sh: 41; makefile: 20
file content (50 lines) | stat: -rwxr-xr-x 912 bytes parent folder | download
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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
#!/bin/sh

# Choose python version
if test "x$1" = x-3; then
	PYTHON=python3
	shift
elif test "x$1" = x-2; then
	PYTHON=python2
	shift
fi
test "x$PYTHON" = x && PYTHON=python
echo "$(which $PYTHON) --version"
$PYTHON --version 2>&1
echo

# Setup environment
DIR=`dirname "$0"`
cd "$DIR/Lib"
PYTHONPATH=".:$PYTHONPATH"
export PYTHONPATH

# Find tests
FILTER=
for arg in "$@"; do
	test "x$FILTER" != x && FILTER="$FILTER|"
	FILTER="$FILTER$arg"
done

test "x$FILTER" = "x" && FILTER=.
TESTS=`grep -r --include='*.py' -l -e doctest -e unittest * | grep -E "$FILTER"`

ret=0
FAILS=
for test in $TESTS; do
	echo "Running tests in $test"
	test=`echo "$test" | sed 's@[/\\]@.@g;s@[.]py$@@'`
	if ! $PYTHON -m $test -v; then
		ret=$((ret+1))
		FAILS="$FAILS
$test"
	fi
done
	echo
	echo "SUMMARY:"
if test $ret = 0; then
	echo "All tests passed."
else
	echo "$ret source file(s) had tests failing:$FAILS" >&2
fi
exit $ret