]> git.ipfire.org Git - thirdparty/linux.git/commit
selftests/bpf: Avoid generating untracked files when running bpf selftests
authorJiayuan Chen <mrpre@163.com>
Tue, 24 Dec 2024 07:59:57 +0000 (15:59 +0800)
committerDaniel Borkmann <daniel@iogearbox.net>
Mon, 6 Jan 2025 14:02:03 +0000 (15:02 +0100)
commit73b9075f334f5debf28646884a320b796b27768d
treeb6f238b91ab6aacdbca765dee7e8ee17f5c16907
parent96ea081ed52bf077cad6d00153b6fba68e510767
selftests/bpf: Avoid generating untracked files when running bpf selftests

Currently, when we run the BPF selftests with the following command:

  make -C tools/testing/selftests TARGETS=bpf SKIP_TARGETS=""

The command generates untracked files and directories with make version
less than 4.4:

'''
Untracked files:
  (use "git add <file>..." to include in what will be committed)
tools/testing/selftests/bpfFEATURE-DUMP.selftests
tools/testing/selftests/bpffeature/
'''

We lost slash after word "bpf". The reason is slash appending code is as
follow:

'''
OUTPUT := $(OUTPUT)/
$(eval include ../../../build/Makefile.feature)
OUTPUT := $(patsubst %/,%,$(OUTPUT))
'''

This way of assigning values to OUTPUT will never be effective for the
variable OUTPUT provided via the command argument [1] and BPF makefile
is called from parent Makfile(tools/testing/selftests/Makefile) like:

'''
all:
  ...
$(MAKE) OUTPUT=$$BUILD_TARGET -C $$TARGET
'''

According to GNU make, we can use override Directive to fix this issue [2].

  [1] https://www.gnu.org/software/make/manual/make.html#Overriding
  [2] https://www.gnu.org/software/make/manual/make.html#Override-Directive

Fixes: dc3a8804d790 ("selftests/bpf: Adapt OUTPUT appending logic to lower versions of Make")
Signed-off-by: Jiayuan Chen <mrpre@163.com>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Acked-by: Jiri Olsa <jolsa@kernel.org>
Link: https://lore.kernel.org/bpf/20241224075957.288018-1-mrpre@163.com
tools/testing/selftests/bpf/Makefile