public inbox for linux-next@vger.kernel.org 
 help / color / mirror / Atom feed
From: David Gow <davidgow@google•com>
To: Rae Moar <rmoar@google•com>,
	Marie Zhussupova <marievic@google•com>,
	marievictoria875@gmail•com,
	 Rodrigo Vivi <rodrigo.vivi@intel•com>,
	Shuah Khan <skhan@linuxfoundation•org>
Cc: David Gow <davidgow@google•com>,
	Stephen Rothwell <sfr@canb•auug.org.au>,
	 Linux Next Mailing List <linux-next@vger•kernel.org>,
	intel-xe@lists•freedesktop.org,  kunit-dev@googlegroups•com,
	linux-kselftest@vger•kernel.org,  linux-kernel@vger•kernel.org
Subject: [PATCH v2 2/2] kunit: Only output a test plan if we're using kunit_array_gen_params
Date: Thu, 21 Aug 2025 21:54:45 +0800	[thread overview]
Message-ID: <20250821135447.1618942-2-davidgow@google.com> (raw)
In-Reply-To: <20250821135447.1618942-1-davidgow@google.com>

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@google•com>
---

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


  reply	other threads:[~2025-08-21 13:54 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-08-21 13:54 [PATCH v2 1/2] drm/xe/tests: Fix some additional gen_params signatures David Gow
2025-08-21 13:54 ` David Gow [this message]
2025-08-21 20:17   ` [PATCH v2 2/2] kunit: Only output a test plan if we're using kunit_array_gen_params Rae Moar
2025-08-21 20:16 ` [PATCH v2 1/2] drm/xe/tests: Fix some additional gen_params signatures Rae Moar

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=20250821135447.1618942-2-davidgow@google.com \
    --to=davidgow@google$(echo .)com \
    --cc=intel-xe@lists$(echo .)freedesktop.org \
    --cc=kunit-dev@googlegroups$(echo .)com \
    --cc=linux-kernel@vger$(echo .)kernel.org \
    --cc=linux-kselftest@vger$(echo .)kernel.org \
    --cc=linux-next@vger$(echo .)kernel.org \
    --cc=marievic@google$(echo .)com \
    --cc=marievictoria875@gmail$(echo .)com \
    --cc=rmoar@google$(echo .)com \
    --cc=rodrigo.vivi@intel$(echo .)com \
    --cc=sfr@canb$(echo .)auug.org.au \
    --cc=skhan@linuxfoundation$(echo .)org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
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