Skip to contentSkip to conversation

selftests: fix prepending $(OUTPUT) to $(TEST_PROGS)

PATCH Superseded Ilya Leoshkevich 2 participants 2 messages Sep 3, 2019 – Sep 6, 2019 Kselftest

v1 of 4 Superseded Latest is v4 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 selftests: fix prepending $(OUTPUT) to $(TEST_PROGS)

The current logic prepends $(OUTPUT) only to the first member of $(TEST_PROGS). Use $(foreach) loop to prepend it to each member.

Fixes 1a940687e424 ("selftests: lib.mk: copy test scripts and test files for make O=dir run")
---
 tools/testing/selftests/lib.mk | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
tools/testing/selftests/lib.mk +2 -1
index 1c8a1963d03f..857916ebbb9b 100644
@@ -75,7 +75,8 @@ ifdef building_out_of_srctree
 		@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))
+		$(call RUN_TESTS, $(TEST_GEN_PROGS) $(TEST_CUSTOM_PROGS) \
+				  $(foreach p,$(TEST_PROGS),$(OUTPUT)$(p)))
 	else
 		$(call RUN_TESTS, $(TEST_GEN_PROGS) $(TEST_CUSTOM_PROGS))
 	fi
Signature · 1 line
2.21.0
maintainer
#1 lore raw
Quoted 15 lines · Ilya Leoshkevich

The current logic prepends $(OUTPUT) only to the first member of $(TEST_PROGS). Use $(foreach) loop to prepend it to each member.

Fixes 1a940687e424 ("selftests: lib.mk: copy test scripts and test files for make O=dir run")
---
  tools/testing/selftests/lib.mk | 3 ++-
  1 file changed, 2 insertions(+), 1 deletion(-)
tools/testing/selftests/lib.mk +0 -0
index 1c8a1963d03f..857916ebbb9b 100644

tools/testing/selftests/lib.mk ifdef building_out_of_srctree · line 82

Quoted 9 lines
tools/testing/selftests/lib.mk +2 -1
@@ -75,7 +75,8 @@ ifdef building_out_of_srctree
  		@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))
+		$(call RUN_TESTS, $(TEST_GEN_PROGS) $(TEST_CUSTOM_PROGS) \
+				  $(foreach p,$(TEST_PROGS),$(OUTPUT)$(p)))
  	else
  		$(call RUN_TESTS, $(TEST_GEN_PROGS) $(TEST_CUSTOM_PROGS))
  	fi

Hmm. with this patch there is a regression:

make kselftest O=/tmp/kselftest TARGETS=splice

fails for me with

TAP version 13
1..1
# selftests: splice: splicedefault_file_splice_read.sh
# Warning: file /tmp/kselftest/splicedefault_file_splice_read.sh is missing! not ok 1 selftests: splice: splicedefault_file_splice_read.sh make[1]: Leaving directory '/tmp/kselftest'

Without your patch works just fine:

make kselftest O=/tmp/kselftest TARGETS=splice
make[1]: Entering directory '/tmp/kselftest'

make --no-builtin-rules INSTALL_HDR_PATH=$BUILD/usr \
	ARCH=x86 -C ../../.. headers_install

INSTALL /tmp/kselftest/usr/include
gcc default_file_splice_read.c -o /tmp/kselftest/splice/default_file_splice_read
TAP version 13
1..1
# selftests: splice: default_file_splice_read.sh ok 1 selftests: splice: default_file_splice_read.sh make[1]: Leaving directory '/tmp/kselftest'

thanks,
-- Shuah