openenvutils/commandshell/shell/test/scripts/findtest3.sh
changeset 0 2e3d3ce01487
child 1 0fdb7f6b0309
equal deleted inserted replaced
-1:000000000000 0:2e3d3ce01487
       
     1 # Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies).
       
     2 # All rights reserved.
       
     3 # This component and the accompanying materials are made available
       
     4 # under the terms of the License "Eclipse Public License v1.0"
       
     5 # which accompanies this distribution, and is available
       
     6 # at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     7 #
       
     8 # Initial Contributors:
       
     9 # Nokia Corporation - initial contribution.
       
    10 #
       
    11 # Contributors:
       
    12 #
       
    13 # Description:
       
    14 #
       
    15 
       
    16 init()
       
    17 {
       
    18     let total=0;
       
    19     let pass=0;
       
    20     let fail=0;
       
    21 
       
    22     if [ ! -d c:\\findtest ]
       
    23     then
       
    24 		mkdir c:\\findtest
       
    25     fi
       
    26 	cd c:\\findtest
       
    27 	cat "fddsfsduf  dsofisdf ndsljfs d" > test1.txt
       
    28 	cat "fddsfsduf  dsofdsfsdf  dfds
       
    29 	          dfsd isdf ndsljfs d" > test2.txt
       
    30 	cat "fddsfsduf " > test3.txt
       
    31 	if [ ! -d .\\test4 ]
       
    32 	then
       
    33 		mkdir .\\test4
       
    34 	fi
       
    35 	cd .\\test4
       
    36 	cat "fddsfsduf  dsofisdf ndsljfs d" > test41.txt
       
    37 	cat "fddsfsduf  dsofdsfsdf  dfds
       
    38 	          dfsd isdf ndsljfs d" > test42.txt
       
    39 	cat "fddsfsduf " > test43.txt
       
    40 	cd 
       
    41 	
       
    42 }
       
    43 report()
       
    44 {
       
    45     echo "Changing the directory back";
       
    46     echo "--------------------Find test results------------------------"
       
    47     echo " TOTAL TESTS : $total"
       
    48     echo " TOTAL PASS  : $pass"
       
    49     echo " TOTAL FAIL  : $fail"
       
    50     echo "------------------------------------------------------------"
       
    51 }
       
    52 test_find33()
       
    53 {
       
    54 	let total+=1;
       
    55 	echo "test_find33 :find with primaries ; find  ./test3.txt -type b"
       
    56 	find c:\\findtest\\test3.txt -type b
       
    57 	ret=$?
       
    58 	if [ $ret -eq 0 ]
       
    59 	then
       
    60 		echo " PASS ";
       
    61 		let pass+=1;
       
    62 	else
       
    63 		echo "Fail"
       
    64 		echo "Expected 0 Returned $ret"
       
    65 		let fail+=1;
       
    66 	fi
       
    67 }
       
    68 test_find34()
       
    69 {
       
    70 	let total+=1;
       
    71 	echo "test_find34 :find with primaries ; find  ./test3.txt -type p"
       
    72 	find c:\\findtest\\test3.txt -type p
       
    73 	ret=$?
       
    74 	if [ $ret -eq 0 ]
       
    75 	then
       
    76 		echo " PASS ";
       
    77 		let pass+=1;
       
    78 	else
       
    79 		echo "Fail"
       
    80 		echo "Expected 0 Returned $ret"
       
    81 		let fail+=1;
       
    82 	fi
       
    83 }
       
    84 test_find35()
       
    85 {
       
    86 	let total+=1;
       
    87 	echo "test_find35 :find with primaries ; find  ./test3.txt -type s"
       
    88 	find c:\\findtest\\test3.txt -type s
       
    89 	ret=$?
       
    90 	if [ $ret -eq 0 ]
       
    91 	then
       
    92 		echo " PASS ";
       
    93 		let pass+=1;
       
    94 	else
       
    95 		echo "Fail"
       
    96 		echo "Expected 0 Returned $ret"
       
    97 		let fail+=1;
       
    98 	fi
       
    99 }
       
   100 test_find36()
       
   101 {
       
   102 	let total+=1;
       
   103 	echo "test_find36 :find with primaries ; find  ./test3.txt -type c"
       
   104 	find c:\\findtest\\test3.txt -type c
       
   105 	ret=$?
       
   106 	if [ $ret -eq 0 ]
       
   107 	then
       
   108 		echo " PASS ";
       
   109 		let pass+=1;
       
   110 	else
       
   111 		echo "Fail"
       
   112 		echo "Expected 0 Returned $ret"
       
   113 		let fail+=1;
       
   114 	fi
       
   115 }
       
   116 test_find37()
       
   117 {
       
   118 	let total+=1;
       
   119 	echo "test_find37 :find with primaries ; find  ./test4 -type d"
       
   120 	find c:\\findtest\\test4 -type d
       
   121 	ret=$?
       
   122 	if [ $ret -eq 0 ]
       
   123 	then
       
   124 		echo " PASS ";
       
   125 		let pass+=1;
       
   126 	else
       
   127 		echo "Fail"
       
   128 		echo "Expected 0 Returned $ret"
       
   129 		let fail+=1;
       
   130 	fi
       
   131 }
       
   132 test_find38()
       
   133 {
       
   134 	let total+=1;
       
   135 	echo "test_find38 :find with primaries ; find  ./test3.txt -type f"
       
   136 	find c:\\findtest\\test3.txt -type f
       
   137 	ret=$?
       
   138 	if [ $ret -eq 0 ]
       
   139 	then
       
   140 		echo " PASS ";
       
   141 		let pass+=1;
       
   142 	else
       
   143 		echo "Fail"
       
   144 		echo "Expected 0 Returned $ret"
       
   145 		let fail+=1;
       
   146 	fi
       
   147 }
       
   148 test_find39()
       
   149 {
       
   150 	let total+=1;
       
   151 	echo "test_find39 :find with primaries ; find  ./test3.txt ! -type f"
       
   152 	find c:\\findtest\\test3.txt ! -type f  
       
   153 	ret=$?
       
   154 	if [ $ret -eq 0 ]
       
   155 	then
       
   156 		echo " PASS ";
       
   157 		let pass+=1;
       
   158 	else
       
   159 		echo "Fail"
       
   160 		echo "Expected 0 Returned $ret"
       
   161 		let fail+=1;
       
   162 	fi
       
   163 }
       
   164 test_find40()
       
   165 {
       
   166 	let total+=1;
       
   167 	echo "test_find40 :find with primaries ; find  ./test3.txt  -type f -and ! -type d"
       
   168 	find c:\\findtest\\test3.txt  -type f -and ! -type d 
       
   169 	ret=$?
       
   170 	if [ $ret -eq 0 ]
       
   171 	then
       
   172 		echo " PASS ";
       
   173 		let pass+=1;
       
   174 	else
       
   175 		echo "Fail"
       
   176 		echo "Expected 0 Returned $ret"
       
   177 		let fail+=1;
       
   178 	fi
       
   179 }
       
   180 test_find41()
       
   181 {
       
   182 	let total+=1;
       
   183 	echo "test_find41 :find with primaries ; find  ./test3.txt  -type f -or  -size 2"
       
   184 	find c:\\findtest\\test3.txt  -type f -or  -size 2 
       
   185 	ret=$?
       
   186 	if [ $ret -eq 0 ]
       
   187 	then
       
   188 		echo " PASS ";
       
   189 		let pass+=1;
       
   190 	else
       
   191 		echo "Fail"
       
   192 		echo "Expected 0 Returned $ret"
       
   193 		let fail+=1;
       
   194 	fi
       
   195 }
       
   196 
       
   197 #begin making calls
       
   198 
       
   199 init
       
   200 test_find33
       
   201 test_find34
       
   202 test_find35
       
   203 test_find36
       
   204 test_find37
       
   205 test_find38
       
   206 test_find39
       
   207 test_find40
       
   208 test_find41
       
   209 report