[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20250819073434.1411114-2-davidgow@google.com>
Date: Tue, 19 Aug 2025 15:34:33 +0800
From: David Gow <davidgow@...gle.com>
To: Rae Moar <rmoar@...gle.com>, Marie Zhussupova <marievic@...gle.com>, marievictoria875@...il.com,
Rodrigo Vivi <rodrigo.vivi@...el.com>, Shuah Khan <skhan@...uxfoundation.org>
Cc: David Gow <davidgow@...gle.com>, 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: [PATCH 2/2] kunit: Only output a test plan if we're using kunit_array_gen_params
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>
---
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.rc1.167.g924127e9c0-goog
Powered by blists - more mailing lists