1#!/bin/sh 2if [ $# -lt 2 ]; then 3cat <<EOF 4Usage: run.sh VFSTEST PREFIX 5EOF 6exit 1; 7fi 8 9TESTBASE=`dirname $0` 10VFSTEST=$1 11PREFIX=$2 12shift 2 13ADDARGS="$*" 14 15VFSTEST_PREFIX=vfstest 16VFSTEST_TMPDIR=$(mktemp -d ${PREFIX}/${VFSTEST_PREFIX}_XXXXXX) 17 18# We could pass in the --option=... via tests.py as ADDARGS 19# Atm i've choosen to specify them here: 20 21MYARGS1="--option=vfsobjects=catia" 22MYARGS2="--option=catia:mappings=0x22:0xa8,0x2a:0xa4,0x2f:0xf8,0x3a:0xf7,0x3c:0xab,0x3e:0xbb,0x3f:0xbf,0x5c:0xff,0x7c:0xa6,0x20:0xb1" 23 24# vars for the translation test: 25# a) here for unix-to-windows test 26UNIX_FILE="a\\a:a*a?a<a>a|a" 27# translated window file name 28WIN_FILE="aÿa÷a¤a¿a«a»a¦a" 29 30# b) here for windows-to-unix test 31WIN_DIR="dir_aÿa÷a¤a¿a«a»a¦a" 32# translated unix directory name 33UNIX_DIR="dir_a\a:a*a?a<a>a|a" 34 35incdir=`dirname $0`/../../../../testprogs/blackbox 36. $incdir/subunit.sh 37 38failed=0 39 40cd $VFSTEST_TMPDIR || exit 1 41 42# create unix file in tmpdir 43touch $UNIX_FILE || exit 1 44 45# test "translate" unix-to-windows 46test_vfstest() 47{ 48 cmd='$VFSTEST -f $TESTBASE/vfstest.cmd $MYARGS1 $MYARGS2 $ADDARGS ' 49 out=`eval $cmd` 50 ret=$? 51 52 if [ $ret != 0 ] ; then 53 echo "$out" 54 echo "command failed" 55 false 56 return 57 fi 58 59 echo "$out" | grep $WIN_FILE >/dev/null 2>&1 60 61 if [ $? = 0 ] ; then 62 echo "ALL IS WORKING" 63 true 64 else 65 false 66 fi 67} 68 69# test the mkdir call with special windows chars 70# and then check the created unix directory name 71test_vfstest_dir() 72{ 73 cmd='$VFSTEST -f $TESTBASE/vfstest1.cmd $MYARGS1 $MYARGS2 $ADDARGS ' 74 out=`eval $cmd` 75 ret=$? 76 77 if [ $ret != 0 ] ; then 78 echo "$out" 79 echo "command failed" 80 false 81 return 82 fi 83 84 NUM=`find $UNIX_DIR | wc -l` 85 if [ $NUM -ne 1 ] ; then 86 echo "Cannot find $UNIX_DIR" 87 false 88 else 89 true 90 fi 91} 92 93testit "vfstest_catia" test_vfstest || failed=`expr $failed + 1` 94 95if [ $failed = 0 ] ; then 96 testit "vfstest1_catia" test_vfstest_dir || failed=`expr $failed + 1` 97fi 98 99# Cleanup: remove tempdir 100rm -R $VFSTEST_TMPDIR 101 102exit $failed 103