Skip to content

Commit 43c6437

Browse files
mcgrofShuah Khan
authored andcommitted
selftests: warn if failure is due to lack of executable bit
Executing selftests is fragile as if someone forgot to set a secript as executable the test will fail, and you won't know for sure if the failure was caused by the lack of proper permissions or something else. Setting scripts as executable is required, this also enable folks to execute selftests as independent units. Signed-off-by: Luis R. Rodriguez <[email protected]> Signed-off-by: Shuah Khan <[email protected]>
1 parent c0bb2cf commit 43c6437

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

tools/testing/selftests/lib.mk

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,12 @@ all: $(TEST_GEN_PROGS) $(TEST_GEN_PROGS_EXTENDED) $(TEST_GEN_FILES)
1414
define RUN_TESTS
1515
@for TEST in $(TEST_GEN_PROGS) $(TEST_PROGS); do \
1616
BASENAME_TEST=`basename $$TEST`; \
17-
cd `dirname $$TEST`; (./$$BASENAME_TEST && echo "selftests: $$BASENAME_TEST [PASS]") || echo "selftests: $$BASENAME_TEST [FAIL]"; cd -;\
17+
if [ ! -x $$BASENAME_TEST ]; then \
18+
echo "selftests: Warning: file $$BASENAME_TEST is not executable, correct this.";\
19+
echo "selftests: $$BASENAME_TEST [FAIL]"; \
20+
else \
21+
cd `dirname $$TEST`; (./$$BASENAME_TEST && echo "selftests: $$BASENAME_TEST [PASS]") || echo "selftests: $$BASENAME_TEST [FAIL]"; cd -;\
22+
fi; \
1823
done;
1924
endef
2025

0 commit comments

Comments
 (0)