]> review.fuel-infra Code Review - openstack-build/neutron-build.git/commitdiff
Generate testr_results.html for neutron functional job
authorarmando-migliaccio <armamig@gmail.com>
Wed, 10 Dec 2014 22:38:26 +0000 (14:38 -0800)
committerarmando-migliaccio <armamig@gmail.com>
Sat, 13 Dec 2014 00:17:00 +0000 (16:17 -0800)
Tweak job post_test_hook script to generate testr results
the same way other jobs do, with a pretty html view that
is easy to digest and navigate.

Closes-bug: #1401340

Change-Id: Ib355f34917580b88bda3d550e33fc630a8e7120b

neutron/tests/functional/contrib/post_test_hook.sh

index a8794b96fe84c42ae82c7e0c33b56c7b55b10f56..dd532457eaa766701825139b1e75117f22622f44 100644 (file)
@@ -2,10 +2,31 @@
 
 set -xe
 
-NEUTRON_DIR=$BASE/new/neutron
+NEUTRON_DIR="$BASE/new/neutron"
+SCRIPTS_DIR="/usr/local/jenkins/slave_scripts"
+venv=dsvm-functional
+
+function generate_testr_results {
+    # Give job user rights to access tox logs
+    sudo -H -u stack chmod o+rw -R .
+    if [ -f ".testrepository/0" ] ; then
+        .tox/$venv/bin/subunit-1to2 < .testrepository/0 > ./testrepository.subunit
+        .tox/$venv/bin/python $SCRIPTS_DIR/subunit2html.py ./testrepository.subunit testr_results.html
+        gzip -9 ./testrepository.subunit
+        gzip -9 ./testr_results.html
+        sudo mv ./*.gz /opt/stack/logs/
+    fi
+}
 
 # Run tests as the stack user to allow sudo+rootwrap.
 sudo chown -R stack:stack $NEUTRON_DIR
 cd $NEUTRON_DIR
+
 echo "Running neutron functional test suite"
-sudo -H -u stack tox -e dsvm-functional
+set +e
+sudo -H -u stack tox -e $venv
+testr_exit_code=$?
+set -e
+
+generate_testr_results
+exit $testr_exit_code