2021-05-28 09:07:54

by David Gow

[permalink] [raw]
Subject: [PATCH v2 4/4] kasan: test: make use of kunit_skip()

From: Marco Elver <[email protected]>

Make use of the recently added kunit_skip() to skip tests, as it permits
TAP parsers to recognize if a test was deliberately skipped.

Signed-off-by: Marco Elver <[email protected]>
Signed-off-by: David Gow <[email protected]>
---
lib/test_kasan.c | 12 ++++--------
1 file changed, 4 insertions(+), 8 deletions(-)

diff --git a/lib/test_kasan.c b/lib/test_kasan.c
index cacbbbdef768..0a2029d14c91 100644
--- a/lib/test_kasan.c
+++ b/lib/test_kasan.c
@@ -111,17 +111,13 @@ static void kasan_test_exit(struct kunit *test)
} while (0)

#define KASAN_TEST_NEEDS_CONFIG_ON(test, config) do { \
- if (!IS_ENABLED(config)) { \
- kunit_info((test), "skipping, " #config " required"); \
- return; \
- } \
+ if (!IS_ENABLED(config)) \
+ kunit_skip((test), "Test requires " #config "=y"); \
} while (0)

#define KASAN_TEST_NEEDS_CONFIG_OFF(test, config) do { \
- if (IS_ENABLED(config)) { \
- kunit_info((test), "skipping, " #config " enabled"); \
- return; \
- } \
+ if (IS_ENABLED(config)) \
+ kunit_skip((test), "Test requires " #config "=n"); \
} while (0)

static void kmalloc_oob_right(struct kunit *test)
--
2.32.0.rc0.204.g9fa02ecfa5-goog


2021-06-01 15:46:39

by Daniel Latypov

[permalink] [raw]
Subject: Re: [PATCH v2 4/4] kasan: test: make use of kunit_skip()

On Fri, May 28, 2021 at 12:59 AM David Gow <[email protected]> wrote:
>
> From: Marco Elver <[email protected]>
>
> Make use of the recently added kunit_skip() to skip tests, as it permits
> TAP parsers to recognize if a test was deliberately skipped.
>
> Signed-off-by: Marco Elver <[email protected]>
> Signed-off-by: David Gow <[email protected]>

Reviewed-by: Daniel Latypov <[email protected]>


> ---
> lib/test_kasan.c | 12 ++++--------
> 1 file changed, 4 insertions(+), 8 deletions(-)
>
> diff --git a/lib/test_kasan.c b/lib/test_kasan.c
> index cacbbbdef768..0a2029d14c91 100644
> --- a/lib/test_kasan.c
> +++ b/lib/test_kasan.c
> @@ -111,17 +111,13 @@ static void kasan_test_exit(struct kunit *test)
> } while (0)
>
> #define KASAN_TEST_NEEDS_CONFIG_ON(test, config) do { \
> - if (!IS_ENABLED(config)) { \
> - kunit_info((test), "skipping, " #config " required"); \
> - return; \
> - } \
> + if (!IS_ENABLED(config)) \
> + kunit_skip((test), "Test requires " #config "=y"); \
> } while (0)
>
> #define KASAN_TEST_NEEDS_CONFIG_OFF(test, config) do { \
> - if (IS_ENABLED(config)) { \
> - kunit_info((test), "skipping, " #config " enabled"); \
> - return; \
> - } \
> + if (IS_ENABLED(config)) \
> + kunit_skip((test), "Test requires " #config "=n"); \
> } while (0)
>
> static void kmalloc_oob_right(struct kunit *test)
> --
> 2.32.0.rc0.204.g9fa02ecfa5-goog
>

2021-06-02 12:32:02

by Andrey Konovalov

[permalink] [raw]
Subject: Re: [PATCH v2 4/4] kasan: test: make use of kunit_skip()

On Fri, May 28, 2021 at 10:59 AM 'David Gow' via kasan-dev
<[email protected]> wrote:
>
> From: Marco Elver <[email protected]>
>
> Make use of the recently added kunit_skip() to skip tests, as it permits
> TAP parsers to recognize if a test was deliberately skipped.
>
> Signed-off-by: Marco Elver <[email protected]>
> Signed-off-by: David Gow <[email protected]>
> ---
> lib/test_kasan.c | 12 ++++--------
> 1 file changed, 4 insertions(+), 8 deletions(-)
>
> diff --git a/lib/test_kasan.c b/lib/test_kasan.c
> index cacbbbdef768..0a2029d14c91 100644
> --- a/lib/test_kasan.c
> +++ b/lib/test_kasan.c
> @@ -111,17 +111,13 @@ static void kasan_test_exit(struct kunit *test)
> } while (0)
>
> #define KASAN_TEST_NEEDS_CONFIG_ON(test, config) do { \
> - if (!IS_ENABLED(config)) { \
> - kunit_info((test), "skipping, " #config " required"); \
> - return; \
> - } \
> + if (!IS_ENABLED(config)) \
> + kunit_skip((test), "Test requires " #config "=y"); \
> } while (0)
>
> #define KASAN_TEST_NEEDS_CONFIG_OFF(test, config) do { \
> - if (IS_ENABLED(config)) { \
> - kunit_info((test), "skipping, " #config " enabled"); \
> - return; \
> - } \
> + if (IS_ENABLED(config)) \
> + kunit_skip((test), "Test requires " #config "=n"); \
> } while (0)
>
> static void kmalloc_oob_right(struct kunit *test)
> --

Reviewed-by: Andrey Konovalov <[email protected]>