From: Janusz Krzysztofik <janusz.krzysztofik@linux.intel.com>
To: Brendan Higgins <brendan.higgins@linux.dev>,
David Gow <davidgow@google.com>
Cc: linux-kernel@vger.kernel.org, igt-dev@lists.freedesktop.org,
linux-kselftest@vger.kernel.org, intel-xe@lists.freedesktop.org,
kunit-dev@googlegroups.com
Subject: [igt-dev] [PATCH v2 1/3] kunit: Report the count of test suites in a module
Date: Mon, 31 Jul 2023 07:45:54 +0200 [thread overview]
Message-ID: <20230731054552.2145292-6-janusz.krzysztofik@linux.intel.com> (raw)
In-Reply-To: <20230731054552.2145292-5-janusz.krzysztofik@linux.intel.com>
According to KTAP specification[1], results should always start from a
header that provides a TAP protocol version, followed by a test plan with
a count of items to be executed. That pattern should be followed at each
nesting level. In the current implementation of the top-most, i.e., test
suite level, those rules apply only for test suites built into the kernel,
executed and reported on boot. Results submitted to dmesg from kunit test
modules loaded later are missing those top-level headers.
As a consequence, if a kunit test module provides more than one test suite
then, without the top level test plan, external tools that are parsing
dmesg for kunit test output are not able to tell how many test suites
should be expected and whether to continue parsing after complete output
from the first test suite is collected.
Submit the top-level headers also from the kunit test module notifier
initialization callback.
[1] https://docs.kernel.org/dev-tools/ktap.html#
Signed-off-by: Janusz Krzysztofik <janusz.krzysztofik@linux.intel.com>
---
lib/kunit/test.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/lib/kunit/test.c b/lib/kunit/test.c
index 84e4666555c94..a29ca1acc4d81 100644
--- a/lib/kunit/test.c
+++ b/lib/kunit/test.c
@@ -729,6 +729,11 @@ EXPORT_SYMBOL_GPL(__kunit_test_suites_exit);
#ifdef CONFIG_MODULES
static void kunit_module_init(struct module *mod)
{
+ if (mod->num_kunit_suites > 0) {
+ pr_info("KTAP version 1\n");
+ pr_info("1..%d\n", mod->num_kunit_suites);
+ }
+
__kunit_test_suites_init(mod->kunit_suites, mod->num_kunit_suites);
}
--
2.41.0
next prev parent reply other threads:[~2023-07-31 5:45 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-07-31 5:45 [igt-dev] [PATCH v2 0/3] kunit: Expose some built-in features to modules Janusz Krzysztofik
2023-07-31 5:45 ` Janusz Krzysztofik [this message]
2023-07-31 5:45 ` [igt-dev] [PATCH v2 2/3] kunit: Make 'list' action available to kunit test modules Janusz Krzysztofik
2023-07-31 5:45 ` [igt-dev] [PATCH v2 3/3] kunit: Allow kunit test modules to use test filtering Janusz Krzysztofik
2023-07-31 8:39 ` kernel test robot
2023-07-31 12:07 ` Janusz Krzysztofik
2023-07-31 6:53 ` [igt-dev] ✗ Fi.CI.BUILD: failure for kunit: Expose some built-in features to modules (rev2) Patchwork
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=20230731054552.2145292-6-janusz.krzysztofik@linux.intel.com \
--to=janusz.krzysztofik@linux.intel.com \
--cc=brendan.higgins@linux.dev \
--cc=davidgow@google.com \
--cc=igt-dev@lists.freedesktop.org \
--cc=intel-xe@lists.freedesktop.org \
--cc=kunit-dev@googlegroups.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-kselftest@vger.kernel.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