diff options
-rw-r--r-- | tests/functions.sh | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/tests/functions.sh b/tests/functions.sh index a3bb482d8..eee6be352 100644 --- a/tests/functions.sh +++ b/tests/functions.sh @@ -20,6 +20,17 @@ function ts_abspath { pwd } +function ts_canonicalize { + P="$1" + C=$(readlink -f $P) + + if [ -n "$C" ]; then + echo "$C" + else + echo "$P" + fi +} + function ts_skip_subtest { echo " IGNORE ($1)" } @@ -107,6 +118,8 @@ function ts_init_env { LC_ALL="POSIX" CHARSET="UTF-8" + mydir=$(ts_canonicalize "$mydir") + export LANG LANGUAGE LC_ALL CHARSET TS_TOPDIR=$(ts_abspath $mydir/../../) @@ -377,7 +390,7 @@ function ts_device_has_uuid { } function ts_is_mounted { - local DEV=$( readlink -f $1 ) + local DEV=$(ts_canonicalize "$1") if [ ".$DEV" = '.' ]; then DEV=$1 fi |