Simplify die_if_error
* Replace die_if_error() with the simpler die() * Attempt to clean up unnecessary trace output * Formatting cleanups on all exercise scripts Change-Id: I72a542b3a59ee9bf12bee6bcc605edd7579205e0
This commit is contained in:
@@ -11,43 +11,28 @@ source $TOP/functions
|
||||
source $TOP/openrc
|
||||
|
||||
|
||||
echo "Testing die_if_error()"
|
||||
|
||||
bash -c "source $TOP/functions; true; die_if_error 'not OK'"
|
||||
if [[ $? != 0 ]]; then
|
||||
echo "die_if_error [true] Failed"
|
||||
fi
|
||||
|
||||
bash -c "source $TOP/functions; false; die_if_error 'OK'"
|
||||
if [[ $? = 0 ]]; then
|
||||
echo "die_if_error [false] Failed"
|
||||
else
|
||||
echo 'OK'
|
||||
fi
|
||||
|
||||
|
||||
echo "Testing die_if_not_set()"
|
||||
|
||||
bash -c "source $TOP/functions; X=`echo Y && true`; die_if_not_set X 'not OK'"
|
||||
bash -cx "source $TOP/functions; X=`echo Y && true`; die_if_not_set X 'not OK'"
|
||||
if [[ $? != 0 ]]; then
|
||||
echo "die_if_not_set [X='Y' true] Failed"
|
||||
else
|
||||
echo 'OK'
|
||||
fi
|
||||
|
||||
bash -c "source $TOP/functions; X=`true`; die_if_not_set X 'OK'"
|
||||
bash -cx "source $TOP/functions; X=`true`; die_if_not_set X 'OK'"
|
||||
if [[ $? = 0 ]]; then
|
||||
echo "die_if_not_set [X='' true] Failed"
|
||||
fi
|
||||
|
||||
bash -c "source $TOP/functions; X=`echo Y && false`; die_if_not_set X 'not OK'"
|
||||
bash -cx "source $TOP/functions; X=`echo Y && false`; die_if_not_set X 'not OK'"
|
||||
if [[ $? != 0 ]]; then
|
||||
echo "die_if_not_set [X='Y' false] Failed"
|
||||
else
|
||||
echo 'OK'
|
||||
fi
|
||||
|
||||
bash -c "source $TOP/functions; X=`false`; die_if_not_set X 'OK'"
|
||||
bash -cx "source $TOP/functions; X=`false`; die_if_not_set X 'OK'"
|
||||
if [[ $? = 0 ]]; then
|
||||
echo "die_if_not_set [X='' false] Failed"
|
||||
fi
|
||||
|
Reference in New Issue
Block a user