[PATCH v2 1/5] drm/ttm: Update Makefile for KUnit

Karolina Stolarek karolina.stolarek at intel.com
Mon Sep 11 10:17:56 UTC 2023


Update Makefile so it can produce a module that consists of TTM tests.
This will allow us to test non-exported functions when KUnit tests
are built as a module. Remove the tests' Makefile.

Signed-off-by: Karolina Stolarek <karolina.stolarek at intel.com>
Reported-by: kernel test robot <lkp at intel.com>
Closes: https://lore.kernel.org/oe-kbuild-all/202309010358.50gYLkmw-lkp@intel.com/
Closes: https://lore.kernel.org/oe-kbuild-all/202309011134.bwvpuyOj-lkp@intel.com/
Closes: https://lore.kernel.org/oe-kbuild-all/202309011935.bBpezbUQ-lkp@intel.com/
---
 drivers/gpu/drm/ttm/Makefile       | 18 +++++++++++++-----
 drivers/gpu/drm/ttm/tests/Makefile |  6 ------
 2 files changed, 13 insertions(+), 11 deletions(-)
 delete mode 100644 drivers/gpu/drm/ttm/tests/Makefile

diff --git a/drivers/gpu/drm/ttm/Makefile b/drivers/gpu/drm/ttm/Makefile
index dad298127226..6322a33e65ed 100644
--- a/drivers/gpu/drm/ttm/Makefile
+++ b/drivers/gpu/drm/ttm/Makefile
@@ -2,10 +2,18 @@
 #
 # Makefile for the drm device driver.  This driver provides support for the
 
-ttm-y := ttm_tt.o ttm_bo.o ttm_bo_util.o ttm_bo_vm.o ttm_module.o \
-	ttm_execbuf_util.o ttm_range_manager.o ttm_resource.o ttm_pool.o \
-	ttm_device.o ttm_sys_manager.o
+ttm := ttm_tt.o ttm_bo.o ttm_bo_util.o ttm_bo_vm.o ttm_module.o \
+       ttm_execbuf_util.o ttm_range_manager.o ttm_resource.o ttm_pool.o \
+       ttm_device.o ttm_sys_manager.o
+obj-$(CONFIG_DRM_TTM) += $(ttm)
 ttm-$(CONFIG_AGP) += ttm_agp_backend.o
 
-obj-$(CONFIG_DRM_TTM) += ttm.o
-obj-$(CONFIG_DRM_TTM_KUNIT_TEST) += tests/
+ttm-tests := tests/ttm_kunit_helpers.o tests/ttm_device_test.o \
+             tests/ttm_pool_test.o
+
+ifeq ($(CONFIG_DRM_TTM_KUNIT_TEST),m)
+    ttm-test-objs := $(ttm) $(ttm-tests)
+    obj-m := ttm-test.o
+else
+    obj-$(CONFIG_DRM_TTM_KUNIT_TEST) += $(ttm-tests)
+endif
diff --git a/drivers/gpu/drm/ttm/tests/Makefile b/drivers/gpu/drm/ttm/tests/Makefile
deleted file mode 100644
index ec87c4fc1ad5..000000000000
--- a/drivers/gpu/drm/ttm/tests/Makefile
+++ /dev/null
@@ -1,6 +0,0 @@
-# SPDX-License-Identifier: GPL-2.0 AND MIT
-
-obj-$(CONFIG_DRM_TTM_KUNIT_TEST) += \
-        ttm_device_test.o \
-        ttm_pool_test.o \
-        ttm_kunit_helpers.o
-- 
2.25.1



More information about the dri-devel mailing list