support for expected_failure explicit message

This commit is contained in:
Shlomi Noach 2016-10-14 09:33:25 +02:00
parent 11ccf09412
commit 7c22f25afa

View File

@ -108,6 +108,17 @@ test_single() {
echo "ERROR $test_name execution was expected to exit on error but did not. cat $test_logfile" echo "ERROR $test_name execution was expected to exit on error but did not. cat $test_logfile"
return 1 return 1
fi fi
if [ -s $tests_path/$test_name/expect_failure ] ; then
# 'expect_failure' file has content. We expect to find this content in the log.
expected_error_message="$(cat $tests_path/$test_name/expect_failure)"
if grep -q "$expected_error_message" $test_logfile ; then
return 0
fi
echo
echo "ERROR $test_name execution was expected to exit with error message '${expected_error_message}' but did not. cat $test_logfile"
return 1
fi
# 'expect_failure' file has no content. We generally agree that the failure is correct
return 0 return 0
fi fi