drm/xe/tests: Fix some additional gen_params signatures
Subsystems (5)
PATCH 1/2 drm/xe/tests: Fix some additional gen_params signatures
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.
---
This should fix the issues found with the linux-next merge:
https://lore.kernel.org/linux-next/[email protected]/
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(-)
drivers/gpu/drm/xe/tests/xe_pci.c +6 -6
@@ -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 ; }
drivers/gpu/drm/xe/tests/xe_pci_test.h +4 -4
@@ -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
Signature · 1 line
2.51.0.rc1.167.g924127e9c0-goog
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.
--- lib/kunit/test.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
lib/kunit/test.c +3 -1
@@ -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_INDENTKUNIT_SUBTEST_INDENT "1..%zd\n" , test.params_array.num_params); + }while (curr_param) {struct kunit param_test = {
Signature · 1 line
2.51.0.rc1.167.g924127e9c0-goog
kernel test robot
build botkernel test robot noticed the following build errors:
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/[email protected]/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/[email protected]/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 <[email protected]>
| Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/
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 Signature · 2 lines
0-DAY CI Kernel Test Service https://github.com/intel/lkp-tests/wiki