selftests: ktap_helpers: Add helper to pass/fail test based on exit code
Similar to the C counterpart, add a helper function that runs a command and passes or fails the test based on the result. Signed-off-by: Nícolas F. R. A. Prado <nfraprado@collabora.com> Signed-off-by: Shuah Khan <skhan@linuxfoundation.org>
This commit is contained in:
committed by
Shuah Khan
parent
6934eea269
commit
d90b7c705c
@@ -76,6 +76,17 @@ ktap_test_fail() {
|
||||
KTAP_CNT_FAIL=$((KTAP_CNT_FAIL+1))
|
||||
}
|
||||
|
||||
ktap_test_result() {
|
||||
description="$1"
|
||||
shift
|
||||
|
||||
if $@; then
|
||||
ktap_test_pass "$description"
|
||||
else
|
||||
ktap_test_fail "$description"
|
||||
fi
|
||||
}
|
||||
|
||||
ktap_print_totals() {
|
||||
echo "# Totals: pass:$KTAP_CNT_PASS fail:$KTAP_CNT_FAIL xfail:0 xpass:0 skip:$KTAP_CNT_SKIP error:0"
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user