blob: f636e17ea3123eae3860aa2b38db8efa40840a69 [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
Mark Whitley336480f2001-05-14 21:18:54 +0000150
Mark Whitleyd2117e92001-03-10 00:51:29 +0000151# grep
Mark Whitley336480f2001-05-14 21:18:54 +0000152grep -l strdup ../*.c
153grep -c strdup ../*.c
154# I swear, GNU grep seems broken for this next one
155grep -lc strdup ../*.c
156grep -cv strdup ../*.c
157
Mark Whitleyd2117e92001-03-10 00:51:29 +0000158# gunzip
159# gzip
160# halt
161
162# head
163head tester.sh
164head -n 2 tester.sh
165
166# hostid
167hostid
168
169# hostname
170hostname
171hostname -s
172hostname -i
173hostname -d
174# not going to do this next one
175#hostname -F
176
177# id
178id
179id -u
180id -g
181id -ur
182id -un
183
184
185# ifconfig
186#ifconfig
Mark Whitleyc75f83d2001-03-13 23:30:18 +0000187#ifconfig -a
Mark Whitleyd2117e92001-03-10 00:51:29 +0000188#ifconfig eth0
189#ifconfig lo
190
191# init - won't test
192# insmod - won't test
193
194# kill
195#kill -l
196# not going to do any more
197
198# length
199# ln
200# loadacm
201# loadfont
202# loadkmap
203# logger
204# logname
Mark Whitleyc75f83d2001-03-13 23:30:18 +0000205
Mark Whitleyd2117e92001-03-10 00:51:29 +0000206# ls
Mark Whitleyc75f83d2001-03-13 23:30:18 +0000207ls ../e*
208ls -l ../e*
209ls -s ../e*
210ls -h ../e*
211ls -1 ../e*
Mark Whitleyd2117e92001-03-10 00:51:29 +0000212
213# lsmod
214lsmod
215
216# makedevs
217
218# md5sum
219md5sum tester.sh
220
221# mkdir
Mark Whitleyc75f83d2001-03-13 23:30:18 +0000222mkdir D ; ls -ld D ; rmdir D
223
Mark Whitleyd2117e92001-03-10 00:51:29 +0000224# mkfifo
Mark Whitleyc75f83d2001-03-13 23:30:18 +0000225#
226# we will test making one. actually testing pushing data through it requires
227# more interaction than we can manage here.
228# (these lines turn up an existing ls bug)
229mkfifo F ; ls -l F ; rm F
230mkfifo -m 0600 F ; ls -l F ; rm F
231
Mark Whitleyd2117e92001-03-10 00:51:29 +0000232# mkfs.minix - won't test
233# mknod
234# mkswap - won't test
235# mktemp
236# more - can't test: interactive
237
238# mount
239mount
240# not going to test any more
241
242# mt
243# nc
244# nfsmount
245# nslookup
Mark Whitleyc75f83d2001-03-13 23:30:18 +0000246# ping
247ping -c 3 yahoo.com
Mark Whitleyd2117e92001-03-10 00:51:29 +0000248# pivot_root
249# poweroff - won't test
250# printf
251# ps - there's lotsa differences between busybox ps and any other ps
252
253# pwd
254pwd
255
256# rdate - won't test
257
258# readlink
Mark Whitleyc75f83d2001-03-13 23:30:18 +0000259ln -sf tester.sh L ; readlink L ; rm -f L
Mark Whitleyd2117e92001-03-10 00:51:29 +0000260
261# reboot - won't test
262# renice - won't test
263# reset - can't test: no output
Mark Whitleyc75f83d2001-03-13 23:30:18 +0000264
Mark Whitleyd2117e92001-03-10 00:51:29 +0000265# rm
Mark Whitleyc75f83d2001-03-13 23:30:18 +0000266touch F ; rm F
267
Mark Whitleyd2117e92001-03-10 00:51:29 +0000268# rmdir
269# rmmod - won't test: dangerous
270# route
271# rpmunpack
Mark Whitley336480f2001-05-14 21:18:54 +0000272
Mark Whitleyd2117e92001-03-10 00:51:29 +0000273# sed - we can do some one-liners here; probably needs it's own input file
Mark Whitley336480f2001-05-14 21:18:54 +0000274echo foo | sed -ne '/^$/p'
275sed -e '/test$/d' testcases
276sed -e '/^echo/d' testcases
277sed -e '/test/s/dangerous/PELIGROSO/' testcases
278
Mark Whitleyd2117e92001-03-10 00:51:29 +0000279# setkeycodes
Mark Whitley7384d7d2001-03-15 18:19:13 +0000280
281# sh - note that we cannot test the shell interactively here
282sh -c "echo a b c"
283sh -c ">"
284sh -c "a"
285
Mark Whitleyd2117e92001-03-10 00:51:29 +0000286# sleep - can't test: produces no output
Mark Whitleyc75f83d2001-03-13 23:30:18 +0000287
Mark Whitleyd2117e92001-03-10 00:51:29 +0000288# sort
Mark Whitleyc75f83d2001-03-13 23:30:18 +0000289sort tester.sh
290sort -n tester.sh
291sort -r tester.sh
292
Mark Whitleyd2117e92001-03-10 00:51:29 +0000293# stty
294# swapon - won't test: dangerous
295# swapoff - won't test: dangerous
296# sync - can't test: no output
Mark Whitleyc75f83d2001-03-13 23:30:18 +0000297# syslogd - won't test: too involved
Mark Whitleyd2117e92001-03-10 00:51:29 +0000298
299# tail
300tail tester.sh
301tail -n 2 tester.sh
302
303# tar
Mark Whitleyc75f83d2001-03-13 23:30:18 +0000304
Mark Whitleyd2117e92001-03-10 00:51:29 +0000305# tee
Mark Whitleyc75f83d2001-03-13 23:30:18 +0000306echo "please tee me!" | tee A B C ; cat A B C
307echo "please tee me!" | tee A B C ; echo "tee me too!" | tee -a A B C ; cat A B C ; rm A B C
308
309# telnet - can't test: interactive
310
Mark Whitleyd2117e92001-03-10 00:51:29 +0000311# test
312# tftp
313# touch
314# tr
315true ; echo $?
316false ; echo $?
317# tty
318# umount
319# uname
320# uniq
321# unix2dos
322# update
323
Mark Whitleyc75f83d2001-03-13 23:30:18 +0000324# uptime
Mark Whitleyd2117e92001-03-10 00:51:29 +0000325uptime
326
327# usleep
328# uudecode
329# uuencode
330# watchdog
331
332# wc
333wc tester.sh
334wc -c tester.sh
335wc -w tester.sh
336wc -l tester.sh
337wc -L tester.sh
338
339# wget
340
341# which
342which ls
343
344# whoami
345whoami
346
347# xargs
Mark Whitleyc75f83d2001-03-13 23:30:18 +0000348ls -1 ../e* | xargs
349ls -1 ../e* | xargs md5sum
Mark Whitleyd2117e92001-03-10 00:51:29 +0000350
351# yes - can't test: interactive (needs ^C)