From 736d1c987be90fd97ec55f15b6b7560e1f295c29 Mon Sep 17 00:00:00 2001 From: Matthew Treinish Date: Tue, 23 Dec 2014 14:35:48 -0500 Subject: [PATCH] Handle more than one stream stored testrepository This commit switches the cleanup function from having a hardcoded assumption that there will only ever be 1 subunit stream stored in the testrepository. Instead it uses the testr last command to retrieve the most recent stream and uses that instead. This will be needed if we start pre-seeding testrepository with data from previous runs. Change-Id: I5a36e73998a9e9200df518c65ad43d1e6d3c13d4 --- functions.sh | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/functions.sh b/functions.sh index 12faf848..1f5f83ee 100644 --- a/functions.sh +++ b/functions.sh @@ -634,7 +634,10 @@ function cleanup_host { # Process testr artifacts. if [ -f $BASE/new/tempest/.testrepository/0 ]; then - sudo cp $BASE/new/tempest/.testrepository/0 $BASE/logs/testrepository.subunit + pushd $BASE/new/tempest + testr last --subunit > $WORKSPACE/testrepository.subunit + popd + sudo mv $WORKSPACE/testrepository.subunit $BASE/logs/testrepository.subunit sudo python /usr/local/jenkins/slave_scripts/subunit2html.py $BASE/logs/testrepository.subunit $BASE/logs/testr_results.html sudo gzip -9 $BASE/logs/testrepository.subunit sudo gzip -9 $BASE/logs/testr_results.html @@ -648,7 +651,10 @@ function cleanup_host { sudo chmod a+r $BASE/logs/testrepository.subunit.gz fi if [ -f $BASE/old/tempest/.testrepository/0 ]; then - sudo cp $BASE/old/tempest/.testrepository/0 $BASE/logs/old/testrepository.subunit + pushd $BASE/old/tempest + testr last --subunit > $WORKSPACE/testrepository.subunit + popd + sudo mv $WORKSPACE/testrepository.subunit $BASE/logs/old/testrepository.subunit sudo python /usr/local/jenkins/slave_scripts/subunit2html.py $BASE/logs/old/testrepository.subunit $BASE/logs/old/testr_results.html sudo gzip -9 $BASE/logs/old/testrepository.subunit sudo gzip -9 $BASE/logs/old/testr_results.html