A test suite that calls unsafe_symlink() directly to see how it
authorMartin Pool <mbp@samba.org>
Mon, 8 Apr 2002 04:47:01 +0000 (04:47 +0000)
committerMartin Pool <mbp@samba.org>
Mon, 8 Apr 2002 04:47:01 +0000 (04:47 +0000)
handles different strings.

testsuite/unsafe-byname.test [new file with mode: 0644]

diff --git a/testsuite/unsafe-byname.test b/testsuite/unsafe-byname.test
new file mode 100644 (file)
index 0000000..2c19972
--- /dev/null
@@ -0,0 +1,20 @@
+#! /bin/sh
+
+# Copyright (C) 2002 by Martin Pool
+
+# Call directly into unsafe_symlink and test its handling of various filenames
+
+. $srcdir/testsuite/rsync.fns
+
+test_unsafe() {
+    result=`"$TOOLDIR/t_unsafe" "$1" "$2"` || test_fail "Failed to check $1 $2"
+    if [ "$result" != "$3" ]
+    then
+       test_fail "t_unsafe $1 $2 returned \"$result\", expected \"$3\""
+    fi
+}
+
+set -x
+
+test_unsafe foo foo safe
+test_unsafe ../foo foo unsafe