Skip to content

Commit a335544

Browse files
compudjShuah Khan (Samsung OSG)
authored andcommitted
selftests: Fix lib.mk run_tests target shell script
Within run_tests target, the whole script needs to be executed within the same shell and not as separate subshells, so the initial test_num variable set to 0 is still present when executing "test_num=`echo $$test_num+1 | bc`;". Demonstration of the issue (make run_tests): TAP version 13 (standard_in) 1: syntax error selftests: basic_test ======================================== ok 1.. selftests: basic_test [PASS] (standard_in) 1: syntax error selftests: basic_percpu_ops_test ======================================== ok 1.. selftests: basic_percpu_ops_test [PASS] (standard_in) 1: syntax error selftests: param_test ======================================== ok 1.. selftests: param_test [PASS] With fix applied: TAP version 13 selftests: basic_test ======================================== ok 1..1 selftests: basic_test [PASS] selftests: basic_percpu_ops_test ======================================== ok 1..2 selftests: basic_percpu_ops_test [PASS] selftests: param_test ======================================== ok 1..3 selftests: param_test [PASS] Signed-off-by: Mathieu Desnoyers <[email protected]> Fixes: 1f87c7c ("selftests: lib.mk: change RUN_TESTS to print messages in TAP13 format") CC: Shuah Khan <[email protected]> CC: [email protected] Signed-off-by: Shuah Khan (Samsung OSG) <[email protected]>
1 parent 8bf24e8 commit a335544

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

tools/testing/selftests/lib.mk

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,10 @@ all: $(TEST_GEN_PROGS) $(TEST_GEN_PROGS_EXTENDED) $(TEST_GEN_FILES)
2020

2121
.ONESHELL:
2222
define RUN_TESTS
23-
@export KSFT_TAP_LEVEL=`echo 1`;
24-
@test_num=`echo 0`;
25-
@echo "TAP version 13";
26-
@for TEST in $(1); do \
23+
@export KSFT_TAP_LEVEL=`echo 1`; \
24+
test_num=`echo 0`; \
25+
echo "TAP version 13"; \
26+
for TEST in $(1); do \
2727
BASENAME_TEST=`basename $$TEST`; \
2828
test_num=`echo $$test_num+1 | bc`; \
2929
echo "selftests: $$BASENAME_TEST"; \

0 commit comments

Comments
 (0)