diff --git a/bin/provide_scenarios.sh b/bin/provide_scenarios.sh index 41c6cabe..31a7f4aa 100755 --- a/bin/provide_scenarios.sh +++ b/bin/provide_scenarios.sh @@ -126,13 +126,13 @@ update_network() { create() { local scen=${BASE_DIR}/${GROUP}/$1 - echo "*** $1 IP:${IP} PORT:${PORT} MPORT:${MPORT} ***" + echo "*** Providing:$1 IP:${IP} PORT:${PORT} MPORT:${MPORT} PEER_IP:${PEER_IP} PEER_PORT:${PEER_PORT} MPORT:${PEER_MPORT}***" "${BIN_DIR}/provide_scenario.sh" \ -i "${IP}" -p "${PORT}" -m "${MPORT}" \ -n "${PHONE_CC}:${PHONE_AC}:${PHONE_SN}" \ -I "${PEER_IP}" -P "${PEER_PORT}" -M "${PEER_MPORT}" \ "${scen}" "${ACTION}" - echo "*** done ***" + echo "*** done $1 ***" update_network "${scen}" } @@ -149,4 +149,4 @@ case ${ACTION} in delete) for t in "${SCEN[@]}"; do delete "${t}"; done;; *) echo "action ${ACTION} unknown" >&2; exit 2 ;; esac -echo "$(date) - Done" +echo "$(date) - Done provide_scenarios.sh ${ACTION}" diff --git a/run_tests.sh b/run_tests.sh index c6f186e2..706d8c05 100755 --- a/run_tests.sh +++ b/run_tests.sh @@ -16,7 +16,7 @@ TMP_LOG_DIR="/tmp" KAM_DIR="/tmp/cfgtest" COREDUMP_DIR="/ngcp-data/coredumps" PROFILE="${PROFILE:-}" -OPTS=(-P -T -M) #SKIP_PARSE=true, SKIP_TESTS=true, SKIP_MOVE_JSON_KAM=true +OPTS=(-P -T -M -C) #SKIP_PARSE=true, SKIP_TESTS=true, SKIP_MOVE_JSON_KAM=true, SKIP=true TIMEOUT=${TIMEOUT:-300} SHOW_SCENARIOS=false @@ -26,6 +26,7 @@ SINGLE_CAPTURE=false FIX_RETRANS=false MEMDBG=false CDR=false +PROV_TYPE="step" START_TIME=$(date +%s) error_flag=0 SCEN=() @@ -220,7 +221,7 @@ cdr_export() { } usage() { - echo "Usage: run_test.sh [-p PROFILE] [-C] [-t]" + echo "Usage: run_test.sh [-p PROFILE] [-C] [-t] [-P ]" echo "Options:" echo -e "\\t-p CE|PRO default is autodetect" echo -e "\\t-l print available SCENARIOS in GROUP" @@ -232,18 +233,23 @@ usage() { echo -e "\\t-r fix retransmission issues" echo -e "\\t-c export CDRs at the end of the test" echo -e "\\t-m mem debug" + echo -e "\\t-P provisioning, default:step" + echo -e "\\t\\tfull: provision all scenarios in one step" + echo -e "\\t\\tstep: provision scenario one by one before execution" + echo -e "\\t\\tnone: skip any provision" echo -e "\\t-h this help" echo "BASE_DIR:${BASE_DIR}" echo "BIN_DIR:${BIN_DIR}" } -while getopts 'hlCcp:kKx:t:rm' opt; do +while getopts 'hlCcP:p:kKx:t:rm' opt; do case $opt in h) usage; exit 0;; l) SHOW_SCENARIOS=true;; C) SKIP_CONFIG=true;; p) PROFILE=${OPTARG};; + P) PROV_TYPE=${OPTARG};; k) SINGLE_CAPTURE=true;; K) CAPTURE=true;; x) GROUP=${OPTARG};; @@ -285,6 +291,11 @@ if [ "${PROFILE}" != "CE" ] && [ "${PROFILE}" != "PRO" ]; then exit 2 fi +case "${PROV_TYPE}" in + full|step|none) ;; + *) echo "provisioning type:${PROV_TYPE} unknown" >&2; exit 2 +esac + if [ "${GROUP}" = "scenarios_pbx" ] ; then PIDWATCH_OPTS="--pbx" # hack for pid_watcher ( sems-pbx was not active ) @@ -371,6 +382,12 @@ elif "${SINGLE_CAPTURE}" ; then OPTS+=(-K) fi +if [[ "${PROV_TYPE}" == "full" ]] ; then + echo "$(date) - Provide all scenarios" + SCENARIOS="${SCEN[*]}" "${BIN_DIR}/provide_scenarios.sh" \ + -f "${BASE_DIR}/config.yml" -x "${GROUP}" create || error_flag=1 +fi + for t in "${SCEN[@]}"; do echo "$(date) - =================================================================================" echo "$(date) - Run [${GROUP}/${PROFILE}]: ${t}" @@ -387,11 +404,21 @@ for t in "${SCEN[@]}"; do rm -rf "${json_temp}" fi + if [[ "${PROV_TYPE}" == "step" ]] ; then + SCENARIOS="${t}" "${BIN_DIR}/provide_scenarios.sh" \ + -f "${BASE_DIR}/config.yml" -x "${GROUP}" create + fi + if ! "${BIN_DIR}/check.sh" "${OPTS[@]}" -p "${PROFILE}" -s "${GROUP}" "${t}" ; then echo "ERROR: ${t}" error_flag=1 fi + if [[ "${PROV_TYPE}" == "step" ]] ; then + SCENARIOS="${t}" "${BIN_DIR}/provide_scenarios.sh" \ + -f "${BASE_DIR}/config.yml" -x "${GROUP}" delete + fi + echo "$(date) - =================================================================================" # Check if core files have been geneared during the test execution @@ -407,6 +434,12 @@ for t in "${SCEN[@]}"; do fi done +if [[ "${PROV_TYPE}" == "full" ]] ; then + echo "$(date) - Delete provided scenarios" + SCENARIOS="${SCEN[*]}" "${BIN_DIR}/provide_scenarios.sh" \ + -f "${BASE_DIR}/config.yml" -x "${GROUP}" delete +fi + # Hack to allow: # - tcpdump to capture all the packages # - kamailio to write all the json files