Browse code

Add subunit output for total elapsed time

This commit adds a success output for the entire devstack run to the
subunit output. Ideally we wouldn't need this, but because we don't
have timing data for every single operation performed by devstack we
need to do this to track the total duration of the devstack run.

To capture failures this commit adds saving a devstack event when we
trip the exit_trap. This will save a similar result to the stream in
the successful case, but instead mark it as a failure.

Depends-On: Icc7df33e4d73ba6322af38fbdf3aea230f2fcf4d
Change-Id: I07112dde996c3e2c73f5aafc9b73d33d26374633

Matthew Treinish authored on 2015/10/13 22:51:17
Showing 2 changed files
... ...
@@ -42,6 +42,8 @@ if [[ -n "$NOUNSET" ]]; then
42 42
     set -o nounset
43 43
 fi
44 44
 
45
+# Set start of devstack timestamp
46
+DEVSTACK_START_TIME=$(date +%s)
45 47
 
46 48
 # Configuration
47 49
 # =============
... ...
@@ -481,11 +483,14 @@ function exit_trap {
481 481
 
482 482
     if [[ $r -ne 0 ]]; then
483 483
         echo "Error on exit"
484
+        generate-subunit $DEVSTACK_START_TIME $SECONDS 'fail' >> ${SUBUNIT_OUTPUT}
484 485
         if [[ -z $LOGDIR ]]; then
485 486
             $TOP_DIR/tools/worlddump.py
486 487
         else
487 488
             $TOP_DIR/tools/worlddump.py -d $LOGDIR
488 489
         fi
490
+    else
491
+        generate-subunit $DEVSTACK_START_TIME $SECONDS >> ${SUBUNIT_OUTPUT}
489 492
     fi
490 493
 
491 494
     exit $r
... ...
@@ -710,6 +715,9 @@ if [[ "$OFFLINE" != "True" ]]; then
710 710
     PYPI_ALTERNATIVE_URL=${PYPI_ALTERNATIVE_URL:-""} $TOP_DIR/tools/install_pip.sh
711 711
 fi
712 712
 
713
+# Install subunit for the subunit output stream
714
+pip_install -U os-testr
715
+
713 716
 TRACK_DEPENDS=${TRACK_DEPENDS:-False}
714 717
 
715 718
 # Install Python packages into a virtualenv so that we can track them
... ...
@@ -29,6 +29,9 @@ DATA_DIR=${DEST}/data
29 29
 # Destination for status files
30 30
 SERVICE_DIR=${DEST}/status
31 31
 
32
+# Path for subunit output file
33
+SUBUNIT_OUTPUT=${DEST}/devstack.subunit
34
+
32 35
 # Determine stack user
33 36
 if [[ $EUID -eq 0 ]]; then
34 37
     STACK_USER=stack