Skip to content

Commit 93edbf1

Browse files
broonieshuahkh
authored andcommitted
selftests: Fix runner.sh busybox support
Commit 2964f6b ("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/[email protected] Fixes: 2964f6b ("selftests: Use ktap helpers for runner.sh") Signed-off-by: Mark Brown <[email protected]> Signed-off-by: Shuah Khan <[email protected]>
1 parent cad6f32 commit 93edbf1

1 file changed

Lines changed: 10 additions & 8 deletions

File tree

tools/testing/selftests/kselftest/runner.sh

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,16 @@
22
# SPDX-License-Identifier: GPL-2.0
33
#
44
# 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+
615
export timeout_rc=124
716
export logfile=/dev/stdout
817
export per_test_logging=
@@ -14,13 +23,6 @@ export RUN_IN_NETNS=
1423
# over our soft timeout limit.
1524
export kselftest_default_timeout=45
1625

17-
# There isn't a shell-agnostic way to find the path of a sourced file,
18-
# so we must rely on BASE_DIR being set to find other tools.
19-
if [ -z "$BASE_DIR" ]; then
20-
echo "Error: BASE_DIR must be set before sourcing." >&2
21-
exit 1
22-
fi
23-
2426
TR_CMD=$(command -v tr)
2527

2628
# If Perl is unavailable, we must fall back to line-at-a-time prefixing

0 commit comments

Comments
 (0)