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
This commit is contained in:
Matthew Treinish
2014-12-23 14:35:48 -05:00
parent 6de39b6eba
commit 736d1c987b

View File

@@ -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