Re: [PATCH net-next v14 13/13] selftests: add ncdevmem, netcat for devmem TCP

Jakub Kicinski
2024-06-27T20:38:12Z

On Thu, 27 Jun 2024 12:55:38 -0700 Mina Almasry wrote:
> `git clean -fdx && make headers_install && make -C
> ./tools/testing/selftests/net` works
>
> `git clean -fdx && make headers_install && make -C
> ./tools/testing/selftests/net ncdevmem` doesn't work with this error:

Hm, I haven't tested this exact combination. Makefiles are fun!

I think in this case you're just hitting the built-in make rule,
you're not exercising our Makefile logic much. This should make
it work:

diff --git a/tools/testing/selftests/lib.mk
b/tools/testing/selftests/lib.mk index 429535816dbd..a274ae8cd72b 100644
--- a/tools/testing/selftests/lib.mk
+++ b/tools/testing/selftests/lib.mk
@@ -45,7 +45,7 @@ endif # LLVM

ifeq (0,$(MAKELEVEL))
ifeq ($(OUTPUT),)
- OUTPUT := $(shell pwd)
+ OUTPUT := .
DEFAULT_INSTALL_HDR_PATH := 1
endif
endif

But it will probably break the makefile for others?

All our targets are defined (or magically redefined) as $(OUTPUT)/name
if you call make directly OUTPUT is not defined, so our rules would
mathc on /name, which obviously doesn't exist. Adding OUTPUT=. on
command line would also work (I think):

make -C ./tools/testing/selftests/net OUTPUT=. ncdevmem

Another option would be for OUTPUT to contain the trailing /, always,
to avoid the /name problem, but:

$ git grep '$(OUTPUT)/' -- tools/testing/selftests/ | wc -l
414

so good luck changing that :(

Long story short what you're trying doesn't really appear to be
supported by kselftest makefile infra, so don't worry about it.