From bf8735ced4e9793ed89676225e2694acbb139354 Mon Sep 17 00:00:00 2001 From: Matthew Treinish Date: Tue, 13 Oct 2015 09:51:17 -0400 Subject: [PATCH] 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. This is backported from master branch to generate subunit result so d-g can collect it from the new location. Depends-On: Icc7df33e4d73ba6322af38fbdf3aea230f2fcf4d Depends-On: I97a604ac08797909afc236401281a5d84b98d53f Change-Id: I07112dde996c3e2c73f5aafc9b73d33d26374633 --- stack.sh | 8 ++++++++ stackrc | 3 +++ 2 files changed, 11 insertions(+) diff --git a/stack.sh b/stack.sh index 78dbf2661c..597584a9f9 100755 --- a/stack.sh +++ b/stack.sh @@ -42,6 +42,8 @@ if [[ -n "$NOUNSET" ]]; then set -o nounset fi +# Set start of devstack timestamp +DEVSTACK_START_TIME=$(date +%s) # Configuration # ============= @@ -457,11 +459,14 @@ function exit_trap { if [[ $r -ne 0 ]]; then echo "Error on exit" + generate-subunit $DEVSTACK_START_TIME $SECONDS 'fail' >> ${SUBUNIT_OUTPUT} if [[ -z $LOGDIR ]]; then $TOP_DIR/tools/worlddump.py else $TOP_DIR/tools/worlddump.py -d $LOGDIR fi + else + generate-subunit $DEVSTACK_START_TIME $SECONDS >> ${SUBUNIT_OUTPUT} fi exit $r @@ -682,6 +687,9 @@ if [[ "$OFFLINE" != "True" ]]; then PYPI_ALTERNATIVE_URL=${PYPI_ALTERNATIVE_URL:-""} $TOP_DIR/tools/install_pip.sh fi +# Install subunit for the subunit output stream +pip_install -U os-testr + TRACK_DEPENDS=${TRACK_DEPENDS:-False} # Install Python packages into a virtualenv so that we can track them diff --git a/stackrc b/stackrc index 7598494d69..e1553b7efd 100644 --- a/stackrc +++ b/stackrc @@ -29,6 +29,9 @@ DATA_DIR=${DEST}/data # Destination for status files SERVICE_DIR=${DEST}/status +# Path for subunit output file +SUBUNIT_OUTPUT=${DEST}/devstack.subunit + # Determine stack user if [[ $EUID -eq 0 ]]; then STACK_USER=stack