summaryrefslogtreecommitdiff
path: root/source3/script
diff options
context:
space:
mode:
authorGuenter Kukkukk <kukks@samba.org>2013-03-11 05:34:27 +0100
committerRichard Sharpe <realrichardsharpe@gmail.com>2013-03-11 21:50:06 -0700
commit396647340f233e30277d6d6081465b7b6d855181 (patch)
treef23b4bdb3e296e2f3f196660488078ca2c9a72c1 /source3/script
parente10c81553b1691ae1b7c260719d724beed61bb48 (diff)
downloadsamba-396647340f233e30277d6d6081465b7b6d855181.tar.gz
samba-396647340f233e30277d6d6081465b7b6d855181.tar.bz2
samba-396647340f233e30277d6d6081465b7b6d855181.zip
vfs_catia: testcase - implement vfstest additions
Signed-off-by: Guenter Kukkukk <kukks@samba.org> Reviewed-by: Richard Sharpe <realrichardsharpe@gmail.com>
Diffstat (limited to 'source3/script')
-rw-r--r--source3/script/tests/vfstest-catia/run.sh96
-rw-r--r--source3/script/tests/vfstest-catia/vfstest.cmd2
-rw-r--r--source3/script/tests/vfstest-catia/vfstest1.cmd2
3 files changed, 100 insertions, 0 deletions
diff --git a/source3/script/tests/vfstest-catia/run.sh b/source3/script/tests/vfstest-catia/run.sh
new file mode 100644
index 0000000000..8f7ea81f6e
--- /dev/null
+++ b/source3/script/tests/vfstest-catia/run.sh
@@ -0,0 +1,96 @@
+#!/bin/sh
+if [ $# -lt 2 ]; then
+cat <<EOF
+Usage: run.sh VFSTEST PREFIX
+EOF
+exit 1;
+fi
+
+TESTBASE=`dirname $0`
+VFSTEST=$1
+PREFIX=$2
+shift 2
+ADDARGS="$*"
+
+VFSTEST_PREFIX=vfstest
+VFSTEST_TMPDIR=$(mktemp -d ${PREFIX}/${VFSTEST_PREFIX}_XXXXXX)
+
+# vars for the translation test:
+# a) here for unix-to-windows test
+UNIX_FILE="a\\a:a*a?a<a>a|a"
+# translated window file name
+WIN_FILE="aÿa÷a¤a¿a«a»a¦a"
+
+# b) here for windows-to-unix test
+WIN_DIR="dir_aÿa÷a¤a¿a«a»a¦a"
+# translated unix directory name
+UNIX_DIR="dir_a\a:a*a?a<a>a|a"
+
+incdir=`dirname $0`/../../../../testprogs/blackbox
+. $incdir/subunit.sh
+
+failed=0
+
+cd $VFSTEST_TMPDIR || exit 1
+
+# create unix file in tmpdir
+touch $UNIX_FILE || exit 1
+
+# test "translate" unix-to-windows
+test_vfstest()
+{
+ cmd='$VFSTEST -f $TESTBASE/vfstest.cmd $ADDARGS '
+ out=`eval $cmd`
+ ret=$?
+
+ if [ $ret != 0 ] ; then
+ echo "$out"
+ echo "command failed"
+ false
+ return
+ fi
+
+ echo "$out" | grep $WIN_FILE >/dev/null 2>&1
+
+ if [ $? = 0 ] ; then
+ echo "ALL IS WORKING"
+ true
+ else
+ false
+ fi
+}
+
+# test the mkdir call with special windows chars
+# and then check the created unix directory name
+test_vfstest_dir()
+{
+ cmd='$VFSTEST -f $TESTBASE/vfstest1.cmd $ADDARGS '
+ out=`eval $cmd`
+ ret=$?
+
+ if [ $ret != 0 ] ; then
+ echo "$out"
+ echo "command failed"
+ false
+ return
+ fi
+
+ NUM=`find $UNIX_DIR | wc -l`
+ if [ $NUM -ne 1 ] ; then
+ echo "Cannot find $UNIX_DIR"
+ false
+ else
+ true
+ fi
+}
+
+testit "vfstest" test_vfstest || failed=`expr $failed + 1`
+
+if [ $failed = 0 ] ; then
+ testit "vfstest1" test_vfstest_dir || failed=`expr $failed + 1`
+fi
+
+# Cleanup: remove tempdir
+rm -R $VFSTEST_TMPDIR
+
+exit $failed
diff --git a/source3/script/tests/vfstest-catia/vfstest.cmd b/source3/script/tests/vfstest-catia/vfstest.cmd
new file mode 100644
index 0000000000..5acecbc636
--- /dev/null
+++ b/source3/script/tests/vfstest-catia/vfstest.cmd
@@ -0,0 +1,2 @@
+connect
+translate_name a\a:a*a?a<a>a|a
diff --git a/source3/script/tests/vfstest-catia/vfstest1.cmd b/source3/script/tests/vfstest-catia/vfstest1.cmd
new file mode 100644
index 0000000000..ef56159c5d
--- /dev/null
+++ b/source3/script/tests/vfstest-catia/vfstest1.cmd
@@ -0,0 +1,2 @@
+connect
+mkdir dir_aÿa÷a¤a¿a«a»a¦a