Handle a stestr results directory

Tempest is in the process of switching the tempest run command to use
stestr internally instead of testrepository. This means that results
will be stored in .stestr instead of .testrepository now. This commit
updates the post-processing function to check which directory exists
before attempting to copy the subunit results.

Change-Id: I3855aad5ce129ec8ccb87c05f7aa709b74070efe
This commit is contained in:
Matthew Treinish 2017-11-28 20:38:11 -05:00
parent b376f17652
commit 8f4de759a3
No known key found for this signature in database
GPG Key ID: FD12A0F214C9E177
1 changed files with 24 additions and 10 deletions

View File

@ -500,7 +500,6 @@ function process_testr_artifacts {
local path_prefix=${2:-new}
local project_path=$BASE/$path_prefix/$project
local repo_path=$project_path/.testrepository
local log_path=$BASE/logs
if [[ "$path_prefix" != "new" ]]; then
log_path=$BASE/logs/$path_prefix
@ -509,17 +508,32 @@ function process_testr_artifacts {
if [[ -f $BASE/devstack.subunit ]]; then
sudo cp $BASE/devstack.subunit $log_path/testrepository.subunit
fi
pushd $project_path
if [ -d ".stestr" ] ; then
# Check for an interrupted run first because 0 will always exist
if [ -f .stestr/tmp* ]; then
# If testr timed out, collect temp file from testr
sudo cat .stestr/tmp* >> $WORKSPACE/tempest.subunit
archive_test_artifact $WORKSPACE/tempest.subunit
elif [ -f ".stestr/0" ] ; then
sudo stestr last --subunit > $WORKSPACE/tempest.subunit
fi
else
if [ ! -d ".testrepository" ] ; then
return
fi
# Check for an interrupted run first because 0 will always exist
if [ -f $repo_path/tmp* ]; then
# If testr timed out, collect temp file from testr
sudo cat $repo_path/tmp* >> $WORKSPACE/tempest.subunit
archive_test_artifact $WORKSPACE/tempest.subunit
elif [ -f $repo_path/0 ]; then
pushd $project_path
sudo testr last --subunit > $WORKSPACE/tempest.subunit
popd
# Check for an interrupted run first because 0 will always exist
if [ -f .testrepository/tmp* ]; then
# If testr timed out, collect temp file from testr
sudo cat .testrepository/tmp* >> $WORKSPACE/tempest.subunit
archive_test_artifact $WORKSPACE/tempest.subunit
elif [ -f ".testrepository/0" ] ; then
sudo testr last --subunit > $WORKSPACE/tempest.subunit
fi
fi
popd
if [[ -f $log_path/testrepository.subunit ]] ; then
if [[ -f $WORKSPACE/tempest.subunit ]] ; then
sudo cat $WORKSPACE/tempest.subunit \