public inbox for linux-next@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/2] drm/xe/tests: Fix some additional gen_params signatures
@ 2025-08-19  7:34 David Gow
  2025-08-19  7:34 ` [PATCH 2/2] kunit: Only output a test plan if we're using kunit_array_gen_params David Gow
  2025-08-20 18:31 ` [PATCH 1/2] drm/xe/tests: Fix some additional gen_params signatures kernel test robot
  0 siblings, 2 replies; 3+ messages in thread
From: David Gow @ 2025-08-19  7:34 UTC (permalink / raw)
  To: Rae Moar, Marie Zhussupova, marievictoria875, Rodrigo Vivi,
	Shuah Khan
  Cc: David Gow, Stephen Rothwell, Linux Next Mailing List, intel-xe,
	kunit-dev, linux-kselftest, linux-kernel

In 444be9072fca ("kunit: Pass parameterized test context to generate_params()")
prototype used for gen_params functions was changed to add a struct
kunit parameter. However, a few of these used in xe were not updated.

Update these so that the xe_pci tests build and run again.

Fixes: 444be9072fca ("kunit: Pass parameterized test context to generate_params()")
Signed-off-by: David Gow <davidgow@google.com>
---

This should fix the issues found with the linux-next merge:
https://lore.kernel.org/linux-next/20250818120846.347d64b1@canb.auug.org.au/

The following should reproduce them:
./tools/testing/kunit/kunit.py run --arch x86_64 --kunitconfig drivers/gpu/drm/xe

Ideally, these should be squashed into the corresponding commits: let me
know if you'd like me to re-send out the whole series with these fixes
applied.

Cheers,
-- David

---
 drivers/gpu/drm/xe/tests/xe_pci.c      | 12 ++++++------
 drivers/gpu/drm/xe/tests/xe_pci_test.h |  8 ++++----
 2 files changed, 10 insertions(+), 10 deletions(-)

diff --git a/drivers/gpu/drm/xe/tests/xe_pci.c b/drivers/gpu/drm/xe/tests/xe_pci.c
index a65705814b9a..f707e0a54295 100644
--- a/drivers/gpu/drm/xe/tests/xe_pci.c
+++ b/drivers/gpu/drm/xe/tests/xe_pci.c
@@ -44,9 +44,9 @@ KUNIT_ARRAY_PARAM(pci_id, pciidlist, xe_pci_id_kunit_desc);
  *
  * Return: pointer to the next parameter or NULL if no more parameters
  */
-const void *xe_pci_graphics_ip_gen_param(const void *prev, char *desc)
+const void *xe_pci_graphics_ip_gen_param(struct kunit *test, const void *prev, char *desc)
 {
-	return graphics_ip_gen_params(prev, desc);
+	return graphics_ip_gen_params(test, prev, desc);
 }
 EXPORT_SYMBOL_IF_KUNIT(xe_pci_graphics_ip_gen_param);
 
@@ -61,9 +61,9 @@ EXPORT_SYMBOL_IF_KUNIT(xe_pci_graphics_ip_gen_param);
  *
  * Return: pointer to the next parameter or NULL if no more parameters
  */
-const void *xe_pci_media_ip_gen_param(const void *prev, char *desc)
+const void *xe_pci_media_ip_gen_param(struct kunit *test, const void *prev, char *desc)
 {
-	return media_ip_gen_params(prev, desc);
+	return media_ip_gen_params(test, prev, desc);
 }
 EXPORT_SYMBOL_IF_KUNIT(xe_pci_media_ip_gen_param);
 
@@ -78,9 +78,9 @@ EXPORT_SYMBOL_IF_KUNIT(xe_pci_media_ip_gen_param);
  *
  * Return: pointer to the next parameter or NULL if no more parameters
  */
-const void *xe_pci_id_gen_param(const void *prev, char *desc)
+const void *xe_pci_id_gen_param(struct kunit *test, const void *prev, char *desc)
 {
-	const struct pci_device_id *pci = pci_id_gen_params(prev, desc);
+	const struct pci_device_id *pci = pci_id_gen_params(test, prev, desc);
 
 	return pci->driver_data ? pci : NULL;
 }
