diff mbox series

drm/client: Build the tests with CONFIG_DRM_KUNIT_TEST=m

Message ID 20250303094808.11860-1-ville.syrjala@linux.intel.com (mailing list archive)
State New
Headers show
Series drm/client: Build the tests with CONFIG_DRM_KUNIT_TEST=m | expand

Commit Message

Ville Syrjälä March 3, 2025, 9:48 a.m. UTC
From: Ville Syrjälä <ville.syrjala@linux.intel.com>

Use IS_ENABLED() to check for CONFIG_DRM_KUNIT_TEST so
that it picks up the modular case as well.

Cc: Maxime Ripard <mripard@kernel.org>
Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
---
 drivers/gpu/drm/drm_client_modeset.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Jani Nikula March 3, 2025, 11:03 a.m. UTC | #1
On Mon, 03 Mar 2025, Ville Syrjala <ville.syrjala@linux.intel.com> wrote:
> From: Ville Syrjälä <ville.syrjala@linux.intel.com>
>
> Use IS_ENABLED() to check for CONFIG_DRM_KUNIT_TEST so
> that it picks up the modular case as well.
>
> Cc: Maxime Ripard <mripard@kernel.org>
> Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>

Reviewed-by: Jani Nikula <jani.nikula@intel.com>

> ---
>  drivers/gpu/drm/drm_client_modeset.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/drm_client_modeset.c b/drivers/gpu/drm/drm_client_modeset.c
> index aca442c25209..27471a4eef21 100644
> --- a/drivers/gpu/drm/drm_client_modeset.c
> +++ b/drivers/gpu/drm/drm_client_modeset.c
> @@ -1268,6 +1268,6 @@ int drm_client_modeset_dpms(struct drm_client_dev *client, int mode)
>  }
>  EXPORT_SYMBOL(drm_client_modeset_dpms);
>  
> -#ifdef CONFIG_DRM_KUNIT_TEST
> +#if IS_ENABLED(CONFIG_DRM_KUNIT_TEST)
>  #include "tests/drm_client_modeset_test.c"
>  #endif
Maxime Ripard March 3, 2025, 12:06 p.m. UTC | #2
On Mon, Mar 03, 2025 at 11:48:08AM +0200, Ville Syrjala wrote:
> From: Ville Syrjälä <ville.syrjala@linux.intel.com>
> 
> Use IS_ENABLED() to check for CONFIG_DRM_KUNIT_TEST so
> that it picks up the modular case as well.
> 
> Cc: Maxime Ripard <mripard@kernel.org>
> Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>

Acked-by: Maxime Ripard <mripard@kernel.org>

Maxime
Ville Syrjälä March 3, 2025, 12:26 p.m. UTC | #3
On Mon, Mar 03, 2025 at 11:52:32AM -0000, Patchwork wrote:
> == Series Details ==
> 
> Series: drm/client: Build the tests with CONFIG_DRM_KUNIT_TEST=m
> URL   : https://patchwork.freedesktop.org/series/145707/
> State : failure
> 
> == Summary ==
> 
> Error: make failed
>   CALL    scripts/checksyscalls.sh
>   DESCEND objtool
>   INSTALL libsubcmd_headers
>   CHK     kernel/kheaders_data.tar.xz
>   HDRTEST drivers/gpu/drm/xe/generated/xe_wa_oob.h
>   UPD     include/generated/utsversion.h
>   CC      init/version-timestamp.o
>   KSYMS   .tmp_vmlinux0.kallsyms.S
>   AS      .tmp_vmlinux0.kallsyms.o
>   LD      .tmp_vmlinux1
> ld: drivers/gpu/drm/drm_client_modeset.o: in function `drm_test_pick_cmdline_named':
> /home/kbuild/kernel/drivers/gpu/drm/tests/drm_client_modeset_test.c:142:(.text+0x3c9): undefined reference to `drm_helper_probe_single_connector_modes'

That comes from drm_kms_helper.ko, but drm_client* goes into
drm.ko. So this looks like a circular dependency :/

> ld: /home/kbuild/kernel/drivers/gpu/drm/tests/drm_client_modeset_test.c:136:(.text+0x4b1): undefined reference to `kunit_unary_assert_format'

No idea what is going on with these. Should be coming via CONFIG_KUNT
and we do seem to depend on that.
kernel test robot March 3, 2025, 1:41 p.m. UTC | #4
Hi Ville,

kernel test robot noticed the following build errors:

[auto build test ERROR on drm-exynos/exynos-drm-next]
[also build test ERROR on linus/master v6.14-rc5]
[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/Ville-Syrjala/drm-client-Build-the-tests-with-CONFIG_DRM_KUNIT_TEST-m/20250303-175715
base:   https://git.kernel.org/pub/scm/linux/kernel/git/daeinki/drm-exynos.git exynos-drm-next
patch link:    https://lore.kernel.org/r/20250303094808.11860-1-ville.syrjala%40linux.intel.com
patch subject: [PATCH] drm/client: Build the tests with CONFIG_DRM_KUNIT_TEST=m
config: riscv-randconfig-002-20250303 (https://download.01.org/0day-ci/archive/20250303/202503032114.TQkZ0b7R-lkp@intel.com/config)
compiler: riscv32-linux-gcc (GCC) 14.2.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20250303/202503032114.TQkZ0b7R-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/202503032114.TQkZ0b7R-lkp@intel.com/

All errors (new ones prefixed by >>):

   riscv32-linux-ld: drivers/gpu/drm/drm_client_modeset.o: in function `drm_client_modeset_test_init':
