diff options
author | Niels de Vos <ndevos@redhat.com> | 2018-02-16 11:29:12 +0100 |
---|---|---|
committer | Amar Tumballi <amarts@redhat.com> | 2018-05-28 02:52:21 +0000 |
commit | 7d92af4eac386001b46b8f1a98e8ccb95ca1a225 (patch) | |
tree | e536d63439a385ffbbf8afd064ca1b370c4b894d | |
parent | 2343d2ca474f5f695add09f8c039078b378c3985 (diff) |
tests: run-tests-in-vagrant.sh should return test status
The ./run-tests-in-vagrant.sh script does not return the correct exit
status. Even if the tests in the Vagrant VM fail, the script returns
success. This throws off the expectations that any regular testers (or
CI) have.
BUG: 1546103
Change-Id: I7f00903f9fe4ef3be8ba80db0f9aa8d412502b86
Signed-off-by: Niels de Vos <ndevos@redhat.com>
-rwxr-xr-x | run-tests-in-vagrant.sh | 22 |
1 files changed, 17 insertions, 5 deletions
diff --git a/run-tests-in-vagrant.sh b/run-tests-in-vagrant.sh index f7838f4732a..c72364a21c8 100755 --- a/run-tests-in-vagrant.sh +++ b/run-tests-in-vagrant.sh @@ -111,8 +111,10 @@ function set_branchname_from_git_branch() } -function destroy_vm_and_exit() +function destroy_vm() { + local retval=0 + echo "!!!!!!!!!!!!!!!!!!!!!!!!!!!!CAUTION!!!!!!!!!!!!!!!!!!!!!!!!!!!!" echo "This will destroy VM and delete tests/vagrant/${BRANCHNAME} dir" echo @@ -128,11 +130,12 @@ function destroy_vm_and_exit() eval vagrant destroy $redirect popd rm -rf "tests/vagrant/${BRANCHNAME}" - exit 0 else echo "Could not find vagrant dir for corresponding git branch, exiting" - exit 1 + retval=1 fi + + return ${retval} } @@ -248,9 +251,14 @@ function compile_gluster() function run_tests() { + local retval=0 + pushd "tests/vagrant/${BRANCHNAME}" vagrant ssh -c "cd /home/vagrant/glusterfs; sudo ./run-tests.sh $run_tests_args" -- -t + retval=$? popd + + return ${retval} } function ssh_into_vm_using_exec() @@ -272,7 +280,8 @@ ansible_check set_branchname_from_git_branch if [ "x$destroy_now" == "xyes" ] ; then - destroy_vm_and_exit + destroy_vm + exit $? fi if [ "x$sshvm" == "xyes" ] ; then @@ -289,7 +298,10 @@ set_vm_attributes copy_source_code compile_gluster run_tests +RET=$? if [ "x$destroy_after_test" == "xyes" ] ; then - destroy_vm_and_exit + destroy_vm fi + +exit ${RET} |