Skip to content

Commit a82e076

Browse files
rbmarliereshuahkh
authored andcommitted
selftests/run_kselftest.sh: Resolve BASE_DIR with pwd -P
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> Link: https://lore.kernel.org/r/20260320-selftests-fixes-v1-3-79144f76be01@suse.com Signed-off-by: Shuah Khan <skhan@linuxfoundation.org>
1 parent dbb6153 commit a82e076

1 file changed

Lines changed: 1 addition & 6 deletions

File tree

tools/testing/selftests/run_kselftest.sh

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,7 @@
44
# Run installed kselftest tests.
55
#
66

7-
# Fallback to readlink if realpath is not available
8-
if which realpath > /dev/null; then
9-
BASE_DIR=$(realpath $(dirname $0))
10-
else
11-
BASE_DIR=$(readlink -f $(dirname $0))
12-
fi
7+
BASE_DIR=$(cd "$(dirname "$0")" && pwd -P)
138

149
cd $BASE_DIR
1510
TESTS="$BASE_DIR"/kselftest-list.txt

0 commit comments

Comments
 (0)