public inbox for linux-kselftest@vger.kernel.org
 help / color / mirror / Atom feed
From: Mark Brown <broonie@kernel.org>
To: Shuah Khan <shuah@kernel.org>, Hangbin Liu <liuhangbin@gmail.com>,
	 Brendan Jackman <jackmanb@google.com>
Cc: Shuah Khan <skhan@linuxfoundation.org>,
	linux-kselftest@vger.kernel.org,  linux-kernel@vger.kernel.org,
	Mark Brown <broonie@kernel.org>
Subject: [PATCH 1/2] selftests: Fix runner.sh busybox support
Date: Thu, 16 Apr 2026 20:03:58 +0100	[thread overview]
Message-ID: <20260416-selftest-fix-readlink-e-v1-1-94e4cabbdec4@kernel.org> (raw)
In-Reply-To: <20260416-selftest-fix-readlink-e-v1-0-94e4cabbdec4@kernel.org>

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.

Fixes: 2964f6b816c2 ("selftests: Use ktap helpers for runner.sh")
Signed-off-by: Mark Brown <broonie@kernel.org>
---
 tools/testing/selftests/kselftest/runner.sh | 18 ++++++++++--------
 1 file changed, 10 insertions(+), 8 deletions(-)

diff --git a/tools/testing/selftests/kselftest/runner.sh b/tools/testing/selftests/kselftest/runner.sh
index 3eeec93c9da4..4dfc4271e4ec 100644
--- a/tools/testing/selftests/kselftest/runner.sh
+++ b/tools/testing/selftests/kselftest/runner.sh
@@ -2,7 +2,16 @@
 # SPDX-License-Identifier: GPL-2.0
 #
 # Runs a set of tests in a given subdirectory.
-. $(dirname "$(readlink -e "${BASH_SOURCE[0]}")")/ktap_helpers.sh
+
+# There isn't a shell-agnostic way to find the path of a sourced file,
+# so we must rely on BASE_DIR being set to find other tools.
+if [ -z "$BASE_DIR" ]; then
+	echo "Error: BASE_DIR must be set before sourcing." >&2
+	exit 1
+fi
+
+. ${BASE_DIR}/kselftest/ktap_helpers.sh
+
 export timeout_rc=124
 export logfile=/dev/stdout
 export per_test_logging=
@@ -13,13 +22,6 @@ export RUN_IN_NETNS=
 # over our soft timeout limit.
 export kselftest_default_timeout=45
 
-# There isn't a shell-agnostic way to find the path of a sourced file,
-# so we must rely on BASE_DIR being set to find other tools.
-if [ -z "$BASE_DIR" ]; then
-	echo "Error: BASE_DIR must be set before sourcing." >&2
-	exit 1
-fi
-
 TR_CMD=$(command -v tr)
 
 # If Perl is unavailable, we must fall back to line-at-a-time prefixing

-- 
2.47.3


  reply	other threads:[~2026-04-16 19:04 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-04-16 19:03 [PATCH 0/2] selftests: Fix runner.sh breakage Mark Brown
2026-04-16 19:03 ` Mark Brown [this message]
2026-04-16 19:03 ` [PATCH 2/2] selftests: Fix runner.sh for non-bash shells Mark Brown
2026-04-16 21:14 ` [PATCH 0/2] selftests: Fix runner.sh breakage Shuah Khan

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260416-selftest-fix-readlink-e-v1-1-94e4cabbdec4@kernel.org \
    --to=broonie@kernel.org \
    --cc=jackmanb@google.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-kselftest@vger.kernel.org \
    --cc=liuhangbin@gmail.com \
    --cc=shuah@kernel.org \
    --cc=skhan@linuxfoundation.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox