From a9f01cc11222433ce38d7f69b98d0c8c39de07b9 Mon Sep 17 00:00:00 2001 From: Marco Capetta Date: Fri, 26 Oct 2018 17:15:36 +0200 Subject: [PATCH] TT#46501 Check previous SIP message in case of wrong packet ordering If retransmission skip is enabled (-r option) an additional check with the previous json file (previous SIP message) is done in case of tap issues. This is useful when wrong packet ordering or timing issues occur. Additionally: * improved logs lines in oreder to be more readable. * fixed inconsistencies in the coding style. Change-Id: I20a026fab33e2a56f23bdccef8ee3aa3e27de732 --- bin/check.sh | 157 ++++++++++++++++++++++++++++-------------- bin/generate_tests.sh | 22 +++--- get_results.sh | 10 +-- run_tests.sh | 60 +++++++++------- 4 files changed, 157 insertions(+), 92 deletions(-) diff --git a/bin/check.sh b/bin/check.sh index e9d290fa..fb8b3297 100755 --- a/bin/check.sh +++ b/bin/check.sh @@ -56,7 +56,7 @@ graph() { # $2 file path generate_error_tap() { local tap_file="$1" - cat < "$tap_file" + cat < "${tap_file}" 1..1 not ok 1 - ERROR: File $2 does not exists EOF @@ -96,28 +96,60 @@ check_test() { echo " NOT ok" if "${FIX_RETRANS}" ; then + # testing next json file, if exist. Necessary in case of retransmissions or wrong timing/order. echo "$(date) - Fix retransmissions enabled: try to test the next json file" local next_msg local next_tap next_test_filepath "$1" - next_tap=${3/_test.tap/_test_retry.tap} + next_tap=${3/_test.tap/_test_next.tap} - if [ -a "$next_msg" ] ; then - echo -n "$(date) - Testing $(basename "$1") against $(basename "$next_msg") -> $(basename "$next_tap")" - if "${BIN_DIR}/check.py" ${kam_type} "$1" "$next_msg" > "$next_tap" ; then + if [ -a "${next_msg}" ] ; then + echo -n "$(date) - Testing $(basename "$1") against $(basename "${next_msg}") -> $(basename "${next_tap}")" + if "${BIN_DIR}/check.py" ${kam_type} "$1" "${next_msg}" > "${next_tap}" ; then # Test using the next json file was fine. That means that, with high probability, there was a retransmission. # Next step is to backup the failed tap test and overwrite it with the working one - mv "${3}" "${3}_retrans" - mv "${next_tap}" "${3}" + mv "$3" "${3}_retrans" + mv "${next_tap}" "$3" echo " ok" return fi - if [ -a "$next_tap" ] ; then + if [ -a "${next_tap}" ] ; then # Test using the next json file was a failure. # Next step is remove $next_tap file to don't create confusion during the additional checks rm "${next_tap}" fi + else + echo -n "$(date) - File $(basename "${next_msg}") doesn't exists. Result" + fi + + echo " NOT ok" + + # testing previous json file, if exist. Necessary in case of wrong timing/order. + echo "$(date) - Fix retransmissions enabled: try to test the previous json file" + local prev_msg + local prev_tap + prev_test_filepath "$1" + prev_tap=${3/_test.tap/_test_prev.tap} + + if [ -a "${prev_msg}" ] ; then + echo -n "$(date) - Testing $(basename "$1") against $(basename "${prev_msg}") -> $(basename "${prev_tap}")" + if "${BIN_DIR}/check.py" ${kam_type} "$1" "${prev_msg}" > "${prev_tap}" ; then + # Test using the previous json file was fine. That means that, with high probability, there was a wrong timing/order. + # Next step is to backup the failed tap test and overwrite it with the working one + mv "$3" "${3}_retrans" + mv "${prev_tap}" "$3" + echo " ok" + return + fi + + if [ -a "${prev_tap}" ] ; then + # Test using the previous json file was a failure. + # Next step is remove $prev_tap file to don't create confusion during the additional checks + rm "${prev_tap}" + fi + else + echo -n "$(date) - File $(basename "${prev_msg}") doesn't exists. Result" fi echo " NOT ok" @@ -246,23 +278,23 @@ delete_locations() { local sub for f in ${SCEN_CHECK_DIR}/callee.csv ${SCEN_CHECK_DIR}/caller.csv; do - for sub in $(uniq "$f" | grep "${DOMAIN}" | cut -d\; -f1 | xargs); do - ngcp-kamctl proxy fifo ul.rm location "$sub@${DOMAIN}" >/dev/null + for sub in $(uniq "${f}" | grep "${DOMAIN}" | cut -d\; -f1 | xargs); do + ngcp-kamctl proxy fifo ul.rm location "${sub}@${DOMAIN}" >/dev/null # delete possible banned user - ngcp-sercmd lb htable.delete auth "$sub@${DOMAIN}::auth_count" + ngcp-sercmd lb htable.delete auth "${sub}@${DOMAIN}::auth_count" done done # check what's in the DDBB f=$(mysql -usipwise -p"${SIPWISE_DB_PASSWORD}" \ kamailio -e 'select count(*) from location;' -s -r | head) - if [ "$f" != "0" ]; then + if [ "${f}" != "0" ]; then echo "$(date) Cleaning location table" sub=$(mysql -usipwise -p"${SIPWISE_DB_PASSWORD}" \ -e 'select concat(username, "@", domain) as user from kamailio.location;' \ -r -s | head| uniq|xargs) for f in $sub; do - ngcp-kamctl proxy fifo ul.rm location "$f" >/dev/null + ngcp-kamctl proxy fifo ul.rm location "${f}" >/dev/null done mysql -usipwise -p"${SIPWISE_DB_PASSWORD}" \ -e 'delete from kamailio.location;' || true @@ -302,7 +334,7 @@ error_helper() { capture() { local name name=$(basename "${SCEN_CHECK_DIR}") - echo "$(date) - Begin capture" + echo "$(date) - Start tcpdump captures" for inter in $(ip link | grep '^[0-9]' | cut -d: -f2 | sed 's/ //' | xargs); do tcpdump -i "${inter}" -n -s 65535 -w "${LOG_DIR}/${name}_${inter}.pcap" & capture_pid="$capture_pid ${inter}:$!" @@ -310,6 +342,7 @@ capture() { } stop_capture() { + echo "$(date) - Stop tcpdump captures" local inter="" local temp_pid="" if [ -n "${capture_pid}" ]; then @@ -331,14 +364,14 @@ check_port() { local port=$1 local step=${2:-1} - until [ $status -eq 1 ]; do - if netstat -an | grep -q ":$port " ; then + until [ ${status} -eq 1 ]; do + if netstat -an | grep -q ":${port} " ; then port=$((port + step)) else status=1 fi done - echo $port + echo ${port} } # $1 media port to check @@ -348,7 +381,7 @@ check_mport() { local mport=$1 local step=${2:-3} local mport2 - until [ $status -eq 1 ]; do + until [ ${status} -eq 1 ]; do if ! (netstat -aun | grep -q ":${mport} ") ; then mport2=$((mport + 2)) if ! (netstat -aun | grep -q ":${mport2} "); then @@ -359,7 +392,7 @@ check_mport() { mport=$((mport + step)) fi done - echo $mport + echo ${mport} } #$1 is filename @@ -438,11 +471,11 @@ run_sipp() { for res in $(find "${SCEN_CHECK_DIR}" -type f -name 'sipp_scenario_responder[0-9][0-9].xml'| sort); do base=$(basename "$res" .xml) - if ! grep -q "$(basename "$res")" "${SCEN_CHECK_DIR}/scenario.csv" ; then - echo "$(date) $(basename "$res") deactivated" + if ! grep -q "$(basename "${res}")" "${SCEN_CHECK_DIR}/scenario.csv" ; then + echo "$(date) $(basename "${res}") deactivated" continue fi - get_ip "$(basename "$res")" + get_ip "$(basename "${res}")" if [ "${peer_host}" != "" ]; then echo "$(date) - Update peer_host:${peer_host} ${ip}:${PORT} info" if ! "${BIN_DIR}/update_peer_host.pl" --ip="${ip}" --port="${PORT}" \ @@ -460,11 +493,11 @@ run_sipp() { fi if [ -f "${SCEN_CHECK_DIR}/${base}_reg.xml" ]; then - echo "$(date) - Register ${base} $ip:${PORT}-${MPORT}" - "${BIN_DIR}/sipp.sh" -T "$transport" -i "$ip" -p "${PORT}" \ + echo "$(date) - Register ${base} ${ip}:${PORT}-${MPORT}" + "${BIN_DIR}/sipp.sh" -T "$transport" -i "${ip}" -p "${PORT}" \ -r "${SCEN_CHECK_DIR}/${base}_reg.xml" fi - pid=$("${BIN_DIR}/sipp.sh" -b -T "$transport" -i "$ip" -p "${PORT}" \ + pid=$("${BIN_DIR}/sipp.sh" -b -T "$transport" -i "${ip}" -p "${PORT}" \ -m "${MPORT}" -r "${SCEN_CHECK_DIR}/${base}.xml") echo "$(date) - Running ${base}[${pid}] ${ip}:${PORT}-${MPORT}" responder_pid="${responder_pid} ${base}:${pid}" @@ -479,28 +512,28 @@ run_sipp() { # let's fire sipp scenarios for send in $(find "${SCEN_CHECK_DIR}" -type f -name 'sipp_scenario[0-9][0-9].xml'| sort); do base=$(basename "$send" .xml) - if ! grep -q "$(basename "$send")" "${SCEN_CHECK_DIR}/scenario.csv" ; then - echo "$(date) $(basename "$send") deactivated" + if ! grep -q "$(basename "${send}")" "${SCEN_CHECK_DIR}/scenario.csv" ; then + echo "$(date) $(basename "${send}") deactivated" continue fi - get_ip "$(basename "$send")" + get_ip "$(basename "${send}")" PORT=$(check_port ) MPORT=$(check_mport ) echo "$(date) - Running ${base} $ip:51602-45003" - if ! "${BIN_DIR}/sipp.sh" -T "$transport" -i "$ip" -p 51602 -m 45003 "$send" ; then - echo "$(date) - $base error" + if ! "${BIN_DIR}/sipp.sh" -T "${transport}" -i "${ip}" -p 51602 -m 45003 "${send}" ; then + echo "$(date) - ${base} error" status=1 fi done for res in ${responder_pid}; do - base=$(echo "$res"| cut -d: -f1) - pid=$(echo "$res"| cut -d: -f2) + base=$(echo "${res}"| cut -d: -f1) + pid=$(echo "${res}"| cut -d: -f2) if ps -p"${pid}" &> /dev/null ; then - echo "$(date) - sipp responder $base pid $pid not finished yet. Waiting 5 secs" + echo "$(date) - sipp responder ${base} pid ${pid} not finished yet. Waiting 5 secs" sleep 5 if ps -p"${pid}" &> /dev/null ; then - echo "$(date) - sipp responder $base pid $pid not finished yet. Killing it" + echo "$(date) - sipp responder ${base} pid ${pid} not finished yet. Killing it" kill -SIGUSR1 "${pid}" fi fi @@ -524,7 +557,7 @@ run_sipp() { release_appearance fi - if [[ $status -ne 0 ]]; then + if [[ ${status} -ne 0 ]]; then error_helper "error in sipp" 2 fi } @@ -537,7 +570,7 @@ test_filepath() { else msg_name=${1/_test.yml/.json} fi - msg="${LOG_DIR}/$(basename "$msg_name")" + msg="${LOG_DIR}/$(basename "${msg_name}")" } next_test_filepath() { @@ -560,6 +593,26 @@ next_test_filepath() { next_msg="${LOG_DIR}/${msg_name}" } +prev_test_filepath() { + local msg_name + local old_json + local new_json + + if ! "${JSON_KAM}" ; then + msg_name=${1/_test.yml/.yml} + else + msg_name=${1/_test.yml/.json} + fi + + msg_name=$(basename "${msg_name}") + old_json="${msg_name:0:4}" + new_json=$(((10#$old_json)-1)) #There should't be any problem since they start from 0001 + new_json=$(printf %04d ${new_json}) + msg_name="${new_json}${msg_name:4}" + + prev_msg="${LOG_DIR}/${msg_name}" +} + cdr_check() { if [ -f "$1" ] ; then echo -n "$(date) - Testing $(basename "$1") against $(basename "$2") -> $(basename "$3")" @@ -599,10 +652,10 @@ while getopts 'hCd:p:Rs:DTPGgrcJKm' opt; do case $opt in h) usage; exit 0;; C) SKIP=true;; - d) DOMAIN=$OPTARG;; - p) PROFILE=$OPTARG;; + d) DOMAIN=${OPTARG};; + p) PROFILE=${OPTARG};; R) SKIP_RUNSIPP=true; SKIP_DELDOMAIN=true;; - s) GROUP=$OPTARG;; + s) GROUP=${OPTARG};; D) SKIP_DELDOMAIN=true;; T) SKIP_TESTS=true;; P) SKIP_PARSE=true;; @@ -704,11 +757,11 @@ if ! "$SKIP_RUNSIPP" ; then if [ -d "${JSON_DIR}" ] ; then for i in "${JSON_DIR}"/*.json ; do json_size_before=$(stat -c%s "${i}") - moved_file="${LOG_DIR}/$(printf "%04d.json" "$(basename "$i" .json)")" - expand -t1 "$i" > "${moved_file}" + moved_file="${LOG_DIR}/$(printf "%04d.json" "$(basename "${i}" .json)")" + expand -t1 "${i}" > "${moved_file}" json_size_after=$(stat -c%s "${moved_file}") echo "$(date) - Moved file ${i} with size before: ${json_size_before} and after: ${json_size_after}" - rm "$i" + rm "${i}" done rm -rf "${JSON_DIR}" echo "$(date) - Done" @@ -731,7 +784,7 @@ if ! "$SKIP_RUNSIPP" ; then continue fi if ( diff -q -u <(tail -n3 "${json_file}") <(tail -n3 "${next_json_file}") &> /dev/null ) ; then - echo "$(basename "${next_json_file}") seems a retransmission of $(basename "${json_file}") ---> renaming the file in ${next_json_file}_retransmission" + echo "$(date) - $(basename "${next_json_file}") seems a retransmission of $(basename "${json_file}") ---> renaming the file in $(basename "${next_json_file}")_retransmission" mv -f "${next_json_file}" "${next_json_file}_retransmission" RETRANS_ISSUE=true fi @@ -774,6 +827,9 @@ fi # let's check the results ERR_FLAG=0 if ! "${SKIP_TESTS}" ; then + echo "$(date) - =================================================================================" + echo "$(date) - Check [${GROUP}/${PROFILE}]: ${NAME_CHECK}" + if [ -d "${RESULT_DIR}" ]; then echo "$(date) - Cleaning result dir" rm -rf "${RESULT_DIR}" @@ -787,14 +843,14 @@ if ! "${SKIP_TESTS}" ; then "${SCEN_CHECK_DIR}" "${LOG_DIR}/scenario_ids.yml" "${PROFILE}" for t in ${SCEN_CHECK_DIR}/[0-9][0-9][0-9][0-9]_test.yml; do - test_filepath "$t" - echo "$(date) - check test $t on $msg" - dest=${RESULT_DIR}/$(basename "$t" .yml) - check_test "$t" "$msg" "${dest}.tap" + test_filepath "${t}" + echo "$(date) - Check test ${t} on ${msg}" + dest=${RESULT_DIR}/$(basename "${t}" .yml) + check_test "${t}" "${msg}" "${dest}.tap" echo "$(date) - Done" if "${GRAPH}" ; then echo "$(date) - Generating flow image: ${dest}.png" - graph "$msg" "${dest}.png" + graph "${msg}" "${dest}.png" echo "$(date) - Done" fi done @@ -804,10 +860,11 @@ if ! "${SKIP_TESTS}" ; then t_cdr="${SCEN_CHECK_DIR}/cdr_test.yml" msg="${LOG_DIR}/cdr.txt" dest="${RESULT_DIR}/cdr_test.tap" - echo "$(date) - check test $t_cdr on $msg" - cdr_check "$t_cdr" "$msg" "${dest}" + echo "$(date) - Check test ${t_cdr} on ${msg}" + cdr_check "${t_cdr}" "${msg}" "${dest}" echo "$(date) - Done" fi + echo "$(date) - =================================================================================" fi exit ${ERR_FLAG} #EOF diff --git a/bin/generate_tests.sh b/bin/generate_tests.sh index 717be1d9..b0168fe5 100755 --- a/bin/generate_tests.sh +++ b/bin/generate_tests.sh @@ -45,7 +45,7 @@ while getopts 'hcd:' opt; do case $opt in h) usage; exit 0;; c) clean; exit 0;; - d) DIR=$OPTARG;; + d) DIR=${OPTARG};; esac done shift $((OPTIND - 1)) @@ -74,27 +74,27 @@ if [ ! -x "${BIN_DIR}/generate_test.pl" ]; then fi for t in $(find "${DIR}" -not -regex '.+customtt.tt2' -type f -name '*.tt2' | sort); do - origdir="$(dirname "$t")" - template="$(basename "$t")" - if [ -n "$DEST_DIR" ] ; then - destdir="$DEST_DIR/$(dirname "$t")" + origdir="$(dirname "${t}")" + template="$(basename "${t}")" + if [ -n "${DEST_DIR}" ] ; then + destdir="${DEST_DIR}/$(dirname "${t}")" mkdir -p "${destdir}" else - destdir="$(dirname "$t")" + destdir="$(dirname "${t}")" fi - destfile="$(basename "$t" .tt2)" - custom_template="$(basename "$t" .tt2).customtt.tt2" + destfile="$(basename "${t}" .tt2)" + custom_template="$(basename "${t}" .tt2).customtt.tt2" if [ -f "${origdir}/${custom_template}" ]; then - echo "Custom detected" + echo "$(date) - - Custom detected" template=${custom_template} fi - echo "generating: ${destdir}/${destfile}" + echo "$(date) - - Generating: ${destdir}/${destfile}" # shellcheck disable=SC2086 if ! "${BIN_DIR}/generate_test.pl" ${ARGS} "${origdir}/${template}" ${IDS} > "${destdir}/${destfile}" ; then error_flag=1 fi done -exit $error_flag +exit ${error_flag} #EOF diff --git a/get_results.sh b/get_results.sh index c07d8ec3..fb8c9e95 100755 --- a/get_results.sh +++ b/get_results.sh @@ -29,7 +29,7 @@ get_scenarios() { flag=0 if [ -n "${SCENARIOS}" ]; then for t in ${SCENARIOS}; do - if [ ! -d "${BASE_DIR}/${GROUP}/$t" ]; then + if [ ! -d "${BASE_DIR}/${GROUP}/${t}" ]; then echo "$(date) - scenario: $t not found" flag=1 fi @@ -52,8 +52,8 @@ while getopts 'hgGp:TPrcx:' opt; do T) OPTS="-P";; r) RETRANS="-r";; c) CDR="-c";; - p) PROFILE=$OPTARG;; - x) GROUP=$OPTARG;; + p) PROFILE=${OPTARG};; + x) GROUP=${OPTARG};; esac done shift $((OPTIND-1)) @@ -75,6 +75,6 @@ get_scenarios echo "${SCENARIOS}" | tr ' ' '\n' \ | parallel "${BIN_DIR}/check.sh ${GRAPH} -J -C -R ${OPTS} ${RETRANS} ${CDR} -d ${DOMAIN} -p ${PROFILE} -s ${GROUP}" status=$? -echo "$(date) - All done[$status]" -exit $status +echo "$(date) - All done[${status}]" +exit ${status} diff --git a/run_tests.sh b/run_tests.sh index 519d472a..dc1e3d79 100755 --- a/run_tests.sh +++ b/run_tests.sh @@ -27,12 +27,12 @@ get_scenarios() { flag=0 if [ -n "${SCENARIOS}" ]; then for t in ${SCENARIOS}; do - if [ ! -d "${BASE_DIR}/${GROUP}/$t" ]; then + if [ ! -d "${BASE_DIR}/${GROUP}/${t}" ]; then echo "$(date) - scenario: $t at ${GROUP} not found" flag=1 fi done - if [ $flag != 0 ]; then + if [ ${flag} != 0 ]; then exit 1 fi else @@ -51,20 +51,25 @@ cfg_debug_off() { echo "$(date) - ngcpcfg apply returned $?" error_flag=4 fi - echo "$(date) - Setting config debug off. Done[$error_flag]" + echo "$(date) - Setting config debug off. Done[${error_flag}]" fi } capture() { - echo "$(date) - Begin capture" + echo "$(date) - =================================================================================" + echo "$(date) - Start tcpdump captures" datetime=$(date '+%y%m%d_%H%M') for inter in $(ip link | grep '^[0-9]' | cut -d: -f2 | sed 's/ //' | xargs); do tcpdump -i "${inter}" -n -s 65535 -w "${LOG_DIR}/_traces_${inter}_${datetime}.pcap" & - capture_pid="$capture_pid ${inter}:$!" + capture_pid="${capture_pid} ${inter}:$!" done + echo "$(date) - Done" + echo "$(date) - =================================================================================" } stop_capture() { + echo "$(date) - =================================================================================" + echo "$(date) - Stop tcpdump captures" local inter="" local temp_pid="" if [ -n "${capture_pid}" ]; then @@ -73,27 +78,29 @@ stop_capture() { temp_pid=$(echo "$temp"|cut -d: -f2) #echo "inter:${inter} temp_pid:${temp_pid}" if ps -p"${temp_pid}" &> /dev/null ; then - echo "$(date) - End ${inter}[$temp_pid] capture" + echo "$(date) - End ${inter}[${temp_pid}] capture" kill -15 "${temp_pid}" fi done fi + echo "$(date) - Done" + echo "$(date) - =================================================================================" } move_json_file() { echo "$(date) - =================================================================================" echo "$(date) - Move kamailio json files" for t in ${SCENARIOS}; do - echo "$(date) - - Scenarios $t =================================================" + echo "$(date) - - Scenario: ${t}" json_dir="${KAM_DIR}/${t}" if [ -d "${json_dir}" ] ; then for i in "${json_dir}"/*.json ; do json_size_before=$(stat -c%s "${i}") moved_file="${LOG_DIR}/${t}/$(printf "%04d.json" "$(basename "$i" .json)")" - expand -t1 "$i" > "${moved_file}" + expand -t1 "${i}" > "${moved_file}" json_size_after=$(stat -c%s "${moved_file}") echo "$(date) - - - Moved file ${i} with size before: ${json_size_before} and after: ${json_size_after}" - rm "$i" + rm "${i}" done rm -rf "${json_dir}" fi @@ -107,7 +114,7 @@ fix_retransmissions() { echo "$(date) - =================================================================================" echo "$(date) - Checking retransmission issues" for t in ${SCENARIOS}; do - echo "$(date) - - Scenarios $t =================================================" + echo "$(date) - - Scenario: ${t}" RETRANS_ISSUE=false file_find=($(find "${LOG_DIR}/${t}" -maxdepth 1 -name '*.json' | sort)) for json_file in "${file_find[@]}" ; do @@ -120,7 +127,7 @@ fix_retransmissions() { continue fi if ( diff -q -u <(tail -n3 "${json_file}") <(tail -n3 "${next_json_file}") &> /dev/null ) ; then - echo "$(basename "${next_json_file}") seems a retransmission of $(basename "${json_file}") ---> renaming the file in ${next_json_file}_retransmission" + echo "$(date) - - - $(basename "${next_json_file}") seems a retransmission of $(basename "${json_file}") ---> renaming the file in $(basename "${next_json_file}")_retransmission" mv -f "${next_json_file}" "${next_json_file}_retransmission" RETRANS_ISSUE=true fi @@ -128,7 +135,7 @@ fix_retransmissions() { done if "${RETRANS_ISSUE}" ; then - echo "$(date) - Reordering kamailio json files" + echo "$(date) - - - Reordering kamailio json files" file_find=($(find "${LOG_DIR}/${t}" -maxdepth 1 -name '*.json' | sort)) a=1 for json_file in "${file_find[@]}" ; do @@ -147,9 +154,9 @@ cdr_export() { echo "$(date) - =================================================================================" echo "$(date) - Extracting CDRs" for t in ${SCENARIOS}; do - echo "$(date) - - Scenarios $t =================================================" - if ! "${BIN_DIR}/cdr_extract.sh" -m -t "${START_TIME}" -s "${GROUP}" "$t" ; then - echo "ERROR: $t" + echo "$(date) - - Scenario: $t" + if ! "${BIN_DIR}/cdr_extract.sh" -m -t "${START_TIME}" -s "${GROUP}" "${t}" ; then + echo "ERROR: ${t}" error_flag=1 fi done @@ -181,10 +188,10 @@ while getopts 'hlCcp:Kx:t:rm' opt; do h) usage; exit 0;; l) SHOW_SCENARIOS=true;; C) SKIP_CONFIG=true;; - p) PROFILE=$OPTARG;; + p) PROFILE=${OPTARG};; K) CAPTURE=true;; - x) GROUP=$OPTARG;; - t) TIMEOUT=$OPTARG;; + x) GROUP=${OPTARG};; + t) TIMEOUT=${OPTARG};; r) FIX_RETRANS=true;; c) CDR=true;; m) MEMDBG=true;; @@ -210,7 +217,7 @@ if [ "${PROFILE}" != "CE" ] && [ "${PROFILE}" != "PRO" ]; then exit 2 fi -if [ "$GROUP" = "scenarios_pbx" ] ; then +if [ "${GROUP}" = "scenarios_pbx" ] ; then PIDWATCH_OPTS="--pbx" # hack for pid_watcher ( sems-pbx was not active ) mkdir -p /var/run/sems-pbx/ @@ -237,7 +244,7 @@ if ! "${SKIP_CONFIG}" ; 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 with timeout[$TIMEOUT]" + 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 @@ -256,7 +263,7 @@ if ! "${SKIP_CONFIG}" ; then exit 1 fi fi - echo "$(date) - Setting config debug on. Done[$error_flag]." + echo "$(date) - Setting config debug on. Done[${error_flag}]." fi echo "$(date) - Initial mem stats" @@ -283,7 +290,8 @@ if "${CAPTURE}" ; then fi for t in ${SCENARIOS}; do - echo "$(date) - Run [${GROUP}/${PROFILE}]: $t =================================================" + echo "$(date) - =================================================================================" + echo "$(date) - Run [${GROUP}/${PROFILE}]: ${t}" log_temp="${LOG_DIR}/${t}" if [ -d "${log_temp}" ]; then @@ -297,8 +305,8 @@ for t in ${SCENARIOS}; do rm -rf "${json_temp}" fi - if ! "${BIN_DIR}/check.sh" "${OPTS[@]}" -d "${DOMAIN}" -p "${PROFILE}" -s "${GROUP}" "$t" ; then - echo "ERROR: $t" + if ! "${BIN_DIR}/check.sh" "${OPTS[@]}" -d "${DOMAIN}" -p "${PROFILE}" -s "${GROUP}" "${t}" ; then + echo "ERROR: ${t}" error_flag=1 fi @@ -337,5 +345,5 @@ fi cfg_debug_off -echo "$(date) - Done[$error_flag]" -exit $error_flag +echo "$(date) - Done[${error_flag}]" +exit ${error_flag}