TT#4475 run_tests.sh: add timeout parameter and set 300 as default

* the duration of the ngcp-apply depends on the environment so
  lets try to be more friendly

Change-Id: I6fcee6a5585fa9e2cd74954f3ac0355334647552
changes/14/8714/1
Victor Seva 10 years ago
parent 86e0e44faf
commit af1467a751

@ -9,6 +9,7 @@ LOG_DIR="${BASE_DIR}/log/${GROUP}"
MLOG_DIR="${BASE_DIR}/mem"
PROFILE="CE"
DOMAIN="spce.test"
TIMEOUT=${TIMEOUT:-300}
error_flag=0
function usage
@ -19,6 +20,7 @@ function usage
echo "-c skips configuration of the environment"
echo "-K capture messages with tcpdump"
echo "-x set GROUP scenario. Default: scenarios"
echo "-t set timeout in secs for pid_watcher.py [PRO]. Default: 300"
echo "-h this help"
echo "BASE_DIR:${BASE_DIR}"
@ -59,7 +61,7 @@ function cfg_debug_off
fi
}
while getopts 'hlcp:Kx:' opt; do
while getopts 'hlcp:Kx:t:' opt; do
case $opt in
h) usage; exit 0;;
l) SHOW_SCENARIOS=1;;
@ -67,6 +69,7 @@ while getopts 'hlcp:Kx:' opt; do
p) PROFILE=$OPTARG;;
K) SKIP_CAPTURE=1;;
x) GROUP=$OPTARG;;
t) TIMEOUT=$OPTARG;;
esac
done
shift $((OPTIND - 1))
@ -90,14 +93,12 @@ if [ "${PROFILE}" != "CE" ] && [ "${PROFILE}" != "PRO" ]; then
fi
if [ "$GROUP" = "scenarios_pbx" ] ; then
TIMEOUT=120
PIDWATCH_OPTS="--pbx"
# hack for pid_watcher ( sems-pbx was not active )
mkdir -p /var/run/sems-pbx/
touch /var/run/sems-pbx/sems-pbx.pid
chown -R sems-pbx:sems-pbx /var/run/sems-pbx/
else
TIMEOUT=60
PIDWATCH_OPTS=""
fi
@ -109,8 +110,8 @@ if [ -z $SKIP ]; then
echo "$(date) - Setting config debug on"
"${BIN_DIR}/config_debug.pl" -g "${GROUP}" on ${DOMAIN}
if [ "${PROFILE}" == "PRO" ]; then
echo "$(date) - Exec pid_watcher"
( timeout ${TIMEOUT} "${BIN_DIR}/pid_watcher.py" ${PIDWATCH_OPTS} )&
echo "$(date) - Exec pid_watcher with timeout[$TIMEOUT]"
( timeout "${TIMEOUT}" "${BIN_DIR}/pid_watcher.py" ${PIDWATCH_OPTS} )&
fi
if ! ngcpcfg apply "config debug on via kamailio-config-tests" ; then
echo "$(date) - ngcp apply returned $?"
@ -121,7 +122,8 @@ if [ -z $SKIP ]; then
if [ "${PROFILE}" == "PRO" ]; then
echo "$(date) - waiting for pid_watcher[$!] result"
if ! wait "$!" ; then
echo "error on apply config"
echo "$(date) - error on apply config. Some expected service didn't restart"
echo "$(date) - check log/pid_watcher.log for details"
cfg_debug_off
echo "$(date) - Done[1]"
exit 1

Loading…
Cancel
Save