bpf.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [RESEND PATCH 0/3] selftests: lib.mk improvements
@ 2020-05-27  7:16 Yauheni Kaliuta
  2020-05-27  7:16 ` [RESEND PATCH 1/3] selftests: do not use .ONESHELL Yauheni Kaliuta
  0 siblings, 1 reply; 4+ messages in thread
From: Yauheni Kaliuta @ 2020-05-27  7:16 UTC (permalink / raw)
  To: linux-kselftest; +Cc: jbenc, Shuah Khan, bpf

Fix 
make[1]: execvp: /bin/sh: Argument list too long

encountered with some shells and a couple of more potential problems
in that part of code.

Yauheni Kaliuta (3):
  selftests: do not use .ONESHELL
  selftests: fix condition in run_tests
  selftests: simplify run_tests

 tools/testing/selftests/lib.mk | 19 ++++++-------------
 1 file changed, 6 insertions(+), 13 deletions(-)

-- 
2.26.2


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

* [RESEND PATCH 1/3] selftests: do not use .ONESHELL
  2020-05-27  7:16 [RESEND PATCH 0/3] selftests: lib.mk improvements Yauheni Kaliuta
@ 2020-05-27  7:16 ` Yauheni Kaliuta
  2020-05-27  7:16   ` [RESEND PATCH 2/3] selftests: fix condition in run_tests Yauheni Kaliuta
  2020-05-27  7:16   ` [RESEND PATCH 3/3] selftests: simplify run_tests Yauheni Kaliuta
  0 siblings, 2 replies; 4+ messages in thread
From: Yauheni Kaliuta @ 2020-05-27  7:16 UTC (permalink / raw)
  To: linux-kselftest; +Cc: jbenc, Shuah Khan, bpf

Using one shell for the whole recipe with long lists can cause

make[1]: execvp: /bin/sh: Argument list too long

with some shells. Triggered by commit 309b81f0fdc4 ("selftests/bpf:
Install generated test progs")

It requires to change the rule which rely on the one shell
behaviour (run_tests).

Simplify also INSTALL_SINGLE_RULE, remove extra echo, required to
workaround .ONESHELL.

Signed-off-by: Yauheni Kaliuta <yauheni.kaliuta@redhat.com>
Cc: Jiri Benc <jbenc@redhat.com>
Cc: Shuah Khan <shuah@kernel.org>
---
 tools/testing/selftests/lib.mk | 20 +++++++++-----------
 1 file changed, 9 insertions(+), 11 deletions(-)

diff --git a/tools/testing/selftests/lib.mk b/tools/testing/selftests/lib.mk
index b0556c752443..5b82433d88e3 100644
--- a/tools/testing/selftests/lib.mk
+++ b/tools/testing/selftests/lib.mk
@@ -59,9 +59,8 @@ else
 all: $(TEST_GEN_PROGS) $(TEST_GEN_PROGS_EXTENDED) $(TEST_GEN_FILES)
 endif
 
-.ONESHELL:
 define RUN_TESTS
-	@BASE_DIR="$(selfdir)";			\
+	BASE_DIR="$(selfdir)";			\
 	. $(selfdir)/kselftest/runner.sh;	\
 	if [ "X$(summary)" != "X" ]; then       \
 		per_test_logging=1;		\
@@ -71,22 +70,21 @@ endef
 
 run_tests: all
 ifdef building_out_of_srctree
-	@if [ "X$(TEST_PROGS) $(TEST_PROGS_EXTENDED) $(TEST_FILES)" != "X" ]; then
-		@rsync -aq $(TEST_PROGS) $(TEST_PROGS_EXTENDED) $(TEST_FILES) $(OUTPUT)
+	@if [ "X$(TEST_PROGS) $(TEST_PROGS_EXTENDED) $(TEST_FILES)" != "X" ]; then \
+		rsync -aq $(TEST_PROGS) $(TEST_PROGS_EXTENDED) $(TEST_FILES) $(OUTPUT); \
 	fi
-	@if [ "X$(TEST_PROGS)" != "X" ]; then
-		$(call RUN_TESTS, $(TEST_GEN_PROGS) $(TEST_CUSTOM_PROGS) $(OUTPUT)/$(TEST_PROGS))
-	else
-		$(call RUN_TESTS, $(TEST_GEN_PROGS) $(TEST_CUSTOM_PROGS))
+	@if [ "X$(TEST_PROGS)" != "X" ]; then \
+		$(call RUN_TESTS, $(TEST_GEN_PROGS) $(TEST_CUSTOM_PROGS) $(OUTPUT)/$(TEST_PROGS)) ; \
+	else \
+		$(call RUN_TESTS, $(TEST_GEN_PROGS) $(TEST_CUSTOM_PROGS)); \
 	fi
 else
-	$(call RUN_TESTS, $(TEST_GEN_PROGS) $(TEST_CUSTOM_PROGS) $(TEST_PROGS))
+	@$(call RUN_TESTS, $(TEST_GEN_PROGS) $(TEST_CUSTOM_PROGS) $(TEST_PROGS))
 endif
 
 define INSTALL_SINGLE_RULE
 	$(if $(INSTALL_LIST),@mkdir -p $(INSTALL_PATH))
-	$(if $(INSTALL_LIST),@echo rsync -a $(INSTALL_LIST) $(INSTALL_PATH)/)
-	$(if $(INSTALL_LIST),@rsync -a $(INSTALL_LIST) $(INSTALL_PATH)/)
+	$(if $(INSTALL_LIST),rsync -a $(INSTALL_LIST) $(INSTALL_PATH)/)
 endef
 
 define INSTALL_RULE
-- 
2.26.2


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

* [RESEND PATCH 2/3] selftests: fix condition in run_tests
  2020-05-27  7:16 ` [RESEND PATCH 1/3] selftests: do not use .ONESHELL Yauheni Kaliuta
@ 2020-05-27  7:16   ` Yauheni Kaliuta
  2020-05-27  7:16   ` [RESEND PATCH 3/3] selftests: simplify run_tests Yauheni Kaliuta
  1 sibling, 0 replies; 4+ messages in thread
From: Yauheni Kaliuta @ 2020-05-27  7:16 UTC (permalink / raw)
  To: linux-kselftest; +Cc: jbenc, Shuah Khan, bpf

The check if there are any files to install in case of no files
compares "X  " with "X" so never false.

Remove extra spaces. It may make sense to use make's $(if) function
here.

Signed-off-by: Yauheni Kaliuta <yauheni.kaliuta@redhat.com>
---
 tools/testing/selftests/lib.mk | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/testing/selftests/lib.mk b/tools/testing/selftests/lib.mk
index 5b82433d88e3..7a17ea815736 100644
--- a/tools/testing/selftests/lib.mk
+++ b/tools/testing/selftests/lib.mk
@@ -70,7 +70,7 @@ endef
 
 run_tests: all
 ifdef building_out_of_srctree
-	@if [ "X$(TEST_PROGS) $(TEST_PROGS_EXTENDED) $(TEST_FILES)" != "X" ]; then \
+	@if [ "X$(TEST_PROGS)$(TEST_PROGS_EXTENDED)$(TEST_FILES)" != "X" ]; then \
 		rsync -aq $(TEST_PROGS) $(TEST_PROGS_EXTENDED) $(TEST_FILES) $(OUTPUT); \
 	fi
 	@if [ "X$(TEST_PROGS)" != "X" ]; then \
-- 
2.26.2


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

* [RESEND PATCH 3/3] selftests: simplify run_tests
  2020-05-27  7:16 ` [RESEND PATCH 1/3] selftests: do not use .ONESHELL Yauheni Kaliuta
  2020-05-27  7:16   ` [RESEND PATCH 2/3] selftests: fix condition in run_tests Yauheni Kaliuta
@ 2020-05-27  7:16   ` Yauheni Kaliuta
  1 sibling, 0 replies; 4+ messages in thread
From: Yauheni Kaliuta @ 2020-05-27  7:16 UTC (permalink / raw)
  To: linux-kselftest; +Cc: jbenc, Shuah Khan, bpf

Remove redundant check for TEST_PROGS and use the same command for
in- and out-of-source builds, and

fix bug with adding $(OUTPUT)/ to first $(TEST_PROGS) element only:

1) use $(addprefix ...) function to add $(OUTPUT). In case of blank
$(TEST_PROGS) it will be expanded to blank, so no need for extra
check;

