summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJim Meyering <jim@meyering.net>2004-07-06 16:14:40 +0000
committerJim Meyering <jim@meyering.net>2004-07-06 16:14:40 +0000
commit06291f17412f4df85c60e8efc200530f733fe10c (patch)
treeea61d1f0d3450d966ea0cf5c23607614cb73e1b2
parent0206598b8ba65feee0983419292e662f466b0636 (diff)
downloadcoreutils-06291f17412f4df85c60e8efc200530f733fe10c.tar.xz
renamed from ../misc/readline
-rwxr-xr-xtests/readlink/rl-154
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