Skip to content

Commit 1107dc4

Browse files
yosrym93shuahkh
authored andcommitted
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/[email protected] Signed-off-by: Yosry Ahmed <[email protected]> Signed-off-by: Shuah Khan <[email protected]>
1 parent 1efe202 commit 1107dc4

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

tools/testing/selftests/run_kselftest.sh

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,14 @@
33
#
44
# Run installed kselftest tests.
55
#
6-
BASE_DIR=$(realpath $(dirname $0))
6+
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
13+
714
cd $BASE_DIR
815
TESTS="$BASE_DIR"/kselftest-list.txt
916
if [ ! -r "$TESTS" ] ; then

0 commit comments

Comments
 (0)