3 # This file should be filled with test cases to test applets that:
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)
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
16 # Some other guidelines to follow:
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 # - pipe symbols that represent real pipes need a space in front of them
25 # (so the test script can find them and add the "../busybox" after it).
26 # - pipe symbols that are not used for pipes need to be shell-escaped,
27 # with a double \. See the expr test cases.
37 echo hello there | cat tester.sh -
43 # chvt - can't be tested here
44 # clear - can't be tested here
50 echo "1234" | cut -c 1
51 echo "1234567890" | cut -c2-7
52 echo "1234567890" | cut -c 2-7
53 echo "f1 f2" | cut -f2
54 echo "f1 f2" | cut -f 2
55 echo "f1 f2 f3 f4 f5" | cut -f2-4
56 echo "f1 f2 f3 f4 f5" | cut -f 2-4
64 # dc - needs an input file
67 # BUG: record count line goes to stdout instead of stderr
68 dd if=/dev/urandom of=O bs=1k count=1 ; ls -l O ; rm O
73 # XXX: minor formatting differences
83 # dmesg (XXX: change the silly cmd business in the source)
87 # I really don't want to do this next one
90 # dos2unix - needs an input file
95 # BUG: rounding behavior differs from GNU du
103 # dumpkmap - no counterprt?
104 # dutmp - no counterprt?
142 # somebody else can do all the string stuff
145 # fbset - can't be tested here
151 # XXX: minor formatting differences
155 # fsck.minix - won't test
159 grep -l strdup ../*.c
160 grep -c strdup ../*.c
161 grep -lc strdup ../*.c
162 grep -cv strdup ../*.c
163 grep -i null ../grep.c
164 grep -e strdup -e regcomp -e atexit ../grep.c
169 # XXX: compressed output differs from gzip-1.2.4, but decompresses fine
170 echo testing 1 2 3 >tmpfile1; gzip tmpfile1; echo tmpfile*; md5sum tmpfile1.gz; rm tmpfile1.gz
171 echo testing 1 2 3 | gzip >tmpfile1.gz; md5sum tmpfile1.gz; rm tmpfile1.gz
174 # halt - won't test, dangerous
184 # XXX: minor formatting differences
189 # not going to do this next one
193 # BUG: Busybox id doesn't print supplemental groups
202 # requires BB_FEATURE_IFCONFIG_STATUS
209 # insmod - won't test
213 # not going to do any more
216 # ln - see ln_tests.mk
224 # XXX: minor formatting differences
240 mkdir D ; ls -ld D ; rmdir D
244 # we will test making one. actually testing pushing data through it requires
245 # more interaction than we can manage here.
246 # (these lines turn up an existing ls bug)
247 mkfifo F ; ls -l F ; rm F
248 mkfifo -m 0600 F ; ls -l F ; rm F
250 # mkfs.minix - won't test
252 # mkswap - won't test
254 # more - can't test: interactive
257 # BUG: proc line starts with /proc instead of proc
259 # not going to test mount with any args, can't be done safely or sanely
262 # mv - see mv_tests.mk
269 # poweroff - won't test
271 # ps - there's lotsa differences between busybox ps and any other ps
279 ln -sf tester.sh L ; readlink L ; rm -f L
281 # reboot - won't test
282 # renice - won't test
283 # reset - can't test: no output
289 # rmmod - won't test: dangerous
292 # XXX: doesn't DNS resolve
299 # sed - we can do some one-liners here, some testing is a little
300 # difficult to do in just this space (like a,i,c cmds).
303 echo foo | sed -ne '/^$/p'
304 echo -e "foo\\n\\nbar" | sed -ne '/^$/p'
306 sed -e '/test$/d' testcases
307 sed -e '/^echo/d' testcases
308 sed -e '/test/s/dangerous/PELIGROSO/' testcases
309 sed -ne '1,/getopt/p' ../pwd.c
310 sed -e '/getopt/r ../pwd.c' ../sed.c
315 # sh - note that we cannot test the shell interactively here
322 # sleep - can't test: produces no output
330 # swapon - won't test: dangerous
331 # swapoff - won't test: dangerous
332 # sync - can't test: no output
333 # syslogd - won't test: too involved
342 echo "please tee me!" | tee A B C ; cat A B C
343 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
345 # telnet - can't test: interactive
351 touch tmpfile1; ls tmpfile1; rm -f tmpfile1
352 touch -c tmpfile1; ls tmpfile1; rm -f tmpfile1
355 # BUG: Busybox tr range handling minix style [a-z] instead of GNU # style a-z
356 echo "cbaab" | tr abc zyx
357 echo "TESTING A B C" | tr [A-Z] [a-z]
359 echo fdhrnzvfu bffvsentr | tr [a-z] [n-z][a-m]
360 echo abc[] | tr a[b AXB
361 echo testing | tr -d aeiou
377 # BUG: doesn't print number of users
401 # XXX: Busygox xargs divides filenames with '\n' instead of ' '
403 ls -1 ../e* | xargs md5sum
405 # yes - can't test: interactive (needs ^C)