aboutsummaryrefslogtreecommitdiffstats
path: root/tools/tests/run_tests.sh
blob: c492876b4b0695974bebc166e53a1d863d5a0066 (plain)
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
51
52
53
54
55
56
57
58
59
60
61
#!/bin/bash
#
# This runs the available unit-tests with all different supported
# python versions.
# 
# To run this this must be 'cd'ed to the tests directory.
#

ENABLE_UNSUPPORTED=0

function usage()
{
    printf "Usage: %s: [-u]\n" $0
    printf "   -u: run test with unsupported python versions also\n"
}

function run_one_test()
{
    PYTHON=$1
    PYTHON_EXECUTABLE=`echo $PYTHON | tr -d "-"`
    echo "+++ Running tests with $PYTHON"
    export LD_LIBRARY_PATH=./regression/installed/$PYTHON/lib
    ./regression/installed/$PYTHON/bin/$PYTHON_EXECUTABLE \
	utests/run_all_tests.py
    echo "--- Finished tests with $PYTHON"
}

function run_all_tests()
{
    for PYTHON in $@;
    do
	run_one_test $PYTHON
    done
}

while getopts u name
do
    case $name in
	h)  usage; exit 0;;
	u)  ENABLE_UNSUPPORTED=1;;
	?)  usage; exit 2;;
    esac
done

# Build the different python versions
(cd regression && make -j4 runtime-environment)

# Supported: when an unit test fails this should be seen as an error
PYTHON_SUPPORTED="python-2.4 python-2.5 python-2.6"
# Unsupported: failure should be seen as a hint
PYTHON_UNSUPPORTED="python-3.1"

export PYTHONPATH=`echo $PWD/../python/build/lib.*`:$PWD

set -e
run_all_tests $PYTHON_SUPPORTED

if test $ENABLE_UNSUPPORTED -eq 1
then
    run_all_tests $PYTHON_UNSUPPORTED
fi