Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

selftests: Fix runner.sh busybox support

Commit 2964f6b816c2 ("selftests: Use ktap helpers for runner.sh") added an
import of ktap_helper.sh to runner.sh in order to standardise on these for
output formatting. Rather than build on the existing requirement for the
user to supply BASE_DIR to find the helpers it uses some magic which
features a use of "readlink -e". Unfortunately the -e option is a GNU
extension and is not available in at least busybox, meaning that runner.sh
starts failing:

./run_kselftest.sh: 5: ./kselftest/runner.sh: Bad substitution
./run_kselftest.sh: 5: .: cannot open ./ktap_helpers.sh: No such file

Fix this by using the already required BASE_DIR to locate the helper
library.

Link: https://lore.kernel.org/r/20260416-selftest-fix-readlink-e-v1-1-94e4cabbdec4@kernel.org
Fixes: 2964f6b816c2 ("selftests: Use ktap helpers for runner.sh")
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Shuah Khan <skhan@linuxfoundation.org>

authored by

Mark Brown and committed by
Shuah Khan
93edbf17 cad6f326

+10 -8
+10 -8
tools/testing/selftests/kselftest/runner.sh
··· 2 2 # SPDX-License-Identifier: GPL-2.0 3 3 # 4 4 # Runs a set of tests in a given subdirectory. 5 - . $(dirname "$(readlink -e "${BASH_SOURCE[0]}")")/ktap_helpers.sh 5 + 6 + # There isn't a shell-agnostic way to find the path of a sourced file, 7 + # so we must rely on BASE_DIR being set to find other tools. 8 + if [ -z "$BASE_DIR" ]; then 9 + echo "Error: BASE_DIR must be set before sourcing." >&2 10 + exit 1 11 + fi 12 + 13 + . ${BASE_DIR}/kselftest/ktap_helpers.sh 14 + 6 15 export timeout_rc=124 7 16 export logfile=/dev/stdout 8 17 export per_test_logging= ··· 22 13 # "timeout" how many seconds to let each test run before running 23 14 # over our soft timeout limit. 24 15 export kselftest_default_timeout=45 25 - 26 - # There isn't a shell-agnostic way to find the path of a sourced file, 27 - # so we must rely on BASE_DIR being set to find other tools. 28 - if [ -z "$BASE_DIR" ]; then 29 - echo "Error: BASE_DIR must be set before sourcing." >&2 30 - exit 1 31 - fi 32 16 33 17 TR_CMD=$(command -v tr) 34 18