On Sun, Feb 25, 2024 at 09:42:06PM -0600, Lucas De Marchi wrote: > On Sat, Feb 24, 2024 at 01:14:59PM +0100, Arnd Bergmann wrote: > > From: Arnd Bergmann <arnd@xxxxxxxx> > > > > When the driver is built-in but the tests are in loadable modules, > > the helpers don't actually get put into the driver: > > > > ERROR: modpost: "xe_kunit_helper_alloc_xe_device" [drivers/gpu/drm/xe/tests/xe_test.ko] undefined! > > > > Change the Makefile to ensure they are always part of the driver > > even when the rest of the kunit tests are in loadable modules. > > > > The tests/xe_kunit_helpers.c file depends on DRM_KUNIT_TEST_HELPERS, > > so this has to always be selected by the main XE module now, rather > > than the actual tests. In turn, the "depends on (m || (y && KUNIT=y))" > > doesn't really do what it tried and can just be removed. > > it actually did, which was to workaround issues prior to the commit you > are pointing out. What it did was to make sure xe.ko is m, or if it's > built-in, kunit is also built-in. Apparently the problem here is that > the xe_test.ko is missing the symbols. > > See commit 08987a8b6820 ("drm/xe: Fix build with KUNIT=m"). > > I'm happy to remove it though if it's indeed not needed anymore. I think the main issue with that original patch is that it keeps the direct include of the test files. I assume it was done to allow kunit tests of static functions, but now that VISIBLE_IF_KUNIT and EXPORT_SYMBOL_IF_KUNIT are a thing, you don't have the need for that include, and you can build your tests in a module while the code is builtin. And the conversion should be pretty minimal. Maxime
Attachment:
signature.asc
Description: PGP signature