Mark Whitley | d2117e9 | 2001-03-10 00:51:29 +0000 | [diff] [blame] | 1 | # testcases |
2 | # | ||||
3 | # This file should be filled with test cases to test applets that: | ||||
4 | # | ||||
5 | # - can somehow produce output (we can't test sync or sleep) | ||||
6 | # - have a GNU (or other) counterpart | ||||
7 | # - are not interactive (don't require a ^C or anything) | ||||
8 | # - don't require extensive setup or cleanup (a litte setup is fine) | ||||
9 | # - don't have huge and possibly damaging effects (fsck, swapoff) | ||||
10 | # | ||||
11 | # If possible, a test case should be made that tests each option the applet | ||||
12 | # supports. When a new option is added, a new test case should be written for | ||||
13 | # it. When somebody reports a bug with a testcase, that testcase should be | ||||
14 | # added here as well. | ||||
15 | # | ||||
16 | # Some other guidelines to follow: | ||||
17 | # | ||||
18 | # - please try to keep applets alphabetized, it will make life easier | ||||
19 | # - use the file tester.sh or testcases when you need to do a non-destructive | ||||
Eric Andersen | 77d9268 | 2001-05-23 20:32:09 +0000 | [diff] [blame] | 20 | # test on a file (i.e., cat, md5sum) |
Mark Whitley | d2117e9 | 2001-03-10 00:51:29 +0000 | [diff] [blame] | 21 | # - try to make the applet you're testing the first thing on the line (this |
22 | # not always possible) | ||||
23 | # - (???) if you have to create a temporary file, call it TMPFILE | ||||
24 | |||||
25 | |||||
26 | # ar | ||||
27 | |||||
28 | # basename | ||||
29 | basename `pwd` | ||||
30 | |||||
31 | # cat | ||||
32 | cat tester.sh | ||||
Mark Whitley | 04052f9 | 2001-05-24 17:15:33 +0000 | [diff] [blame] | 33 | echo hello there | cat tester.sh - |
Mark Whitley | d2117e9 | 2001-03-10 00:51:29 +0000 | [diff] [blame] | 34 | |
35 | # chmod | ||||
36 | # chown | ||||
37 | # chgrp | ||||
38 | # chroot | ||||
39 | # chvt - can't be tested here | ||||
40 | # clear - can't be tested here | ||||
41 | # cmp | ||||
42 | # cp | ||||
Mark Whitley | d2117e9 | 2001-03-10 00:51:29 +0000 | [diff] [blame] | 43 | |
44 | # cut | ||||
45 | echo "1234" | cut -c1 | ||||
Mark Whitley | cc7b4f3 | 2001-03-27 20:48:01 +0000 | [diff] [blame] | 46 | echo "1234" | cut -c 1 |
47 | echo "1234567890" | cut -c2-7 | ||||
48 | echo "1234567890" | cut -c 2-7 | ||||
Mark Whitley | d2117e9 | 2001-03-10 00:51:29 +0000 | [diff] [blame] | 49 | echo "f1 f2" | cut -f2 |
Mark Whitley | cc7b4f3 | 2001-03-27 20:48:01 +0000 | [diff] [blame] | 50 | echo "f1 f2" | cut -f 2 |
51 | echo "f1 f2 f3 f4 f5" | cut -f2-4 | ||||
52 | echo "f1 f2 f3 f4 f5" | cut -f 2-4 | ||||
Mark Whitley | d2117e9 | 2001-03-10 00:51:29 +0000 | [diff] [blame] | 53 | |
54 | # date | ||||
55 | date | ||||
56 | date -R | ||||
57 | date -u | ||||
58 | date +%d/%m/%y | ||||
59 | |||||
60 | # dc - needs an input file | ||||
Mark Whitley | c75f83d | 2001-03-13 23:30:18 +0000 | [diff] [blame] | 61 | |
Mark Whitley | d2117e9 | 2001-03-10 00:51:29 +0000 | [diff] [blame] | 62 | # dd |
Mark Whitley | c75f83d | 2001-03-13 23:30:18 +0000 | [diff] [blame] | 63 | dd if=/dev/urandom of=O bs=1k count=1 ; ls -l O ; rm O |
64 | |||||
Mark Whitley | d2117e9 | 2001-03-10 00:51:29 +0000 | [diff] [blame] | 65 | # deallocvt |
66 | |||||
67 | # df | ||||
68 | df | ||||
69 | df . | ||||
70 | df -k | ||||
71 | df -h | ||||
72 | df -m | ||||
73 | |||||
74 | # dirname | ||||
75 | dirname `pwd` | ||||
76 | |||||
77 | # dmesg (XXX: change the silly cmd business in the source) | ||||
78 | dmesg | ||||
79 | dmesg -n 8 | ||||
80 | dmesg -s 512 | ||||
81 | # I really don't want to do this next one | ||||
82 | #dmesg -c | ||||
83 | |||||
84 | # dos2unix - needs an input file | ||||
85 | # dpkg | ||||
86 | # dpkg_deb | ||||
87 | |||||
88 | # du | ||||
89 | du | ||||
90 | du -s | ||||
91 | du -l | ||||
92 | du -k | ||||
93 | du -h | ||||
94 | du -m | ||||
95 | |||||
96 | # dumpkmap - no counterprt? | ||||
97 | # dutmp - no counterprt? | ||||
98 | |||||
99 | # echo | ||||
100 | echo "foo bar baz" | ||||
101 | echo -n "no newline" | ||||
102 | |||||
103 | |||||
104 | # expr | ||||
Mark Whitley | 04052f9 | 2001-05-24 17:15:33 +0000 | [diff] [blame] | 105 | expr 1 \\| 1 |
106 | expr 1 \\| 0 | ||||
107 | expr 0 \\| 1 | ||||
108 | expr 0 \\| 0 | ||||
109 | |||||
110 | expr 1 \\& 1 | ||||
111 | expr 1 \\& 0 | ||||
112 | expr 0 \\& 1 | ||||
113 | expr 0 \\& 0 | ||||
114 | |||||
115 | expr 0 \\< 1 | ||||
116 | expr 1 \\< 0 | ||||
117 | |||||
118 | expr 1 \\> 0 | ||||
119 | expr 0 \\> 1 | ||||
120 | |||||
121 | expr 0 \\<= 1 | ||||
122 | expr 1 \\<= 0 | ||||
123 | expr 1 \\<= 1 | ||||
124 | |||||
125 | expr 1 \\>= 0 | ||||
126 | expr 0 \\>= 1 | ||||
127 | expr 1 \\>= 1 | ||||
128 | |||||
129 | expr 1 + 2 | ||||
130 | expr 2 - 1 | ||||
131 | expr 2 \\* 3 | ||||
132 | expr 12 / 2 | ||||
133 | expr 12 % 5 | ||||
Mark Whitley | d2117e9 | 2001-03-10 00:51:29 +0000 | [diff] [blame] | 134 | |
135 | # somebody else can do all the string stuff | ||||
136 | |||||
137 | |||||
138 | # fbset - can't be tested here | ||||
139 | # fdflush | ||||
140 | # find | ||||
141 | find . | ||||
142 | |||||
143 | # free | ||||
144 | free | ||||
145 | |||||
146 | # freeramdisk | ||||
147 | # fsck.minix - won't test | ||||
148 | # getopt | ||||
Mark Whitley | 336480f | 2001-05-14 21:18:54 +0000 | [diff] [blame] | 149 | |
Mark Whitley | d2117e9 | 2001-03-10 00:51:29 +0000 | [diff] [blame] | 150 | # grep |
Mark Whitley | 336480f | 2001-05-14 21:18:54 +0000 | [diff] [blame] | 151 | grep -l strdup ../*.c |
152 | grep -c strdup ../*.c | ||||
Mark Whitley | 336480f | 2001-05-14 21:18:54 +0000 | [diff] [blame] | 153 | grep -lc strdup ../*.c |
154 | grep -cv strdup ../*.c | ||||
Mark Whitley | fa43e54 | 2001-05-24 18:36:18 +0000 | [diff] [blame^] | 155 | grep -i null ../grep.c |
156 | grep -e strdup -e regcomp -e atexit ../grep.c | ||||
Mark Whitley | 336480f | 2001-05-14 21:18:54 +0000 | [diff] [blame] | 157 | |
Mark Whitley | d2117e9 | 2001-03-10 00:51:29 +0000 | [diff] [blame] | 158 | # gunzip |
Mark Whitley | 04052f9 | 2001-05-24 17:15:33 +0000 | [diff] [blame] | 159 | |
Mark Whitley | d2117e9 | 2001-03-10 00:51:29 +0000 | [diff] [blame] | 160 | # gzip |
Mark Whitley | 04052f9 | 2001-05-24 17:15:33 +0000 | [diff] [blame] | 161 | echo testing 1 2 3 >tmpfile1; gzip tmpfile1; echo tmpfile*; md5sum tmpfile1.gz; rm tmpfile1.gz |
162 | echo testing 1 2 3 | gzip >tmpfile1.gz; md5sum tmpfile1.gz; rm tmpfile1.gz | ||||
Mark Whitley | d2117e9 | 2001-03-10 00:51:29 +0000 | [diff] [blame] | 163 | # halt |
164 | |||||
165 | # head | ||||
166 | head tester.sh | ||||
167 | head -n 2 tester.sh | ||||
168 | |||||
169 | # hostid | ||||
170 | hostid | ||||
171 | |||||
172 | # hostname | ||||
173 | hostname | ||||
174 | hostname -s | ||||
175 | hostname -i | ||||
176 | hostname -d | ||||
177 | # not going to do this next one | ||||
178 | #hostname -F | ||||
179 | |||||
180 | # id | ||||
181 | id | ||||
182 | id -u | ||||
183 | id -g | ||||
184 | id -ur | ||||
185 | id -un | ||||
186 | |||||
187 | |||||
188 | # ifconfig | ||||
Mark Whitley | 04052f9 | 2001-05-24 17:15:33 +0000 | [diff] [blame] | 189 | # requires BB_FEATURE_IFCONFIG_STATUS |
190 | ifconfig | ||||
Mark Whitley | c75f83d | 2001-03-13 23:30:18 +0000 | [diff] [blame] | 191 | #ifconfig -a |
Mark Whitley | d2117e9 | 2001-03-10 00:51:29 +0000 | [diff] [blame] | 192 | #ifconfig eth0 |
193 | #ifconfig lo | ||||
194 | |||||
195 | # init - won't test | ||||
196 | # insmod - won't test | ||||
197 | |||||
198 | # kill | ||||
199 | #kill -l | ||||
200 | # not going to do any more | ||||
201 | |||||
202 | # length | ||||
Mark Whitley | 04052f9 | 2001-05-24 17:15:33 +0000 | [diff] [blame] | 203 | # ln - see ln_tests.mk |
Mark Whitley | d2117e9 | 2001-03-10 00:51:29 +0000 | [diff] [blame] | 204 | # loadacm |
205 | # loadfont | ||||
206 | # loadkmap | ||||
207 | # logger | ||||
208 | # logname | ||||
Mark Whitley | c75f83d | 2001-03-13 23:30:18 +0000 | [diff] [blame] | 209 | |
Mark Whitley | d2117e9 | 2001-03-10 00:51:29 +0000 | [diff] [blame] | 210 | # ls |
Mark Whitley | c75f83d | 2001-03-13 23:30:18 +0000 | [diff] [blame] | 211 | ls ../e* |
212 | ls -l ../e* | ||||
213 | ls -s ../e* | ||||
214 | ls -h ../e* | ||||
215 | ls -1 ../e* | ||||
Mark Whitley | d2117e9 | 2001-03-10 00:51:29 +0000 | [diff] [blame] | 216 | |
217 | # lsmod | ||||
218 | lsmod | ||||
219 | |||||
220 | # makedevs | ||||
221 | |||||
222 | # md5sum | ||||
223 | md5sum tester.sh | ||||
224 | |||||
225 | # mkdir | ||||
Mark Whitley | c75f83d | 2001-03-13 23:30:18 +0000 | [diff] [blame] | 226 | mkdir D ; ls -ld D ; rmdir D |
227 | |||||
Mark Whitley | d2117e9 | 2001-03-10 00:51:29 +0000 | [diff] [blame] | 228 | # mkfifo |
Mark Whitley | c75f83d | 2001-03-13 23:30:18 +0000 | [diff] [blame] | 229 | # |
230 | # we will test making one. actually testing pushing data through it requires | ||||
231 | # more interaction than we can manage here. | ||||
232 | # (these lines turn up an existing ls bug) | ||||
233 | mkfifo F ; ls -l F ; rm F | ||||
234 | mkfifo -m 0600 F ; ls -l F ; rm F | ||||
235 | |||||
Mark Whitley | d2117e9 | 2001-03-10 00:51:29 +0000 | [diff] [blame] | 236 | # mkfs.minix - won't test |
237 | # mknod | ||||
238 | # mkswap - won't test | ||||
239 | # mktemp | ||||
240 | # more - can't test: interactive | ||||
241 | |||||
242 | # mount | ||||
243 | mount | ||||
244 | # not going to test any more | ||||
245 | |||||
246 | # mt | ||||
Mark Whitley | 04052f9 | 2001-05-24 17:15:33 +0000 | [diff] [blame] | 247 | # mv - see mv_tests.mk |
Mark Whitley | d2117e9 | 2001-03-10 00:51:29 +0000 | [diff] [blame] | 248 | # nc |
249 | # nfsmount | ||||
250 | # nslookup | ||||
Mark Whitley | c75f83d | 2001-03-13 23:30:18 +0000 | [diff] [blame] | 251 | # ping |
252 | ping -c 3 yahoo.com | ||||
Mark Whitley | d2117e9 | 2001-03-10 00:51:29 +0000 | [diff] [blame] | 253 | # pivot_root |
254 | # poweroff - won't test | ||||
255 | # printf | ||||
256 | # ps - there's lotsa differences between busybox ps and any other ps | ||||
257 | |||||
258 | # pwd | ||||
259 | pwd | ||||
260 | |||||
261 | # rdate - won't test | ||||
262 | |||||
263 | # readlink | ||||
Mark Whitley | c75f83d | 2001-03-13 23:30:18 +0000 | [diff] [blame] | 264 | ln -sf tester.sh L ; readlink L ; rm -f L |
Mark Whitley | d2117e9 | 2001-03-10 00:51:29 +0000 | [diff] [blame] | 265 | |
266 | # reboot - won't test | ||||
267 | # renice - won't test | ||||
268 | # reset - can't test: no output | ||||
Mark Whitley | c75f83d | 2001-03-13 23:30:18 +0000 | [diff] [blame] | 269 | |
Mark Whitley | d2117e9 | 2001-03-10 00:51:29 +0000 | [diff] [blame] | 270 | # rm |
Mark Whitley | c75f83d | 2001-03-13 23:30:18 +0000 | [diff] [blame] | 271 | touch F ; rm F |
272 | |||||
Mark Whitley | d2117e9 | 2001-03-10 00:51:29 +0000 | [diff] [blame] | 273 | # rmdir |
274 | # rmmod - won't test: dangerous | ||||
Mark Whitley | 04052f9 | 2001-05-24 17:15:33 +0000 | [diff] [blame] | 275 | |
Mark Whitley | d2117e9 | 2001-03-10 00:51:29 +0000 | [diff] [blame] | 276 | # route |
Mark Whitley | 04052f9 | 2001-05-24 17:15:33 +0000 | [diff] [blame] | 277 | route |
278 | |||||
Mark Whitley | d2117e9 | 2001-03-10 00:51:29 +0000 | [diff] [blame] | 279 | # rpmunpack |
Mark Whitley | 336480f | 2001-05-14 21:18:54 +0000 | [diff] [blame] | 280 | |
Mark Whitley | d2117e9 | 2001-03-10 00:51:29 +0000 | [diff] [blame] | 281 | # sed - we can do some one-liners here; probably needs it's own input file |
Mark Whitley | 336480f | 2001-05-14 21:18:54 +0000 | [diff] [blame] | 282 | echo foo | sed -ne '/^$/p' |
283 | sed -e '/test$/d' testcases | ||||
284 | sed -e '/^echo/d' testcases | ||||
285 | sed -e '/test/s/dangerous/PELIGROSO/' testcases | ||||
286 | |||||
Mark Whitley | d2117e9 | 2001-03-10 00:51:29 +0000 | [diff] [blame] | 287 | # setkeycodes |
Mark Whitley | 7384d7d | 2001-03-15 18:19:13 +0000 | [diff] [blame] | 288 | |
289 | # sh - note that we cannot test the shell interactively here | ||||
290 | sh -c "echo a b c" | ||||
291 | sh -c ">" | ||||
292 | sh -c "a" | ||||
Mark Whitley | 04052f9 | 2001-05-24 17:15:33 +0000 | [diff] [blame] | 293 | #sh sh.testcases |
294 | |||||
Mark Whitley | 7384d7d | 2001-03-15 18:19:13 +0000 | [diff] [blame] | 295 | |
Mark Whitley | d2117e9 | 2001-03-10 00:51:29 +0000 | [diff] [blame] | 296 | # sleep - can't test: produces no output |
Mark Whitley | c75f83d | 2001-03-13 23:30:18 +0000 | [diff] [blame] | 297 | |
Mark Whitley | d2117e9 | 2001-03-10 00:51:29 +0000 | [diff] [blame] | 298 | # sort |
Mark Whitley | c75f83d | 2001-03-13 23:30:18 +0000 | [diff] [blame] | 299 | sort tester.sh |
300 | sort -n tester.sh | ||||
301 | sort -r tester.sh | ||||
302 | |||||
Mark Whitley | d2117e9 | 2001-03-10 00:51:29 +0000 | [diff] [blame] | 303 | # stty |
304 | # swapon - won't test: dangerous | ||||
305 | # swapoff - won't test: dangerous | ||||
306 | # sync - can't test: no output | ||||
Mark Whitley | c75f83d | 2001-03-13 23:30:18 +0000 | [diff] [blame] | 307 | # syslogd - won't test: too involved |
Mark Whitley | d2117e9 | 2001-03-10 00:51:29 +0000 | [diff] [blame] | 308 | |
309 | # tail | ||||
310 | tail tester.sh | ||||
311 | tail -n 2 tester.sh | ||||
312 | |||||
313 | # tar | ||||
Mark Whitley | c75f83d | 2001-03-13 23:30:18 +0000 | [diff] [blame] | 314 | |
Mark Whitley | d2117e9 | 2001-03-10 00:51:29 +0000 | [diff] [blame] | 315 | # tee |
Mark Whitley | c75f83d | 2001-03-13 23:30:18 +0000 | [diff] [blame] | 316 | echo "please tee me!" | tee A B C ; cat A B C |
317 | echo "please tee me!" | tee A B C ; echo "tee me too!" | tee -a A B C ; cat A B C ; rm A B C | ||||
318 | |||||
319 | # telnet - can't test: interactive | ||||
320 | |||||
Mark Whitley | d2117e9 | 2001-03-10 00:51:29 +0000 | [diff] [blame] | 321 | # test |
322 | # tftp | ||||
Mark Whitley | 04052f9 | 2001-05-24 17:15:33 +0000 | [diff] [blame] | 323 | |
Mark Whitley | d2117e9 | 2001-03-10 00:51:29 +0000 | [diff] [blame] | 324 | # touch |
Mark Whitley | 04052f9 | 2001-05-24 17:15:33 +0000 | [diff] [blame] | 325 | touch tmpfile1; ls tmpfile1; rm -f tmpfile1 |
326 | touch -c tmpfile1; ls tmpfile1; rm -f tmpfile1 | ||||
327 | |||||
Mark Whitley | d2117e9 | 2001-03-10 00:51:29 +0000 | [diff] [blame] | 328 | # tr |
Mark Whitley | 04052f9 | 2001-05-24 17:15:33 +0000 | [diff] [blame] | 329 | echo "cbaab" | tr abc zyx |
330 | echo "TESTING A B C" | tr [A-Z] [a-z] | ||||
331 | # not GNU compatible | ||||
332 | echo fdhrnzvfu bffvsentr | tr [a-z] [n-z][a-m] | ||||
333 | echo abc[] | tr a[b AXB | ||||
334 | echo testing | tr -d aeiou | ||||
335 | |||||
336 | # true | ||||
Mark Whitley | d2117e9 | 2001-03-10 00:51:29 +0000 | [diff] [blame] | 337 | true ; echo $? |
Mark Whitley | 04052f9 | 2001-05-24 17:15:33 +0000 | [diff] [blame] | 338 | |
339 | # false | ||||
Mark Whitley | d2117e9 | 2001-03-10 00:51:29 +0000 | [diff] [blame] | 340 | false ; echo $? |
Mark Whitley | 04052f9 | 2001-05-24 17:15:33 +0000 | [diff] [blame] | 341 | |
Mark Whitley | d2117e9 | 2001-03-10 00:51:29 +0000 | [diff] [blame] | 342 | # tty |
343 | # umount | ||||
344 | # uname | ||||
345 | # uniq | ||||
346 | # unix2dos | ||||
347 | # update | ||||
348 | |||||
Mark Whitley | c75f83d | 2001-03-13 23:30:18 +0000 | [diff] [blame] | 349 | # uptime |
Mark Whitley | d2117e9 | 2001-03-10 00:51:29 +0000 | [diff] [blame] | 350 | uptime |
351 | |||||
352 | # usleep | ||||
353 | # uudecode | ||||
354 | # uuencode | ||||
355 | # watchdog | ||||
356 | |||||
357 | # wc | ||||
358 | wc tester.sh | ||||
359 | wc -c tester.sh | ||||
360 | wc -w tester.sh | ||||
361 | wc -l tester.sh | ||||
362 | wc -L tester.sh | ||||
363 | |||||
364 | # wget | ||||
365 | |||||
366 | # which | ||||
367 | which ls | ||||
368 | |||||
369 | # whoami | ||||
370 | whoami | ||||
371 | |||||
372 | # xargs | ||||
Mark Whitley | c75f83d | 2001-03-13 23:30:18 +0000 | [diff] [blame] | 373 | ls -1 ../e* | xargs |
374 | ls -1 ../e* | xargs md5sum | ||||
Mark Whitley | d2117e9 | 2001-03-10 00:51:29 +0000 | [diff] [blame] | 375 | |
376 | # yes - can't test: interactive (needs ^C) |