[PATCH v2 1/2] selftests: kvm: Introduce the TEST_FAIL macro

From: Wainer dos Santos Moschetta
Date: Mon Mar 09 2020 - 22:51:20 EST


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@xxxxxxxxxx>
---
tools/testing/selftests/kvm/include/test_util.h | 3 +++
1 file changed, 3 insertions(+)

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 */
--
2.17.2