X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;f=jjb%2Fintegration%2Fcommon-functions.sh;h=2c466d220a3f8c8052102af87620be5fc1e0396d;hb=3f74d54d316d9ee1648aa645be5dc71fe5b6cfa3;hp=0e1af1bbb4dbc800489dbfd3fb5844d2afec6036;hpb=f4801e9b55da7151902aa3a287851514ef42f663;p=releng%2Fbuilder.git diff --git a/jjb/integration/common-functions.sh b/jjb/integration/common-functions.sh index 0e1af1bbb..2c466d220 100644 --- a/jjb/integration/common-functions.sh +++ b/jjb/integration/common-functions.sh @@ -133,6 +133,40 @@ function get_os_deploy() { export OPENSTACK_TOPO } +function get_test_suites() { + + #let the caller pick the name of the variable we will assign the suites to + local __suite_list=$1 + + echo "Locating test plan to use..." + testplan_filepath="${WORKSPACE}/test/csit/testplans/${STREAMTESTPLAN}" + if [ ! -f "${testplan_filepath}" ]; then + testplan_filepath="${WORKSPACE}/test/csit/testplans/${TESTPLAN}" + fi + + echo "Changing the testplan path..." + cat "${testplan_filepath}" | sed "s:integration:${WORKSPACE}:" > testplan.txt + cat testplan.txt + + # Use the testplan if specific SUITES are not defined. + if [ -z "${SUITES}" ]; then + suite_list=`egrep -v '(^[[:space:]]*#|^[[:space:]]*$)' testplan.txt | tr '\012' ' '` + else + suite_list="" + workpath="${WORKSPACE}/test/csit/suites" + for suite in ${SUITES}; do + fullsuite="${workpath}/${suite}" + if [ -z "${suite_list}" ]; then + suite_list+=${fullsuite} + else + suite_list+=" "${fullsuite} + fi + done + fi + + eval $__suite_list="'$suite_list'" +} + function run_plan() { local -r type=$1 @@ -145,7 +179,7 @@ function run_plan() { ;; esac - printf "Locating ${type} plan to use...\n" + printf "Locating %s plan to use...\n" "${type}" plan_filepath="${WORKSPACE}/test/csit/${type}plans/$plan" if [ ! -f "${plan_filepath}" ]; then plan_filepath="${WORKSPACE}/test/csit/${type}plans/${STREAMTESTPLAN}" @@ -155,17 +189,17 @@ function run_plan() { fi if [ -f "${plan_filepath}" ]; then - printf "${type} plan exists!!!\n" - printf "Changing the ${type} plan path...\n" + printf "%s plan exists!!!\n" "${type}" + printf "Changing the %s plan path...\n" "${type}" cat ${plan_filepath} | sed "s:integration:${WORKSPACE}:" > ${type}plan.txt cat ${type}plan.txt for line in $( egrep -v '(^[[:space:]]*#|^[[:space:]]*$)' ${type}plan.txt ); do - printf "Executing ${line}...\n" + printf "Executing %s...\n" "${line}" # shellcheck source=${line} disable=SC1091 source ${line} done fi - printf "Finished running ${type} plans\n" + printf "Finished running %s plans\n" "${type}" } # function run_plan() # Return elapsed time. Usage: @@ -175,7 +209,7 @@ function timer() { if [ $# -eq 0 ]; then # return the current time - printf "$(date "+%s")" + printf "%s" "$(date "+%s")" else local start_time=$1 end_time=$(date "+%s") @@ -268,7 +302,7 @@ function tcpdump_start() { local -r filter=$3 filter_=${filter// /_} - printf "node ${ip}, ${prefix}_${ip}__${filter}: starting tcpdump\n" + printf "node %s, %s_%s__%s: starting tcpdump\n" "${ip}" "${prefix}" "${ip}" "${filter}" ssh ${ip} "nohup sudo /usr/sbin/tcpdump -vvv -ni eth0 ${filter} -w /tmp/tcpdump_${prefix}_${ip}__${filter_}.pcap > /tmp/tcpdump_start.log 2>&1 &" ${SSH} ${ip} "ps -ef | grep tcpdump" } @@ -276,7 +310,7 @@ function tcpdump_start() { function tcpdump_stop() { local -r ip=$1 - printf "node $ip: stopping tcpdump\n" + printf "node %s: stopping tcpdump\n" "$ip" ${SSH} ${ip} "ps -ef | grep tcpdump.sh" ${SSH} ${ip} "sudo pkill -f tcpdump" ${SSH} ${ip} "sudo xz -9ekvvf /tmp/*.pcap" @@ -332,7 +366,7 @@ function collect_openstack_logs() { local -r node_type=${3} local oslogs="${folder}/oslogs" - printf "collect_openstack_logs for ${node_type} node: ${ip} into ${oslogs}\n" + printf "collect_openstack_logs for %s node: %s into %s\n" "${node_type}" "${ip}" "${oslogs}" rm -rf ${oslogs} mkdir -p ${oslogs} # There are always some logs in /opt/stack/logs and this also covers the @@ -372,7 +406,7 @@ fi ls -al /tmp/oslogs EOF # cat > ${WORKSPACE}/collect_openstack_logs.sh << EOF - printf "collect_openstack_logs for ${node_type} node: ${ip} into ${oslogs}, executing script\n" + printf "collect_openstack_logs for %s node: %s into %s, executing script\n" "${node_type}" "${ip}" "${oslogs}" cat ${WORKSPACE}/collect_openstack_logs.sh scp ${WORKSPACE}/collect_openstack_logs.sh ${ip}:/tmp ${SSH} ${ip} "bash /tmp/collect_openstack_logs.sh > /tmp/collect_openstack_logs.log 2>&1" @@ -418,6 +452,7 @@ EOF mkdir -p ${WORKSPACE}/archives mv /tmp/changes.txt ${WORKSPACE}/archives + mv /tmp/validations.txt ${WORKSPACE}/archives mv ${WORKSPACE}/rabbit.txt ${WORKSPACE}/archives mv ${WORKSPACE}/haproxy.cfg ${WORKSPACE}/archives ssh ${OPENSTACK_HAPROXY_1_IP} "sudo journalctl -u haproxy > /tmp/haproxy.log"