| 1 | #!/usr/bin/env bash |
| 2 | |
| 3 | set -xe |
| 4 | |
| 5 | FWAAS_DIR="$BASE/new/neutron-fwaas" |
| 6 | NEUTRON_DIR="$BASE/new/neutron" |
| 7 | TEMPEST_DIR="$BASE/new/tempest" |
| 8 | SCRIPTS_DIR="/usr/os-testr-env/bin" |
| 9 | |
| 10 | venv=${1:-"dsvm-functional"} |
| 11 | |
| 12 | function generate_testr_results { |
| 13 | # Give job user rights to access tox logs |
| 14 | sudo -H -u $owner chmod o+rw . |
| 15 | sudo -H -u $owner chmod o+rw -R .stestr |
| 16 | if [ -f ".stestr/0" ] ; then |
| 17 | .tox/$venv/bin/subunit-1to2 < .stestr/0 > ./stestr.subunit |
| 18 | $SCRIPTS_DIR/subunit2html ./stestr.subunit testr_results.html |
| 19 | gzip -9 ./stestr.subunit |
| 20 | gzip -9 ./testr_results.html |
| 21 | sudo mv ./*.gz /opt/stack/logs/ |
| 22 | fi |
| 23 | } |
| 24 | |
| 25 | function dsvm_functional_prep_func { |
| 26 | : |
| 27 | } |
| 28 | |
| 29 | if [[ "$venv" == dsvm-functional* ]] |
| 30 | then |
| 31 | owner=stack |
| 32 | sudo_env= |
| 33 | # Set owner permissions according to job's requirements. |
| 34 | cd $FWAAS_DIR |
| 35 | sudo chown -R $owner:stack $FWAAS_DIR |
| 36 | sudo chown -R $owner:stack $NEUTRON_DIR |
| 37 | # Prep the environment according to job's requirements. |
| 38 | $prep_func |
| 39 | |
| 40 | # Run tests |
| 41 | echo "Running neutron-fwaas $venv test suite" |
| 42 | set +e |
| 43 | sudo -H -u $owner $sudo_env tox -e $venv |
| 44 | testr_exit_code=$? |
| 45 | set -e |
| 46 | |
| 47 | # Collect and parse results |
| 48 | generate_testr_results |
| 49 | exit $testr_exit_code |
| 50 | fi |