diff --git a/tests/functions.sh b/tests/functions.sh index 2c4d205..ed06040 100755 --- a/tests/functions.sh +++ b/tests/functions.sh @@ -100,6 +100,25 @@ expect_pass() { return $ret } +expect_pass_if() { + local indexes="$1" + local ret idx + + shift + + expect_pass "$@" + ret=$? + + if [ $ret -ne 0 ] && [ $ret -ne 77 ] && [ -n "$PATCHES" ]; then + echo $YELLOW"Possibly missing patches:"$NORM + for idx in $indexes; do + echo $YELLOW" - ${PATCHES[$((idx))]}"$NORM + done + fi + + return $ret +} + # Eval negative test (one that should fail) and account its result expect_fail() { local ret @@ -137,6 +156,25 @@ expect_fail() { return $ret } +expect_fail_if() { + local indexes="$1" + local ret idx + + shift + + expect_fail "$@" + ret=$? + + if { [ $ret -eq 0 ] || [ $ret -eq 99 ]; } && [ -n "$PATCHES" ]; then + echo $YELLOW"Possibly missing patches:"$NORM + for idx in $indexes; do + echo $YELLOW" - ${PATCHES[$((idx))]}"$NORM + done + fi + + return $ret +} + # return true if current test is positive _test_expected_to_pass() { [ ! $TFAIL ]