forked from bottlepy/bottle
-
Notifications
You must be signed in to change notification settings - Fork 0
/
run_tests.sh
executable file
·48 lines (35 loc) · 947 Bytes
/
run_tests.sh
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
#!/bin/bash
root=`pwd`
# build_env.sh installs to in ./tbuild
if [ -d "$root/tbuild/opt/bin" ]; then
PATH="$root/tbuild/opt/bin:$PATH"
fi
function fail {
# Print test log and rexit script.
cat test.log
echo -e "\e[0;31mFAILED! :(\e[0m"
exit 1
}
function runtest {
# Run tests using interpreter $1 and test folder $2 if interpreter is installed.
if type $1 &>/dev/null ; then
$1 $2/testall.py | tee test.log | egrep -i "(warning|error)" || fail
else
echo "Warning: Skipping test for $1 (Not installed)"
fi
}
runtest python2.5 test
runtest python2.6 test
runtest python2.7 test
if type 2to3 &> /dev/null ; then
rm -rf test3k &> /dev/null
mkdir test3k
cp -a test/* test3k
cp bottle.py test3k
2to3 -w test3k/*.py &> 2to3.log || fail
runtest python3.0 test3k
runtest python3.1 test3k
runtest python3.2 test3k
rm -rf test3k
fi
echo -e "\e[0;32mPASSED :)\e[0m"