Re: [PATCH v2 3/4] selftests: drop KSFT_KHDR_INSTALL make target

From: Anders Roxell
Date: Tue Jul 12 2022 - 05:59:21 EST


On Tue, 12 Jul 2022 at 10:29, Guillaume Tucker
<guillaume.tucker@xxxxxxxxxxxxx> wrote:
>
> Drop the KSFT_KHDR_INSTALL make target now that all use-cases have
> been removed from the other kselftest Makefiles.
>
> Signed-off-by: Guillaume Tucker <guillaume.tucker@xxxxxxxxxxxxx>
> ---
> tools/testing/selftests/Makefile | 1 -
> tools/testing/selftests/lib.mk | 38 --------------------------------
> 2 files changed, 39 deletions(-)
>
> diff --git a/tools/testing/selftests/Makefile b/tools/testing/selftests/Makefile
> index 619451e82863..e060777239a4 100644
> --- a/tools/testing/selftests/Makefile
> +++ b/tools/testing/selftests/Makefile
> @@ -143,7 +143,6 @@ endif
> # Prepare for headers install
> include $(top_srcdir)/scripts/subarch.include
> ARCH ?= $(SUBARCH)
> -export KSFT_KHDR_INSTALL_DONE := 1
> export BUILD
> export KHDR_INCLUDES
>
> diff --git a/tools/testing/selftests/lib.mk b/tools/testing/selftests/lib.mk
> index 2a2d240cdc1b..df5f853951f2 100644
> --- a/tools/testing/selftests/lib.mk
> +++ b/tools/testing/selftests/lib.mk
> @@ -30,45 +30,7 @@ TEST_GEN_PROGS := $(patsubst %,$(OUTPUT)/%,$(TEST_GEN_PROGS))
> TEST_GEN_PROGS_EXTENDED := $(patsubst %,$(OUTPUT)/%,$(TEST_GEN_PROGS_EXTENDED))
> TEST_GEN_FILES := $(patsubst %,$(OUTPUT)/%,$(TEST_GEN_FILES))
>
> -ifdef KSFT_KHDR_INSTALL
> -top_srcdir ?= ../../../..
> -include $(top_srcdir)/scripts/subarch.include
> -ARCH ?= $(SUBARCH)
> -
> -# set default goal to all, so make without a target runs all, even when
> -# all isn't the first target in the file.
> -.DEFAULT_GOAL := all
> -
> -# Invoke headers install with --no-builtin-rules to avoid circular
> -# dependency in "make kselftest" case. In this case, second level
> -# make inherits builtin-rules which will use the rule generate
> -# Makefile.o and runs into
> -# "Circular Makefile.o <- prepare dependency dropped."
> -# and headers_install fails and test compile fails.
> -# O= KBUILD_OUTPUT cases don't run into this error, since main Makefile
> -# invokes them as sub-makes and --no-builtin-rules is not necessary,
> -# but doesn't cause any failures. Keep it simple and use the same
> -# flags in both cases.
> -# Note that the support to install headers from lib.mk is necessary
> -# when test Makefile is run directly with "make -C".
> -# When local build is done, headers are installed in the default
> -# INSTALL_HDR_PATH usr/include.
> -.PHONY: khdr
> -.NOTPARALLEL:
> -khdr:
> -ifndef KSFT_KHDR_INSTALL_DONE
> -ifeq (1,$(DEFAULT_INSTALL_HDR_PATH))
> - $(MAKE) --no-builtin-rules ARCH=$(ARCH) -C $(top_srcdir) headers_install
> -else
> - $(MAKE) --no-builtin-rules INSTALL_HDR_PATH=$$OUTPUT/usr \
> - ARCH=$(ARCH) -C $(top_srcdir) headers_install
> -endif
> -endif
> -
> -all: khdr $(TEST_GEN_PROGS) $(TEST_GEN_PROGS_EXTENDED) $(TEST_GEN_FILES)
> -else
> all: $(TEST_GEN_PROGS) $(TEST_GEN_PROGS_EXTENDED) $(TEST_GEN_FILES)
> -endif
>
> define RUN_TESTS
> BASE_DIR="$(selfdir)"; \

Should this be removed as well, since 'khdr' gets droped from file the lib.mk ?

diff --git a/tools/testing/selftests/landlock/Makefile
b/tools/testing/selftests/landlock/Makefile
index 1313e44e8fb9..99f88c52d61a 100644
--- a/tools/testing/selftests/landlock/Makefile
+++ b/tools/testing/selftests/landlock/Makefile
@@ -13,9 +13,6 @@ include ../lib.mk

khdr_dir = $(top_srcdir)/usr/include

-$(khdr_dir)/linux/landlock.h: khdr
- @:
-
$(OUTPUT)/true: true.c
$(LINK.c) $< $(LDLIBS) -o $@ -static


Cheers,
Anders