Some new testcases, some improvements to the tester.sh script.
[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 "f1        f2" | cut -f2
47
48 # date
49 date
50 date -R
51 date -u
52 date +%d/%m/%y
53
54 # dc - needs an input file
55
56 # dd
57 dd if=/dev/urandom of=O bs=1k count=1 ; ls -l O ; rm O
58
59 # deallocvt
60
61 # df
62 df
63 df .
64 df -k
65 df -h
66 df -m
67
68 # dirname
69 dirname `pwd`
70
71 # dmesg (XXX: change the silly cmd business in the source)
72 dmesg
73 dmesg -n 8
74 dmesg -s 512
75 # I really don't want to do this next one
76 #dmesg -c
77
78 # dos2unix - needs an input file
79 # dpkg
80 # dpkg_deb
81
82 # du
83 du
84 du -s
85 du -l
86 du -k
87 du -h
88 du -m
89
90 # dumpkmap - no counterprt?
91 # dutmp - no counterprt?
92
93 # echo
94 echo "foo bar baz"
95 echo -n "no newline"
96
97
98 # expr
99 # XXX: something's wrong with the way I'm doing these. Figure it out later.
100 #expr 1 \| 1
101 #expr 1 \| 0
102 #expr 0 \| 1
103 #expr 0 \| 0
104 #
105 #expr 1 \& 1
106 #expr 1 \& 0
107 #expr 0 \& 1
108 #expr 0 \& 0
109 #
110 #expr 0 \< 1
111 #expr 1 \< 0
112 #
113 #expr 1 \> 0
114 #expr 0 \> 1
115 #
116 #expr 0 \<= 1
117 #expr 1 \<= 0
118 #expr 1 \<= 1
119 #
120 #expr 1 \>= 0
121 #expr 0 \>= 1
122 #expr 1 \>= 1
123 #
124 #expr 1 + 2
125 #expr 2 - 1
126 #expr 2 \* 3
127 #expr 12 / 2
128 #expr 12 % 5
129
130 # somebody else can do all the string stuff
131
132
133 # fbset - can't be tested here
134 # fdflush
135 # find
136 find .
137
138 # free
139 free
140
141 # freeramdisk
142 # fsck.minix - won't test
143 # getopt
144 # grep
145 # gunzip
146 # gzip
147 # halt
148
149 # head
150 head tester.sh
151 head -n 2 tester.sh
152
153 # hostid
154 hostid
155
156 # hostname
157 hostname
158 hostname -s
159 hostname -i
160 hostname -d
161 # not going to do this next one
162 #hostname -F
163
164 # id
165 id
166 id -u
167 id -g
168 id -ur
169 id -un
170
171
172 # ifconfig
173 #ifconfig
174 #ifconfig -a
175 #ifconfig eth0
176 #ifconfig lo
177
178 # init - won't test
179 # insmod - won't test
180
181 # kill
182 #kill -l
183 # not going to do any more
184
185 # length
186 # ln
187 # loadacm
188 # loadfont
189 # loadkmap
190 # logger
191 # logname
192
193 # ls
194 ls ../e*
195 ls -l ../e*
196 ls -s ../e*
197 ls -h ../e*
198 ls -1 ../e*
199
200 # lsmod
201 lsmod
202
203 # makedevs
204
205 # md5sum
206 md5sum tester.sh
207
208 # mkdir
209 mkdir D ; ls -ld D ; rmdir D
210
211 # mkfifo
212 #
213 # we will test making one. actually testing pushing data through it requires
214 # more interaction than we can manage here.
215 # (these lines turn up an existing ls bug)
216 mkfifo F ; ls -l F ; rm F
217 mkfifo -m 0600 F ; ls -l F ; rm F
218
219 # mkfs.minix - won't test
220 # mknod
221 # mkswap - won't test
222 # mktemp
223 # more - can't test: interactive
224
225 # mount
226 mount
227 # not going to test any more
228
229 # mt
230 # nc
231 # nfsmount
232 # nslookup
233 # ping
234 ping -c 3 yahoo.com
235 # pivot_root
236 # poweroff - won't test
237 # printf
238 # ps - there's lotsa differences between busybox ps and any other ps
239
240 # pwd
241 pwd
242
243 # rdate - won't test
244
245 # readlink
246 ln -sf tester.sh L ; readlink L ; rm -f L
247
248 # reboot - won't test
249 # renice - won't test
250 # reset - can't test: no output
251
252 # rm
253 touch F ; rm F
254
255 # rmdir
256 # rmmod - won't test: dangerous
257 # route
258 # rpmunpack
259 # sed - we can do some one-liners here; probably needs it's own input file
260 # setkeycodes
261 # sh - this should probably have it's own testcase or input file
262 # sleep - can't test: produces no output
263
264 # sort
265 sort tester.sh
266 sort -n tester.sh
267 sort -r tester.sh
268
269 # stty
270 # swapon - won't test: dangerous
271 # swapoff - won't test: dangerous
272 # sync - can't test: no output
273 # syslogd - won't test: too involved
274
275 # tail
276 tail tester.sh
277 tail -n 2  tester.sh
278
279 # tar
280
281 # tee
282 echo "please tee me!" | tee A B C ; cat A B C
283 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
284
285 # telnet - can't test: interactive
286
287 # test
288 # tftp
289 # touch
290 # tr
291 true ; echo $?
292 false ; echo $?
293 # tty
294 # umount
295 # uname
296 # uniq
297 # unix2dos
298 # update
299
300 # uptime
301 uptime
302
303 # usleep
304 # uudecode
305 # uuencode
306 # watchdog
307
308 # wc
309 wc tester.sh
310 wc -c tester.sh
311 wc -w tester.sh
312 wc -l tester.sh
313 wc -L tester.sh
314
315 # wget
316
317 # which
318 which ls
319
320 # whoami
321 whoami
322
323 # xargs
324 ls -1 ../e* | xargs
325 ls -1 ../e* | xargs md5sum
326
327 # yes - can't test: interactive (needs ^C)