From: Mauro Carvalho Chehab <mchehab@kernel.org>
To: Janusz Krzysztofik <janusz.krzysztofik@linux.intel.com>
Cc: David Gow <davidgow@google.com>,
linux-kernel@vger.kernel.org, igt-dev@lists.freedesktop.org,
Brendan Higgins <brendan.higgins@linux.dev>,
linux-kselftest@vger.kernel.org, intel-xe@lists.freedesktop.org,
kunit-dev@googlegroups.com
Subject: Re: [Intel-xe] [PATCH v3 1/3] kunit: Report the count of test suites in a module
Date: Tue, 1 Aug 2023 15:17:11 +0200 [thread overview]
Message-ID: <20230801151711.2765e2eb@coco.lan> (raw)
In-Reply-To: <20230731141021.2854827-6-janusz.krzysztofik@linux.intel.com>
Em Mon, 31 Jul 2023 16:10:23 +0200
Janusz Krzysztofik <janusz.krzysztofik@linux.intel.com> escreveu:
> 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);
> }
IMO, the best would be instead to export kunit_exec_run_tests() and
use it here too.
Except for the nit, LGTM.
Thanks,
Mauro
WARNING: multiple messages have this Message-ID (diff)
From: Mauro Carvalho Chehab <mchehab@kernel.org>
To: Janusz Krzysztofik <janusz.krzysztofik@linux.intel.com>
Cc: Brendan Higgins <brendan.higgins@linux.dev>,
David Gow <davidgow@google.com>,
linux-kselftest@vger.kernel.org, kunit-dev@googlegroups.com,
igt-dev@lists.freedesktop.org, intel-xe@lists.freedesktop.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH v3 1/3] kunit: Report the count of test suites in a module
Date: Tue, 1 Aug 2023 15:17:11 +0200 [thread overview]
Message-ID: <20230801151711.2765e2eb@coco.lan> (raw)
In-Reply-To: <20230731141021.2854827-6-janusz.krzysztofik@linux.intel.com>
Em Mon, 31 Jul 2023 16:10:23 +0200
Janusz Krzysztofik <janusz.krzysztofik@linux.intel.com> escreveu:
> 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);
> }
IMO, the best would be instead to export kunit_exec_run_tests() and
use it here too.
Except for the nit, LGTM.
Thanks,
Mauro
next prev parent reply other threads:[~2023-08-01 13:17 UTC|newest]
Thread overview: 37+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-07-31 14:10 [igt-dev] [PATCH v3 0/3] kunit: Expose some built-in features to modules Janusz Krzysztofik
2023-07-31 14:10 ` Janusz Krzysztofik
2023-07-31 14:10 ` [Intel-xe] " Janusz Krzysztofik
2023-07-31 14:10 ` [igt-dev] [PATCH v3 1/3] kunit: Report the count of test suites in a module Janusz Krzysztofik
2023-07-31 14:10 ` Janusz Krzysztofik
2023-07-31 14:10 ` [Intel-xe] " Janusz Krzysztofik
2023-08-01 13:17 ` Mauro Carvalho Chehab [this message]
2023-08-01 13:17 ` Mauro Carvalho Chehab
2023-08-01 15:13 ` [Intel-xe] " Janusz Krzysztofik
2023-08-01 15:13 ` Janusz Krzysztofik
2023-08-03 20:57 ` [igt-dev] " Rae Moar
2023-08-03 20:57 ` Rae Moar
2023-08-03 20:57 ` [Intel-xe] " Rae Moar
2023-08-04 9:33 ` [igt-dev] " Janusz Krzysztofik
2023-08-04 9:33 ` Janusz Krzysztofik
2023-08-04 9:33 ` [Intel-xe] " Janusz Krzysztofik
2023-07-31 14:10 ` [igt-dev] [PATCH v3 2/3] kunit: Make 'list' action available to kunit test modules Janusz Krzysztofik
2023-07-31 14:10 ` Janusz Krzysztofik
2023-07-31 14:10 ` [Intel-xe] " Janusz Krzysztofik
2023-08-01 13:21 ` Mauro Carvalho Chehab
2023-08-01 13:21 ` Mauro Carvalho Chehab
2023-08-01 15:18 ` [Intel-xe] " Janusz Krzysztofik
2023-08-01 15:18 ` Janusz Krzysztofik
2023-08-03 21:27 ` [igt-dev] " Rae Moar
2023-08-03 21:27 ` Rae Moar
2023-08-03 21:27 ` [Intel-xe] " Rae Moar
2023-07-31 14:10 ` [igt-dev] [PATCH v3 3/3] kunit: Allow kunit test modules to use test filtering Janusz Krzysztofik
2023-07-31 14:10 ` Janusz Krzysztofik
2023-07-31 14:10 ` [Intel-xe] " Janusz Krzysztofik
2023-07-31 14:15 ` [Intel-xe] ✓ CI.Patch_applied: success for kunit: Expose some built-in features to modules (rev3) Patchwork
2023-07-31 14:15 ` [Intel-xe] ✗ CI.checkpatch: warning " Patchwork
2023-07-31 14:16 ` [Intel-xe] ✓ CI.KUnit: success " Patchwork
2023-07-31 14:20 ` [Intel-xe] ✓ CI.Build: " Patchwork
2023-07-31 14:20 ` [Intel-xe] ✓ CI.Hooks: " Patchwork
2023-07-31 14:22 ` [Intel-xe] ✓ CI.checksparse: " Patchwork
2023-07-31 14:55 ` [igt-dev] ✗ Fi.CI.BUILD: failure " Patchwork
2023-07-31 14:55 ` [Intel-xe] ○ CI.BAT: info " 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=20230801151711.2765e2eb@coco.lan \
--to=mchehab@kernel.org \
--cc=brendan.higgins@linux.dev \
--cc=davidgow@google.com \
--cc=igt-dev@lists.freedesktop.org \
--cc=intel-xe@lists.freedesktop.org \
--cc=janusz.krzysztofik@linux.intel.com \
--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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.