blob: 41c1a08e1185adcedfff8e113ba2e267220ab00a [file] [log] [blame]
Mark Whitleyd2117e92001-03-10 00:51:29 +00001# 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 Andersen77d92682001-05-23 20:32:09 +000020# test on a file (i.e., cat, md5sum)
Mark Whitleyd2117e92001-03-10 00:51:29 +000021# - 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
29basename `pwd`
30
31# cat
32cat tester.sh
Mark Whitley04052f92001-05-24 17:15:33 +000033echo hello there | cat tester.sh -
Mark Whitleyd2117e92001-03-10 00:51:29 +000034
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 Whitleyd2117e92001-03-10 00:51:29 +000043
44# cut
45echo "1234" | cut -c1
Mark Whitleycc7b4f32001-03-27 20:48:01 +000046echo "1234" | cut -c 1
47echo "1234567890" | cut -c2-7
48echo "1234567890" | cut -c 2-7
Mark Whitleyd2117e92001-03-10 00:51:29 +000049echo "f1 f2" | cut -f2
Mark Whitleycc7b4f32001-03-27 20:48:01 +000050echo "f1 f2" | cut -f 2
51echo "f1 f2 f3 f4 f5" | cut -f2-4
52echo "f1 f2 f3 f4 f5" | cut -f 2-4
Mark Whitleyd2117e92001-03-10 00:51:29 +000053
54# date
55date
56date -R
57date -u
58date +%d/%m/%y
59
60# dc - needs an input file
Mark Whitleyc75f83d2001-03-13 23:30:18 +000061
Mark Whitleyd2117e92001-03-10 00:51:29 +000062# dd
Mark Whitleyc75f83d2001-03-13 23:30:18 +000063dd if=/dev/urandom of=O bs=1k count=1 ; ls -l O ; rm O
64
Mark Whitleyd2117e92001-03-10 00:51:29 +000065# deallocvt
66
67# df
68df
69df .
70df -k
71df -h
72df -m
73
74# dirname
75dirname `pwd`
76
77# dmesg (XXX: change the silly cmd business in the source)
78dmesg
79dmesg -n 8
80dmesg -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
89du
90du -s
91du -l
92du -k
93du -h
94du -m
95
96# dumpkmap - no counterprt?
97# dutmp - no counterprt?
98
99# echo
100echo "foo bar baz"
101echo -n "no newline"
102
103
104# expr
Mark Whitley04052f92001-05-24 17:15:33 +0000105expr 1 \\| 1
106expr 1 \\| 0
107expr 0 \\| 1
108expr 0 \\| 0
109
110expr 1 \\& 1
111expr 1 \\& 0
112expr 0 \\& 1
113expr 0 \\& 0
114
115expr 0 \\< 1
116expr 1 \\< 0
117
118expr 1 \\> 0
119expr 0 \\> 1
120
121expr 0 \\<= 1
122expr 1 \\<= 0
123expr 1 \\<= 1
124
125expr 1 \\>= 0
126expr 0 \\>= 1
127expr 1 \\>= 1
128
129expr 1 + 2
130expr 2 - 1
131expr 2 \\* 3
132expr 12 / 2
133expr 12 % 5
Mark Whitleyd2117e92001-03-10 00:51:29 +0000134
135# somebody else can do all the string stuff
136
137
138# fbset - can't be tested here
139# fdflush
140# find
141find .
142
143# free
144free
145
146# freeramdisk
147# fsck.minix - won't test
148# getopt
Mark Whitley336480f2001-05-14 21:18:54 +0000149
Mark Whitleyd2117e92001-03-10 00:51:29 +0000150# grep
Mark Whitley336480f2001-05-14 21:18:54 +0000151grep -l strdup ../*.c
152grep -c strdup ../*.c
Mark Whitley336480f2001-05-14 21:18:54 +0000153grep -lc strdup ../*.c
154grep -cv strdup ../*.c
Mark Whitleyfa43e542001-05-24 18:36:18 +0000155grep -i null ../grep.c
156grep -e strdup -e regcomp -e atexit ../grep.c
Mark Whitley336480f2001-05-14 21:18:54 +0000157
Mark Whitleyd2117e92001-03-10 00:51:29 +0000158# gunzip
Mark Whitley04052f92001-05-24 17:15:33 +0000159
Mark Whitleyd2117e92001-03-10 00:51:29 +0000160# gzip
Mark Whitley04052f92001-05-24 17:15:33 +0000161echo testing 1 2 3 >tmpfile1; gzip tmpfile1; echo tmpfile*; md5sum tmpfile1.gz; rm tmpfile1.gz
162echo testing 1 2 3 | gzip >tmpfile1.gz; md5sum tmpfile1.gz; rm tmpfile1.gz
Mark Whitleyd2117e92001-03-10 00:51:29 +0000163# halt
164
165# head
166head tester.sh
167head -n 2 tester.sh
168
169# hostid
170hostid
171
172# hostname
173hostname
174hostname -s
175hostname -i
176hostname -d
177# not going to do this next one
178#hostname -F
179
180# id
181id
182id -u
183id -g
184id -ur
185id -un
186
187
188# ifconfig
Mark Whitley04052f92001-05-24 17:15:33 +0000189# requires BB_FEATURE_IFCONFIG_STATUS
190ifconfig
Mark Whitleyc75f83d2001-03-13 23:30:18 +0000191#ifconfig -a
Mark Whitleyd2117e92001-03-10 00:51:29 +0000192#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 Whitley04052f92001-05-24 17:15:33 +0000203# ln - see ln_tests.mk
Mark Whitleyd2117e92001-03-10 00:51:29 +0000204# loadacm
205# loadfont
206# loadkmap
207# logger
208# logname
Mark Whitleyc75f83d2001-03-13 23:30:18 +0000209
Mark Whitleyd2117e92001-03-10 00:51:29 +0000210# ls
Mark Whitleyc75f83d2001-03-13 23:30:18 +0000211ls ../e*
212ls -l ../e*
213ls -s ../e*
214ls -h ../e*
215ls -1 ../e*
Mark Whitleyd2117e92001-03-10 00:51:29 +0000216
217# lsmod
218lsmod
219
220# makedevs
221
222# md5sum
223md5sum tester.sh
224
225# mkdir
Mark Whitleyc75f83d2001-03-13 23:30:18 +0000226mkdir D ; ls -ld D ; rmdir D
227
Mark Whitleyd2117e92001-03-10 00:51:29 +0000228# mkfifo
Mark Whitleyc75f83d2001-03-13 23:30:18 +0000229#
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)
233mkfifo F ; ls -l F ; rm F
234mkfifo -m 0600 F ; ls -l F ; rm F
235
Mark Whitleyd2117e92001-03-10 00:51:29 +0000236# mkfs.minix - won't test
237# mknod
238# mkswap - won't test
239# mktemp
240# more - can't test: interactive
241
242# mount
243mount
244# not going to test any more
245
246# mt
Mark Whitley04052f92001-05-24 17:15:33 +0000247# mv - see mv_tests.mk
Mark Whitleyd2117e92001-03-10 00:51:29 +0000248# nc
249# nfsmount
250# nslookup
Mark Whitleyc75f83d2001-03-13 23:30:18 +0000251# ping
252ping -c 3 yahoo.com
Mark Whitleyd2117e92001-03-10 00:51:29 +0000253# 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
259pwd
260
261# rdate - won't test
262
263# readlink
Mark Whitleyc75f83d2001-03-13 23:30:18 +0000264ln -sf tester.sh L ; readlink L ; rm -f L
Mark Whitleyd2117e92001-03-10 00:51:29 +0000265
266# reboot - won't test
267# renice - won't test
268# reset - can't test: no output
Mark Whitleyc75f83d2001-03-13 23:30:18 +0000269
Mark Whitleyd2117e92001-03-10 00:51:29 +0000270# rm
Mark Whitleyc75f83d2001-03-13 23:30:18 +0000271touch F ; rm F
272
Mark Whitleyd2117e92001-03-10 00:51:29 +0000273# rmdir
274# rmmod - won't test: dangerous
Mark Whitley04052f92001-05-24 17:15:33 +0000275
Mark Whitleyd2117e92001-03-10 00:51:29 +0000276# route
Mark Whitley04052f92001-05-24 17:15:33 +0000277route
278
Mark Whitleyd2117e92001-03-10 00:51:29 +0000279# rpmunpack
Mark Whitley336480f2001-05-14 21:18:54 +0000280
Mark Whitleyd2117e92001-03-10 00:51:29 +0000281# sed - we can do some one-liners here; probably needs it's own input file
Mark Whitley336480f2001-05-14 21:18:54 +0000282echo foo | sed -ne '/^$/p'
283sed -e '/test$/d' testcases
284sed -e '/^echo/d' testcases
285sed -e '/test/s/dangerous/PELIGROSO/' testcases
286
Mark Whitleyd2117e92001-03-10 00:51:29 +0000287# setkeycodes
Mark Whitley7384d7d2001-03-15 18:19:13 +0000288
289# sh - note that we cannot test the shell interactively here
290sh -c "echo a b c"
291sh -c ">"
292sh -c "a"
Mark Whitley04052f92001-05-24 17:15:33 +0000293#sh sh.testcases
294
Mark Whitley7384d7d2001-03-15 18:19:13 +0000295
Mark Whitleyd2117e92001-03-10 00:51:29 +0000296# sleep - can't test: produces no output
Mark Whitleyc75f83d2001-03-13 23:30:18 +0000297
Mark Whitleyd2117e92001-03-10 00:51:29 +0000298# sort
Mark Whitleyc75f83d2001-03-13 23:30:18 +0000299sort tester.sh
300sort -n tester.sh
301sort -r tester.sh
302
Mark Whitleyd2117e92001-03-10 00:51:29 +0000303# stty
304# swapon - won't test: dangerous
305# swapoff - won't test: dangerous
306# sync - can't test: no output
Mark Whitleyc75f83d2001-03-13 23:30:18 +0000307# syslogd - won't test: too involved
Mark Whitleyd2117e92001-03-10 00:51:29 +0000308
309# tail
310tail tester.sh
311tail -n 2 tester.sh
312
313# tar
Mark Whitleyc75f83d2001-03-13 23:30:18 +0000314
Mark Whitleyd2117e92001-03-10 00:51:29 +0000315# tee
Mark Whitleyc75f83d2001-03-13 23:30:18 +0000316echo "please tee me!" | tee A B C ; cat A B C
317echo "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 Whitleyd2117e92001-03-10 00:51:29 +0000321# test
322# tftp
Mark Whitley04052f92001-05-24 17:15:33 +0000323
Mark Whitleyd2117e92001-03-10 00:51:29 +0000324# touch
Mark Whitley04052f92001-05-24 17:15:33 +0000325touch tmpfile1; ls tmpfile1; rm -f tmpfile1
326touch -c tmpfile1; ls tmpfile1; rm -f tmpfile1
327
Mark Whitleyd2117e92001-03-10 00:51:29 +0000328# tr
Mark Whitley04052f92001-05-24 17:15:33 +0000329echo "cbaab" | tr abc zyx
330echo "TESTING A B C" | tr [A-Z] [a-z]
331# not GNU compatible
332echo fdhrnzvfu bffvsentr | tr [a-z] [n-z][a-m]
333echo abc[] | tr a[b AXB
334echo testing | tr -d aeiou
335
336# true
Mark Whitleyd2117e92001-03-10 00:51:29 +0000337true ; echo $?
Mark Whitley04052f92001-05-24 17:15:33 +0000338
339# false
Mark Whitleyd2117e92001-03-10 00:51:29 +0000340false ; echo $?
Mark Whitley04052f92001-05-24 17:15:33 +0000341
Mark Whitleyd2117e92001-03-10 00:51:29 +0000342# tty
343# umount
344# uname
345# uniq
346# unix2dos
347# update
348
Mark Whitleyc75f83d2001-03-13 23:30:18 +0000349# uptime
Mark Whitleyd2117e92001-03-10 00:51:29 +0000350uptime
351
352# usleep
353# uudecode
354# uuencode
355# watchdog
356
357# wc
358wc tester.sh
359wc -c tester.sh
360wc -w tester.sh
361wc -l tester.sh
362wc -L tester.sh
363
364# wget
365
366# which
367which ls
368
369# whoami
370whoami
371
372# xargs
Mark Whitleyc75f83d2001-03-13 23:30:18 +0000373ls -1 ../e* | xargs
374ls -1 ../e* | xargs md5sum
Mark Whitleyd2117e92001-03-10 00:51:29 +0000375
376# yes - can't test: interactive (needs ^C)