Skip to content

Commit

Permalink
selftests: kvm: Introduce the TEST_FAIL macro
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
wainersm authored and bonzini committed Mar 16, 2020
1 parent 3203a01 commit a46f8a6
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions tools/testing/selftests/kvm/include/test_util.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit a46f8a6

Please sign in to comment.