diff options
Diffstat (limited to 'tests')
-rwxr-xr-x | tests/readlink/rl-1 | 54 |
1 files changed, 54 insertions, 0 deletions
diff --git a/tests/readlink/rl-1 b/tests/readlink/rl-1 new file mode 100755 index 000000000..6ebbe923e --- /dev/null +++ b/tests/readlink/rl-1 @@ -0,0 +1,54 @@ +#!/bin/sh +# test for readlink mode. + +if test "$VERBOSE" = yes; then + set -x + readlink --version +fi + +pwd=`pwd` +t0=`echo "$0" |sed 's,.*/,,'`.tmp; tmp=$t0/$$ +trap 'status=$?; cd $pwd; chmod -R u+rwx $t0; rm -rf $t0 && exit $status' 0 +trap 'status=$?; (exit $status); exit $status' 1 2 13 15 + +fail=1 +while :; do + mkdir -p $tmp || break + cd $tmp || break + + mkdir subdir || break + touch regfile || break + ln -s regfile link1 || break + ln -s missing link2 || break + + fail=0 + break +done + +if test $fail = 1; then + echo "$0: failure in testing framework" 1>&2 + (exit 1); exit 1 +fi + +fail=1 +while :; do + v=`readlink link1` || break + test "$v" = regfile || break + + v=`readlink link2` || break + test "$v" = missing || break + + v=`readlink subdir` && break + test -z "$v" || break + + v=`readlink regfile` && break + test -z "$v" || break + + v=`readlink missing` && break + test -z "$v" || break + + fail=0 + break +done + +(exit $fail); exit $fail |