From: "Ricardo B. Marlière" <rbm@suse.com>
To: Shuah Khan <shuah@kernel.org>,
Nathan Chancellor <nathan@kernel.org>,
Nicolas Schier <nsc@kernel.org>
Cc: linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org,
linux-kbuild@vger.kernel.org,
"Ricardo B. Marlière" <rbm@suse.com>
Subject: [PATCH 3/6] selftests/run_kselftest.sh: Resolve BASE_DIR with pwd -P
Date: Fri, 20 Mar 2026 15:29:18 -0300 [thread overview]
Message-ID: <20260320-selftests-fixes-v1-3-79144f76be01@suse.com> (raw)
In-Reply-To: <20260320-selftests-fixes-v1-0-79144f76be01@suse.com>
run_kselftest.sh only needs to canonicalize the directory containing the
script itself. Use shell-native path resolution for that by changing into
the directory and calling pwd -P.
This avoids depending on either realpath or readlink -f while still
producing a physical absolute path for BASE_DIR.
Signed-off-by: Ricardo B. Marlière <rbm@suse.com>
---
tools/testing/selftests/run_kselftest.sh | 7 +------
1 file changed, 1 insertion(+), 6 deletions(-)
diff --git a/tools/testing/selftests/run_kselftest.sh b/tools/testing/selftests/run_kselftest.sh
index b782b025d002..5f7bce9a640b 100755
--- a/tools/testing/selftests/run_kselftest.sh
+++ b/tools/testing/selftests/run_kselftest.sh
@@ -4,12 +4,7 @@
# Run installed kselftest tests.
#
-# Fallback to readlink if realpath is not available
-if which realpath > /dev/null; then
- BASE_DIR=$(realpath $(dirname $0))
-else
- BASE_DIR=$(readlink -f $(dirname $0))
-fi
+BASE_DIR=$(cd "$(dirname "$0")" && pwd -P)
cd "$BASE_DIR"
TESTS="$BASE_DIR"/kselftest-list.txt
--
2.53.0
next prev parent reply other threads:[~2026-03-20 18:29 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-03-20 18:29 [PATCH 0/6] selftests: run_kselftest.sh cleanup and fixes Ricardo B. Marlière
2026-03-20 18:29 ` [PATCH 1/6] selftests/run_kselftest.sh: Remove unused $ROOT Ricardo B. Marlière
2026-03-20 18:29 ` [PATCH 2/6] selftests/run_kselftest.sh: Add missing quotes Ricardo B. Marlière
2026-03-20 18:29 ` Ricardo B. Marlière [this message]
2026-03-20 18:29 ` [PATCH 4/6] selftests/run_kselftest.sh: Allow choosing per-test log directory Ricardo B. Marlière
2026-03-20 18:29 ` [PATCH 5/6] selftests: Preserve subtarget failures in all/install Ricardo B. Marlière
2026-03-20 18:29 ` [PATCH 6/6] kbuild: remove kselftest output in mrproper Ricardo B. Marlière
2026-04-10 19:19 ` Shuah Khan
2026-04-11 12:49 ` Ricardo B. Marlière
2026-04-13 15:58 ` Shuah Khan
2026-04-13 16:22 ` Ricardo B. Marlière
2026-03-31 22:43 ` [PATCH 0/6] selftests: run_kselftest.sh cleanup and fixes Shuah Khan
2026-04-01 11:45 ` Ricardo B. Marlière
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=20260320-selftests-fixes-v1-3-79144f76be01@suse.com \
--to=rbm@suse.com \
--cc=linux-kbuild@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-kselftest@vger.kernel.org \
--cc=nathan@kernel.org \
--cc=nsc@kernel.org \
--cc=shuah@kernel.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