diff --git a/drivers/gpu/drm/xe/tests/xe_pci_test.h b/drivers/gpu/drm/xe/tests/xe_pci_test.h
index ce4d2b86b778..690b36e6500c 100644
--- a/drivers/gpu/drm/xe/tests/xe_pci_test.h
+++ b/drivers/gpu/drm/xe/tests/xe_pci_test.h
@@ -25,9 +25,9 @@ struct xe_pci_fake_data {
 
 int xe_pci_fake_device_init(struct xe_device *xe);
 
-const void *xe_pci_graphics_ip_gen_param(const void *prev, char *desc);
-const void *xe_pci_media_ip_gen_param(const void *prev, char *desc);
-const void *xe_pci_id_gen_param(const void *prev, char *desc);
-const void *xe_pci_live_device_gen_param(const void *prev, char *desc);
+const void *xe_pci_graphics_ip_gen_param(struct kunit *test, const void *prev, char *desc);
+const void *xe_pci_media_ip_gen_param(struct kunit *test, const void *prev, char *desc);
+const void *xe_pci_id_gen_param(struct kunit *test, const void *prev, char *desc);
+const void *xe_pci_live_device_gen_param(struct kunit *test, const void *prev, char *desc);
 
 #endif
-- 
2.51.0.rc1.167.g924127e9c0-goog


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [PATCH 2/2] kunit: Only output a test plan if we're using kunit_array_gen_params
  2025-08-19  7:34 [PATCH 1/2] drm/xe/tests: Fix some additional gen_params signatures David Gow
@ 2025-08-19  7:34 ` David Gow
  2025-08-20 18:31 ` [PATCH 1/2] drm/xe/tests: Fix some additional gen_params signatures kernel test robot
  1 sibling, 0 replies; 3+ messages in thread
From: David Gow @ 2025-08-19  7:34 UTC (permalink / raw)
  To: Rae Moar, Marie Zhussupova, marievictoria875, Rodrigo Vivi,
	Shuah Khan
  Cc: David Gow, Stephen Rothwell, Linux Next Mailing List, intel-xe,
	kunit-dev, linux-kselftest, linux-kernel

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>
---
 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


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH 1/2] drm/xe/tests: Fix some additional gen_params signatures
  2025-08-19  7:34 [PATCH 1/2] drm/xe/tests: Fix some additional gen_params signatures David Gow
  2025-08-19  7:34 ` [PATCH 2/2] kunit: Only output a test plan if we're using kunit_array_gen_params David Gow
@ 2025-08-20 18:31 ` kernel test robot
  1 sibling, 0 replies; 3+ messages in thread
From: kernel test robot @ 2025-08-20 18:31 UTC (permalink / raw)
  To: David Gow, Rae Moar, Marie Zhussupova, marievictoria875,
	Rodrigo Vivi, Shuah Khan
  Cc: llvm, oe-kbuild-all, David Gow, Linux Next Mailing List, intel-xe,
	kunit-dev, linux-kselftest, linux-kernel

Hi David,

kernel test robot noticed the following build errors:

[auto build test ERROR on shuah-kselftest/kunit]
[also build test ERROR on linus/master v6.17-rc2 next-20250820]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url:    https://github.com/intel-lab-lkp/linux/commits/David-Gow/kunit-Only-output-a-test-plan-if-we-re-using-kunit_array_gen_params/20250819-154731
base:   https://git.kernel.org/pub/scm/linux/kernel/git/shuah/linux-kselftest.git kunit
patch link:    https://lore.kernel.org/r/20250819073434.1411114-1-davidgow%40google.com
patch subject: [PATCH 1/2] drm/xe/tests: Fix some additional gen_params signatures
config: x86_64-randconfig-071-20250820 (https://download.01.org/0day-ci/archive/20250821/202508210248.4CiPvWGD-lkp@intel.com/config)
compiler: clang version 20.1.8 (https://github.com/llvm/llvm-project 87f0227cb60147a26a1eeb4fb06e3b505e9c7261)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20250821/202508210248.4CiPvWGD-lkp@intel.com/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202508210248.4CiPvWGD-lkp@intel.com/

All errors (new ones prefixed by >>):

   In file included from <built-in>:4:
>> drivers/gpu/drm/xe/tests/xe_pci_test.h:28:49: error: declaration of 'struct kunit' will not be visible outside of this function [-Werror,-Wvisibility]
      28 | const void *xe_pci_graphics_ip_gen_param(struct kunit *test, const void *prev, char *desc);
         |                                                 ^
   drivers/gpu/drm/xe/tests/xe_pci_test.h:29:46: error: declaration of 'struct kunit' will not be visible outside of this function [-Werror,-Wvisibility]
      29 | const void *xe_pci_media_ip_gen_param(struct kunit *test, const void *prev, char *desc);
         |                                              ^
   drivers/gpu/drm/xe/tests/xe_pci_test.h:30:40: error: declaration of 'struct kunit' will not be visible outside of this function [-Werror,-Wvisibility]
      30 | const void *xe_pci_id_gen_param(struct kunit *test, const void *prev, char *desc);
         |                                        ^
   drivers/gpu/drm/xe/tests/xe_pci_test.h:31:49: error: declaration of 'struct kunit' will not be visible outside of this function [-Werror,-Wvisibility]
      31 | const void *xe_pci_live_device_gen_param(struct kunit *test, const void *prev, char *desc);
         |                                                 ^
   4 errors generated.


vim +28 drivers/gpu/drm/xe/tests/xe_pci_test.h

    27	
  > 28	const void *xe_pci_graphics_ip_gen_param(struct kunit *test, const void *prev, char *desc);
    29	const void *xe_pci_media_ip_gen_param(struct kunit *test, const void *prev, char *desc);
    30	const void *xe_pci_id_gen_param(struct kunit *test, const void *prev, char *desc);
    31	const void *xe_pci_live_device_gen_param(struct kunit *test, const void *prev, char *desc);
    32	

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2025-08-20 18:31 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-08-19  7:34 [PATCH 1/2] drm/xe/tests: Fix some additional gen_params signatures David Gow
2025-08-19  7:34 ` [PATCH 2/2] kunit: Only output a test plan if we're using kunit_array_gen_params David Gow
2025-08-20 18:31 ` [PATCH 1/2] drm/xe/tests: Fix some additional gen_params signatures kernel test robot

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox