Fix die_if_not_set tests

The "die_if_not_set" test has the LINENO as a positional argument.
The existing tests are not passing this in, so they are failing.

Along with this, remove the "-x" from the invocation and hide the
output of the tests that are expected to fail to avoid confusion.

Change-Id: Ibf6b9d7bb72b9f92831e1a90292ff8b0bec7faea
This commit is contained in:
Ian Wienand 2015-04-17 13:10:33 +10:00
parent 9b0ebc44f4
commit 9b845da478

View File

@ -13,26 +13,26 @@ source $TOP/openrc
echo "Testing die_if_not_set()"
bash -cx "source $TOP/functions; X=`echo Y && true`; die_if_not_set X 'not OK'"
bash -c "source $TOP/functions; X=`echo Y && true`; die_if_not_set $LINENO X 'not OK'"
if [[ $? != 0 ]]; then
echo "die_if_not_set [X='Y' true] Failed"
else
echo 'OK'
fi
bash -cx "source $TOP/functions; X=`true`; die_if_not_set X 'OK'"
bash -c "source $TOP/functions; X=`true`; die_if_not_set $LINENO X 'OK'" > /dev/null 2>&1
if [[ $? = 0 ]]; then
echo "die_if_not_set [X='' true] Failed"
fi
bash -cx "source $TOP/functions; X=`echo Y && false`; die_if_not_set X 'not OK'"
bash -c "source $TOP/functions; X=`echo Y && false`; die_if_not_set $LINENO X 'not OK'"
if [[ $? != 0 ]]; then
echo "die_if_not_set [X='Y' false] Failed"
else
echo 'OK'
fi
bash -cx "source $TOP/functions; X=`false`; die_if_not_set X 'OK'"
bash -c "source $TOP/functions; X=`false`; die_if_not_set $LINENO X 'OK'" > /dev/null 2>&1
if [[ $? = 0 ]]; then
echo "die_if_not_set [X='' false] Failed"
fi