| 1 | #!/usr/bin/env bash |
| 2 | CIDIR=$(dirname $(readlink -fn $0)) |
| 3 | REALTIME=0 |
| 4 | TEST_TIMEOUT=600 |
| 5 | source $CIDIR/ci.functions |
| 6 | ASTETCDIR=$DESTDIR/etc/asterisk |
| 7 | |
| 8 | if [ x"$WORK_DIR" != x ] ; then |
| 9 | export AST_WORK_DIR="$(readlink -f $WORK_DIR)" |
| 10 | mkdir -p "$AST_WORK_DIR" |
| 11 | fi |
| 12 | |
| 13 | pushd $TESTSUITE_DIR |
| 14 | ./cleanup-test-remnants.sh |
| 15 | |
| 16 | if [ $REALTIME -eq 1 ] ; then |
| 17 | $CIDIR/setupRealtime.sh --initialize-db=${INITIALIZE_DB:?0} |
| 18 | fi |
| 19 | |
| 20 | # check to see if venv scripts exist so we can use them |
| 21 | if [ -f ./setupVenv.sh ] ; then |
| 22 | echo "Running in Virtual Environment" |
| 23 | # explicitly invoking setupVenv to capture output in case of failure |
| 24 | ./setupVenv.sh |
| 25 | VENVPREFIX="runInVenv.sh python " |
| 26 | else |
| 27 | echo "Running in Legacy Mode" |
| 28 | export PYTHONPATH=./lib/python/ |
| 29 | fi |
| 30 | |
| 31 | echo "Running tests ${TESTSUITE_COMMAND} ${AST_WORK_DIR:+with work directory ${AST_WORK_DIR}}" |
| 32 | ./${VENVPREFIX}runtests.py --cleanup --timeout=${TEST_TIMEOUT} ${TESTSUITE_COMMAND} | contrib/scripts/pretty_print --no-color --no-timer --term-width=120 --show-errors || : |
| 33 | |
| 34 | if [ $REALTIME -eq 1 ] ; then |
| 35 | $CIDIR/teardownRealtime.sh --cleanup-db=${CLEANUP_DB:?0} |
| 36 | fi |
| 37 | |
| 38 | if [ -f core* ] ; then |
| 39 | echo "*** Found a core file after running unit tests ***" |
| 40 | /var/lib/asterisk/scripts/ast_coredumper --no-default-search core* |
| 41 | exit 1 |
| 42 | fi |
| 43 | |
| 44 | popd |