summaryrefslogtreecommitdiff
path: root/tests/ln/misc
diff options
context:
space:
mode:
authorJim Meyering <jim@meyering.net>1998-03-14 16:25:42 +0000
committerJim Meyering <jim@meyering.net>1998-03-14 16:25:42 +0000
commit17070ae7bf5476458af49685fb55a1f225ca6137 (patch)
tree0c0acedc48259bb78c33356d315cd4bae4a461a2 /tests/ln/misc
parenta1cc8f59617de2d90d1e7c810230aacd7594087d (diff)
downloadcoreutils-17070ae7bf5476458af49685fb55a1f225ca6137.tar.xz
.
Diffstat (limited to 'tests/ln/misc')
-rwxr-xr-xtests/ln/misc89
1 files changed, 89 insertions, 0 deletions
diff --git a/tests/ln/misc b/tests/ln/misc
new file mode 100755
index 000000000..f3b39efec
--- /dev/null
+++ b/tests/ln/misc
@@ -0,0 +1,89 @@
+#!/bin/sh
+
+PATH=../../../src:$PATH
+tmp=t2-ln.$$
+
+test_failure=0
+mkdir $tmp || test_failure=1
+cd $tmp || test_failure=1
+
+if test $test_failure = 1; then
+ echo 'failure in testing framework'
+ exit 1
+fi
+
+
+t=tln-symlink
+d=tln-subdir
+ld=tln-symlink-to-subdir
+f=tln-file
+fail=0
+
+# Create a simple symlink with both source and destination files
+# in current directory.
+touch $f || test_failure=1
+rm -f $t || test_failure=1
+ln -s $f $t || fail=1
+test -f $t || fail=1
+rm $t $f
+
+# Create a symlink with source file and explicit destination directory/file.
+touch $f || test_failure=1
+rm -rf $d || test_failure=1
+mkdir $d || test_failure=1
+ln -s ../$f $d/$t || fail=1
+test -f $d/$t || fail=1
+rm -rf $d $f
+
+# Create a symlink with source file and destination directory.
+touch $f || test_failure=1
+rm -rf $d || test_failure=1
+mkdir $d || test_failure=1
+ln -s ../$f $d || fail=1
+test -f $d/$f || fail=1
+rm -rf $d $f
+
+# Make sure we get a failure with existing dest without -f option
+touch $t || test_failure=1
+# FIXME: don't ignore the error message but rather test
+# it to make sure it's the right one.
+ln -s $t $t 2> /dev/null && fail=1
+rm $t
+
+# Make sure -sf fails when src and dest are the same
+touch $t && test_failure=1
+ln -sf $t $t 2> /dev/null && fail=1
+rm $t
+
+# Create a symlink with source file and no explicit directory
+rm -rf $d || test_failure=1
+mkdir $d || test_failure=1
+touch $d/$f || test_failure=1
+ln -s $d/$f || fail=1
+test -f $f || fail=1
+rm -rf $d $f
+
+# Create a symlink with source file and destination symlink-to-directory.
+rm -rf $d $f $ld || test_failure=1
+touch $f || test_failure=1
+mkdir $d || test_failure=1
+ln -s $d $ld
+ln -s ../$f $ld || fail=1
+test -f $d/$f || fail=1
+rm -rf $d $f $ld
+
+# Create a symlink with source file and destination symlink-to-directory.
+# BUT use the new --no-dereference option.
+rm -rf $d $f $ld || test_failure=1
+touch $f || test_failure=1
+mkdir $d || test_failure=1
+ln -s $d $ld
+af=`pwd`/$f
+ln --no-dereference -fs $af $ld || fail=1
+test -f $ld || fail=1
+rm -rf $d $f $ld
+
+cd ..
+rm -rf $tmp
+
+exit $fail