X-Git-Url: https://gerrit.opnfv.org/gerrit/gitweb?a=blobdiff_plain;f=tests%2Frun.sh;h=5c922265d3724143d077df4f27d2c1c615832176;hb=3e0300e8f9695348aa4564f87a23ac3c0cf737ff;hp=c21c3fd7c2bd589bc0799642a137aa50e91f828d;hpb=661fbc57a5cd5137a58cc6a285f4b6f91d78e0f0;p=doctor.git diff --git a/tests/run.sh b/tests/run.sh index c21c3fd7..5c922265 100755 --- a/tests/run.sh +++ b/tests/run.sh @@ -30,6 +30,7 @@ DOCTOR_PW=doctor DOCTOR_PROJECT=doctor DOCTOR_ROLE=_member_ PROFILER_TYPE=${PROFILER_TYPE:-none} +PYTHON_ENABLE=${PYTHON_ENABLE:-false} TOP_DIR=$(cd $(dirname "$0") && pwd) @@ -47,7 +48,7 @@ as_admin_user="--os-username admin --os-project-name $DOCTOR_PROJECT get_compute_host_info() { # get computer host info which first VM boot in as admin user COMPUTE_HOST=$(openstack $as_admin_user server show ${VM_BASENAME}1 | - grep "OS-EXT-SRV-ATTR:host" | awk '{ print $4 }') + grep "OS-EXT-SRV-ATTR:host " | awk '{ print $4 }') compute_host_in_undercloud=${COMPUTE_HOST%%.*} die_if_not_set $LINENO COMPUTE_HOST "Failed to get compute hostname" @@ -293,8 +294,7 @@ inject_failure() { echo "disabling network of compute host [$COMPUTE_HOST] for 3 mins..." cat > disable_network.sh << 'END_TXT' #!/bin/bash -x -dev=$(sudo ip a | awk '/ @COMPUTE_IP@\//{print $7}') -[[ -n "$dev" ]] || dev=$(sudo ip a | awk '/ @COMPUTE_IP@\//{print $5}') +dev=$(sudo ip a | awk '/ @COMPUTE_IP@\//{print $NF}') sleep 1 sudo ip link set $dev down echo "doctor set link down at" $(date "+%s.%N") @@ -480,6 +480,20 @@ cleanup() { # Main process +if [[ $PYTHON_ENABLE == [Tt]rue ]]; then + which tox || sudo pip install tox + if [ -f /usr/bin/apt-get ]; then + sudo apt-get install -y python3-dev + elif [ -f /usr/bin/yum ] ; then + sudo yum install -y python3-devel + fi + + cd $TOP_DIR + echo "executing tox..." + tox + exit $? +fi + echo "Note: doctor/tests/run.sh has been executed." git log --oneline -1 || true # ignore even you don't have git installed