|
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 totalno=0 |
|
19 let passno=0 |
|
20 let failno=0 |
|
21 } |
|
22 |
|
23 |
|
24 #Test: Tests whence with -w option |
|
25 test_whence1() |
|
26 { |
|
27 let totalno=totalno+1 |
|
28 echo "Test $totalno: Tests whence with -w option" |
|
29 whence -w echo |
|
30 ret=$? |
|
31 |
|
32 if [ $ret = 0 ] |
|
33 then |
|
34 { |
|
35 echo "PASS" |
|
36 let passno=passno+1 |
|
37 } |
|
38 else |
|
39 { |
|
40 echo "whence fails with option '-w'" |
|
41 echo "FAIL" |
|
42 let failno=failno+1 |
|
43 } |
|
44 fi |
|
45 } |
|
46 |
|
47 #Test: Tests whence with -v option |
|
48 test_whence2() |
|
49 { |
|
50 let totalno=totalno+1 |
|
51 echo "Test $totalno: Tests whence with -w option" |
|
52 whence -v echo |
|
53 ret=$? |
|
54 |
|
55 if [ $ret = 0 ] |
|
56 then |
|
57 { |
|
58 echo "PASS" |
|
59 let passno=passno+1 |
|
60 } |
|
61 else |
|
62 { |
|
63 echo "whence fails with option '-v'" |
|
64 echo "FAIL" |
|
65 let failno=failno+1 |
|
66 } |
|
67 fi |
|
68 } |
|
69 |
|
70 #Test: Tests whence with -f option |
|
71 test_whence3() |
|
72 { |
|
73 let totalno=totalno+1 |
|
74 echo "Test $totalno: Tests whence with -w option" |
|
75 whence -f echo |
|
76 ret=$? |
|
77 |
|
78 if [ $ret = 0 ] |
|
79 then |
|
80 { |
|
81 echo "PASS" |
|
82 let passno=passno+1 |
|
83 } |
|
84 else |
|
85 { |
|
86 echo "whence fails with option '-f'" |
|
87 echo "FAIL" |
|
88 let failno=failno+1 |
|
89 } |
|
90 fi |
|
91 } |
|
92 |
|
93 #Test: Tests whence with -m option |
|
94 test_whence4() |
|
95 { |
|
96 let totalno=totalno+1 |
|
97 echo "Test $totalno: Tests whence with -m option" |
|
98 whence -m 'whence' |
|
99 ret=$? |
|
100 |
|
101 if [ $ret = 0 ] |
|
102 then |
|
103 { |
|
104 echo "PASS" |
|
105 let passno=passno+1 |
|
106 } |
|
107 else |
|
108 { |
|
109 echo "whence fails with option '-m'" |
|
110 echo "FAIL" |
|
111 let failno=failno+1 |
|
112 } |
|
113 fi |
|
114 } |
|
115 |
|
116 #Test: Tests whence with -p option |
|
117 test_whence5() |
|
118 { |
|
119 let totalno=totalno+1 |
|
120 echo "Test $totalno: Tests whence with -p option" |
|
121 res=`whence -p dklfsg` |
|
122 ret=$? |
|
123 echo $res |
|
124 if [ $ret = 1 ] && [ -z $res ] |
|
125 then |
|
126 { |
|
127 echo "PASS" |
|
128 let passno=passno+1 |
|
129 } |
|
130 else |
|
131 { |
|
132 echo "whence fails with option '-p'" |
|
133 echo "FAIL" |
|
134 let failno=failno+1 |
|
135 } |
|
136 fi |
|
137 } |
|
138 |
|
139 #Test: Tests whence with -a option and bad argument |
|
140 test_whence6() |
|
141 { |
|
142 let totalno=totalno+1 |
|
143 echo "Test $totalno: Tests whence with -p option" |
|
144 whence -a World |
|
145 ret=$? |
|
146 |
|
147 if [ $ret = 0 ] |
|
148 then |
|
149 { |
|
150 echo "PASS" |
|
151 let passno=passno+1 |
|
152 } |
|
153 else |
|
154 { |
|
155 echo "whence fails with option '-a'" |
|
156 echo "FAIL" |
|
157 let failno=failno+1 |
|
158 } |
|
159 fi |
|
160 } |
|
161 |
|
162 |
|
163 report() |
|
164 { |
|
165 echo "---------------------------------------------------------" |
|
166 echo "Total tests : $totalno" |
|
167 echo "Passed tests : $passno" |
|
168 echo "Failed tests : $failno" |
|
169 echo "---------------------------------------------------------" |
|
170 } |
|
171 |
|
172 |
|
173 init |
|
174 test_whence1 |
|
175 test_whence2 |
|
176 test_whence3 |
|
177 test_whence4 |
|
178 test_whence5 |
|
179 test_whence6 |
|
180 report |