⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 testcases

📁 手机嵌入式Linux下可用的busybox源码
💻
字号:
# 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#    test on a file (i.e., cat, md5sum)#  - 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#  - 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.# ar# basenamebasename `pwd`# catcat tester.shecho hello there | cat tester.sh -# chmod# chown# chgrp# chroot# chvt - can't be tested here# clear - can't be tested here# cmp# cp# cutecho "1234" | cut -c1echo "1234" | cut -c 1echo "1234567890" | cut -c2-7echo "1234567890" | cut -c 2-7echo "f1	f2" | cut -f2echo "f1	f2" | cut -f 2echo "f1	f2	f3	f4	f5" | cut -f2-4echo "f1	f2	f3	f4	f5" | cut -f 2-4# datedatedate -Rdate -udate +%d/%m/%y# dc - needs an input file# dd# BUG: record count line goes to stdout instead of stderrdd if=/dev/urandom of=O bs=1k count=1 ; ls -l O ; rm O# deallocvt# df# XXX: minor formatting differencesdfdf .df -kdf -hdf -m# dirnamedirname `pwd`# dmesg (XXX: change the silly cmd business in the source)dmesgdmesg -n 8dmesg -s 512# I really don't want to do this next one#dmesg -c# dos2unix - needs an input file# dpkg# dpkg_deb# du# BUG: rounding behavior differs from GNU dududu -sdu -ldu -kdu -hdu -m# dumpkmap - no counterprt?# dutmp - no counterprt?# echoecho "foo bar baz"echo -n "no newline"# exprexpr 1 \\| 1expr 1 \\| 0expr 0 \\| 1expr 0 \\| 0expr 1 \\& 1expr 1 \\& 0expr 0 \\& 1expr 0 \\& 0expr 0 \\< 1expr 1 \\< 0expr 1 \\> 0expr 0 \\> 1expr 0 \\<= 1expr 1 \\<= 0expr 1 \\<= 1expr 1 \\>= 0expr 0 \\>= 1expr 1 \\>= 1expr 1 + 2expr 2 - 1expr 2 \\* 3expr 12 / 2expr 12 % 5# somebody else can do all the string stuff# fbset - can't be tested here# fdflush# findfind .# free# XXX: minor formatting differencesfree# freeramdisk# fsck.minix - won't test# getopt# grepgrep -l strdup ../*.cgrep -c strdup ../*.cgrep -lc strdup ../*.cgrep -cv strdup ../*.cgrep -i null ../grep.cgrep -e strdup -e regcomp -e atexit ../grep.c# gunzip# gzip# XXX: compressed output differs from gzip-1.2.4, but decompresses fineecho testing 1 2 3 >tmpfile1; gzip tmpfile1; echo tmpfile*; md5sum tmpfile1.gz; rm tmpfile1.gzecho testing 1 2 3 | gzip >tmpfile1.gz; md5sum tmpfile1.gz; rm tmpfile1.gz# halt - won't test, dangerous# headhead tester.shhead -n 2 tester.sh# hostidhostid# hostname# XXX: minor formatting differenceshostnamehostname -shostname -ihostname -d# not going to do this next one#hostname -F# id# BUG: Busybox id doesn't print supplemental groupsidid -uid -gid -urid -un# ifconfig# requires BB_FEATURE_IFCONFIG_STATUSifconfig#ifconfig -a#ifconfig eth0#ifconfig lo# init - won't test# insmod - won't test# kill#kill -l# not going to do any more# length# ln - see ln_tests.mk# loadacm# loadfont# loadkmap# logger# logname# ls# XXX: minor formatting differencesls ../e*ls -l ../e*ls -s ../e*ls -h ../e*ls -1 ../e*# lsmodlsmod# makedevs# md5summd5sum tester.sh# mkdirmkdir D ; ls -ld D ; rmdir D# mkfifo## 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 Fmkfifo -m 0600 F ; ls -l F ; rm F# mkfs.minix - won't test# mknod# mkswap - won't test# mktemp# more - can't test: interactive# mount# BUG: proc line starts with /proc instead of procmount# not going to test mount with any args, can't be done safely or sanely# mt# mv - see mv_tests.mk# nc# nfsmount# nslookup# pingping -c 3 yahoo.com# pivot_root# poweroff - won't test# printf# ps - there's lotsa differences between busybox ps and any other ps# pwdpwd# rdate - won't test# readlinkln -sf tester.sh L ; readlink L ; rm -f L# reboot - won't test# renice - won't test# reset - can't test: no output# rmtouch F ; rm F# rmdir# rmmod - won't test: dangerous# route# XXX: doesn't DNS resolveroute# rpm2cpio# 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 ^$ matchingecho foo | sed -ne '/^$/p'echo -e "foo\\n\\nbar" | sed -ne '/^$/p'sed -e '/test$/d' testcasessed -e '/^echo/d' testcasessed -e '/test/s/dangerous/PELIGROSO/' testcasessed -ne '1,/getopt/p' ../pwd.csed -e '/getopt/r ../pwd.c' ../sed.c# setkeycodes# sh - note that we cannot test the shell interactively heresh -c "echo a b c"sh -c ">"sh -c "a"sh sh.testcases# sleep - can't test: produces no output# sortsort tester.shsort -n tester.shsort -r tester.sh# stty# swapon - won't test: dangerous# swapoff - won't test: dangerous# sync - can't test: no output# syslogd - won't test: too involved# tailtail tester.shtail -n 2  tester.sh# tar# teeecho "please tee me!" | tee A B C ; cat A B Cecho "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# test# tftp# touchtouch tmpfile1; ls tmpfile1; rm -f tmpfile1touch -c tmpfile1; ls tmpfile1; rm -f tmpfile1# tr# BUG: Busybox tr range handling minix style [a-z] instead of GNU # style a-zecho "cbaab" | tr abc zyxecho "TESTING A B C" | tr [A-Z] [a-z]# not GNU compatibleecho fdhrnzvfu bffvsentr | tr [a-z] [n-z][a-m]echo abc[] | tr a[b AXBecho testing | tr -d aeiou# truetrue ; echo $?# falsefalse ; echo $?# tty# umount# uname# uniq# unix2dos# update# uptime# BUG: doesn't print number of usersuptime# usleep# uudecode# uuencode# watchdog# wcwc tester.shwc -c tester.shwc -w tester.shwc -l tester.shwc -L tester.sh# wget# whichwhich ls# whoamiwhoami# xargs# XXX: Busygox xargs divides filenames with '\n' instead of ' 'ls -1 ../e* | xargsls -1 ../e* | xargs md5sum# yes - can't test: interactive (needs ^C)

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -