Another update from Larry:
[oweals/busybox.git] / tests / testcases
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
20 #    test on a file (i.e. cat, md5sum)
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
33
34 # chmod
35 # chown
36 # chgrp
37 # chroot
38 # chvt - can't be tested here
39 # clear - can't be tested here
40 # cmp
41 # cp
42 # mv
43
44 # cut
45 echo "1234" | cut -c1
46 echo "1234" | cut -c 1
47 echo "1234567890" | cut -c2-7
48 echo "1234567890" | cut -c 2-7
49 echo "f1        f2" | cut -f2
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
53
54 # date
55 date
56 date -R
57 date -u
58 date +%d/%m/%y
59
60 # dc - needs an input file
61
62 # dd
63 dd if=/dev/urandom of=O bs=1k count=1 ; ls -l O ; rm O
64
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
105 # XXX: something's wrong with the way I'm doing these. Figure it out later.
106 #expr 1 \| 1
107 #expr 1 \| 0
108 #expr 0 \| 1
109 #expr 0 \| 0
110 #
111 #expr 1 \& 1
112 #expr 1 \& 0
113 #expr 0 \& 1
114 #expr 0 \& 0
115 #
116 #expr 0 \< 1
117 #expr 1 \< 0
118 #
119 #expr 1 \> 0
120 #expr 0 \> 1
121 #
122 #expr 0 \<= 1
123 #expr 1 \<= 0
124 #expr 1 \<= 1
125 #
126 #expr 1 \>= 0
127 #expr 0 \>= 1
128 #expr 1 \>= 1
129 #
130 #expr 1 + 2
131 #expr 2 - 1
132 #expr 2 \* 3
133 #expr 12 / 2
134 #expr 12 % 5
135
136 # somebody else can do all the string stuff
137
138
139 # fbset - can't be tested here
140 # fdflush
141 # find
142 find .
143
144 # free
145 free
146
147 # freeramdisk
148 # fsck.minix - won't test
149 # getopt
150 # grep
151 # gunzip
152 # gzip
153 # halt
154
155 # head
156 head tester.sh
157 head -n 2 tester.sh
158
159 # hostid
160 hostid
161
162 # hostname
163 hostname
164 hostname -s
165 hostname -i
166 hostname -d
167 # not going to do this next one
168 #hostname -F
169
170 # id
171 id
172 id -u
173 id -g
174 id -ur
175 id -un
176
177
178 # ifconfig
179 #ifconfig
180 #ifconfig -a
181 #ifconfig eth0
182 #ifconfig lo
183
184 # init - won't test
185 # insmod - won't test
186
187 # kill
188 #kill -l
189 # not going to do any more
190
191 # length
192 # ln
193 # loadacm
194 # loadfont
195 # loadkmap
196 # logger
197 # logname
198
199 # ls
200 ls ../e*
201 ls -l ../e*
202 ls -s ../e*
203 ls -h ../e*
204 ls -1 ../e*
205
206 # lsmod
207 lsmod
208
209 # makedevs
210
211 # md5sum
212 md5sum tester.sh
213
214 # mkdir
215 mkdir D ; ls -ld D ; rmdir D
216
217 # mkfifo
218 #
219 # we will test making one. actually testing pushing data through it requires
220 # more interaction than we can manage here.
221 # (these lines turn up an existing ls bug)
222 mkfifo F ; ls -l F ; rm F
223 mkfifo -m 0600 F ; ls -l F ; rm F
224
225 # mkfs.minix - won't test
226 # mknod
227 # mkswap - won't test
228 # mktemp
229 # more - can't test: interactive
230
231 # mount
232 mount
233 # not going to test any more
234
235 # mt
236 # nc
237 # nfsmount
238 # nslookup
239 # ping
240 ping -c 3 yahoo.com
241 # pivot_root
242 # poweroff - won't test
243 # printf
244 # ps - there's lotsa differences between busybox ps and any other ps
245
246 # pwd
247 pwd
248
249 # rdate - won't test
250
251 # readlink
252 ln -sf tester.sh L ; readlink L ; rm -f L
253
254 # reboot - won't test
255 # renice - won't test
256 # reset - can't test: no output
257
258 # rm
259 touch F ; rm F
260
261 # rmdir
262 # rmmod - won't test: dangerous
263 # route
264 # rpmunpack
265 # sed - we can do some one-liners here; probably needs it's own input file
266 # setkeycodes
267
268 # sh - note that we cannot test the shell interactively here
269 sh -c "echo a b c"
270 sh -c ">"
271 sh -c "a"
272
273 # sleep - can't test: produces no output
274
275 # sort
276 sort tester.sh
277 sort -n tester.sh
278 sort -r tester.sh
279
280 # stty
281 # swapon - won't test: dangerous
282 # swapoff - won't test: dangerous
283 # sync - can't test: no output
284 # syslogd - won't test: too involved
285
286 # tail
287 tail tester.sh
288 tail -n 2  tester.sh
289
290 # tar
291
292 # tee
293 echo "please tee me!" | tee A B C ; cat A B C
294 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
295
296 # telnet - can't test: interactive
297
298 # test
299 # tftp
300 # touch
301 # tr
302 true ; echo $?
303 false ; echo $?
304 # tty
305 # umount
306 # uname
307 # uniq
308 # unix2dos
309 # update
310
311 # uptime
312 uptime
313
314 # usleep
315 # uudecode
316 # uuencode
317 # watchdog
318
319 # wc
320 wc tester.sh
321 wc -c tester.sh
322 wc -w tester.sh
323 wc -l tester.sh
324 wc -L tester.sh
325
326 # wget
327
328 # which
329 which ls
330
331 # whoami
332 whoami
333
334 # xargs
335 ls -1 ../e* | xargs
336 ls -1 ../e* | xargs md5sum
337
338 # yes - can't test: interactive (needs ^C)