[v2,1/2] selftests: kvm: Introduce the TEST_FAIL macro
diff mbox series

Message ID 20200310025059.9301-2-wainersm@redhat.com
State New
Headers show
Series
  • kvm: selftests: Introduce TEST_FAIL and convert
Related show

Commit Message

Wainer dos Santos Moschetta March 10, 2020, 2:50 a.m. UTC
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>
---
 tools/testing/selftests/kvm/include/test_util.h | 3 +++
 1 file changed, 3 insertions(+)

Patch
diff mbox series

diff --git a/tools/testing/selftests/kvm/include/test_util.h b/tools/testing/selftests/kvm/include/test_util.h
index a41db6fb7e24..903a7576d0e1 100644
--- a/tools/testing/selftests/kvm/include/test_util.h
+++ b/tools/testing/selftests/kvm/include/test_util.h
@@ -39,4 +39,7 @@  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__)
+
 #endif /* SELFTEST_KVM_TEST_UTIL_H */