summaryrefslogtreecommitdiffstats
path: root/tools/testing/selftests/kvm
diff options
context:
space:
mode:
authorWainer dos Santos Moschetta <wainersm@redhat.com>2020-03-09 23:50:58 -0300
committerPaolo Bonzini <pbonzini@redhat.com>2020-03-16 17:59:10 +0100
commita46f8a63cde8d4fee05693bc5c566c1374d0baaa (patch)
treea2f51258c13020d94b6935f611bd9efe829fffbe /tools/testing/selftests/kvm
parent3203a01737af5c929854940cc72425bef553d403 (diff)
downloadlinux-a46f8a63cde8d4fee05693bc5c566c1374d0baaa.tar.bz2
selftests: kvm: Introduce the TEST_FAIL macro
Some tests/utilities use the TEST_ASSERT(false, ...) pattern to indicate a failure and stop execution. This change introduces the TEST_FAIL macro which is a wrap around TEST_ASSERT(false, ...) and so provides a direct alternative for failing a test. Signed-off-by: Wainer dos Santos Moschetta <wainersm@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'tools/testing/selftests/kvm')
-rw-r--r--tools/testing/selftests/kvm/include/test_util.h3
1 files changed, 3 insertions, 0 deletions
diff --git a/tools/testing/selftests/kvm/include/test_util.h b/tools/testing/selftests/kvm/include/test_util.h
index f556ec5fe47b..f588ad1403f1 100644
--- a/tools/testing/selftests/kvm/include/test_util.h
+++ b/tools/testing/selftests/kvm/include/test_util.h
@@ -55,6 +55,9 @@ void test_assert(bool exp, const char *exp_str,
#a, #b, #a, (unsigned long) __a, #b, (unsigned long) __b); \
} while (0)
+#define TEST_FAIL(fmt, ...) \
+ TEST_ASSERT(false, fmt, ##__VA_ARGS__)
+
size_t parse_size(const char *size);
int64_t timespec_to_ns(struct timespec ts);