vfs_catia: testcase - implement vfstest additions
[Samba/id10ts.git] / source3 / script / tests / vfstest-catia / run.sh
blob8f7ea81f6e7a02b4d3b2b6ca39ddb73aa1e270ff
1 #!/bin/sh
2 if [ $# -lt 2 ]; then
3 cat <<EOF
4 Usage: run.sh VFSTEST PREFIX
5 EOF
6 exit 1;
7 fi
9 TESTBASE=`dirname $0`
10 VFSTEST=$1
11 PREFIX=$2
12 shift 2
13 ADDARGS="$*"
15 VFSTEST_PREFIX=vfstest
16 VFSTEST_TMPDIR=$(mktemp -d ${PREFIX}/${VFSTEST_PREFIX}_XXXXXX)
18 # vars for the translation test:
19 # a) here for unix-to-windows test
20 UNIX_FILE="a\\a:a*a?a<a>a|a"
21 # translated window file name
22 WIN_FILE="aÿa÷a¤a¿a«a»a¦a"
24 # b) here for windows-to-unix test
25 WIN_DIR="dir_aÿa÷a¤a¿a«a»a¦a"
26 # translated unix directory name
27 UNIX_DIR="dir_a\a:a*a?a<a>a|a"
29 incdir=`dirname $0`/../../../../testprogs/blackbox
30 . $incdir/subunit.sh
32 failed=0
34 cd $VFSTEST_TMPDIR || exit 1
36 # create unix file in tmpdir
37 touch $UNIX_FILE || exit 1
39 # test "translate" unix-to-windows
40 test_vfstest()
42 cmd='$VFSTEST -f $TESTBASE/vfstest.cmd $ADDARGS '
43 out=`eval $cmd`
44 ret=$?
46 if [ $ret != 0 ] ; then
47 echo "$out"
48 echo "command failed"
49 false
50 return
53 echo "$out" | grep $WIN_FILE >/dev/null 2>&1
55 if [ $? = 0 ] ; then
56 echo "ALL IS WORKING"
57 true
58 else
59 false
63 # test the mkdir call with special windows chars
64 # and then check the created unix directory name
65 test_vfstest_dir()
67 cmd='$VFSTEST -f $TESTBASE/vfstest1.cmd $ADDARGS '
68 out=`eval $cmd`
69 ret=$?
71 if [ $ret != 0 ] ; then
72 echo "$out"
73 echo "command failed"
74 false
75 return
78 NUM=`find $UNIX_DIR | wc -l`
79 if [ $NUM -ne 1 ] ; then
80 echo "Cannot find $UNIX_DIR"
81 false
82 else
83 true
87 testit "vfstest" test_vfstest || failed=`expr $failed + 1`
89 if [ $failed = 0 ] ; then
90 testit "vfstest1" test_vfstest_dir || failed=`expr $failed + 1`
93 # Cleanup: remove tempdir
94 rm -R $VFSTEST_TMPDIR
96 exit $failed