2) $(OUTPUT) is always initialized to current dir or supplied value,
so it does not make any harm to add it unconditionally.

Signed-off-by: Yauheni Kaliuta <yauheni.kaliuta@redhat.com>
---
 tools/testing/selftests/lib.mk | 9 ++-------
 1 file changed, 2 insertions(+), 7 deletions(-)

diff --git a/tools/testing/selftests/lib.mk b/tools/testing/selftests/lib.mk
index 7a17ea815736..fac4f7de37fb 100644
--- a/tools/testing/selftests/lib.mk
+++ b/tools/testing/selftests/lib.mk
@@ -73,14 +73,9 @@ ifdef building_out_of_srctree
 	@if [ "X$(TEST_PROGS)$(TEST_PROGS_EXTENDED)$(TEST_FILES)" != "X" ]; then \
 		rsync -aq $(TEST_PROGS) $(TEST_PROGS_EXTENDED) $(TEST_FILES) $(OUTPUT); \
 	fi
-	@if [ "X$(TEST_PROGS)" != "X" ]; then \
-		$(call RUN_TESTS, $(TEST_GEN_PROGS) $(TEST_CUSTOM_PROGS) $(OUTPUT)/$(TEST_PROGS)) ; \
-	else \
-		$(call RUN_TESTS, $(TEST_GEN_PROGS) $(TEST_CUSTOM_PROGS)); \
-	fi
-else
-	@$(call RUN_TESTS, $(TEST_GEN_PROGS) $(TEST_CUSTOM_PROGS) $(TEST_PROGS))
 endif
+	@$(call RUN_TESTS, $(TEST_GEN_PROGS) $(TEST_CUSTOM_PROGS) \
+			   $(addprefix $(OUTPUT)/,$(TEST_PROGS)))
 
 define INSTALL_SINGLE_RULE
 	$(if $(INSTALL_LIST),@mkdir -p $(INSTALL_PATH))
-- 
2.26.2


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

end of thread, other threads:[~2020-05-27  7:17 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-05-27  7:16 [RESEND PATCH 0/3] selftests: lib.mk improvements Yauheni Kaliuta
2020-05-27  7:16 ` [RESEND PATCH 1/3] selftests: do not use .ONESHELL Yauheni Kaliuta
2020-05-27  7:16   ` [RESEND PATCH 2/3] selftests: fix condition in run_tests Yauheni Kaliuta
2020-05-27  7:16   ` [RESEND PATCH 3/3] selftests: simplify run_tests Yauheni Kaliuta

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).