blob: 5933c3b105d69b39638785d996783bfae523ca6b [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
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
29basename `pwd`
30
31# cat
32cat 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
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 Whitleyc75f83d2001-03-13 23:30:18 +0000105# 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
Mark Whitleyd2117e92001-03-10 00:51:29 +0000135
136# somebody else can do all the string stuff
137
138
139# fbset - can't be tested here
140# fdflush
141# find
142find .
143
144# free
145free
146
147# freeramdisk
148# fsck.minix - won't test
149# getopt
150# grep
151# gunzip
152# gzip
153# halt
154
155# head
156head tester.sh
157head -n 2 tester.sh
158
159# hostid
160hostid
161
162# hostname
163hostname
164hostname -s
165hostname -i
166hostname -d
167# not going to do this next one
168#hostname -F
169
170# id
171id
172id -u
173id -g
174id -ur
175id -un
176
177
178# ifconfig
179#ifconfig
Mark Whitleyc75f83d2001-03-13 23:30:18 +0000180#ifconfig -a
Mark Whitleyd2117e92001-03-10 00:51:29 +0000181#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
Mark Whitleyc75f83d2001-03-13 23:30:18 +0000198
Mark Whitleyd2117e92001-03-10 00:51:29 +0000199# ls
Mark Whitleyc75f83d2001-03-13 23:30:18 +0000200ls ../e*
201ls -l ../e*
202ls -s ../e*
203ls -h ../e*
204ls -1 ../e*
Mark Whitleyd2117e92001-03-10 00:51:29 +0000205
206# lsmod
207lsmod
208
209# makedevs
210
211# md5sum
212md5sum tester.sh
213
214# mkdir
Mark Whitleyc75f83d2001-03-13 23:30:18 +0000215mkdir D ; ls -ld D ; rmdir D
216
Mark Whitleyd2117e92001-03-10 00:51:29 +0000217# mkfifo
Mark Whitleyc75f83d2001-03-13 23:30:18 +0000218#
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)
222mkfifo F ; ls -l F ; rm F
223mkfifo -m 0600 F ; ls -l F ; rm F
224
Mark Whitleyd2117e92001-03-10 00:51:29 +0000225# mkfs.minix - won't test
226# mknod
227# mkswap - won't test
228# mktemp
229# more - can't test: interactive
230
231# mount
232mount
233# not going to test any more
234
235# mt
236# nc
237# nfsmount
238# nslookup
Mark Whitleyc75f83d2001-03-13 23:30:18 +0000239# ping
240ping -c 3 yahoo.com
Mark Whitleyd2117e92001-03-10 00:51:29 +0000241# 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
247pwd
248
249# rdate - won't test
250
251# readlink
Mark Whitleyc75f83d2001-03-13 23:30:18 +0000252ln -sf tester.sh L ; readlink L ; rm -f L
Mark Whitleyd2117e92001-03-10 00:51:29 +0000253
254# reboot - won't test
255# renice - won't test
256# reset - can't test: no output
Mark Whitleyc75f83d2001-03-13 23:30:18 +0000257
Mark Whitleyd2117e92001-03-10 00:51:29 +0000258# rm
Mark Whitleyc75f83d2001-03-13 23:30:18 +0000259touch F ; rm F
260
Mark Whitleyd2117e92001-03-10 00:51:29 +0000261# 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
Mark Whitley7384d7d2001-03-15 18:19:13 +0000267
268# sh - note that we cannot test the shell interactively here
269sh -c "echo a b c"
270sh -c ">"
271sh -c "a"
272
Mark Whitleyd2117e92001-03-10 00:51:29 +0000273# sleep - can't test: produces no output
Mark Whitleyc75f83d2001-03-13 23:30:18 +0000274
Mark Whitleyd2117e92001-03-10 00:51:29 +0000275# sort
Mark Whitleyc75f83d2001-03-13 23:30:18 +0000276sort tester.sh
277sort -n tester.sh
278sort -r tester.sh
279
Mark Whitleyd2117e92001-03-10 00:51:29 +0000280# stty
281# swapon - won't test: dangerous
282# swapoff - won't test: dangerous
283# sync - can't test: no output
Mark Whitleyc75f83d2001-03-13 23:30:18 +0000284# syslogd - won't test: too involved
Mark Whitleyd2117e92001-03-10 00:51:29 +0000285
286# tail
287tail tester.sh
288tail -n 2 tester.sh
289
290# tar
Mark Whitleyc75f83d2001-03-13 23:30:18 +0000291
Mark Whitleyd2117e92001-03-10 00:51:29 +0000292# tee
Mark Whitleyc75f83d2001-03-13 23:30:18 +0000293echo "please tee me!" | tee A B C ; cat A B C
294echo "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
Mark Whitleyd2117e92001-03-10 00:51:29 +0000298# test
299# tftp
300# touch
301# tr
302true ; echo $?
303false ; echo $?
304# tty
305# umount
306# uname
307# uniq
308# unix2dos
309# update
310
Mark Whitleyc75f83d2001-03-13 23:30:18 +0000311# uptime
Mark Whitleyd2117e92001-03-10 00:51:29 +0000312uptime
313
314# usleep
315# uudecode
316# uuencode
317# watchdog
318
319# wc
320wc tester.sh
321wc -c tester.sh
322wc -w tester.sh
323wc -l tester.sh
324wc -L tester.sh
325
326# wget
327
328# which
329which ls
330
331# whoami
332whoami
333
334# xargs
Mark Whitleyc75f83d2001-03-13 23:30:18 +0000335ls -1 ../e* | xargs
336ls -1 ../e* | xargs md5sum
Mark Whitleyd2117e92001-03-10 00:51:29 +0000337
338# yes - can't test: interactive (needs ^C)