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
33 echo hello there | cat tester.sh -
39 # chvt - can't be tested here
40 # clear - can't be tested here
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
60 # dc - needs an input file
63 dd if=/dev/urandom of=O bs=1k count=1 ; ls -l O ; rm O
77 # dmesg (XXX: change the silly cmd business in the source)
81 # I really don't want to do this next one
84 # dos2unix - needs an input file
96 # dumpkmap - no counterprt?
97 # dutmp - no counterprt?
135 # somebody else can do all the string stuff
138 # fbset - can't be tested here
147 # fsck.minix - won't test
151 grep -l strdup ../*.c
152 grep -c strdup ../*.c
153 grep -lc strdup ../*.c
154 grep -cv strdup ../*.c
155 grep -i null ../grep.c
156 grep -e strdup -e regcomp -e atexit ../grep.c
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
177 # not going to do this next one
189 # requires BB_FEATURE_IFCONFIG_STATUS
196 # insmod - won't test
200 # not going to do any more
203 # ln - see ln_tests.mk
226 mkdir D ; ls -ld D ; rmdir D
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
236 # mkfs.minix - won't test
238 # mkswap - won't test
240 # more - can't test: interactive
244 # not going to test any more
247 # mv - see mv_tests.mk
254 # poweroff - won't test
256 # ps - there's lotsa differences between busybox ps and any other ps
264 ln -sf tester.sh L ; readlink L ; rm -f L
266 # reboot - won't test
267 # renice - won't test
268 # reset - can't test: no output
274 # rmmod - won't test: dangerous
281 # sed - we can do some one-liners here; probably needs it's own input file
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
289 # sh - note that we cannot test the shell interactively here
296 # sleep - can't test: produces no output
304 # swapon - won't test: dangerous
305 # swapoff - won't test: dangerous
306 # sync - can't test: no output
307 # syslogd - won't test: too involved
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
319 # telnet - can't test: interactive
325 touch tmpfile1; ls tmpfile1; rm -f tmpfile1
326 touch -c tmpfile1; ls tmpfile1; rm -f tmpfile1
329 echo "cbaab" | tr abc zyx
330 echo "TESTING A B C" | tr [A-Z] [a-z]
332 echo fdhrnzvfu bffvsentr | tr [a-z] [n-z][a-m]
333 echo abc[] | tr a[b AXB
334 echo testing | tr -d aeiou
374 ls -1 ../e* | xargs md5sum
376 # yes - can't test: interactive (needs ^C)