selftests: ktap_helpers: Add a helper to abort the test
authorNícolas F. R. A. Prado <nfraprado@collabora.com>
Wed, 31 Jan 2024 22:02:42 +0000 (17:02 -0500)
committerShuah Khan <skhan@linuxfoundation.org>
Tue, 20 Feb 2024 22:53:15 +0000 (15:53 -0700)
Similar to the C counterpart, add a helper function to abort the
remainder of the test.

Signed-off-by: Nícolas F. R. A. Prado <nfraprado@collabora.com>
Signed-off-by: Shuah Khan <skhan@linuxfoundation.org>
tools/testing/selftests/kselftest/ktap_helpers.sh

index 29107924f5c2013b599bec70b6340e723f6b44e2..87f93c6900c5997eef5054be3399e877e9bd3fa9 100644 (file)
@@ -87,6 +87,13 @@ ktap_test_result() {
        fi
 }
 
+ktap_exit_fail_msg() {
+       echo "Bail out! " $@
+       ktap_print_totals
+
+       exit "$KSFT_FAIL"
+}
+
 ktap_print_totals() {
        echo "# Totals: pass:$KTAP_CNT_PASS fail:$KTAP_CNT_FAIL xfail:0 xpass:0 skip:$KTAP_CNT_SKIP error:0"
 }