aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorYosry Ahmed <yosry.ahmed@linux.dev>2025-03-18 16:05:10 +0000
committerShuah Khan <skhan@linuxfoundation.org>2025-05-15 16:52:47 -0600
commit1107dc4c5b06188a3fb4897ceb197eb320a52e85 (patch)
tree42f898006cab38b018146c41b703feca401b2ed2
parentselftests/timens: timerfd: Use correct clockid type in tclock_gettime() (diff)
downloadwireguard-linux-1107dc4c5b06188a3fb4897ceb197eb320a52e85.tar.xz
wireguard-linux-1107dc4c5b06188a3fb4897ceb197eb320a52e85.zip
selftests/run_kselftest.sh: Use readlink if realpath is not available
'realpath' is not always available, fallback to 'readlink -f' if is not available. They seem to work equally well in this context. Link: https://lore.kernel.org/r/20250318160510.3441646-1-yosry.ahmed@linux.dev Signed-off-by: Yosry Ahmed <yosry.ahmed@linux.dev> Signed-off-by: Shuah Khan <skhan@linuxfoundation.org>
-rwxr-xr-xtools/testing/selftests/run_kselftest.sh9
1 files changed, 8 insertions, 1 deletions
diff --git a/tools/testing/selftests/run_kselftest.sh b/tools/testing/selftests/run_kselftest.sh
index 50e03eefe7ac..0443beacf362 100755
--- a/tools/testing/selftests/run_kselftest.sh
+++ b/tools/testing/selftests/run_kselftest.sh
@@ -3,7 +3,14 @@
#
# Run installed kselftest tests.
#
-BASE_DIR=$(realpath $(dirname $0))
+
+# 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
+
cd $BASE_DIR
TESTS="$BASE_DIR"/kselftest-list.txt
if [ ! -r "$TESTS" ] ; then