From: Marco Elver <elver@google.com>
To: David Gow <davidgow@google.com>
Cc: Brendan Higgins <brendanhiggins@google.com>,
Alan Maguire <alan.maguire@oracle.com>,
Shuah Khan <skhan@linuxfoundation.org>,
kunit-dev@googlegroups.com, linux-kselftest@vger.kernel.org,
linux-kernel@vger.kernel.org,
Alexander Potapenko <glider@google.com>,
Andrey Konovalov <andreyknvl@gmail.com>,
Dmitry Vyukov <dvyukov@google.com>,
kasan-dev@googlegroups.com
Subject: Re: [PATCH 1/3] kunit: Support skipped tests
Date: Wed, 26 May 2021 11:03:16 +0200 [thread overview]
Message-ID: <YK4O1DkP1/DKzVU5@elver.google.com> (raw)
In-Reply-To: <20210526081112.3652290-1-davidgow@google.com>
On Wed, May 26, 2021 at 01:11AM -0700, David Gow wrote:
> The kunit_mark_skipped() macro marks the current test as "skipped", with
> the provided reason. The kunit_skip() macro will mark the test as
> skipped, and abort the test.
>
> The TAP specification supports this "SKIP directive" as a comment after
> the "ok" / "not ok" for a test. See the "Directives" section of the TAP
> spec for details:
> https://testanything.org/tap-specification.html#directives
>
> The 'success' field for KUnit tests is replaced with a kunit_status
> enum, which can be SUCCESS, FAILURE, or SKIPPED, combined with a
> 'status_comment' containing information on why a test was skipped.
>
> A new 'kunit_status' test suite is added to test this.
>
> Signed-off-by: David Gow <davidgow@google.com>
[...]
> include/kunit/test.h | 68 ++++++++++++++++++++++++++++++++++++++----
> lib/kunit/kunit-test.c | 42 +++++++++++++++++++++++++-
> lib/kunit/test.c | 51 ++++++++++++++++++-------------
> 3 files changed, 134 insertions(+), 27 deletions(-)
Very nice, thank you.
Tested-by: Marco Elver <elver@google.com>
, with the below changes to test_kasan.c. If you would like an immediate
user of kunit_skip(), please feel free to add the below patch to your
series.
Thanks,
-- Marco
------ >8 ------
From: Marco Elver <elver@google.com>
Date: Wed, 26 May 2021 10:43:12 +0200
Subject: [PATCH] kasan: test: make use of kunit_skip()
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 <elver@google.com>
---
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.31.1.818.g46aad6cb9e-goog
next prev parent reply other threads:[~2021-05-26 9:03 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-05-26 8:11 [PATCH 1/3] kunit: Support skipped tests David Gow
2021-05-26 8:11 ` [PATCH 2/3] kunit: tool: Support skipped tests in kunit_tool David Gow
2021-05-26 19:10 ` Daniel Latypov
2021-05-27 8:22 ` David Gow
2021-05-27 19:11 ` Daniel Latypov
2021-05-26 8:11 ` [PATCH 3/3] kunit: test: Add example_skip test suite which is always skipped David Gow
2021-05-26 8:56 ` Marco Elver
2021-05-26 18:29 ` Daniel Latypov
2021-05-26 18:35 ` Marco Elver
2021-05-27 8:21 ` David Gow
2021-05-26 18:58 ` Daniel Latypov
2021-05-26 9:03 ` Marco Elver [this message]
2021-05-27 8:21 ` [PATCH 1/3] kunit: Support skipped tests David Gow
2021-05-26 10:52 ` kernel test robot
2021-05-26 10:54 ` kernel test robot
2021-05-26 12:03 ` kernel test robot
2021-05-26 20:49 ` Daniel Latypov
2021-05-27 8:21 ` David Gow
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=YK4O1DkP1/DKzVU5@elver.google.com \
--to=elver@google.com \
--cc=alan.maguire@oracle.com \
--cc=andreyknvl@gmail.com \
--cc=brendanhiggins@google.com \
--cc=davidgow@google.com \
--cc=dvyukov@google.com \
--cc=glider@google.com \
--cc=kasan-dev@googlegroups.com \
--cc=kunit-dev@googlegroups.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-kselftest@vger.kernel.org \
--cc=skhan@linuxfoundation.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox