Files
asterisk/tests/CI/runTestsuite.sh
George Joseph be87185f6d CI: Pass work directory to runTestsuite
The testsuite can now use a user-specified work directory for
all it's temp files.  This allows the docker containers to use
a tmpfs backed directory for the temp files instead of it's
own write-layer image.

* runTestsuite.sh now accepts a --work-dir command line argument
  that gets exported as AST_WORK_DIR before running the testsuite.

* gates.jenkinsfile now specifies --work-dir to be
  <testsuite_dir>/astroot.

Since the Asterisk CI docker hosts now mount /srv/jenkins/workspace
on a tmpfs, asterisk should be compiled and the testsuite run all in
memory.

Change-Id: If5ee905a15821296c355bb84cda38950ad8edc45
(cherry picked from commit a335f4c9ad)
2018-11-17 17:05:39 -05:00

36 lines
946 B
Bash
Executable File

#!/usr/bin/env bash
CIDIR=$(dirname $(readlink -fn $0))
REALTIME=0
TEST_TIMEOUT=600
source $CIDIR/ci.functions
ASTETCDIR=$DESTDIR/etc/asterisk
if [ x"$WORK_DIR" != x ] ; then
export AST_WORK_DIR="$(readlink -f $WORK_DIR)"
mkdir -p "$AST_WORK_DIR"
fi
pushd $TESTSUITE_DIR
./cleanup-test-remnants.sh
if [ $REALTIME -eq 1 ] ; then
$CIDIR/setupRealtime.sh --initialize-db=${INITIALIZE_DB:?0}
fi
export PYTHONPATH=./lib/python/
echo "Running tests ${TESTSUITE_COMMAND} ${AST_WORK_DIR:+with work directory ${AST_WORK_DIR}}"
./runtests.py --cleanup --timeout=${TEST_TIMEOUT} ${TESTSUITE_COMMAND} | contrib/scripts/pretty_print --no-color --no-timer --term-width=120 --show-errors || :
if [ $REALTIME -eq 1 ] ; then
$CIDIR/teardownRealtime.sh --cleanup-db=${CLEANUP_DB:?0}
fi
if [ -f core* ] ; then
echo "*** Found a core file after running unit tests ***"
/var/lib/asterisk/scripts/ast_coredumper --no-default-search core*
exit 1
fi
popd