>> drivers/gpu/drm/tests/drm_client_modeset_test.c:59:(.text.drm_client_modeset_test_init+0xa4): undefined reference to `drm_kunit_helper_alloc_device'
   riscv32-linux-ld: drivers/gpu/drm/drm_client_modeset.o: in function `__drm_kunit_helper_alloc_drm_device':
>> include/drm/drm_kunit_helpers.h:63:(.text.drm_client_modeset_test_init+0x198): undefined reference to `__drm_kunit_helper_alloc_drm_device_with_driver'


vim +59 drivers/gpu/drm/tests/drm_client_modeset_test.c

8fc0380f6ba7e9 Maxime Ripard 2022-11-14  52  
8fc0380f6ba7e9 Maxime Ripard 2022-11-14  53  static int drm_client_modeset_test_init(struct kunit *test)
8fc0380f6ba7e9 Maxime Ripard 2022-11-14  54  {
8fc0380f6ba7e9 Maxime Ripard 2022-11-14  55  	struct drm_client_modeset_test_priv *priv;
8fc0380f6ba7e9 Maxime Ripard 2022-11-14  56  	int ret;
8fc0380f6ba7e9 Maxime Ripard 2022-11-14  57  
8fc0380f6ba7e9 Maxime Ripard 2022-11-14  58  	priv = kunit_kzalloc(test, sizeof(*priv), GFP_KERNEL);
8fc0380f6ba7e9 Maxime Ripard 2022-11-14 @59  	KUNIT_ASSERT_NOT_NULL(test, priv);
8fc0380f6ba7e9 Maxime Ripard 2022-11-14  60  
8fc0380f6ba7e9 Maxime Ripard 2022-11-14  61  	test->priv = priv;
8fc0380f6ba7e9 Maxime Ripard 2022-11-14  62  
9ecd8045bf64f8 Maxime Ripard 2022-12-01  63  	priv->dev = drm_kunit_helper_alloc_device(test);
9ecd8045bf64f8 Maxime Ripard 2022-12-01  64  	KUNIT_ASSERT_NOT_ERR_OR_NULL(test, priv->dev);
9ecd8045bf64f8 Maxime Ripard 2022-12-01  65  
a9143c5852a7a1 Maxime Ripard 2022-12-01  66  	priv->drm = __drm_kunit_helper_alloc_drm_device(test, priv->dev,
a9143c5852a7a1 Maxime Ripard 2022-12-01  67  							sizeof(*priv->drm), 0,
a9143c5852a7a1 Maxime Ripard 2022-12-01  68  							DRIVER_MODESET);
8fc0380f6ba7e9 Maxime Ripard 2022-11-14  69  	KUNIT_ASSERT_NOT_ERR_OR_NULL(test, priv->drm);
8fc0380f6ba7e9 Maxime Ripard 2022-11-14  70  
8fc0380f6ba7e9 Maxime Ripard 2022-11-14  71  	ret = drmm_connector_init(priv->drm, &priv->connector,
8fc0380f6ba7e9 Maxime Ripard 2022-11-14  72  				  &drm_client_modeset_connector_funcs,
8fc0380f6ba7e9 Maxime Ripard 2022-11-14  73  				  DRM_MODE_CONNECTOR_Unknown,
8fc0380f6ba7e9 Maxime Ripard 2022-11-14  74  				  NULL);
8fc0380f6ba7e9 Maxime Ripard 2022-11-14  75  	KUNIT_ASSERT_EQ(test, ret, 0);
8fc0380f6ba7e9 Maxime Ripard 2022-11-14  76  
8fc0380f6ba7e9 Maxime Ripard 2022-11-14  77  	drm_connector_helper_add(&priv->connector, &drm_client_modeset_connector_helper_funcs);
8fc0380f6ba7e9 Maxime Ripard 2022-11-14  78  
fedcaf726f542b Maxime Ripard 2022-11-17  79  	priv->connector.interlace_allowed = true;
fedcaf726f542b Maxime Ripard 2022-11-17  80  	priv->connector.doublescan_allowed = true;
fedcaf726f542b Maxime Ripard 2022-11-17  81  
8fc0380f6ba7e9 Maxime Ripard 2022-11-14  82  	return 0;
8fc0380f6ba7e9 Maxime Ripard 2022-11-14  83  }
8fc0380f6ba7e9 Maxime Ripard 2022-11-14  84
diff mbox series

Patch

diff --git a/drivers/gpu/drm/drm_client_modeset.c b/drivers/gpu/drm/drm_client_modeset.c
index aca442c25209..27471a4eef21 100644
--- a/drivers/gpu/drm/drm_client_modeset.c
+++ b/drivers/gpu/drm/drm_client_modeset.c
@@ -1268,6 +1268,6 @@  int drm_client_modeset_dpms(struct drm_client_dev *client, int mode)
 }
 EXPORT_SYMBOL(drm_client_modeset_dpms);
 
-#ifdef CONFIG_DRM_KUNIT_TEST
+#if IS_ENABLED(CONFIG_DRM_KUNIT_TEST)
 #include "tests/drm_client_modeset_test.c"
 #endif