Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

selftests/bpf: avoid generating untracked files when running bpf selftests #8272

Open
wants to merge 1 commit into
base: bpf-next_base
Choose a base branch
from

Conversation

kernel-patches-daemon-bpf[bot]
Copy link

Pull request for series with
subject: selftests/bpf: avoid generating untracked files when running bpf selftests
version: 1
url: https://patchwork.kernel.org/project/netdevbpf/list/?series=919079

@kernel-patches-daemon-bpf
Copy link
Author

Upstream branch: a7c2051
series: https://patchwork.kernel.org/project/netdevbpf/list/?series=919079
version: 1

@kernel-patches-daemon-bpf
Copy link
Author

Upstream branch: 8eef6ac
series: https://patchwork.kernel.org/project/netdevbpf/list/?series=919079
version: 1

@kernel-patches-daemon-bpf
Copy link
Author

Upstream branch: c5d2bac
series: https://patchwork.kernel.org/project/netdevbpf/list/?series=919079
version: 1

@kernel-patches-daemon-bpf
Copy link
Author

Upstream branch: c5d2bac
series: https://patchwork.kernel.org/project/netdevbpf/list/?series=919079
version: 1

@kernel-patches-daemon-bpf
Copy link
Author

Upstream branch: c5d2bac
series: https://patchwork.kernel.org/project/netdevbpf/list/?series=919079
version: 1

…tests

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

The core reason is our Makefile(tools/testing/selftests/bpf/Makefile)
was written like this:
'''
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 and sub makefile called
like this(tools/testing/selftests/Makefile):
'''
all:
    ...
	$(MAKE) OUTPUT=$$BUILD_TARGET -C $$TARGET
'''

As stated in the GNU make documentation:
'''
An argument that contains '=' specifies the value of a variable: 'v=x'
sets the value of the variable v to x. If you specify a value in this way,
all ordinary assignments of the same variable in the makefile are ignored;
we say they have been overridden by the command line argument.
'''

According to GNU make, we use override Directive to fix this issue:
'''
If you want to set the variable in the makefile even though it was set
with a command argument, you can use an override directive, which is a
line that looks like this:
override variable := value

Link: https://www.gnu.org/software/make/manual/make.html#Override-Directive
Fixes: dc3a880 ("selftests/bpf: Adapt OUTPUT appending logic to lower versions of Make")

Signed-off-by: Jiayuan Chen <mrpre@163.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant