public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH bpf-next v2] selftests/bpf: avoid generating untracked files when running bpf selftests
@ 2024-12-24  7:59 Jiayuan Chen
  2024-12-29 21:40 ` Jiri Olsa
  2025-01-06 14:10 ` patchwork-bot+netdevbpf
  0 siblings, 2 replies; 3+ messages in thread
From: Jiayuan Chen @ 2024-12-24  7:59 UTC (permalink / raw)
  To: bpf
  Cc: martin.lau, ast, edumazet, jakub, davem, dsahern, kuba, pabeni,
	linux-kernel, song, john.fastabend, andrii, mhal, yonghong.song,
	daniel, xiyou.wangcong, horms, eddyz87, mykolal, kpsingh, sdf,
	haoluo, jolsa, shuah, pulehui, Jiayuan Chen

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>

---
v1->v2: fix patchwork check fail.
---
---
 tools/testing/selftests/bpf/Makefile | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/tools/testing/selftests/bpf/Makefile b/tools/testing/selftests/bpf/Makefile
index 9e870e519c30..eb4d21651aa7 100644
--- a/tools/testing/selftests/bpf/Makefile
+++ b/tools/testing/selftests/bpf/Makefile
@@ -202,9 +202,9 @@ ifeq ($(shell expr $(MAKE_VERSION) \>= 4.4), 1)
 $(let OUTPUT,$(OUTPUT)/,\
 	$(eval include ../../../build/Makefile.feature))
 else
-OUTPUT := $(OUTPUT)/
+override OUTPUT := $(OUTPUT)/
 $(eval include ../../../build/Makefile.feature)
-OUTPUT := $(patsubst %/,%,$(OUTPUT))
+override OUTPUT := $(patsubst %/,%,$(OUTPUT))
 endif
 endif
 
-- 
2.43.5


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH bpf-next v2] selftests/bpf: avoid generating untracked files when running bpf selftests
  2024-12-24  7:59 [PATCH bpf-next v2] selftests/bpf: avoid generating untracked files when running bpf selftests Jiayuan Chen
@ 2024-12-29 21:40 ` Jiri Olsa
  2025-01-06 14:10 ` patchwork-bot+netdevbpf
  1 sibling, 0 replies; 3+ messages in thread
From: Jiri Olsa @ 2024-12-29 21:40 UTC (permalink / raw)
  To: Jiayuan Chen
  Cc: bpf, martin.lau, ast, edumazet, jakub, davem, dsahern, kuba,
	pabeni, linux-kernel, song, john.fastabend, andrii, mhal,
	yonghong.song, daniel, xiyou.wangcong, horms, eddyz87, mykolal,
	kpsingh, sdf, haoluo, shuah, pulehui

On Tue, Dec 24, 2024 at 03:59:57PM +0800, Jiayuan Chen wrote:
> 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>

lgtm, tested with make 4.3

Acked-by: Jiri Olsa <jolsa@kernel.org>

jirka


> 
> ---
> v1->v2: fix patchwork check fail.
> ---
> ---
>  tools/testing/selftests/bpf/Makefile | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/tools/testing/selftests/bpf/Makefile b/tools/testing/selftests/bpf/Makefile
> index 9e870e519c30..eb4d21651aa7 100644
> --- a/tools/testing/selftests/bpf/Makefile
> +++ b/tools/testing/selftests/bpf/Makefile
> @@ -202,9 +202,9 @@ ifeq ($(shell expr $(MAKE_VERSION) \>= 4.4), 1)
>  $(let OUTPUT,$(OUTPUT)/,\
>  	$(eval include ../../../build/Makefile.feature))
>  else
> -OUTPUT := $(OUTPUT)/
> +override OUTPUT := $(OUTPUT)/
>  $(eval include ../../../build/Makefile.feature)
> -OUTPUT := $(patsubst %/,%,$(OUTPUT))
> +override OUTPUT := $(patsubst %/,%,$(OUTPUT))
>  endif
>  endif
>  
> -- 
> 2.43.5
> 

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH bpf-next v2] selftests/bpf: avoid generating untracked files when running bpf selftests
  2024-12-24  7:59 [PATCH bpf-next v2] selftests/bpf: avoid generating untracked files when running bpf selftests Jiayuan Chen
  2024-12-29 21:40 ` Jiri Olsa
@ 2025-01-06 14:10 ` patchwork-bot+netdevbpf
  1 sibling, 0 replies; 3+ messages in thread
From: patchwork-bot+netdevbpf @ 2025-01-06 14:10 UTC (permalink / raw)
  To: Jiayuan Chen
  Cc: bpf, martin.lau, ast, edumazet, jakub, davem, dsahern, kuba,
	pabeni, linux-kernel, song, john.fastabend, andrii, mhal,
	yonghong.song, daniel, xiyou.wangcong, horms, eddyz87, mykolal,
	kpsingh, sdf, haoluo, jolsa, shuah, pulehui

Hello:

This patch was applied to bpf/bpf-next.git (master)
by Daniel Borkmann <daniel@iogearbox.net>:

On Tue, 24 Dec 2024 15:59:57 +0800 you wrote:
> 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".
> 
> [...]

Here is the summary with links:
  - [bpf-next,v2] selftests/bpf: avoid generating untracked files when running bpf selftests
    https://git.kernel.org/bpf/bpf-next/c/73b9075f334f

You are awesome, thank you!
-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2025-01-06 14:10 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-12-24  7:59 [PATCH bpf-next v2] selftests/bpf: avoid generating untracked files when running bpf selftests Jiayuan Chen
2024-12-29 21:40 ` Jiri Olsa
2025-01-06 14:10 ` patchwork-bot+netdevbpf

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox