2001-03-10 06:21:29 +05:30
|
|
|
# testcases
|
|
|
|
#
|
|
|
|
# This file should be filled with test cases to test applets that:
|
|
|
|
#
|
|
|
|
# - can somehow produce output (we can't test sync or sleep)
|
|
|
|
# - have a GNU (or other) counterpart
|
|
|
|
# - are not interactive (don't require a ^C or anything)
|
|
|
|
# - don't require extensive setup or cleanup (a litte setup is fine)
|
|
|
|
# - don't have huge and possibly damaging effects (fsck, swapoff)
|
|
|
|
#
|
|
|
|
# If possible, a test case should be made that tests each option the applet
|
|
|
|
# supports. When a new option is added, a new test case should be written for
|
|
|
|
# it. When somebody reports a bug with a testcase, that testcase should be
|
|
|
|
# added here as well.
|
|
|
|
#
|
|
|
|
# Some other guidelines to follow:
|
|
|
|
#
|
|
|
|
# - please try to keep applets alphabetized, it will make life easier
|
|
|
|
# - use the file tester.sh or testcases when you need to do a non-destructive
|
2001-05-24 02:02:09 +05:30
|
|
|
# test on a file (i.e., cat, md5sum)
|
2001-03-10 06:21:29 +05:30
|
|
|
# - try to make the applet you're testing the first thing on the line (this
|
|
|
|
# not always possible)
|
|
|
|
# - (???) if you have to create a temporary file, call it TMPFILE
|
2001-05-25 02:54:39 +05:30
|
|
|
# - pipe symbols that represent real pipes need a space in front of them
|
|
|
|
# (so the test script can find them and add the "../busybox" after it).
|
|
|
|
# - pipe symbols that are not used for pipes need to be shell-escaped,
|
|
|
|
# with a double \. See the expr test cases.
|
2001-03-10 06:21:29 +05:30
|
|
|
|
|
|
|
|
|
|
|
# ar
|
|
|
|
|
|
|
|
# basename
|
|
|
|
basename `pwd`
|
|
|
|
|
|
|
|
# cat
|
|
|
|
cat tester.sh
|
2001-05-24 22:45:33 +05:30
|
|
|
echo hello there | cat tester.sh -
|
2001-03-10 06:21:29 +05:30
|
|
|
|
|
|
|
# chmod
|
|
|
|
# chown
|
|
|
|
# chgrp
|
|
|
|
# chroot
|
|
|
|
# chvt - can't be tested here
|
|
|
|
# clear - can't be tested here
|
|
|
|
# cmp
|
|
|
|
# cp
|
|
|
|
|
|
|
|
# cut
|
|
|
|
echo "1234" | cut -c1
|
2001-03-28 02:18:01 +05:30
|
|
|
echo "1234" | cut -c 1
|
|
|
|
echo "1234567890" | cut -c2-7
|
|
|
|
echo "1234567890" | cut -c 2-7
|
2001-03-10 06:21:29 +05:30
|
|
|
echo "f1 f2" | cut -f2
|
2001-03-28 02:18:01 +05:30
|
|
|
echo "f1 f2" | cut -f 2
|
|
|
|
echo "f1 f2 f3 f4 f5" | cut -f2-4
|
|
|
|
echo "f1 f2 f3 f4 f5" | cut -f 2-4
|
2001-03-10 06:21:29 +05:30
|
|
|
|
|
|
|
# date
|
|
|
|
date
|
|
|
|
date -R
|
|
|
|
date -u
|
|
|
|
date +%d/%m/%y
|
|
|
|
|
|
|
|
# dc - needs an input file
|
2001-03-14 05:00:18 +05:30
|
|
|
|
2001-03-10 06:21:29 +05:30
|
|
|
# dd
|
2001-05-25 02:54:39 +05:30
|
|
|
# BUG: record count line goes to stdout instead of stderr
|
2001-03-14 05:00:18 +05:30
|
|
|
dd if=/dev/urandom of=O bs=1k count=1 ; ls -l O ; rm O
|
|
|
|
|
2001-03-10 06:21:29 +05:30
|
|
|
# deallocvt
|
|
|
|
|
|
|
|
# df
|
2001-05-25 02:54:39 +05:30
|
|
|
# XXX: minor formatting differences
|
2001-03-10 06:21:29 +05:30
|
|
|
df
|
|
|
|
df .
|
|
|
|
df -k
|
|
|
|
df -h
|
|
|
|
df -m
|
|
|
|
|
|
|
|
# dirname
|
|
|
|
dirname `pwd`
|
|
|
|
|
|
|
|
# dmesg (XXX: change the silly cmd business in the source)
|
|
|
|
dmesg
|
|
|
|
dmesg -n 8
|
|
|
|
dmesg -s 512
|
|
|
|
# I really don't want to do this next one
|
|
|
|
#dmesg -c
|
|
|
|
|
|
|
|
# dos2unix - needs an input file
|
|
|
|
# dpkg
|
|
|
|
# dpkg_deb
|
|
|
|
|
|
|
|
# du
|
2001-05-25 02:54:39 +05:30
|
|
|
# BUG: rounding behavior differs from GNU du
|
2001-03-10 06:21:29 +05:30
|
|
|
du
|
|
|
|
du -s
|
|
|
|
du -l
|
|
|
|
du -k
|
|
|
|
du -h
|
|
|
|
du -m
|
|
|
|
|
|
|
|
# dumpkmap - no counterprt?
|
|
|
|
# dutmp - no counterprt?
|
|
|
|
|
|
|
|
# echo
|
|
|
|
echo "foo bar baz"
|
|
|
|
echo -n "no newline"
|
|
|
|
|
|
|
|
|
|
|
|
# expr
|
2001-05-24 22:45:33 +05:30
|
|
|
expr 1 \\| 1
|
|
|
|
expr 1 \\| 0
|
|
|
|
expr 0 \\| 1
|
|
|
|
expr 0 \\| 0
|
|
|
|
|
|
|
|
expr 1 \\& 1
|
|
|
|
expr 1 \\& 0
|
|
|
|
expr 0 \\& 1
|
|
|
|
expr 0 \\& 0
|
|
|
|
|
|
|
|
expr 0 \\< 1
|
|
|
|
expr 1 \\< 0
|
|
|
|
|
|
|
|
expr 1 \\> 0
|
|
|
|
expr 0 \\> 1
|
|
|
|
|
|
|
|
expr 0 \\<= 1
|
|
|
|
expr 1 \\<= 0
|
|
|
|
expr 1 \\<= 1
|
|
|
|
|
|
|
|
expr 1 \\>= 0
|
|
|
|
expr 0 \\>= 1
|
|
|
|
expr 1 \\>= 1
|
|
|
|
|
|
|
|
expr 1 + 2
|
|
|
|
expr 2 - 1
|
|
|
|
expr 2 \\* 3
|
|
|
|
expr 12 / 2
|
|
|
|
expr 12 % 5
|
2001-03-10 06:21:29 +05:30
|
|
|
|
|
|
|
# somebody else can do all the string stuff
|
|
|
|
|
|
|
|
|
|
|
|
# fbset - can't be tested here
|
|
|
|
# fdflush
|
|
|
|
# find
|
|
|
|
find .
|
|
|
|
|
|
|
|
# free
|
2001-05-25 02:54:39 +05:30
|
|
|
# XXX: minor formatting differences
|
2001-03-10 06:21:29 +05:30
|
|
|
free
|
|
|
|
|
|
|
|
# freeramdisk
|
|
|
|
# fsck.minix - won't test
|
|
|
|
# getopt
|
2001-05-15 02:48:54 +05:30
|
|
|
|
2001-03-10 06:21:29 +05:30
|
|
|
# grep
|
2001-11-10 16:19:42 +05:30
|
|
|
grep -l strdup ../*utils/*.c
|
|
|
|
grep -c strdup ../*utils/*.c
|
|
|
|
grep -lc strdup ../*utils/*.c
|
|
|
|
grep -cv strdup ../*utils/*.c
|
|
|
|
grep -i null ../findutils/grep.c
|
|
|
|
grep -e strdup -e regcomp -e atexit ../findutils/grep.c
|
2001-05-15 02:48:54 +05:30
|
|
|
|
2001-03-10 06:21:29 +05:30
|
|
|
# gunzip
|
2001-05-24 22:45:33 +05:30
|
|
|
|
2001-03-10 06:21:29 +05:30
|
|
|
# gzip
|
2001-05-25 02:54:39 +05:30
|
|
|
# XXX: compressed output differs from gzip-1.2.4, but decompresses fine
|
2001-05-24 22:45:33 +05:30
|
|
|
echo testing 1 2 3 >tmpfile1; gzip tmpfile1; echo tmpfile*; md5sum tmpfile1.gz; rm tmpfile1.gz
|
|
|
|
echo testing 1 2 3 | gzip >tmpfile1.gz; md5sum tmpfile1.gz; rm tmpfile1.gz
|
2001-05-25 02:54:39 +05:30
|
|
|
|
|
|
|
|
|
|
|
# halt - won't test, dangerous
|
2001-03-10 06:21:29 +05:30
|
|
|
|
|
|
|
# head
|
|
|
|
head tester.sh
|
|
|
|
head -n 2 tester.sh
|
|
|
|
|
|
|
|
# hostid
|
|
|
|
hostid
|
|
|
|
|
|
|
|
# hostname
|
2001-05-25 02:54:39 +05:30
|
|
|
# XXX: minor formatting differences
|
2001-03-10 06:21:29 +05:30
|
|
|
hostname
|
|
|
|
hostname -s
|
|
|
|
hostname -i
|
|
|
|
hostname -d
|
|
|
|
# not going to do this next one
|
|
|
|
#hostname -F
|
|
|
|
|
|
|
|
# id
|
2001-05-25 02:54:39 +05:30
|
|
|
# BUG: Busybox id doesn't print supplemental groups
|
2001-03-10 06:21:29 +05:30
|
|
|
id
|
|
|
|
id -u
|
|
|
|
id -g
|
|
|
|
id -ur
|
|
|
|
id -un
|
|
|
|
|
|
|
|
|
|
|
|
# ifconfig
|
2001-10-24 10:30:29 +05:30
|
|
|
# requires CONFIG_FEATURE_IFCONFIG_STATUS
|
2001-05-24 22:45:33 +05:30
|
|
|
ifconfig
|
2001-03-14 05:00:18 +05:30
|
|
|
#ifconfig -a
|
2001-03-10 06:21:29 +05:30
|
|
|
#ifconfig eth0
|
|
|
|
#ifconfig lo
|
|
|
|
|
|
|
|
# init - won't test
|
|
|
|
# insmod - won't test
|
|
|
|
|
|
|
|
# kill
|
|
|
|
#kill -l
|
|
|
|
# not going to do any more
|
|
|
|
|
|
|
|
# length
|
2001-05-24 22:45:33 +05:30
|
|
|
# ln - see ln_tests.mk
|
2001-03-10 06:21:29 +05:30
|
|
|
# loadacm
|
|
|
|
# loadfont
|
|
|
|
# loadkmap
|
|
|
|
# logger
|
|
|
|
# logname
|
2001-03-14 05:00:18 +05:30
|
|
|
|
2001-03-10 06:21:29 +05:30
|
|
|
# ls
|
2001-05-25 02:54:39 +05:30
|
|
|
# XXX: minor formatting differences
|
2001-03-14 05:00:18 +05:30
|
|
|
ls ../e*
|
|
|
|
ls -l ../e*
|
|
|
|
ls -s ../e*
|
|
|
|
ls -h ../e*
|
|
|
|
ls -1 ../e*
|
2001-03-10 06:21:29 +05:30
|
|
|
|
|
|
|
# lsmod
|
|
|
|
lsmod
|
|
|
|
|
|
|
|
# makedevs
|
|
|
|
|
|
|
|
# md5sum
|
|
|
|
md5sum tester.sh
|
|
|
|
|
|
|
|
# mkdir
|
2001-03-14 05:00:18 +05:30
|
|
|
mkdir D ; ls -ld D ; rmdir D
|
|
|
|
|
2001-03-10 06:21:29 +05:30
|
|
|
# mkfifo
|
2001-03-14 05:00:18 +05:30
|
|
|
#
|
|
|
|
# we will test making one. actually testing pushing data through it requires
|
|
|
|
# more interaction than we can manage here.
|
|
|
|
# (these lines turn up an existing ls bug)
|
|
|
|
mkfifo F ; ls -l F ; rm F
|
|
|
|
mkfifo -m 0600 F ; ls -l F ; rm F
|
|
|
|
|
2001-03-10 06:21:29 +05:30
|
|
|
# mkfs.minix - won't test
|
|
|
|
# mknod
|
|
|
|
# mkswap - won't test
|
|
|
|
# mktemp
|
|
|
|
# more - can't test: interactive
|
|
|
|
|
|
|
|
# mount
|
2001-05-25 02:54:39 +05:30
|
|
|
# BUG: proc line starts with /proc instead of proc
|
2001-03-10 06:21:29 +05:30
|
|
|
mount
|
2001-05-25 02:54:39 +05:30
|
|
|
# not going to test mount with any args, can't be done safely or sanely
|
2001-03-10 06:21:29 +05:30
|
|
|
|
|
|
|
# mt
|
2001-05-24 22:45:33 +05:30
|
|
|
# mv - see mv_tests.mk
|
2001-03-10 06:21:29 +05:30
|
|
|
# nc
|
|
|
|
# nfsmount
|
|
|
|
# nslookup
|
2001-03-14 05:00:18 +05:30
|
|
|
# ping
|
|
|
|
ping -c 3 yahoo.com
|
2001-03-10 06:21:29 +05:30
|
|
|
# pivot_root
|
|
|
|
# poweroff - won't test
|
|
|
|
# printf
|
|
|
|
# ps - there's lotsa differences between busybox ps and any other ps
|
|
|
|
|
|
|
|
# pwd
|
|
|
|
pwd
|
|
|
|
|
|
|
|
# rdate - won't test
|
|
|
|
|
|
|
|
# readlink
|
2001-03-14 05:00:18 +05:30
|
|
|
ln -sf tester.sh L ; readlink L ; rm -f L
|
2001-03-10 06:21:29 +05:30
|
|
|
|
|
|
|
# reboot - won't test
|
|
|
|
# renice - won't test
|
|
|
|
# reset - can't test: no output
|
2001-03-14 05:00:18 +05:30
|
|
|
|
2001-03-10 06:21:29 +05:30
|
|
|
# rm
|
2001-03-14 05:00:18 +05:30
|
|
|
touch F ; rm F
|
|
|
|
|
2001-03-10 06:21:29 +05:30
|
|
|
# rmdir
|
|
|
|
# rmmod - won't test: dangerous
|
2001-05-24 22:45:33 +05:30
|
|
|
|
2001-03-10 06:21:29 +05:30
|
|
|
# route
|
2001-05-25 02:54:39 +05:30
|
|
|
# XXX: doesn't DNS resolve
|
2001-05-24 22:45:33 +05:30
|
|
|
route
|
|
|
|
|
2001-06-26 06:49:34 +05:30
|
|
|
# rpm2cpio
|
|
|
|
|
2001-06-12 05:20:06 +05:30
|
|
|
# sed - we can do some one-liners here, some testing is a little
|
|
|
|
# difficult to do in just this space (like a,i,c cmds).
|
|
|
|
|
|
|
|
# test ^$ matching
|
2001-05-15 02:48:54 +05:30
|
|
|
echo foo | sed -ne '/^$/p'
|
2001-06-12 05:20:06 +05:30
|
|
|
echo -e "foo\\n\\nbar" | sed -ne '/^$/p'
|
|
|
|
|
2001-05-15 02:48:54 +05:30
|
|
|
sed -e '/test$/d' testcases
|
|
|
|
sed -e '/^echo/d' testcases
|
|
|
|
sed -e '/test/s/dangerous/PELIGROSO/' testcases
|
2001-11-10 16:19:42 +05:30
|
|
|
sed -ne '1,/getopt/p' ../shellutils/pwd.c
|
|
|
|
sed -e '/getopt/r ../shellutils/pwd.c' ../editors/sed.c
|
2001-06-12 05:20:06 +05:30
|
|
|
|
2001-05-15 02:48:54 +05:30
|
|
|
|
2001-03-10 06:21:29 +05:30
|
|
|
# setkeycodes
|
2001-03-15 23:49:13 +05:30
|
|
|
|
|
|
|
# sh - note that we cannot test the shell interactively here
|
|
|
|
sh -c "echo a b c"
|
|
|
|
sh -c ">"
|
|
|
|
sh -c "a"
|
2001-05-25 04:35:13 +05:30
|
|
|
sh sh.testcases
|
2001-05-24 22:45:33 +05:30
|
|
|
|
2001-03-15 23:49:13 +05:30
|
|
|
|
2001-03-10 06:21:29 +05:30
|
|
|
# sleep - can't test: produces no output
|
2001-03-14 05:00:18 +05:30
|
|
|
|
2001-03-10 06:21:29 +05:30
|
|
|
# sort
|
2001-03-14 05:00:18 +05:30
|
|
|
sort tester.sh
|
|
|
|
sort -n tester.sh
|
|
|
|
sort -r tester.sh
|
|
|
|
|
2001-03-10 06:21:29 +05:30
|
|
|
# stty
|
|
|
|
# swapon - won't test: dangerous
|
|
|
|
# swapoff - won't test: dangerous
|
|
|
|
# sync - can't test: no output
|
2001-03-14 05:00:18 +05:30
|
|
|
# syslogd - won't test: too involved
|
2001-03-10 06:21:29 +05:30
|
|
|
|
|
|
|
# tail
|
|
|
|
tail tester.sh
|
|
|
|
tail -n 2 tester.sh
|
|
|
|
|
|
|
|
# tar
|
2001-03-14 05:00:18 +05:30
|
|
|
|
2001-03-10 06:21:29 +05:30
|
|
|
# tee
|
2001-03-14 05:00:18 +05:30
|
|
|
echo "please tee me!" | tee A B C ; cat A B C
|
|
|
|
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
|
|
|
|
|
|
|
|
# telnet - can't test: interactive
|
|
|
|
|
2001-03-10 06:21:29 +05:30
|
|
|
# test
|
|
|
|
# tftp
|
2001-05-24 22:45:33 +05:30
|
|
|
|
2001-03-10 06:21:29 +05:30
|
|
|
# touch
|
2001-05-24 22:45:33 +05:30
|
|
|
touch tmpfile1; ls tmpfile1; rm -f tmpfile1
|
|
|
|
touch -c tmpfile1; ls tmpfile1; rm -f tmpfile1
|
|
|
|
|
2001-03-10 06:21:29 +05:30
|
|
|
# tr
|
2001-05-25 02:54:39 +05:30
|
|
|
# BUG: Busybox tr range handling minix style [a-z] instead of GNU # style a-z
|
2001-05-24 22:45:33 +05:30
|
|
|
echo "cbaab" | tr abc zyx
|
|
|
|
echo "TESTING A B C" | tr [A-Z] [a-z]
|
|
|
|
# not GNU compatible
|
|
|
|
echo fdhrnzvfu bffvsentr | tr [a-z] [n-z][a-m]
|
|
|
|
echo abc[] | tr a[b AXB
|
|
|
|
echo testing | tr -d aeiou
|
|
|
|
|
|
|
|
# true
|
2001-03-10 06:21:29 +05:30
|
|
|
true ; echo $?
|
2001-05-24 22:45:33 +05:30
|
|
|
|
|
|
|
# false
|
2001-03-10 06:21:29 +05:30
|
|
|
false ; echo $?
|
2001-05-24 22:45:33 +05:30
|
|
|
|
2001-03-10 06:21:29 +05:30
|
|
|
# tty
|
|
|
|
# umount
|
|
|
|
# uname
|
|
|
|
# uniq
|
|
|
|
# unix2dos
|
|
|
|
# update
|
|
|
|
|
2001-03-14 05:00:18 +05:30
|
|
|
# uptime
|
2001-05-25 02:54:39 +05:30
|
|
|
# BUG: doesn't print number of users
|
2001-03-10 06:21:29 +05:30
|
|
|
uptime
|
|
|
|
|
|
|
|
# usleep
|
|
|
|
# uudecode
|
|
|
|
# uuencode
|
|
|
|
# watchdog
|
|
|
|
|
|
|
|
# wc
|
|
|
|
wc tester.sh
|
|
|
|
wc -c tester.sh
|
|
|
|
wc -w tester.sh
|
|
|
|
wc -l tester.sh
|
|
|
|
wc -L tester.sh
|
|
|
|
|
|
|
|
# wget
|
|
|
|
|
|
|
|
# which
|
|
|
|
which ls
|
|
|
|
|
|
|
|
# whoami
|
|
|
|
whoami
|
|
|
|
|
|
|
|
# xargs
|
2001-05-25 02:54:39 +05:30
|
|
|
# XXX: Busygox xargs divides filenames with '\n' instead of ' '
|
2001-03-14 05:00:18 +05:30
|
|
|
ls -1 ../e* | xargs
|
|
|
|
ls -1 ../e* | xargs md5sum
|
2001-03-10 06:21:29 +05:30
|
|
|
|
|
|
|
# yes - can't test: interactive (needs ^C)
|
2001-06-26 06:49:34 +05:30
|
|
|
|