aboutsummaryrefslogtreecommitdiff
path: root/testsuite
diff options
context:
space:
mode:
authorEric Andersen <andersen@codepoet.org>2004-04-06 11:10:30 +0000
committerEric Andersen <andersen@codepoet.org>2004-04-06 11:10:30 +0000
commit650fe63467e693990cf357c51b74db3278088a56 (patch)
tree660b1fb0e4d7f99802a85cdd00166fafbf3132dc /testsuite
parent39396b95fc7c46bfa29ec576357fb7f8e755762c (diff)
downloadbusybox-650fe63467e693990cf357c51b74db3278088a56.tar.gz
Kill off the old 'tests' stuff. Write a ton of new tests for the
'testsuite' dir. Fix a bunch of broken tests. Fix the testsuite 'runtest' script so it actually reports all failures and provides meaningful feedback. -Erik
Diffstat (limited to 'testsuite')
-rw-r--r--testsuite/basename/basename-works2
-rw-r--r--testsuite/cmp/cmp-detects-difference8
-rw-r--r--testsuite/cp/cp-a-files-to-dir8
-rw-r--r--testsuite/cp/cp-a-preserves-links2
-rw-r--r--testsuite/cp/cp-d-files-to-dir4
-rw-r--r--testsuite/cp/cp-does-not-copy-unreadable-file2
-rw-r--r--testsuite/cp/cp-preserves-links2
-rw-r--r--testsuite/date/date-R-works2
-rw-r--r--testsuite/date/date-format-works1
-rw-r--r--testsuite/date/date-u-works2
-rw-r--r--testsuite/date/date-works2
-rw-r--r--testsuite/dirname/dirname-works2
-rw-r--r--testsuite/du/du-h-works3
-rw-r--r--testsuite/du/du-k-works3
-rw-r--r--testsuite/du/du-l-works3
-rw-r--r--testsuite/du/du-m-works3
-rw-r--r--testsuite/du/du-s-works3
-rw-r--r--testsuite/du/du-works3
-rw-r--r--testsuite/echo/echo-prints-argument2
-rw-r--r--testsuite/expr/expr-works59
-rw-r--r--testsuite/grep/grep-matches-NUL8
-rw-r--r--testsuite/head/head-n-works3
-rw-r--r--testsuite/head/head-works3
-rw-r--r--testsuite/hostid/hostid-works2
-rw-r--r--testsuite/hostname/hostname-d-works2
-rw-r--r--testsuite/hostname/hostname-i-works2
-rw-r--r--testsuite/hostname/hostname-s-works1
-rw-r--r--testsuite/hostname/hostname-works1
-rw-r--r--testsuite/id/id-g-works1
-rw-r--r--testsuite/id/id-u-works1
-rw-r--r--testsuite/id/id-un-works1
-rw-r--r--testsuite/id/id-ur-works1
-rw-r--r--testsuite/ln/ln-creates-hard-links4
-rw-r--r--testsuite/ln/ln-creates-soft-links4
-rw-r--r--testsuite/ln/ln-force-creates-hard-links5
-rw-r--r--testsuite/ln/ln-force-creates-soft-links5
-rw-r--r--testsuite/ln/ln-preserves-hard-links8
-rw-r--r--testsuite/ln/ln-preserves-soft-links9
-rw-r--r--testsuite/ls/ls-1-works3
-rw-r--r--testsuite/ls/ls-h-works3
-rw-r--r--testsuite/ls/ls-l-works3
-rw-r--r--testsuite/ls/ls-s-works3
-rw-r--r--testsuite/mv/mv-files-to-dir16
-rw-r--r--testsuite/mv/mv-follows-links4
-rw-r--r--testsuite/mv/mv-moves-empty-file4
-rw-r--r--testsuite/mv/mv-moves-hardlinks4
-rw-r--r--testsuite/mv/mv-moves-large-file4
-rw-r--r--testsuite/mv/mv-moves-small-file4
-rw-r--r--testsuite/mv/mv-moves-symlinks6
-rw-r--r--testsuite/mv/mv-moves-unreadable-files5
-rw-r--r--testsuite/mv/mv-preserves-hard-links6
-rw-r--r--testsuite/mv/mv-preserves-links5
-rw-r--r--testsuite/mv/mv-refuses-mv-dir-to-subdir23
-rw-r--r--testsuite/mv/mv-removes-source-file4
-rw-r--r--testsuite/pwd/pwd-prints-working-directory2
-rwxr-xr-xtestsuite/runtest34
-rw-r--r--testsuite/sed/sed-append-next-line7
-rw-r--r--testsuite/sort/sort-n-works3
-rw-r--r--testsuite/sort/sort-r-works3
-rw-r--r--testsuite/sort/sort-works3
-rw-r--r--testsuite/strings/strings-works-like-GNU7
-rw-r--r--testsuite/tail/tail-n-works3
-rw-r--r--testsuite/tail/tail-works3
-rw-r--r--testsuite/tar/tar-extracts-multiple-files3
-rw-r--r--testsuite/tr/tr-d-works4
-rw-r--r--testsuite/tr/tr-non-gnu1
-rw-r--r--testsuite/tr/tr-works9
-rw-r--r--testsuite/uptime/uptime-works2
-rw-r--r--testsuite/uuencode/uuencode-sets-standard-input-mode-correctly2
-rw-r--r--testsuite/which/which-uses-default-path3
-rw-r--r--testsuite/xargs/xargs-works3
71 files changed, 316 insertions, 50 deletions
diff --git a/testsuite/basename/basename-works b/testsuite/basename/basename-works
new file mode 100644
index 000000000..38907d4c1
--- /dev/null
+++ b/testsuite/basename/basename-works
@@ -0,0 +1,2 @@
+test x$(basename $(pwd)) = x$(busybox basename $(pwd))
+
diff --git a/testsuite/cmp/cmp-detects-difference b/testsuite/cmp/cmp-detects-difference
index aa0744487..b9bb628f1 100644
--- a/testsuite/cmp/cmp-detects-difference
+++ b/testsuite/cmp/cmp-detects-difference
@@ -1,3 +1,9 @@
echo foo >foo
echo bar >bar
-! busybox cmp -s foo bar
+set +e
+busybox cmp -s foo bar
+if [ $? != 0 ] ; then
+ exit 0;
+fi
+
+exit 1;
diff --git a/testsuite/cp/cp-a-files-to-dir b/testsuite/cp/cp-a-files-to-dir
index 8fb3c201d..39f8f8103 100644
--- a/testsuite/cp/cp-a-files-to-dir
+++ b/testsuite/cp/cp-a-files-to-dir
@@ -8,7 +8,7 @@ busybox cp -a file1 file2 link1 dir1 there
test -f there/file1
test -f there/file2
test ! -s there/dir1/file3
-test -l there/link1
-test `readlink there/link1` = "file2"
-test ! file3 -ot there/dir1/file3
-test ! file3 -nt there/dir1/file3
+test -L there/link1
+test xfile2 = x`readlink there/link1`
+test ! dir1/file3 -ot there/dir1/file3
+test ! dir1/file3 -nt there/dir1/file3
diff --git a/testsuite/cp/cp-a-preserves-links b/testsuite/cp/cp-a-preserves-links
index aae8313c6..0c0cd9653 100644
--- a/testsuite/cp/cp-a-preserves-links
+++ b/testsuite/cp/cp-a-preserves-links
@@ -2,4 +2,4 @@ touch foo
ln -s foo bar
busybox cp -a bar baz
test -L baz
-test `readlink baz` = "foo"
+test xfoo = x`readlink baz`
diff --git a/testsuite/cp/cp-d-files-to-dir b/testsuite/cp/cp-d-files-to-dir
index 9407ead00..9571a567e 100644
--- a/testsuite/cp/cp-d-files-to-dir
+++ b/testsuite/cp/cp-d-files-to-dir
@@ -7,5 +7,5 @@ busybox cp -d file1 file2 file3 link1 there
test -f there/file1
test -f there/file2
test ! -s there/file3
-test -l there/link1
-test `readlink there/link1` = "file2"
+test -L there/link1
+test xfile2 = x`readlink there/link1`
diff --git a/testsuite/cp/cp-does-not-copy-unreadable-file b/testsuite/cp/cp-does-not-copy-unreadable-file
index 68c576727..ce11bfab0 100644
--- a/testsuite/cp/cp-does-not-copy-unreadable-file
+++ b/testsuite/cp/cp-does-not-copy-unreadable-file
@@ -1,4 +1,6 @@
touch foo
chmod a-r foo
+set +e
busybox cp foo bar
+set -e
test ! -f bar
diff --git a/testsuite/cp/cp-preserves-links b/testsuite/cp/cp-preserves-links
index d3223b132..301dc5fd8 100644
--- a/testsuite/cp/cp-preserves-links
+++ b/testsuite/cp/cp-preserves-links
@@ -2,4 +2,4 @@ touch foo
ln -s foo bar
busybox cp -d bar baz
test -L baz
-test `readlink baz` = "foo"
+test xfoo = x`readlink baz`
diff --git a/testsuite/date/date-R-works b/testsuite/date/date-R-works
new file mode 100644
index 000000000..ec3a06751
--- /dev/null
+++ b/testsuite/date/date-R-works
@@ -0,0 +1,2 @@
+test x"`date -R`" = x"`busybox date -R`"
+
diff --git a/testsuite/date/date-format-works b/testsuite/date/date-format-works
new file mode 100644
index 000000000..f28d06cfc
--- /dev/null
+++ b/testsuite/date/date-format-works
@@ -0,0 +1 @@
+test x"`date +%d/%m/%y`" = x"`busybox date +%d/%m/%y`"
diff --git a/testsuite/date/date-u-works b/testsuite/date/date-u-works
new file mode 100644
index 000000000..7d9902a3f
--- /dev/null
+++ b/testsuite/date/date-u-works
@@ -0,0 +1,2 @@
+test x"`date -u`" = x"`busybox date -u`"
+
diff --git a/testsuite/date/date-works b/testsuite/date/date-works
new file mode 100644
index 000000000..2f6dd1eca
--- /dev/null
+++ b/testsuite/date/date-works
@@ -0,0 +1,2 @@
+test x"`date`" = x"`busybox date`"
+
diff --git a/testsuite/dirname/dirname-works b/testsuite/dirname/dirname-works
new file mode 100644
index 000000000..f339c8f73
--- /dev/null
+++ b/testsuite/dirname/dirname-works
@@ -0,0 +1,2 @@
+test x$(dirname $(pwd)) = x$(busybox dirname $(pwd))
+
diff --git a/testsuite/du/du-h-works b/testsuite/du/du-h-works
new file mode 100644
index 000000000..8ec5d4c24
--- /dev/null
+++ b/testsuite/du/du-h-works
@@ -0,0 +1,3 @@
+du -h .. > logfile.gnu
+busybox du -h .. > logfile.bb
+cmp logfile.gnu logfile.bb
diff --git a/testsuite/du/du-k-works b/testsuite/du/du-k-works
new file mode 100644
index 000000000..43b119c7c
--- /dev/null
+++ b/testsuite/du/du-k-works
@@ -0,0 +1,3 @@
+du -k .. > logfile.gnu
+busybox du -k .. > logfile.bb
+cmp logfile.gnu logfile.bb
diff --git a/testsuite/du/du-l-works b/testsuite/du/du-l-works
new file mode 100644
index 000000000..c5d439853
--- /dev/null
+++ b/testsuite/du/du-l-works
@@ -0,0 +1,3 @@
+du -l .. > logfile.gnu
+busybox du -l .. > logfile.bb
+cmp logfile.gnu logfile.bb
diff --git a/testsuite/du/du-m-works b/testsuite/du/du-m-works
new file mode 100644
index 000000000..e3e2d3a56
--- /dev/null
+++ b/testsuite/du/du-m-works
@@ -0,0 +1,3 @@
+du -m .. > logfile.gnu
+busybox du -m .. > logfile.bb
+cmp logfile.gnu logfile.bb
diff --git a/testsuite/du/du-s-works b/testsuite/du/du-s-works
new file mode 100644
index 000000000..16b0a3e5a
--- /dev/null
+++ b/testsuite/du/du-s-works
@@ -0,0 +1,3 @@
+du -s .. > logfile.gnu
+busybox du -s .. > logfile.bb
+cmp logfile.gnu logfile.bb
diff --git a/testsuite/du/du-works b/testsuite/du/du-works
new file mode 100644
index 000000000..87ba63032
--- /dev/null
+++ b/testsuite/du/du-works
@@ -0,0 +1,3 @@
+du .. > logfile.gnu
+busybox du .. > logfile.bb
+cmp logfile.gnu logfile.bb
diff --git a/testsuite/echo/echo-prints-argument b/testsuite/echo/echo-prints-argument
index 98779dbbb..479dac89c 100644
--- a/testsuite/echo/echo-prints-argument
+++ b/testsuite/echo/echo-prints-argument
@@ -1 +1 @@
-test `busybox echo fubar` = fubar
+test xfubar = x`busybox echo fubar`
diff --git a/testsuite/expr/expr-works b/testsuite/expr/expr-works
new file mode 100644
index 000000000..af49ac4d5
--- /dev/null
+++ b/testsuite/expr/expr-works
@@ -0,0 +1,59 @@
+# busybox expr
+busybox expr 1 \| 1
+busybox expr 1 \| 0
+busybox expr 0 \| 1
+busybox expr 1 \& 1
+busybox expr 0 \< 1
+busybox expr 1 \> 0
+busybox expr 0 \<= 1
+busybox expr 1 \<= 1
+busybox expr 1 \>= 0
+busybox expr 1 \>= 1
+busybox expr 1 + 2
+busybox expr 2 - 1
+busybox expr 2 \* 3
+busybox expr 12 / 2
+busybox expr 12 % 5
+
+
+set +e
+busybox expr 0 \| 0
+if [ $? != 1 ] ; then
+ exit 1;
+fi;
+
+busybox expr 1 \& 0
+if [ $? != 1 ] ; then
+ exit 1;
+fi;
+
+busybox expr 0 \& 1
+if [ $? != 1 ] ; then
+ exit 1;
+fi;
+
+busybox expr 0 \& 0
+if [ $? != 1 ] ; then
+ exit 1;
+fi;
+
+busybox expr 1 \< 0
+if [ $? != 1 ] ; then
+ exit 1;
+fi;
+
+busybox expr 0 \> 1
+if [ $? != 1 ] ; then
+ exit 1;
+fi;
+
+busybox expr 1 \<= 0
+if [ $? != 1 ] ; then
+ exit 1;
+fi;
+
+busybox expr 0 \>= 1
+if [ $? != 1 ] ; then
+ exit 1;
+fi;
+
diff --git a/testsuite/grep/grep-matches-NUL b/testsuite/grep/grep-matches-NUL
index 597d22cb4..082bd8700 100644
--- a/testsuite/grep/grep-matches-NUL
+++ b/testsuite/grep/grep-matches-NUL
@@ -1,2 +1,8 @@
-# XFAIL
+set +e
echo -e '\0' | busybox grep .
+if [ $? != 0 ] ; then
+ exit 0;
+fi
+
+exit 1;
+
diff --git a/testsuite/head/head-n-works b/testsuite/head/head-n-works
new file mode 100644
index 000000000..121a1fa1d
--- /dev/null
+++ b/testsuite/head/head-n-works
@@ -0,0 +1,3 @@
+head -n 2 ../README > logfile.gnu
+busybox head -n 2 ../README > logfile.bb
+cmp logfile.gnu logfile.bb
diff --git a/testsuite/head/head-works b/testsuite/head/head-works
new file mode 100644
index 000000000..ea10adeb4
--- /dev/null
+++ b/testsuite/head/head-works
@@ -0,0 +1,3 @@
+head ../README > logfile.gnu
+busybox head ../README > logfile.bb
+cmp logfile.gnu logfile.bb
diff --git a/testsuite/hostid/hostid-works b/testsuite/hostid/hostid-works
new file mode 100644
index 000000000..e85698e66
--- /dev/null
+++ b/testsuite/hostid/hostid-works
@@ -0,0 +1,2 @@
+test x$(hostid) = x$(busybox hostid)
+
diff --git a/testsuite/hostname/hostname-d-works b/testsuite/hostname/hostname-d-works
new file mode 100644
index 000000000..a9aeb92cb
--- /dev/null
+++ b/testsuite/hostname/hostname-d-works
@@ -0,0 +1,2 @@
+test x$(hostname -d) = x$(busybox hostname -d)
+
diff --git a/testsuite/hostname/hostname-i-works b/testsuite/hostname/hostname-i-works
new file mode 100644
index 000000000..68a3e6789
--- /dev/null
+++ b/testsuite/hostname/hostname-i-works
@@ -0,0 +1,2 @@
+test x$(hostname -i) = x$(busybox hostname -i)
+
diff --git a/testsuite/hostname/hostname-s-works b/testsuite/hostname/hostname-s-works
new file mode 100644
index 000000000..172b94409
--- /dev/null
+++ b/testsuite/hostname/hostname-s-works
@@ -0,0 +1 @@
+test x$(hostname -s) = x$(busybox hostname -s)
diff --git a/testsuite/hostname/hostname-works b/testsuite/hostname/hostname-works
new file mode 100644
index 000000000..f51a406ea
--- /dev/null
+++ b/testsuite/hostname/hostname-works
@@ -0,0 +1 @@
+test x$(hostname) = x$(busybox hostname)
diff --git a/testsuite/id/id-g-works b/testsuite/id/id-g-works
new file mode 100644
index 000000000..671fc5361
--- /dev/null
+++ b/testsuite/id/id-g-works
@@ -0,0 +1 @@
+test x$(id -g) = x$(busybox id -g)
diff --git a/testsuite/id/id-u-works b/testsuite/id/id-u-works
new file mode 100644
index 000000000..2358cb0d7
--- /dev/null
+++ b/testsuite/id/id-u-works
@@ -0,0 +1 @@
+test x$(id -u) = x$(busybox id -u)
diff --git a/testsuite/id/id-un-works b/testsuite/id/id-un-works
new file mode 100644
index 000000000..db390e733
--- /dev/null
+++ b/testsuite/id/id-un-works
@@ -0,0 +1 @@
+test x$(id -un) = x$(busybox id -un)
diff --git a/testsuite/id/id-ur-works b/testsuite/id/id-ur-works
new file mode 100644
index 000000000..6b0fcb038
--- /dev/null
+++ b/testsuite/id/id-ur-works
@@ -0,0 +1 @@
+test x$(id -ur) = x$(busybox id -ur)
diff --git a/testsuite/ln/ln-creates-hard-links b/testsuite/ln/ln-creates-hard-links
new file mode 100644
index 000000000..2f6e23f9a
--- /dev/null
+++ b/testsuite/ln/ln-creates-hard-links
@@ -0,0 +1,4 @@
+echo file number one > file1
+busybox ln file1 link1
+test -f file1
+test -f link1
diff --git a/testsuite/ln/ln-creates-soft-links b/testsuite/ln/ln-creates-soft-links
new file mode 100644
index 000000000..e875e4c8a
--- /dev/null
+++ b/testsuite/ln/ln-creates-soft-links
@@ -0,0 +1,4 @@
+echo file number one > file1
+busybox ln -s file1 link1
+test -L link1
+test xfile1 = x`readlink link1`
diff --git a/testsuite/ln/ln-force-creates-hard-links b/testsuite/ln/ln-force-creates-hard-links
new file mode 100644
index 000000000..c96b7d6cf
--- /dev/null
+++ b/testsuite/ln/ln-force-creates-hard-links
@@ -0,0 +1,5 @@
+echo file number one > file1
+echo file number two > link1
+busybox ln -f file1 link1
+test -f file1
+test -f link1
diff --git a/testsuite/ln/ln-force-creates-soft-links b/testsuite/ln/ln-force-creates-soft-links
new file mode 100644
index 000000000..cab8d1db7
--- /dev/null
+++ b/testsuite/ln/ln-force-creates-soft-links
@@ -0,0 +1,5 @@
+echo file number one > file1
+echo file number two > link1
+busybox ln -f -s file1 link1
+test -L link1
+test xfile1 = x`readlink link1`
diff --git a/testsuite/ln/ln-preserves-hard-links b/testsuite/ln/ln-preserves-hard-links
new file mode 100644
index 000000000..47fb98961
--- /dev/null
+++ b/testsuite/ln/ln-preserves-hard-links
@@ -0,0 +1,8 @@
+echo file number one > file1
+echo file number two > link1
+set +e
+busybox ln file1 link1
+if [ $? != 0 ] ; then
+ exit 0;
+fi
+exit 1;
diff --git a/testsuite/ln/ln-preserves-soft-links b/testsuite/ln/ln-preserves-soft-links
new file mode 100644
index 000000000..a8123ece3
--- /dev/null
+++ b/testsuite/ln/ln-preserves-soft-links
@@ -0,0 +1,9 @@
+echo file number one > file1
+echo file number two > link1
+set +e
+busybox ln -s file1 link1
+if [ $? != 0 ] ; then
+ exit 0;
+fi
+exit 1;
+
diff --git a/testsuite/ls/ls-1-works b/testsuite/ls/ls-1-works
new file mode 100644
index 000000000..8651ecd72
--- /dev/null
+++ b/testsuite/ls/ls-1-works
@@ -0,0 +1,3 @@
+ls -1 .. > logfile.gnu
+busybox ls -1 .. > logfile.bb
+cmp logfile.gnu logfile.bb
diff --git a/testsuite/ls/ls-h-works b/testsuite/ls/ls-h-works
new file mode 100644
index 000000000..f54a7be0b
--- /dev/null
+++ b/testsuite/ls/ls-h-works
@@ -0,0 +1,3 @@
+ls -h .. > logfile.gnu
+busybox ls -h .. > logfile.bb
+cmp logfile.gnu logfile.bb
diff --git a/testsuite/ls/ls-l-works b/testsuite/ls/ls-l-works
new file mode 100644
index 000000000..50e44597e
--- /dev/null
+++ b/testsuite/ls/ls-l-works
@@ -0,0 +1,3 @@
+ls -l .. > logfile.gnu
+busybox ls -l .. > logfile.bb
+cmp logfile.gnu logfile.bb
diff --git a/testsuite/ls/ls-s-works b/testsuite/ls/ls-s-works
new file mode 100644
index 000000000..98a612d06
--- /dev/null
+++ b/testsuite/ls/ls-s-works
@@ -0,0 +1,3 @@
+ls -1s .. > logfile.gnu
+busybox ls -1s .. > logfile.bb
+cmp logfile.gnu logfile.bb
diff --git a/testsuite/mv/mv-files-to-dir b/testsuite/mv/mv-files-to-dir
new file mode 100644
index 000000000..c8eaba88e
--- /dev/null
+++ b/testsuite/mv/mv-files-to-dir
@@ -0,0 +1,16 @@
+echo file number one > file1
+echo file number two > file2
+ln -s file2 link1
+mkdir dir1
+touch --date='Sat Jan 29 21:24:08 PST 2000' dir1/file3
+mkdir there
+busybox mv file1 file2 link1 dir1 there
+test -f there/file1
+test -f there/file2
+test -f there/dir1/file3
+test -L there/link1
+test xfile2 = x`readlink there/link1`
+test ! -e file1
+test ! -e file2
+test ! -e link1
+test ! -e dir1/file3
diff --git a/testsuite/mv/mv-follows-links b/testsuite/mv/mv-follows-links
new file mode 100644
index 000000000..1fb355b81
--- /dev/null
+++ b/testsuite/mv/mv-follows-links
@@ -0,0 +1,4 @@
+touch foo
+ln -s foo bar
+busybox mv bar baz
+test -f baz
diff --git a/testsuite/mv/mv-moves-empty-file b/testsuite/mv/mv-moves-empty-file
new file mode 100644
index 000000000..48afca4d5
--- /dev/null
+++ b/testsuite/mv/mv-moves-empty-file
@@ -0,0 +1,4 @@
+touch foo
+busybox mv foo bar
+test ! -e foo
+test -f bar
diff --git a/testsuite/mv/mv-moves-hardlinks b/testsuite/mv/mv-moves-hardlinks
new file mode 100644
index 000000000..eaa8215a4
--- /dev/null
+++ b/testsuite/mv/mv-moves-hardlinks
@@ -0,0 +1,4 @@
+touch foo
+ln foo bar
+busybox mv bar baz
+test ! -f bar -a -f baz
diff --git a/testsuite/mv/mv-moves-large-file b/testsuite/mv/mv-moves-large-file
new file mode 100644
index 000000000..77d088ff1
--- /dev/null
+++ b/testsuite/mv/mv-moves-large-file
@@ -0,0 +1,4 @@
+dd if=/dev/zero of=foo seek=10k count=1 2>/dev/null
+busybox mv foo bar
+test ! -e foo
+test -f bar
diff --git a/testsuite/mv/mv-moves-small-file b/testsuite/mv/mv-moves-small-file
new file mode 100644
index 000000000..065c7f1e9
--- /dev/null
+++ b/testsuite/mv/mv-moves-small-file
@@ -0,0 +1,4 @@
+echo I WANT > foo
+busybox mv foo bar
+test ! -e foo
+test -f bar
diff --git a/testsuite/mv/mv-moves-symlinks b/testsuite/mv/mv-moves-symlinks
new file mode 100644
index 000000000..c413af07c
--- /dev/null
+++ b/testsuite/mv/mv-moves-symlinks
@@ -0,0 +1,6 @@
+touch foo
+ln -s foo bar
+busybox mv bar baz
+test -f foo
+test ! -e bar
+test -L baz
diff --git a/testsuite/mv/mv-moves-unreadable-files b/testsuite/mv/mv-moves-unreadable-files
new file mode 100644
index 000000000..bc9c3133c
--- /dev/null
+++ b/testsuite/mv/mv-moves-unreadable-files
@@ -0,0 +1,5 @@
+touch foo
+chmod a-r foo
+busybox mv foo bar
+test ! -e foo
+test -f bar
diff --git a/testsuite/mv/mv-preserves-hard-links b/testsuite/mv/mv-preserves-hard-links
new file mode 100644
index 000000000..b3ba3aa29
--- /dev/null
+++ b/testsuite/mv/mv-preserves-hard-links
@@ -0,0 +1,6 @@
+# FEATURE: CONFIG_FEATURE_PRESERVE_HARDLINKS
+touch foo
+ln foo bar
+mkdir baz
+busybox mv foo bar baz
+test baz/foo -ef baz/bar
diff --git a/testsuite/mv/mv-preserves-links b/testsuite/mv/mv-preserves-links
new file mode 100644
index 000000000..ea565d2f1
--- /dev/null
+++ b/testsuite/mv/mv-preserves-links
@@ -0,0 +1,5 @@
+touch foo
+ln -s foo bar
+busybox mv bar baz
+test -L baz
+test xfoo = x`readlink baz`
diff --git a/testsuite/mv/mv-refuses-mv-dir-to-subdir b/testsuite/mv/mv-refuses-mv-dir-to-subdir
new file mode 100644
index 000000000..7c572c4f8
--- /dev/null
+++ b/testsuite/mv/mv-refuses-mv-dir-to-subdir
@@ -0,0 +1,23 @@
+echo file number one > file1
+echo file number two > file2
+ln -s file2 link1
+mkdir dir1
+touch --date='Sat Jan 29 21:24:08 PST 2000' dir1/file3
+mkdir there
+busybox mv file1 file2 link1 dir1 there
+test -f there/file1
+test -f there/file2
+test -f there/dir1/file3
+test -L there/link1
+test xfile2 = x`readlink there/link1`
+test ! -e file1
+test ! -e file2
+test ! -e link1
+test ! -e dir1/file3
+set +e
+busybox mv there there/dir1
+if [ $? != 0 ] ; then
+ exit 0;
+fi
+
+exit 1;
diff --git a/testsuite/mv/mv-removes-source-file b/testsuite/mv/mv-removes-source-file
new file mode 100644
index 000000000..48afca4d5
--- /dev/null
+++ b/testsuite/mv/mv-removes-source-file
@@ -0,0 +1,4 @@
+touch foo
+busybox mv foo bar
+test ! -e foo
+test -f bar
diff --git a/testsuite/pwd/pwd-prints-working-directory b/testsuite/pwd/pwd-prints-working-directory
index 7bea10741..8575347d6 100644
--- a/testsuite/pwd/pwd-prints-working-directory
+++ b/testsuite/pwd/pwd-prints-working-directory
@@ -1 +1 @@
-test `pwd` = `busybox pwd`
+test $(pwd) = $(busybox pwd)
diff --git a/testsuite/runtest b/testsuite/runtest
index f57f464ee..89aba3985 100755
--- a/testsuite/runtest
+++ b/testsuite/runtest
@@ -2,37 +2,19 @@
PATH=$(dirname $(pwd)):$PATH
-show_result ()
-{
- local resolution=$1
- local testcase=$2
- local status=0
-
- if [ $resolution = XPASS -o $resolution = FAIL ]; then
- status=1
- fi
-
- if [ "$verbose" -o $status -eq 1 ]; then
- echo "$resolution: $testcase"
- fi
-
- return $status
-}
-
run_applet_testcase ()
{
local applet=$1
local testcase=$2
local status=0
- local X=
local RES=
local uc_applet=$(echo $applet | tr a-z A-Z)
local testname=$(basename $testcase)
if grep -q "^# CONFIG_${uc_applet} is not set$" ../.config; then
- show_result UNTESTED $testname
+ echo UNTESTED: $testname
return 0
fi
@@ -40,15 +22,11 @@ run_applet_testcase ()
local feature=`sed -ne 's/^# FEATURE: //p' $testcase`
if grep -q "^# ${feature} is not set$" ../.config; then
- show_result UNTESTED $testname
+ echo UNTESTED: $testname
return 0
fi
fi
- if grep -q "^# XFAIL$" $testcase; then
- X=X
- fi
-
rm -rf tmp
mkdir -p tmp
pushd tmp >/dev/null
@@ -56,14 +34,14 @@ run_applet_testcase ()
sh -x -e ../$testcase >.logfile.txt 2>&1
if [ $? != 0 ] ; then
- show_result ${X}FAIL $testname
- if [ "$verbose" == 1 ]; then
+ echo FAIL: $testname
+ if [ "$verbose" = 1 ]; then
cat .logfile.txt
- exit 1;
+ #exit 1;
fi;
status=$?
else
- show_result ${X}PASS $testname
+ echo PASS: $testname
rm -f .logfile.txt
status=$?
fi
diff --git a/testsuite/sed/sed-append-next-line b/testsuite/sed/sed-append-next-line
index e7f72f476..0621a319f 100644
--- a/testsuite/sed/sed-append-next-line
+++ b/testsuite/sed/sed-append-next-line
@@ -1,10 +1,11 @@
-# XFAIL
# This will fail if CONFIG_FEATURE_SED_GNU_COMPATABILITY is defined
busybox sed 'N;p'>output <<EOF
a
b
c
EOF
+
+set +e
cmp -s output - <<EOF
a
b
@@ -12,3 +13,7 @@ a
b
c
EOF
+if [ $? != 0 ] ; then
+ exit 0;
+fi
+exit 1;
diff --git a/testsuite/sort/sort-n-works b/testsuite/sort/sort-n-works
new file mode 100644
index 000000000..c9b63a36a
--- /dev/null
+++ b/testsuite/sort/sort-n-works
@@ -0,0 +1,3 @@
+sort -n ../README > logfile.gnu
+busybox sort -n ../README > logfile.bb
+cmp logfile.gnu logfile.bb
diff --git a/testsuite/sort/sort-r-works b/testsuite/sort/sort-r-works
new file mode 100644
index 000000000..6422ba940
--- /dev/null
+++ b/testsuite/sort/sort-r-works
@@ -0,0 +1,3 @@
+sort -r ../README > logfile.gnu
+busybox sort -r ../README > logfile.bb
+cmp logfile.gnu logfile.bb
diff --git a/testsuite/sort/sort-works b/testsuite/sort/sort-works
new file mode 100644
index 000000000..0110aa010
--- /dev/null
+++ b/testsuite/sort/sort-works
@@ -0,0 +1,3 @@
+sort ../README > logfile.gnu
+busybox sort ../README > logfile.bb
+cmp logfile.gnu logfile.bb
diff --git a/testsuite/strings/strings-works-like-GNU b/testsuite/strings/strings-works-like-GNU
index 02e423134..2d6471033 100644
--- a/testsuite/strings/strings-works-like-GNU
+++ b/testsuite/strings/strings-works-like-GNU
@@ -1,8 +1,9 @@
rm -f foo bar
strings -af ../../busybox > foo
busybox strings -af ../../busybox > bar
+set +e
test ! -f foo -a -f bar
if [ $? = 0 ] ; then
- diff -q foo bar
-fi;
-
+ set -e
+ diff -q foo bar
+fi
diff --git a/testsuite/tail/tail-n-works b/testsuite/tail/tail-n-works
new file mode 100644
index 000000000..321db7f8a
--- /dev/null
+++ b/testsuite/tail/tail-n-works
@@ -0,0 +1,3 @@
+tail -n 2 ../README > logfile.gnu
+busybox tail -n 2 ../README > logfile.bb
+cmp logfile.gnu logfile.bb
diff --git a/testsuite/tail/tail-works b/testsuite/tail/tail-works
new file mode 100644
index 000000000..321db7f8a
--- /dev/null
+++ b/testsuite/tail/tail-works
@@ -0,0 +1,3 @@
+tail -n 2 ../README > logfile.gnu
+busybox tail -n 2 ../README > logfile.bb
+cmp logfile.gnu logfile.bb
diff --git a/testsuite/tar/tar-extracts-multiple-files b/testsuite/tar/tar-extracts-multiple-files
index e26901e8c..46701dc3f 100644
--- a/testsuite/tar/tar-extracts-multiple-files
+++ b/testsuite/tar/tar-extracts-multiple-files
@@ -1,5 +1,6 @@
touch foo bar
tar cf foo.tar foo bar
rm foo bar
-busybox tar xf foo.tar
+busybox tar -xf foo.tar
test -f foo -a -f bar
+exit 99;
diff --git a/testsuite/tr/tr-d-works b/testsuite/tr/tr-d-works
new file mode 100644
index 000000000..d939e8b0f
--- /dev/null
+++ b/testsuite/tr/tr-d-works
@@ -0,0 +1,4 @@
+echo testing | tr -d aeiou > logfile.gnu
+echo testing | busybox tr -d aeiou > logfile.bb
+
+cmp logfile.gnu logfile.bb
diff --git a/testsuite/tr/tr-non-gnu b/testsuite/tr/tr-non-gnu
new file mode 100644
index 000000000..ffa6951ae
--- /dev/null
+++ b/testsuite/tr/tr-non-gnu
@@ -0,0 +1 @@
+echo fdhrnzvfu bffvsentr | busybox tr '[a-z]' '[n-z][a-m]'
diff --git a/testsuite/tr/tr-works b/testsuite/tr/tr-works
new file mode 100644
index 000000000..8753a3f28
--- /dev/null
+++ b/testsuite/tr/tr-works
@@ -0,0 +1,9 @@
+echo "cbaab" | tr abc zyx > logfile.gnu
+echo "TESTING A B C" | tr [A-Z] [a-z] >> logfile.gnu
+echo abc[] | tr a[b AXB >> logfile.gnu
+
+echo "cbaab" | busybox tr abc zyx > logfile.bb
+echo "TESTING A B C" | busybox tr [A-Z] [a-z] >> logfile.bb
+echo abc[] | busybox tr a[b AXB >> logfile.bb
+
+cmp logfile.gnu logfile.bb
diff --git a/testsuite/uptime/uptime-works b/testsuite/uptime/uptime-works
new file mode 100644
index 000000000..80e578778
--- /dev/null
+++ b/testsuite/uptime/uptime-works
@@ -0,0 +1,2 @@
+busybox uptime
+
diff --git a/testsuite/uuencode/uuencode-sets-standard-input-mode-correctly b/testsuite/uuencode/uuencode-sets-standard-input-mode-correctly
index 0ccf23b59..1a48a6656 100644
--- a/testsuite/uuencode/uuencode-sets-standard-input-mode-correctly
+++ b/testsuite/uuencode/uuencode-sets-standard-input-mode-correctly
@@ -1,6 +1,4 @@
saved_umask=$(umask)
umask 0
busybox uuencode foo </dev/null | head -n 1 | grep -q 666
-status=$?
umask $saved_umask
-return $status
diff --git a/testsuite/which/which-uses-default-path b/testsuite/which/which-uses-default-path
index f612aeb54..63ceb9f8f 100644
--- a/testsuite/which/which-uses-default-path
+++ b/testsuite/which/which-uses-default-path
@@ -2,6 +2,3 @@ BUSYBOX=$(type -p busybox)
SAVED_PATH=$PATH
unset PATH
$BUSYBOX which ls
-STATUS=$?
-export PATH=$SAVED_PATH
-return $STATUS
diff --git a/testsuite/xargs/xargs-works b/testsuite/xargs/xargs-works
new file mode 100644
index 000000000..4ad581804
--- /dev/null
+++ b/testsuite/xargs/xargs-works
@@ -0,0 +1,3 @@
+find -name \*works -type f | xargs md5sum > logfile.gnu
+find -name \*works -type f | busybox xargs md5sum > logfile.bb
+diff -u logfile.gnu logfile.bb