On Fri, Aug 29, 2025 at 04:23:06PM +0530, Bala-Vignesh-Reddy wrote: > >>+ifeq ($(KSFT_INCLUDES),) >>+KSFT_INCLUDES := -I../ >>+endif >>+ > >This makes sense, but if we do it for mm/ then we have to >follow this for all subdirectories in selftests.. that might >cause problems if subdirectories are nested ones likes filesystems/. >Duplicating this across all subdir Makefile adds churn and can >lead to errors. > >Another way, is adding `CFLAGS += -I../` as is done in net/Makefile, >but this also doesn't solve the problem completely as this also >remain to relative addressing. > >But, if preferred we can add this snippet in Makefile to >resolve the error temporarily.
Well, maybe I find a way. Since we already get the top_srcdir in lib.mk, sounds we can add the include path directly in lib.mk. Some quick build looks good, not fully tested. diff --git a/tools/testing/selftests/lib.mk b/tools/testing/selftests/lib.mk index 530390033929..1d3d0ad037d7 100644 --- a/tools/testing/selftests/lib.mk +++ b/tools/testing/selftests/lib.mk @@ -199,11 +199,18 @@ clean: $(if $(TEST_GEN_MODS_DIR),clean_mods_dir) # Build with _GNU_SOURCE by default CFLAGS += -D_GNU_SOURCE= +CFLAGS += -I${top_srcdir}/tools/testing/selftests + # Enables to extend CFLAGS and LDFLAGS from command line, e.g. # make USERCFLAGS=-Werror USERLDFLAGS=-static CFLAGS += $(USERCFLAGS) LDFLAGS += $(USERLDFLAGS) > >Thanks, >Bala Vignesh -- Wei Yang Help you, Help me