[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CA+GJov7kyZLFccSyJ9VON_GpE2kvgF9jav8FP7d94amHQQkDmg@mail.gmail.com>
Date: Thu, 21 Aug 2025 15:17:13 -0500
From: Rae Moar <rmoar@...gle.com>
To: David Gow <davidgow@...gle.com>
Cc: Marie Zhussupova <marievic@...gle.com>, marievictoria875@...il.com,
Rodrigo Vivi <rodrigo.vivi@...el.com>, Shuah Khan <skhan@...uxfoundation.org>,
Stephen Rothwell <sfr@...b.auug.org.au>, Linux Next Mailing List <linux-next@...r.kernel.org>,
intel-xe@...ts.freedesktop.org, kunit-dev@...glegroups.com,
linux-kselftest@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH v2 2/2] kunit: Only output a test plan if we're using kunit_array_gen_params
On Thu, Aug 21, 2025 at 8:54 AM David Gow <davidgow@...gle.com> wrote:
>
> In 6a2a027e254b ("kunit: Enable direct registration of parameter arrays to a KUnit test"),
> we now output a test plan for parameterised tests which use parameter
> arrays. This uses the size of the array (via the ARRAY_SIZE macro) to
> determine the number of subtests, which otherwise was indeterminate.
>
> However some tests (particularly xe_pci.check_platform_gt_count) use
> their own gen_params function which further filters the array, resulting
> in the test plan being inaccurate (and hence kunit.py failing).
>
> For now, only print the test plan line if the gen_params function is the
> provided kunit_array_gen_params. Unfortunately, this catches a lot of
> tests which would work, but at least makes sure we don't regress
> anything until we can rework how some of these macros function.
>
> Fixes: 6a2a027e254b ("kunit: Enable direct registration of parameter arrays to a KUnit test")
> Signed-off-by: David Gow <davidgow@...gle.com>
Hello!
This makes sense to me. Maybe we can work on this feature in the future. Thanks!
Reviewed-by: Rae Moar <rmoar@...gle.com>
Thanks!
-Rae
> ---
>
> No changes since v1:
> https://lore.kernel.org/linux-kselftest/20250819073434.1411114-2-davidgow@google.com/
>
> (The change was in patch 1.)
>
> ---
> lib/kunit/test.c | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/lib/kunit/test.c b/lib/kunit/test.c
> index b661407ad0a3..bb66ea1a3eac 100644
> --- a/lib/kunit/test.c
> +++ b/lib/kunit/test.c
> @@ -732,10 +732,12 @@ int kunit_run_tests(struct kunit_suite *suite)
> "KTAP version 1\n");
> kunit_log(KERN_INFO, &test, KUNIT_SUBTEST_INDENT KUNIT_SUBTEST_INDENT
> "# Subtest: %s", test_case->name);
> - if (test.params_array.params)
> + if (test.params_array.params &&
> + test_case->generate_params == kunit_array_gen_params) {
> kunit_log(KERN_INFO, &test, KUNIT_SUBTEST_INDENT
> KUNIT_SUBTEST_INDENT "1..%zd\n",
> test.params_array.num_params);
> + }
>
> while (curr_param) {
> struct kunit param_test = {
> --
> 2.51.0.rc2.233.g662b1ed5c5-goog
>
Powered by blists - more mailing lists