|
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_ps1() |
|
25 { |
|
26 |
|
27 let totalno+=1; |
|
28 echo "--- test_ps1:ps without options---" |
|
29 #echo "--- test_ps1:ps without options---" > pslog.txt |
|
30 ps #>> pslog.txt 2>> pslog.txt |
|
31 ret=$? |
|
32 |
|
33 if [ $ret -eq 0 ] |
|
34 then |
|
35 echo "PASS" |
|
36 let passno+=1 |
|
37 else |
|
38 echo "FAIL,Return Value : $ret" |
|
39 let failno+=1 |
|
40 fi |
|
41 } |
|
42 |
|
43 test_ps2() |
|
44 { |
|
45 |
|
46 let totalno+=1; |
|
47 echo "---test_ps2:ps with invalid options---" |
|
48 #echo "---test_ps2:ps with invalid options---" >> pslog.txt |
|
49 ps -q #>> pslog.txt 2>> pslog.txt |
|
50 ret=$? |
|
51 |
|
52 if [ $ret -ne 0 ] |
|
53 then |
|
54 echo "PASS" |
|
55 let passno+=1 |
|
56 else |
|
57 echo "FAIL, Return Value : $ret" |
|
58 let failno+=1 |
|
59 fi |
|
60 } |
|
61 |
|
62 test_ps3() |
|
63 { |
|
64 let totalno+=1 |
|
65 echo "test_ps3:ps -l (with valid option)" |
|
66 #echo "test_ps3:ps -l(with valid option)" >> pslog.txt |
|
67 ps -l #>> pslog.txt 2>> pslog.txt |
|
68 ret=$? |
|
69 |
|
70 if [ $ret -eq 0 ] |
|
71 then |
|
72 echo "PASS" |
|
73 let passno+=1 |
|
74 else |
|
75 echo "FAIL,Return Value : $ret" |
|
76 let failno+=1 |
|
77 fi |
|
78 } |
|
79 |
|
80 |
|
81 test_ps4() |
|
82 { |
|
83 let totalno+=1 |
|
84 echo "ps_test4:ps -o with valid column" |
|
85 #echo "ps_test4:ps -o with valid column" >> pslog.txt |
|
86 ps -o time,args,comm #>> pslog.txt 2>> pslog.txt |
|
87 ret=$? |
|
88 |
|
89 if [ $ret -eq 0 ] |
|
90 then |
|
91 echo "PASS" |
|
92 let passno+=1 |
|
93 else |
|
94 echo "FAIL, Return Value : $ret" |
|
95 let failno+=1 |
|
96 fi |
|
97 } |
|
98 |
|
99 test_ps5() |
|
100 { |
|
101 let totalno+=1 |
|
102 echo "test_ps5:ps -o with invalid column" |
|
103 #echo "test_ps5:ps -o with invalid column" >>pslog.txt |
|
104 ps -o abc,def #>> pslog.txt 2>> pslog.txt |
|
105 ret=$? |
|
106 |
|
107 if [ $ret -ne 0 ] |
|
108 then |
|
109 echo "PASS" |
|
110 let passno+=1 |
|
111 else |
|
112 echo "FAIL,Return Value : $ret" |
|
113 let failno+=1 |
|
114 fi |
|
115 } |
|
116 |
|
117 test_ps6() |
|
118 { |
|
119 let totalno+=1; |
|
120 echo "test_ps6:ps -o with both valid and invalid column" |
|
121 #echo "test_ps6:ps -o with both valid and invalid column" >>pslog.txt |
|
122 ps -o time |
|
123 ret=$? |
|
124 |
|
125 if [ $ret -eq 0 ] |
|
126 then |
|
127 echo "PASS" |
|
128 let passno+=1 |
|
129 else |
|
130 echo "FAIL,Return Value : $ret" |
|
131 let failno+=1 |
|
132 fi |
|
133 } |
|
134 |
|
135 test_ps7() |
|
136 { |
|
137 let totalno+=1 |
|
138 echo "test_ps7:ps -f (with valid option)" |
|
139 #echo "test_ps7:ps -f(with valid option)" >> pslog.txt |
|
140 ps -f #>> pslog.txt 2>> pslog.txt |
|
141 ret=$? |
|
142 |
|
143 if [ $ret -eq 0 ] |
|
144 then |
|
145 echo "PASS" |
|
146 let passno+=1 |
|
147 else |
|
148 echo "FAIL,Return Value : $ret" |
|
149 let failno+=1 |
|
150 fi |
|
151 } |
|
152 test_ps8() |
|
153 { |
|
154 let totalno+=1 |
|
155 echo "test_ps8:ps -s (with valid option)" |
|
156 #echo "test_ps8:ps -s(with valid option)" >> pslog.txt |
|
157 ps -s #>> pslog.txt 2>> pslog.txt |
|
158 ret=$? |
|
159 |
|
160 if [ $ret -eq 0 ] |
|
161 then |
|
162 echo "PASS" |
|
163 let passno+=1 |
|
164 else |
|
165 echo "FAIL,Return Value : $ret" |
|
166 let failno+=1 |
|
167 fi |
|
168 } |
|
169 test_ps9() |
|
170 { |
|
171 let totalno+=1 |
|
172 echo "test_ps9:ps -h (with valid option)" |
|
173 #echo "test_ps9:ps -h(with valid option)" >> pslog.txt |
|
174 ps -h #>> pslog.txt 2>> pslog.txt |
|
175 ret=$? |
|
176 |
|
177 if [ $ret -eq 0 ] |
|
178 then |
|
179 echo "PASS" |
|
180 let passno+=1 |
|
181 else |
|
182 echo "FAIL,Return Value : $ret" |
|
183 let failno+=1 |
|
184 fi |
|
185 } |
|
186 test_ps10() |
|
187 { |
|
188 let totalno+=1 |
|
189 echo "test_ps10:ps -lf (with valid option)" |
|
190 #echo "test_ps10:ps -lf(with valid option)" >> pslog.txt |
|
191 ps -lf #>> pslog.txt 2>> pslog.txt |
|
192 ret=$? |
|
193 |
|
194 if [ $ret -eq 0 ] |
|
195 then |
|
196 echo "PASS" |
|
197 let passno+=1 |
|
198 else |
|
199 echo "FAIL,Return Value : $ret" |
|
200 let failno+=1 |
|
201 fi |
|
202 } |
|
203 test_ps11() |
|
204 { |
|
205 let totalno+=1 |
|
206 echo "test_ps11:ps -lf -o time(with invalid option)" |
|
207 #echo "test_ps10:ps -lf -o time(with invalid option)" >> pslog.txt |
|
208 ps -lf -o time #>> pslog.txt 2>> pslog.txt |
|
209 ret=$? |
|
210 |
|
211 if [ $ret -ne 0 ] |
|
212 then |
|
213 echo "PASS" |
|
214 let passno+=1 |
|
215 else |
|
216 echo "FAIL,Return Value : $ret" |
|
217 let failno+=1 |
|
218 fi |
|
219 } |
|
220 |
|
221 report() |
|
222 { |
|
223 echo "--------------------ps test results------------------------" |
|
224 echo " TOTAL TESTS : $totalno" |
|
225 echo " TOTAL PASS : $passno" |
|
226 echo " TOTAL FAIL : $failno" |
|
227 echo "------------------------------------------------------------" |
|
228 } |
|
229 |
|
230 #begin making the calls |
|
231 { |
|
232 init |
|
233 test_ps1 |
|
234 test_ps2 |
|
235 test_ps3 |
|
236 test_ps4 |
|
237 test_ps5 |
|
238 test_ps6 |
|
239 test_ps7 |
|
240 test_ps8 |
|
241 test_ps9 |
|
242 test_ps10 |
|
243 test_ps11 |
|
244 report |
|
245 } |