From 97564ba26376308166c52fc01616de37d5ea989e Mon Sep 17 00:00:00 2001 From: Johnny Hughes Date: May 18 2016 15:49:00 +0000 Subject: Merge pull request #16 from CentOS/revert-14-master Revert "t_CheckExitStatus to have optional error message" --- diff --git a/tests/0_lib/functions.sh b/tests/0_lib/functions.sh index b4b9e64..ff87c62 100755 --- a/tests/0_lib/functions.sh +++ b/tests/0_lib/functions.sh @@ -14,9 +14,7 @@ function t_CheckExitStatus { [ $1 -eq 0 ] && { t_Log "PASS"; return $PASS; } - comment='' - [ "$2" ] && comment=": $2" - t_Log "FAIL" $comment + t_Log "FAIL" exit $FAIL } diff --git a/tests/p_bzip2/10-bzip2-test.sh b/tests/p_bzip2/10-bzip2-test.sh index c613599..ef1aae8 100755 --- a/tests/p_bzip2/10-bzip2-test.sh +++ b/tests/p_bzip2/10-bzip2-test.sh @@ -18,7 +18,11 @@ bzip2 $FILE #run file through bzcat bzcat $FILE.bz2 | grep -q 'bzip2-test of single file' -t_CheckExitStatus $? 'bzcat failed' +if [ $? == 1 ] + then + t_Log 'bzcat failed' + exit +fi #run file through bunzip2 bunzip2 $FILE.bz2 diff --git a/tests/p_vconfig/10_test_vconfig.sh b/tests/p_vconfig/10_test_vconfig.sh index 2bb21a6..900d6bb 100755 --- a/tests/p_vconfig/10_test_vconfig.sh +++ b/tests/p_vconfig/10_test_vconfig.sh @@ -15,22 +15,44 @@ fi # create VLAN-IF 10 on eth0 vconfig add eth0 10 ip addr list | grep -q eth0.10 -t_CheckExitStatus $? "VLAN-IF creation failed" -t_Log "VLAN-IF successfully created" +if [ $? == 1 ] + then + t_Log "VLAN-IF creation failed" + ret_val=1 +else + t_Log "VLAN-IF successfully created" +fi #assign IP address on VLAN-IF ifconfig eth0.10 172.16.30.1 netmask 255.255.255.255 ip addr list | grep -q 172.16.30.1 -t_CheckExitStatus $? "IP address assignment on eth0.10 failed" -t_Log "IP address successfully assigned on eth0.10" +if [ $? == 1 ] + then + t_Log "IP address assignment on eth0.10 failed" + ret_val=1 +else + t_Log "IP address successfully assigned on eth0.10" +fi #testing address with ping ping -c 4 -q 172.16.30.1 | grep -q '4 received' -t_CheckExitStatus $? "pinging on eth0.10 failed" -t_Log "local ping on VLAN IF worked" +if [ $? == 1 ] + then + t_Log "pinging on eth0.10 failed" + ret_val=1 +else + t_Log "local ping on VLAN IF worked" +fi # delete VLAN-IF 10 on eth0 vconfig rem eth0.10 ip addr list | grep -q eth0.10 -t_CheckExitStatus $? "Removing VLAN IF failed" -t_Log "Removing of VLAN IF worked" +if [ $? == 0 ] + then + t_Log "Removing VLAN IF failed" + ret_val=1 +else + t_Log "Removing of VLAN IF worked" +fi + +t_CheckExitStatus $ret_val diff --git a/tests/r_lamp/50_lamp_check_mysql55.sh b/tests/r_lamp/50_lamp_check_mysql55.sh index 1d9398c..d81edd4 100755 --- a/tests/r_lamp/50_lamp_check_mysql55.sh +++ b/tests/r_lamp/50_lamp_check_mysql55.sh @@ -39,7 +39,14 @@ do $SERVICE $D start &>/dev/null - t_CheckExitStatus $? "FAIL: service startup for '$D' failed ($RETVAL)" + RETVAL=$? + + if [ $RETVAL -ne 0 ]; then + + t_Log "FAIL: service startup for '$D' failed ($RETVAL)" + exit $FAIL + + fi done for D in "${DAEMONSPID[@]}" do