kcsan: test: Use kunit_skip() to skip tests
Use the new kunit_skip() to skip tests if requirements were not met. Signed-off-by: Marco Elver <elver@google.com> Signed-off-by: Paul E. McKenney <paulmck@kernel.org>
This commit is contained in:
parent
e80704272f
commit
8080428410
|
@ -29,6 +29,11 @@
|
|||
#include <linux/types.h>
|
||||
#include <trace/events/printk.h>
|
||||
|
||||
#define KCSAN_TEST_REQUIRES(test, cond) do { \
|
||||
if (!(cond)) \
|
||||
kunit_skip((test), "Test requires: " #cond); \
|
||||
} while (0)
|
||||
|
||||
#ifdef CONFIG_CC_HAS_TSAN_COMPOUND_READ_BEFORE_WRITE
|
||||
#define __KCSAN_ACCESS_RW(alt) (KCSAN_ACCESS_COMPOUND | KCSAN_ACCESS_WRITE)
|
||||
#else
|
||||
|
@ -642,8 +647,7 @@ static void test_read_plain_atomic_write(struct kunit *test)
|
|||
};
|
||||
bool match_expect = false;
|
||||
|
||||
if (IS_ENABLED(CONFIG_KCSAN_IGNORE_ATOMICS))
|
||||
return;
|
||||
KCSAN_TEST_REQUIRES(test, !IS_ENABLED(CONFIG_KCSAN_IGNORE_ATOMICS));
|
||||
|
||||
begin_test_checks(test_kernel_read, test_kernel_write_atomic);
|
||||
do {
|
||||
|
@ -665,8 +669,7 @@ static void test_read_plain_atomic_rmw(struct kunit *test)
|
|||
};
|
||||
bool match_expect = false;
|
||||
|
||||
if (IS_ENABLED(CONFIG_KCSAN_IGNORE_ATOMICS))
|
||||
return;
|
||||
KCSAN_TEST_REQUIRES(test, !IS_ENABLED(CONFIG_KCSAN_IGNORE_ATOMICS));
|
||||
|
||||
begin_test_checks(test_kernel_read, test_kernel_atomic_rmw);
|
||||
do {
|
||||
|
|
Loading…
Reference in New Issue