drm/i915: reimplement header test feature
authorMasahiro Yamada <yamada.masahiro@socionext.com>
Thu, 19 Dec 2019 15:56:52 +0000 (17:56 +0200)
committerJani Nikula <jani.nikula@intel.com>
Thu, 2 Jan 2020 10:24:10 +0000 (12:24 +0200)
I implemented a small build rule in drivers/gpu/drm/i915/Makefile
without relying on the special header-test-y syntax that was removed in
commit fcbb8461fd23 ("kbuild: remove header compile test").

I excluded some headers from the test coverage. I hope somebody
intrested can take a closer look at them.

Dummy subdir Makefiles can be removed altogether as single target build
use case is now covered by commit 394053f4a4b3 ("kbuild: make single
targets work more correctly").

v2 by Jani:
- add selftests/i915_perf_selftests.h to no-header-test
- add .gitignore for *.hdrtest

Cc: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Masahiro Yamada <yamada.masahiro@socionext.com>
Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
Signed-off-by: Jani Nikula <jani.nikula@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20191219155652.2666-3-jani.nikula@intel.com
drivers/gpu/drm/i915/.gitignore [new file with mode: 0644]
drivers/gpu/drm/i915/Makefile
drivers/gpu/drm/i915/display/Makefile [deleted file]
drivers/gpu/drm/i915/gem/Makefile [deleted file]
drivers/gpu/drm/i915/gt/Makefile [deleted file]
drivers/gpu/drm/i915/gt/uc/Makefile [deleted file]
drivers/gpu/drm/i915/oa/Makefile [deleted file]

diff --git a/drivers/gpu/drm/i915/.gitignore b/drivers/gpu/drm/i915/.gitignore
new file mode 100644 (file)
index 0000000..d9a77f3
--- /dev/null
@@ -0,0 +1 @@
+*.hdrtest
index b0c53661f62bb1758ad6e4e4d5bf41152ed4db92..1a2fad832a4d7e756c31cc14900c485ecbfa8430 100644 (file)
@@ -31,9 +31,6 @@ CFLAGS_display/intel_fbdev.o = $(call cc-disable-warning, override-init)
 subdir-ccflags-y += \
        $(call as-instr,movntdqa (%eax)$(comma)%xmm0,-DCONFIG_AS_MOVNTDQA)
 
-# Extra header tests
-header-test-pattern-$(CONFIG_DRM_I915_WERROR) := *.h
-
 subdir-ccflags-y += -I$(srctree)/$(src)
 
 # Please keep these build lists sorted!
@@ -73,7 +70,6 @@ i915-$(CONFIG_DEBUG_FS) += i915_debugfs.o display/intel_pipe_crc.o
 i915-$(CONFIG_PERF_EVENTS) += i915_pmu.o
 
 # "Graphics Technology" (aka we talk to the gpu)
-obj-y += gt/
 gt-y += \
        gt/debugfs_engines.o \
        gt/debugfs_gt.o \
@@ -111,7 +107,6 @@ gt-y += \
 i915-y += $(gt-y)
 
 # GEM (Graphics Execution Management) code
-obj-y += gem/
 gem-y += \
        gem/i915_gem_busy.o \
        gem/i915_gem_clflush.o \
@@ -157,7 +152,6 @@ i915-y += \
          intel_wopcm.o
 
 # general-purpose microcontroller (GuC) support
-obj-y += gt/uc/
 i915-y += gt/uc/intel_uc.o \
          gt/uc/intel_uc_fw.o \
          gt/uc/intel_guc.o \
@@ -170,7 +164,6 @@ i915-y += gt/uc/intel_uc.o \
          gt/uc/intel_huc_fw.o
 
 # modesetting core code
-obj-y += display/
 i915-y += \
        display/intel_atomic.o \
        display/intel_atomic_plane.o \
@@ -235,7 +228,6 @@ i915-y += \
        display/vlv_dsi_pll.o
 
 # perf code
-obj-y += oa/
 i915-y += \
        oa/i915_oa_hsw.o \
        oa/i915_oa_bdw.o \
@@ -276,3 +268,33 @@ endif
 
 obj-$(CONFIG_DRM_I915) += i915.o
 obj-$(CONFIG_DRM_I915_GVT_KVMGT) += gvt/kvmgt.o
+
+# header test
+
+# exclude some broken headers from the test coverage
+no-header-test := \
+       display/intel_vbt_defs.h \
+       gem/selftests/huge_gem_object.h \
+       gem/selftests/mock_gem_object.h \
+       gvt/execlist.h \
+       gvt/fb_decoder.h \
+       gvt/gtt.h \
+       gvt/gvt.h \
+       gvt/interrupt.h \
+       gvt/mmio_context.h \
+       gvt/mpt.h \
+       gvt/scheduler.h \
+       selftests/i915_live_selftests.h \
+       selftests/i915_mock_selftests.h \
+       selftests/i915_perf_selftests.h \
+       selftests/igt_live_test.h
+
+extra-$(CONFIG_DRM_I915_WERROR) += \
+       $(patsubst %.h,%.hdrtest, $(filter-out $(no-header-test), \
+               $(shell cd $(srctree)/$(src) && find * -name '*.h')))
+
+quiet_cmd_hdrtest = HDRTEST $(patsubst %.hdrtest,%.h,$@)
+      cmd_hdrtest = $(CC) $(c_flags) -S -o /dev/null -x c /dev/null -include $<; touch $@
+
+$(obj)/%.hdrtest: $(src)/%.h FORCE
+       $(call if_changed_dep,hdrtest)
diff --git a/drivers/gpu/drm/i915/display/Makefile b/drivers/gpu/drm/i915/display/Makefile
deleted file mode 100644 (file)
index 173c305..0000000
+++ /dev/null
@@ -1,6 +0,0 @@
-# For building individual subdir files on the command line
-subdir-ccflags-y += -I$(srctree)/$(src)/..
-
-# Extra header tests
-header-test-pattern-$(CONFIG_DRM_I915_WERROR) := *.h
-header-test- := intel_vbt_defs.h
diff --git a/drivers/gpu/drm/i915/gem/Makefile b/drivers/gpu/drm/i915/gem/Makefile
deleted file mode 100644 (file)
index 7e73aa5..0000000
+++ /dev/null
@@ -1,5 +0,0 @@
-# For building individual subdir files on the command line
-subdir-ccflags-y += -I$(srctree)/$(src)/..
-
-# Extra header tests
-header-test-pattern-$(CONFIG_DRM_I915_WERROR) := *.h
diff --git a/drivers/gpu/drm/i915/gt/Makefile b/drivers/gpu/drm/i915/gt/Makefile
deleted file mode 100644 (file)
index 7e73aa5..0000000
+++ /dev/null
@@ -1,5 +0,0 @@
-# For building individual subdir files on the command line
-subdir-ccflags-y += -I$(srctree)/$(src)/..
-
-# Extra header tests
-header-test-pattern-$(CONFIG_DRM_I915_WERROR) := *.h
diff --git a/drivers/gpu/drm/i915/gt/uc/Makefile b/drivers/gpu/drm/i915/gt/uc/Makefile
deleted file mode 100644 (file)
index bec94d4..0000000
+++ /dev/null
@@ -1,5 +0,0 @@
-# For building individual subdir files on the command line
-subdir-ccflags-y += -I$(srctree)/$(src)/../..
-
-# Extra header tests
-header-test-pattern-$(CONFIG_DRM_I915_WERROR) := *.h
diff --git a/drivers/gpu/drm/i915/oa/Makefile b/drivers/gpu/drm/i915/oa/Makefile
deleted file mode 100644 (file)
index df028e2..0000000
+++ /dev/null
@@ -1,7 +0,0 @@
-# SPDX-License-Identifier: MIT
-
-# For building individual subdir files on the command line
-subdir-ccflags-y += -I$(srctree)/$(src)/..
-
-# Extra header tests
-header-test-pattern-$(CONFIG_DRM_I915_WERROR) := *.h