Skip to content

Commit 4af2afc

Browse files
committed
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
1 parent 2d9f777 commit 4af2afc

2 files changed

Lines changed: 11 additions & 0 deletions

File tree

stack.sh

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,8 @@ if [[ -n "$NOUNSET" ]]; then
4242
set -o nounset
4343
fi
4444

45+
# Set start of devstack timestamp
46+
DEVSTACK_START_TIME=$(date +%s)
4547

4648
# Configuration
4749
# =============
@@ -481,11 +483,14 @@ function exit_trap {
481483

482484
if [[ $r -ne 0 ]]; then
483485
echo "Error on exit"
486+
generate-subunit $DEVSTACK_START_TIME $SECONDS 'fail' >> ${SUBUNIT_OUTPUT}
484487
if [[ -z $LOGDIR ]]; then
485488
$TOP_DIR/tools/worlddump.py
486489
else
487490
$TOP_DIR/tools/worlddump.py -d $LOGDIR
488491
fi
492+
else
493+
generate-subunit $DEVSTACK_START_TIME $SECONDS >> ${SUBUNIT_OUTPUT}
489494
fi
490495

491496
exit $r
@@ -710,6 +715,9 @@ if [[ "$OFFLINE" != "True" ]]; then
710715
PYPI_ALTERNATIVE_URL=${PYPI_ALTERNATIVE_URL:-""} $TOP_DIR/tools/install_pip.sh
711716
fi
712717

718+
# Install subunit for the subunit output stream
719+
pip_install -U os-testr
720+
713721
TRACK_DEPENDS=${TRACK_DEPENDS:-False}
714722

715723
# Install Python packages into a virtualenv so that we can track them

stackrc

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,9 @@ DATA_DIR=${DEST}/data
2929
# Destination for status files
3030
SERVICE_DIR=${DEST}/status
3131

32+
# Path for subunit output file
33+
SUBUNIT_OUTPUT=${DEST}/devstack.subunit
34+
3235
# Determine stack user
3336
if [[ $EUID -eq 0 ]]; then
3437
STACK_USER=stack

0 commit comments

Comments
 (0)