summaryrefslogtreecommitdiff
path: root/busybox/testsuite
diff options
context:
space:
mode:
Diffstat (limited to 'busybox/testsuite')
-rw-r--r--busybox/testsuite/README31
-rw-r--r--busybox/testsuite/TODO18
-rw-r--r--busybox/testsuite/basename/basename-does-not-remove-identical-extension1
-rw-r--r--busybox/testsuite/basename/basename-works2
-rw-r--r--busybox/testsuite/bunzip2/bunzip2-reads-from-standard-input2
-rw-r--r--busybox/testsuite/bunzip2/bunzip2-removes-compressed-file3
-rw-r--r--busybox/testsuite/bunzip2/bzcat-does-not-remove-compressed-file3
-rw-r--r--busybox/testsuite/cat/cat-prints-a-file3
-rw-r--r--busybox/testsuite/cat/cat-prints-a-file-and-standard-input7
-rw-r--r--busybox/testsuite/cmp/cmp-detects-difference9
-rw-r--r--busybox/testsuite/cp/cp-a-files-to-dir14
-rw-r--r--busybox/testsuite/cp/cp-a-preserves-links5
-rw-r--r--busybox/testsuite/cp/cp-copies-empty-file3
-rw-r--r--busybox/testsuite/cp/cp-copies-large-file3
-rw-r--r--busybox/testsuite/cp/cp-copies-small-file3
-rw-r--r--busybox/testsuite/cp/cp-d-files-to-dir11
-rw-r--r--busybox/testsuite/cp/cp-dir-create-dir4
-rw-r--r--busybox/testsuite/cp/cp-dir-existing-dir5
-rw-r--r--busybox/testsuite/cp/cp-does-not-copy-unreadable-file6
-rw-r--r--busybox/testsuite/cp/cp-files-to-dir11
-rw-r--r--busybox/testsuite/cp/cp-follows-links4
-rw-r--r--busybox/testsuite/cp/cp-preserves-hard-links6
-rw-r--r--busybox/testsuite/cp/cp-preserves-links5
-rw-r--r--busybox/testsuite/cp/cp-preserves-source-file3
-rw-r--r--busybox/testsuite/cut/cut-cuts-a-character1
-rw-r--r--busybox/testsuite/cut/cut-cuts-a-closed-range1
-rw-r--r--busybox/testsuite/cut/cut-cuts-a-field1
-rw-r--r--busybox/testsuite/cut/cut-cuts-an-open-range1
-rw-r--r--busybox/testsuite/cut/cut-cuts-an-unclosed-range1
-rw-r--r--busybox/testsuite/date/date-R-works2
-rw-r--r--busybox/testsuite/date/date-format-works1
-rw-r--r--busybox/testsuite/date/date-u-works2
-rw-r--r--busybox/testsuite/date/date-works2
-rw-r--r--busybox/testsuite/dd/dd-accepts-if2
-rw-r--r--busybox/testsuite/dd/dd-accepts-of2
-rw-r--r--busybox/testsuite/dd/dd-copies-from-standard-input-to-standard-output1
-rw-r--r--busybox/testsuite/dd/dd-prints-count-to-standard-error2
-rw-r--r--busybox/testsuite/dirname/dirname-handles-absolute-path1
-rw-r--r--busybox/testsuite/dirname/dirname-handles-empty-path1
-rw-r--r--busybox/testsuite/dirname/dirname-handles-multiple-slashes1
-rw-r--r--busybox/testsuite/dirname/dirname-handles-relative-path1
-rw-r--r--busybox/testsuite/dirname/dirname-handles-root1
-rw-r--r--busybox/testsuite/dirname/dirname-handles-single-component1
-rw-r--r--busybox/testsuite/dirname/dirname-works2
-rw-r--r--busybox/testsuite/du/du-h-works4
-rw-r--r--busybox/testsuite/du/du-k-works4
-rw-r--r--busybox/testsuite/du/du-l-works4
-rw-r--r--busybox/testsuite/du/du-m-works4
-rw-r--r--busybox/testsuite/du/du-s-works4
-rw-r--r--busybox/testsuite/du/du-works4
-rw-r--r--busybox/testsuite/echo/echo-does-not-print-newline1
-rw-r--r--busybox/testsuite/echo/echo-prints-argument1
-rw-r--r--busybox/testsuite/echo/echo-prints-arguments1
-rw-r--r--busybox/testsuite/echo/echo-prints-newline1
-rw-r--r--busybox/testsuite/expr/expr-works59
-rw-r--r--busybox/testsuite/false/false-is-silent1
-rw-r--r--busybox/testsuite/false/false-returns-failure1
-rw-r--r--busybox/testsuite/find/find-supports-minus-xdev1
-rw-r--r--busybox/testsuite/grep/egrep-is-not-case-insensitive2
-rw-r--r--busybox/testsuite/grep/egrep-supports-extended-regexps2
-rw-r--r--busybox/testsuite/grep/grep-handles-binary-files1
-rw-r--r--busybox/testsuite/grep/grep-handles-multiple-regexps1
-rw-r--r--busybox/testsuite/grep/grep-is-also-egrep2
-rw-r--r--busybox/testsuite/grep/grep-matches-NUL8
-rw-r--r--busybox/testsuite/gunzip/gunzip-reads-from-standard-input2
-rw-r--r--busybox/testsuite/gzip/gzip-accepts-multiple-files3
-rw-r--r--busybox/testsuite/gzip/gzip-accepts-single-minus1
-rw-r--r--busybox/testsuite/gzip/gzip-removes-original-file3
-rw-r--r--busybox/testsuite/head/head-n-works4
-rw-r--r--busybox/testsuite/head/head-works4
-rw-r--r--busybox/testsuite/hostid/hostid-works2
-rw-r--r--busybox/testsuite/hostname/hostname-d-works2
-rw-r--r--busybox/testsuite/hostname/hostname-i-works2
-rw-r--r--busybox/testsuite/hostname/hostname-s-works1
-rw-r--r--busybox/testsuite/hostname/hostname-works1
-rw-r--r--busybox/testsuite/id/id-g-works1
-rw-r--r--busybox/testsuite/id/id-u-works1
-rw-r--r--busybox/testsuite/id/id-un-works1
-rw-r--r--busybox/testsuite/id/id-ur-works1
-rw-r--r--busybox/testsuite/ln/ln-creates-hard-links4
-rw-r--r--busybox/testsuite/ln/ln-creates-soft-links4
-rw-r--r--busybox/testsuite/ln/ln-force-creates-hard-links5
-rw-r--r--busybox/testsuite/ln/ln-force-creates-soft-links5
-rw-r--r--busybox/testsuite/ln/ln-preserves-hard-links8
-rw-r--r--busybox/testsuite/ln/ln-preserves-soft-links9
-rw-r--r--busybox/testsuite/ls/ls-1-works4
-rw-r--r--busybox/testsuite/ls/ls-h-works4
-rw-r--r--busybox/testsuite/ls/ls-l-works4
-rw-r--r--busybox/testsuite/ls/ls-s-works4
-rw-r--r--busybox/testsuite/md5sum/md5sum-verifies-non-binary-file3
-rw-r--r--busybox/testsuite/mkdir/mkdir-makes-a-directory2
-rw-r--r--busybox/testsuite/mkdir/mkdir-makes-parent-directories2
-rw-r--r--busybox/testsuite/msh/msh-supports-underscores-in-variable-names1
-rw-r--r--busybox/testsuite/mv/mv-files-to-dir16
-rw-r--r--busybox/testsuite/mv/mv-follows-links4
-rw-r--r--busybox/testsuite/mv/mv-moves-empty-file4
-rw-r--r--busybox/testsuite/mv/mv-moves-file3
-rw-r--r--busybox/testsuite/mv/mv-moves-hardlinks4
-rw-r--r--busybox/testsuite/mv/mv-moves-large-file4
-rw-r--r--busybox/testsuite/mv/mv-moves-small-file4
-rw-r--r--busybox/testsuite/mv/mv-moves-symlinks6
-rw-r--r--busybox/testsuite/mv/mv-moves-unreadable-files5
-rw-r--r--busybox/testsuite/mv/mv-preserves-hard-links6
-rw-r--r--busybox/testsuite/mv/mv-preserves-links5
-rw-r--r--busybox/testsuite/mv/mv-refuses-mv-dir-to-subdir23
-rw-r--r--busybox/testsuite/mv/mv-removes-source-file4
-rw-r--r--busybox/testsuite/pwd/pwd-prints-working-directory1
-rw-r--r--busybox/testsuite/rm/rm-removes-file3
-rw-r--r--busybox/testsuite/rmdir/rmdir-removes-parent-directories3
-rwxr-xr-xbusybox/testsuite/runtest102
-rw-r--r--busybox/testsuite/sed/sed-accepts-blanks-before-command1
-rw-r--r--busybox/testsuite/sed/sed-aic-commands134
-rw-r--r--busybox/testsuite/sed/sed-append-hold-space-to-pattern-space13
-rw-r--r--busybox/testsuite/sed/sed-append-next-line19
-rw-r--r--busybox/testsuite/sed/sed-branch1
-rw-r--r--busybox/testsuite/sed/sed-branch-conditional15
-rw-r--r--busybox/testsuite/sed/sed-branch-conditional211
-rw-r--r--busybox/testsuite/sed/sed-branch-no-label1
-rw-r--r--busybox/testsuite/sed/sed-chains-substs1
-rw-r--r--busybox/testsuite/sed/sed-chains-substs21
-rw-r--r--busybox/testsuite/sed/sed-does-not-substitute-in-deleted-line2
-rw-r--r--busybox/testsuite/sed/sed-handles-embedded-slashes1
-rw-r--r--busybox/testsuite/sed/sed-handles-empty-lines1
-rw-r--r--busybox/testsuite/sed/sed-handles-unsatisfied-backrefs6
-rw-r--r--busybox/testsuite/sed/sed-next-line12
-rw-r--r--busybox/testsuite/sed/sed-prints-line-once-for-multiple-substs4
-rw-r--r--busybox/testsuite/sed/sed-recurses-properly1
-rw-r--r--busybox/testsuite/sed/sed-regex-match-newline10
-rw-r--r--busybox/testsuite/sed/sed-splits-edit-commands-on-command-line9
-rw-r--r--busybox/testsuite/sed/sed-subst-subprint9
-rw-r--r--busybox/testsuite/sed/sed-write-to-stdout10
-rw-r--r--busybox/testsuite/sort/sort-n-works4
-rw-r--r--busybox/testsuite/sort/sort-r-works4
-rw-r--r--busybox/testsuite/sort/sort-works4
-rw-r--r--busybox/testsuite/strings/strings-works-like-GNU9
-rw-r--r--busybox/testsuite/tail/tail-n-works4
-rw-r--r--busybox/testsuite/tail/tail-works4
-rw-r--r--busybox/testsuite/tar/tar-archives-multiple-files6
-rw-r--r--busybox/testsuite/tar/tar-complains-about-missing-file3
-rw-r--r--busybox/testsuite/tar/tar-demands-at-least-one-ctx1
-rw-r--r--busybox/testsuite/tar/tar-demands-at-most-one-ctx1
-rw-r--r--busybox/testsuite/tar/tar-extracts-file5
-rw-r--r--busybox/testsuite/tar/tar-extracts-from-standard-input5
-rw-r--r--busybox/testsuite/tar/tar-extracts-multiple-files6
-rw-r--r--busybox/testsuite/tar/tar-extracts-to-standard-output3
-rw-r--r--busybox/testsuite/tar/tar-handles-cz-options5
-rw-r--r--busybox/testsuite/tar/tar-handles-empty-include-and-non-empty-exclude-list6
-rw-r--r--busybox/testsuite/tar/tar-handles-exclude-and-extract-lists8
-rw-r--r--busybox/testsuite/tar/tar-handles-multiple-X-options10
-rw-r--r--busybox/testsuite/tar/tar-handles-nested-exclude9
-rw-r--r--busybox/testsuite/tee/tee-appends-input5
-rw-r--r--busybox/testsuite/tee/tee-tees-input3
-rw-r--r--busybox/testsuite/touch/touch-creates-file2
-rw-r--r--busybox/testsuite/touch/touch-does-not-create-file2
-rw-r--r--busybox/testsuite/touch/touch-touches-files-after-non-existent-file3
-rw-r--r--busybox/testsuite/tr/tr-d-works4
-rw-r--r--busybox/testsuite/tr/tr-non-gnu1
-rw-r--r--busybox/testsuite/tr/tr-works9
-rw-r--r--busybox/testsuite/true/true-is-silent1
-rw-r--r--busybox/testsuite/true/true-returns-success1
-rw-r--r--busybox/testsuite/uptime/uptime-works2
-rw-r--r--busybox/testsuite/uuencode/uuencode-sets-standard-input-mode-correctly4
-rw-r--r--busybox/testsuite/wc/wc-counts-all1
-rw-r--r--busybox/testsuite/wc/wc-counts-characters1
-rw-r--r--busybox/testsuite/wc/wc-counts-lines1
-rw-r--r--busybox/testsuite/wc/wc-counts-words1
-rw-r--r--busybox/testsuite/wc/wc-prints-longest-line-length1
-rw-r--r--busybox/testsuite/wget/wget--O-overrides--P3
-rw-r--r--busybox/testsuite/wget/wget-handles-empty-path1
-rw-r--r--busybox/testsuite/wget/wget-retrieves-google-index2
-rw-r--r--busybox/testsuite/wget/wget-supports--P3
-rw-r--r--busybox/testsuite/which/which-uses-default-path4
-rw-r--r--busybox/testsuite/xargs/xargs-works4
173 files changed, 998 insertions, 0 deletions
diff --git a/busybox/testsuite/README b/busybox/testsuite/README
new file mode 100644
index 0000000..40439bf
--- /dev/null
+++ b/busybox/testsuite/README
@@ -0,0 +1,31 @@
+To run the test suite, change to this directory and run "./runtest". It will
+run all of the test cases, and list those with unexpected outcomes. Adding the
+-v option will cause it to show expected outcomes as well. To only run the test
+cases for particular applets, specify them as parameters to runtest.
+
+The test cases for an applet reside in the subdirectory of the applet name. The
+name of the test case should be the assertion that is tested. The test case
+should be a shell fragment that returns successfully if the test case passes,
+and unsuccessfully otherwise.
+
+If the test case relies on a certain feature, it should include the string
+"FEATURE: " followed by the name of the feature in a comment. If it is always
+expected to fail, it should include the string "XFAIL" in a comment.
+
+For the entire testsuite, the copyright is as follows:
+
+Copyright (C) 2001, 2002 Matt Kraai
+
+This program is free software; you can redistribute it and/or
+modify it under the terms of the GNU General Public License
+as published by the Free Software Foundation; either version 2
+of the License, or (at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program; if not, write to the Free Software
+Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
diff --git a/busybox/testsuite/TODO b/busybox/testsuite/TODO
new file mode 100644
index 0000000..ced5715
--- /dev/null
+++ b/busybox/testsuite/TODO
@@ -0,0 +1,18 @@
+This testsuite is quite obviously a work in progress. As such,
+there are a number of good extensions. If you are looking for
+something to do, feel free to tackle one or more of the following:
+
+Buildroot support
+ Erik has put together a handy package for constructing and
+ testing busybox called buildroot. Integrating this into
+ the testsuite would allow for greater test coverage (e.g.,
+ init, mount, and other privileged applications).
+
+libbb unit testing
+ Being able to test the functions of libbb individually may
+ help to prevent regressions.
+
+Standardization
+ This testsuite is totally bastardized. It would be better
+ to use an existing test framework, such as dejagnu, greg,
+ or a XUnit clone (shunit?).
diff --git a/busybox/testsuite/basename/basename-does-not-remove-identical-extension b/busybox/testsuite/basename/basename-does-not-remove-identical-extension
new file mode 100644
index 0000000..4448fde
--- /dev/null
+++ b/busybox/testsuite/basename/basename-does-not-remove-identical-extension
@@ -0,0 +1 @@
+test xfoo = x`busybox basename foo foo`
diff --git a/busybox/testsuite/basename/basename-works b/busybox/testsuite/basename/basename-works
new file mode 100644
index 0000000..38907d4
--- /dev/null
+++ b/busybox/testsuite/basename/basename-works
@@ -0,0 +1,2 @@
+test x$(basename $(pwd)) = x$(busybox basename $(pwd))
+
diff --git a/busybox/testsuite/bunzip2/bunzip2-reads-from-standard-input b/busybox/testsuite/bunzip2/bunzip2-reads-from-standard-input
new file mode 100644
index 0000000..e212a12
--- /dev/null
+++ b/busybox/testsuite/bunzip2/bunzip2-reads-from-standard-input
@@ -0,0 +1,2 @@
+echo foo | bzip2 | busybox bunzip2 > output
+echo foo | cmp - output
diff --git a/busybox/testsuite/bunzip2/bunzip2-removes-compressed-file b/busybox/testsuite/bunzip2/bunzip2-removes-compressed-file
new file mode 100644
index 0000000..f1d1550
--- /dev/null
+++ b/busybox/testsuite/bunzip2/bunzip2-removes-compressed-file
@@ -0,0 +1,3 @@
+echo foo | bzip2 >foo.bz2
+busybox bunzip2 foo.bz2
+test ! -f foo.bz2
diff --git a/busybox/testsuite/bunzip2/bzcat-does-not-remove-compressed-file b/busybox/testsuite/bunzip2/bzcat-does-not-remove-compressed-file
new file mode 100644
index 0000000..7d4016e
--- /dev/null
+++ b/busybox/testsuite/bunzip2/bzcat-does-not-remove-compressed-file
@@ -0,0 +1,3 @@
+echo foo | bzip2 >foo.bz2
+busybox bzcat foo.bz2
+test -f foo.bz2
diff --git a/busybox/testsuite/cat/cat-prints-a-file b/busybox/testsuite/cat/cat-prints-a-file
new file mode 100644
index 0000000..e3f35a8
--- /dev/null
+++ b/busybox/testsuite/cat/cat-prints-a-file
@@ -0,0 +1,3 @@
+echo I WANT > foo
+busybox cat foo >bar
+cmp foo bar
diff --git a/busybox/testsuite/cat/cat-prints-a-file-and-standard-input b/busybox/testsuite/cat/cat-prints-a-file-and-standard-input
new file mode 100644
index 0000000..bc92318
--- /dev/null
+++ b/busybox/testsuite/cat/cat-prints-a-file-and-standard-input
@@ -0,0 +1,7 @@
+echo I WANT > foo
+echo SOMETHING | busybox cat foo - >bar
+cat >baz <<EOF
+I WANT
+SOMETHING
+EOF
+cmp bar baz
diff --git a/busybox/testsuite/cmp/cmp-detects-difference b/busybox/testsuite/cmp/cmp-detects-difference
new file mode 100644
index 0000000..b9bb628
--- /dev/null
+++ b/busybox/testsuite/cmp/cmp-detects-difference
@@ -0,0 +1,9 @@
+echo foo >foo
+echo bar >bar
+set +e
+busybox cmp -s foo bar
+if [ $? != 0 ] ; then
+ exit 0;
+fi
+
+exit 1;
diff --git a/busybox/testsuite/cp/cp-a-files-to-dir b/busybox/testsuite/cp/cp-a-files-to-dir
new file mode 100644
index 0000000..39f8f81
--- /dev/null
+++ b/busybox/testsuite/cp/cp-a-files-to-dir
@@ -0,0 +1,14 @@
+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 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 xfile2 = x`readlink there/link1`
+test ! dir1/file3 -ot there/dir1/file3
+test ! dir1/file3 -nt there/dir1/file3
diff --git a/busybox/testsuite/cp/cp-a-preserves-links b/busybox/testsuite/cp/cp-a-preserves-links
new file mode 100644
index 0000000..0c0cd96
--- /dev/null
+++ b/busybox/testsuite/cp/cp-a-preserves-links
@@ -0,0 +1,5 @@
+touch foo
+ln -s foo bar
+busybox cp -a bar baz
+test -L baz
+test xfoo = x`readlink baz`
diff --git a/busybox/testsuite/cp/cp-copies-empty-file b/busybox/testsuite/cp/cp-copies-empty-file
new file mode 100644
index 0000000..ad25aa1
--- /dev/null
+++ b/busybox/testsuite/cp/cp-copies-empty-file
@@ -0,0 +1,3 @@
+touch foo
+busybox cp foo bar
+cmp foo bar
diff --git a/busybox/testsuite/cp/cp-copies-large-file b/busybox/testsuite/cp/cp-copies-large-file
new file mode 100644
index 0000000..c2225c6
--- /dev/null
+++ b/busybox/testsuite/cp/cp-copies-large-file
@@ -0,0 +1,3 @@
+dd if=/dev/zero of=foo seek=10k count=1 2>/dev/null
+busybox cp foo bar
+cmp foo bar
diff --git a/busybox/testsuite/cp/cp-copies-small-file b/busybox/testsuite/cp/cp-copies-small-file
new file mode 100644
index 0000000..d52a887
--- /dev/null
+++ b/busybox/testsuite/cp/cp-copies-small-file
@@ -0,0 +1,3 @@
+echo I WANT > foo
+busybox cp foo bar
+cmp foo bar
diff --git a/busybox/testsuite/cp/cp-d-files-to-dir b/busybox/testsuite/cp/cp-d-files-to-dir
new file mode 100644
index 0000000..9571a56
--- /dev/null
+++ b/busybox/testsuite/cp/cp-d-files-to-dir
@@ -0,0 +1,11 @@
+echo file number one > file1
+echo file number two > file2
+touch file3
+ln -s file2 link1
+mkdir there
+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 xfile2 = x`readlink there/link1`
diff --git a/busybox/testsuite/cp/cp-dir-create-dir b/busybox/testsuite/cp/cp-dir-create-dir
new file mode 100644
index 0000000..2c89af6
--- /dev/null
+++ b/busybox/testsuite/cp/cp-dir-create-dir
@@ -0,0 +1,4 @@
+mkdir bar
+touch bar/baz
+busybox cp -R bar foo
+test -f foo/baz
diff --git a/busybox/testsuite/cp/cp-dir-existing-dir b/busybox/testsuite/cp/cp-dir-existing-dir
new file mode 100644
index 0000000..5ba3f8e
--- /dev/null
+++ b/busybox/testsuite/cp/cp-dir-existing-dir
@@ -0,0 +1,5 @@
+mkdir bar
+touch bar/baz
+mkdir foo
+busybox cp -R bar foo
+test -f foo/bar/baz
diff --git a/busybox/testsuite/cp/cp-does-not-copy-unreadable-file b/busybox/testsuite/cp/cp-does-not-copy-unreadable-file
new file mode 100644
index 0000000..ce11bfa
--- /dev/null
+++ b/busybox/testsuite/cp/cp-does-not-copy-unreadable-file
@@ -0,0 +1,6 @@
+touch foo
+chmod a-r foo
+set +e
+busybox cp foo bar
+set -e
+test ! -f bar
diff --git a/busybox/testsuite/cp/cp-files-to-dir b/busybox/testsuite/cp/cp-files-to-dir
new file mode 100644
index 0000000..fdb8191
--- /dev/null
+++ b/busybox/testsuite/cp/cp-files-to-dir
@@ -0,0 +1,11 @@
+echo file number one > file1
+echo file number two > file2
+touch file3
+ln -s file2 link1
+mkdir there
+busybox cp file1 file2 file3 link1 there
+test -f there/file1
+test -f there/file2
+test ! -s there/file3
+test -f there/link1
+cmp there/file2 there/link1
diff --git a/busybox/testsuite/cp/cp-follows-links b/busybox/testsuite/cp/cp-follows-links
new file mode 100644
index 0000000..2d9f05e
--- /dev/null
+++ b/busybox/testsuite/cp/cp-follows-links
@@ -0,0 +1,4 @@
+touch foo
+ln -s foo bar
+busybox cp bar baz
+test -f baz
diff --git a/busybox/testsuite/cp/cp-preserves-hard-links b/busybox/testsuite/cp/cp-preserves-hard-links
new file mode 100644
index 0000000..4de7b85
--- /dev/null
+++ b/busybox/testsuite/cp/cp-preserves-hard-links
@@ -0,0 +1,6 @@
+# FEATURE: CONFIG_FEATURE_PRESERVE_HARDLINKS
+touch foo
+ln foo bar
+mkdir baz
+busybox cp -d foo bar baz
+test baz/foo -ef baz/bar
diff --git a/busybox/testsuite/cp/cp-preserves-links b/busybox/testsuite/cp/cp-preserves-links
new file mode 100644
index 0000000..301dc5f
--- /dev/null
+++ b/busybox/testsuite/cp/cp-preserves-links
@@ -0,0 +1,5 @@
+touch foo
+ln -s foo bar
+busybox cp -d bar baz
+test -L baz
+test xfoo = x`readlink baz`
diff --git a/busybox/testsuite/cp/cp-preserves-source-file b/busybox/testsuite/cp/cp-preserves-source-file
new file mode 100644
index 0000000..f0f5065
--- /dev/null
+++ b/busybox/testsuite/cp/cp-preserves-source-file
@@ -0,0 +1,3 @@
+touch foo
+busybox cp foo bar
+test -f foo
diff --git a/busybox/testsuite/cut/cut-cuts-a-character b/busybox/testsuite/cut/cut-cuts-a-character
new file mode 100644
index 0000000..d6c5efa
--- /dev/null
+++ b/busybox/testsuite/cut/cut-cuts-a-character
@@ -0,0 +1 @@
+test $(echo abcd | busybox cut -c 3) = c
diff --git a/busybox/testsuite/cut/cut-cuts-a-closed-range b/busybox/testsuite/cut/cut-cuts-a-closed-range
new file mode 100644
index 0000000..9680b76
--- /dev/null
+++ b/busybox/testsuite/cut/cut-cuts-a-closed-range
@@ -0,0 +1 @@
+test $(echo abcd | busybox cut -c 1-2) = ab
diff --git a/busybox/testsuite/cut/cut-cuts-a-field b/busybox/testsuite/cut/cut-cuts-a-field
new file mode 100644
index 0000000..4c7f440
--- /dev/null
+++ b/busybox/testsuite/cut/cut-cuts-a-field
@@ -0,0 +1 @@
+test $(echo -e "f1\tf2\tf3" | busybox cut -f 2) = f2
diff --git a/busybox/testsuite/cut/cut-cuts-an-open-range b/busybox/testsuite/cut/cut-cuts-an-open-range
new file mode 100644
index 0000000..1fbf277
--- /dev/null
+++ b/busybox/testsuite/cut/cut-cuts-an-open-range
@@ -0,0 +1 @@
+test $(echo abcd | busybox cut -c -3) = abc
diff --git a/busybox/testsuite/cut/cut-cuts-an-unclosed-range b/busybox/testsuite/cut/cut-cuts-an-unclosed-range
new file mode 100644
index 0000000..a2b0cdb
--- /dev/null
+++ b/busybox/testsuite/cut/cut-cuts-an-unclosed-range
@@ -0,0 +1 @@
+test $(echo abcd | busybox cut -c 3-) = cd
diff --git a/busybox/testsuite/date/date-R-works b/busybox/testsuite/date/date-R-works
new file mode 100644
index 0000000..ec3a067
--- /dev/null
+++ b/busybox/testsuite/date/date-R-works
@@ -0,0 +1,2 @@
+test x"`date -R`" = x"`busybox date -R`"
+
diff --git a/busybox/testsuite/date/date-format-works b/busybox/testsuite/date/date-format-works
new file mode 100644
index 0000000..f28d06c
--- /dev/null
+++ b/busybox/testsuite/date/date-format-works
@@ -0,0 +1 @@
+test x"`date +%d/%m/%y`" = x"`busybox date +%d/%m/%y`"
diff --git a/busybox/testsuite/date/date-u-works b/busybox/testsuite/date/date-u-works
new file mode 100644
index 0000000..7d9902a
--- /dev/null
+++ b/busybox/testsuite/date/date-u-works
@@ -0,0 +1,2 @@
+test x"`date -u`" = x"`busybox date -u`"
+
diff --git a/busybox/testsuite/date/date-works b/busybox/testsuite/date/date-works
new file mode 100644
index 0000000..2f6dd1e
--- /dev/null
+++ b/busybox/testsuite/date/date-works
@@ -0,0 +1,2 @@
+test x"`date`" = x"`busybox date`"
+
diff --git a/busybox/testsuite/dd/dd-accepts-if b/busybox/testsuite/dd/dd-accepts-if
new file mode 100644
index 0000000..03d1af8
--- /dev/null
+++ b/busybox/testsuite/dd/dd-accepts-if
@@ -0,0 +1,2 @@
+echo I WANT >foo
+test "$(busybox dd if=foo 2>/dev/null)" = "I WANT"
diff --git a/busybox/testsuite/dd/dd-accepts-of b/busybox/testsuite/dd/dd-accepts-of
new file mode 100644
index 0000000..84405e6
--- /dev/null
+++ b/busybox/testsuite/dd/dd-accepts-of
@@ -0,0 +1,2 @@
+echo I WANT | busybox dd of=foo 2>/dev/null
+echo I WANT | cmp foo -
diff --git a/busybox/testsuite/dd/dd-copies-from-standard-input-to-standard-output b/busybox/testsuite/dd/dd-copies-from-standard-input-to-standard-output
new file mode 100644
index 0000000..d890eb0
--- /dev/null
+++ b/busybox/testsuite/dd/dd-copies-from-standard-input-to-standard-output
@@ -0,0 +1 @@
+test "$(echo I WANT | busybox dd 2>/dev/null)" = "I WANT"
diff --git a/busybox/testsuite/dd/dd-prints-count-to-standard-error b/busybox/testsuite/dd/dd-prints-count-to-standard-error
new file mode 100644
index 0000000..2187dc0
--- /dev/null
+++ b/busybox/testsuite/dd/dd-prints-count-to-standard-error
@@ -0,0 +1,2 @@
+echo I WANT | busybox dd of=foo >/dev/null 2>bar
+grep -q records bar
diff --git a/busybox/testsuite/dirname/dirname-handles-absolute-path b/busybox/testsuite/dirname/dirname-handles-absolute-path
new file mode 100644
index 0000000..ca1a51b
--- /dev/null
+++ b/busybox/testsuite/dirname/dirname-handles-absolute-path
@@ -0,0 +1 @@
+test $(busybox dirname /foo/bar/baz) = /foo/bar
diff --git a/busybox/testsuite/dirname/dirname-handles-empty-path b/busybox/testsuite/dirname/dirname-handles-empty-path
new file mode 100644
index 0000000..04134a5
--- /dev/null
+++ b/busybox/testsuite/dirname/dirname-handles-empty-path
@@ -0,0 +1 @@
+test $(busybox dirname '') = .
diff --git a/busybox/testsuite/dirname/dirname-handles-multiple-slashes b/busybox/testsuite/dirname/dirname-handles-multiple-slashes
new file mode 100644
index 0000000..286f253
--- /dev/null
+++ b/busybox/testsuite/dirname/dirname-handles-multiple-slashes
@@ -0,0 +1 @@
+test $(busybox dirname foo/bar///baz) = foo/bar
diff --git a/busybox/testsuite/dirname/dirname-handles-relative-path b/busybox/testsuite/dirname/dirname-handles-relative-path
new file mode 100644
index 0000000..ffe4ab4
--- /dev/null
+++ b/busybox/testsuite/dirname/dirname-handles-relative-path
@@ -0,0 +1 @@
+test $(busybox dirname foo/bar/baz) = foo/bar
diff --git a/busybox/testsuite/dirname/dirname-handles-root b/busybox/testsuite/dirname/dirname-handles-root
new file mode 100644
index 0000000..6bd62b8
--- /dev/null
+++ b/busybox/testsuite/dirname/dirname-handles-root
@@ -0,0 +1 @@
+test $(busybox dirname /) = /
diff --git a/busybox/testsuite/dirname/dirname-handles-single-component b/busybox/testsuite/dirname/dirname-handles-single-component
new file mode 100644
index 0000000..24f9ae1
--- /dev/null
+++ b/busybox/testsuite/dirname/dirname-handles-single-component
@@ -0,0 +1 @@
+test $(busybox dirname foo) = .
diff --git a/busybox/testsuite/dirname/dirname-works b/busybox/testsuite/dirname/dirname-works
new file mode 100644
index 0000000..f339c8f
--- /dev/null
+++ b/busybox/testsuite/dirname/dirname-works
@@ -0,0 +1,2 @@
+test x$(dirname $(pwd)) = x$(busybox dirname $(pwd))
+
diff --git a/busybox/testsuite/du/du-h-works b/busybox/testsuite/du/du-h-works
new file mode 100644
index 0000000..82041ab
--- /dev/null
+++ b/busybox/testsuite/du/du-h-works
@@ -0,0 +1,4 @@
+[ -n "$d" ] || d=..
+du -h "$d" > logfile.gnu
+busybox du -h "$d" > logfile.bb
+cmp logfile.gnu logfile.bb
diff --git a/busybox/testsuite/du/du-k-works b/busybox/testsuite/du/du-k-works
new file mode 100644
index 0000000..177a1a2
--- /dev/null
+++ b/busybox/testsuite/du/du-k-works
@@ -0,0 +1,4 @@
+[ -n "$d" ] || d=..
+du -k "$d" > logfile.gnu
+busybox du -k "$d" > logfile.bb
+cmp logfile.gnu logfile.bb
diff --git a/busybox/testsuite/du/du-l-works b/busybox/testsuite/du/du-l-works
new file mode 100644
index 0000000..61e9140
--- /dev/null
+++ b/busybox/testsuite/du/du-l-works
@@ -0,0 +1,4 @@
+[ -n "$d" ] || d=..
+du -l "$d" > logfile.gnu
+busybox du -l "$d" > logfile.bb
+cmp logfile.gnu logfile.bb
diff --git a/busybox/testsuite/du/du-m-works b/busybox/testsuite/du/du-m-works
new file mode 100644
index 0000000..bc97073
--- /dev/null
+++ b/busybox/testsuite/du/du-m-works
@@ -0,0 +1,4 @@
+[ -n "$d" ] || d=..
+du -m "$d" > logfile.gnu
+busybox du -m "$d" > logfile.bb
+cmp logfile.gnu logfile.bb
diff --git a/busybox/testsuite/du/du-s-works b/busybox/testsuite/du/du-s-works
new file mode 100644
index 0000000..f0b3bf0
--- /dev/null
+++ b/busybox/testsuite/du/du-s-works
@@ -0,0 +1,4 @@
+[ -n "$d" ] || d=..
+du -s "$d" > logfile.gnu
+busybox du -s "$d" > logfile.bb
+cmp logfile.gnu logfile.bb
diff --git a/busybox/testsuite/du/du-works b/busybox/testsuite/du/du-works
new file mode 100644
index 0000000..47949c6
--- /dev/null
+++ b/busybox/testsuite/du/du-works
@@ -0,0 +1,4 @@
+[ -n "$d" ] || d=..
+du "$d" > logfile.gnu
+busybox du "$d" > logfile.bb
+cmp logfile.gnu logfile.bb
diff --git a/busybox/testsuite/echo/echo-does-not-print-newline b/busybox/testsuite/echo/echo-does-not-print-newline
new file mode 100644
index 0000000..2ed03ca
--- /dev/null
+++ b/busybox/testsuite/echo/echo-does-not-print-newline
@@ -0,0 +1 @@
+test `busybox echo -n word | wc -c` -eq 4
diff --git a/busybox/testsuite/echo/echo-prints-argument b/busybox/testsuite/echo/echo-prints-argument
new file mode 100644
index 0000000..479dac8
--- /dev/null
+++ b/busybox/testsuite/echo/echo-prints-argument
@@ -0,0 +1 @@
+test xfubar = x`busybox echo fubar`
diff --git a/busybox/testsuite/echo/echo-prints-arguments b/busybox/testsuite/echo/echo-prints-arguments
new file mode 100644
index 0000000..4e4e3b4
--- /dev/null
+++ b/busybox/testsuite/echo/echo-prints-arguments
@@ -0,0 +1 @@
+test "`busybox echo foo bar`" = "foo bar"
diff --git a/busybox/testsuite/echo/echo-prints-newline b/busybox/testsuite/echo/echo-prints-newline
new file mode 100644
index 0000000..838671e
--- /dev/null
+++ b/busybox/testsuite/echo/echo-prints-newline
@@ -0,0 +1 @@
+test `busybox echo word | wc -c` -eq 5
diff --git a/busybox/testsuite/expr/expr-works b/busybox/testsuite/expr/expr-works
new file mode 100644
index 0000000..af49ac4
--- /dev/null
+++ b/busybox/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/busybox/testsuite/false/false-is-silent b/busybox/testsuite/false/false-is-silent
new file mode 100644
index 0000000..8a9aa0c
--- /dev/null
+++ b/busybox/testsuite/false/false-is-silent
@@ -0,0 +1 @@
+busybox false 2>&1 | cmp - /dev/null
diff --git a/busybox/testsuite/false/false-returns-failure b/busybox/testsuite/false/false-returns-failure
new file mode 100644
index 0000000..1a061f2
--- /dev/null
+++ b/busybox/testsuite/false/false-returns-failure
@@ -0,0 +1 @@
+! busybox false
diff --git a/busybox/testsuite/find/find-supports-minus-xdev b/busybox/testsuite/find/find-supports-minus-xdev
new file mode 100644
index 0000000..4c559a1
--- /dev/null
+++ b/busybox/testsuite/find/find-supports-minus-xdev
@@ -0,0 +1 @@
+busybox find . -xdev >/dev/null 2>&1
diff --git a/busybox/testsuite/grep/egrep-is-not-case-insensitive b/busybox/testsuite/grep/egrep-is-not-case-insensitive
new file mode 100644
index 0000000..8816073
--- /dev/null
+++ b/busybox/testsuite/grep/egrep-is-not-case-insensitive
@@ -0,0 +1,2 @@
+# FEATURE: CONFIG_FEATURE_GREP_EGREP_ALIAS
+test x`echo foo | busybox egrep FOO` = x
diff --git a/busybox/testsuite/grep/egrep-supports-extended-regexps b/busybox/testsuite/grep/egrep-supports-extended-regexps
new file mode 100644
index 0000000..6ef8b91
--- /dev/null
+++ b/busybox/testsuite/grep/egrep-supports-extended-regexps
@@ -0,0 +1,2 @@
+# FEATURE: CONFIG_FEATURE_GREP_EGREP_ALIAS
+echo foo | busybox egrep fo+
diff --git a/busybox/testsuite/grep/grep-handles-binary-files b/busybox/testsuite/grep/grep-handles-binary-files
new file mode 100644
index 0000000..edb2042
--- /dev/null
+++ b/busybox/testsuite/grep/grep-handles-binary-files
@@ -0,0 +1 @@
+echo -e '\0foo' | busybox grep foo
diff --git a/busybox/testsuite/grep/grep-handles-multiple-regexps b/busybox/testsuite/grep/grep-handles-multiple-regexps
new file mode 100644
index 0000000..5c1b8de
--- /dev/null
+++ b/busybox/testsuite/grep/grep-handles-multiple-regexps
@@ -0,0 +1 @@
+echo foo | busybox grep -e foo -e bar
diff --git a/busybox/testsuite/grep/grep-is-also-egrep b/busybox/testsuite/grep/grep-is-also-egrep
new file mode 100644
index 0000000..2e6977c
--- /dev/null
+++ b/busybox/testsuite/grep/grep-is-also-egrep
@@ -0,0 +1,2 @@
+# FEATURE: CONFIG_FEATURE_GREP_EGREP_ALIAS
+echo foo | busybox egrep foo
diff --git a/busybox/testsuite/grep/grep-matches-NUL b/busybox/testsuite/grep/grep-matches-NUL
new file mode 100644
index 0000000..082bd87
--- /dev/null
+++ b/busybox/testsuite/grep/grep-matches-NUL
@@ -0,0 +1,8 @@
+set +e
+echo -e '\0' | busybox grep .
+if [ $? != 0 ] ; then
+ exit 0;
+fi
+
+exit 1;
+
diff --git a/busybox/testsuite/gunzip/gunzip-reads-from-standard-input b/busybox/testsuite/gunzip/gunzip-reads-from-standard-input
new file mode 100644
index 0000000..7c498c0
--- /dev/null
+++ b/busybox/testsuite/gunzip/gunzip-reads-from-standard-input
@@ -0,0 +1,2 @@
+echo foo | gzip | busybox gunzip > output
+echo foo | cmp - output
diff --git a/busybox/testsuite/gzip/gzip-accepts-multiple-files b/busybox/testsuite/gzip/gzip-accepts-multiple-files
new file mode 100644
index 0000000..8f0d9c8
--- /dev/null
+++ b/busybox/testsuite/gzip/gzip-accepts-multiple-files
@@ -0,0 +1,3 @@
+touch foo bar
+busybox gzip foo bar
+test -f foo.gz -a -f bar.gz
diff --git a/busybox/testsuite/gzip/gzip-accepts-single-minus b/busybox/testsuite/gzip/gzip-accepts-single-minus
new file mode 100644
index 0000000..8b51fdf
--- /dev/null
+++ b/busybox/testsuite/gzip/gzip-accepts-single-minus
@@ -0,0 +1 @@
+echo foo | busybox gzip - >/dev/null
diff --git a/busybox/testsuite/gzip/gzip-removes-original-file b/busybox/testsuite/gzip/gzip-removes-original-file
new file mode 100644
index 0000000..b9cb995
--- /dev/null
+++ b/busybox/testsuite/gzip/gzip-removes-original-file
@@ -0,0 +1,3 @@
+touch foo
+busybox gzip foo
+test ! -f foo
diff --git a/busybox/testsuite/head/head-n-works b/busybox/testsuite/head/head-n-works
new file mode 100644
index 0000000..db43255
--- /dev/null
+++ b/busybox/testsuite/head/head-n-works
@@ -0,0 +1,4 @@
+[ -n "$d" ] || d=..
+head -n 2 "$d/README" > logfile.gnu
+busybox head -n 2 "$d/README" > logfile.bb
+cmp logfile.gnu logfile.bb
diff --git a/busybox/testsuite/head/head-works b/busybox/testsuite/head/head-works
new file mode 100644
index 0000000..56ad3e3
--- /dev/null
+++ b/busybox/testsuite/head/head-works
@@ -0,0 +1,4 @@
+[ -n "$d" ] || d=..
+head "$d/README" > logfile.gnu
+busybox head "$d/README" > logfile.bb
+cmp logfile.gnu logfile.bb
diff --git a/busybox/testsuite/hostid/hostid-works b/busybox/testsuite/hostid/hostid-works
new file mode 100644
index 0000000..e85698e
--- /dev/null
+++ b/busybox/testsuite/hostid/hostid-works
@@ -0,0 +1,2 @@
+test x$(hostid) = x$(busybox hostid)
+
diff --git a/busybox/testsuite/hostname/hostname-d-works b/busybox/testsuite/hostname/hostname-d-works
new file mode 100644
index 0000000..a9aeb92
--- /dev/null
+++ b/busybox/testsuite/hostname/hostname-d-works
@@ -0,0 +1,2 @@
+test x$(hostname -d) = x$(busybox hostname -d)
+
diff --git a/busybox/testsuite/hostname/hostname-i-works b/busybox/testsuite/hostname/hostname-i-works
new file mode 100644
index 0000000..68a3e67
--- /dev/null
+++ b/busybox/testsuite/hostname/hostname-i-works
@@ -0,0 +1,2 @@
+test x$(hostname -i) = x$(busybox hostname -i)
+
diff --git a/busybox/testsuite/hostname/hostname-s-works b/busybox/testsuite/hostname/hostname-s-works
new file mode 100644
index 0000000..172b944
--- /dev/null
+++ b/busybox/testsuite/hostname/hostname-s-works
@@ -0,0 +1 @@
+test x$(hostname -s) = x$(busybox hostname -s)
diff --git a/busybox/testsuite/hostname/hostname-works b/busybox/testsuite/hostname/hostname-works
new file mode 100644
index 0000000..f51a406
--- /dev/null
+++ b/busybox/testsuite/hostname/hostname-works
@@ -0,0 +1 @@
+test x$(hostname) = x$(busybox hostname)
diff --git a/busybox/testsuite/id/id-g-works b/busybox/testsuite/id/id-g-works
new file mode 100644
index 0000000..671fc53
--- /dev/null
+++ b/busybox/testsuite/id/id-g-works
@@ -0,0 +1 @@
+test x$(id -g) = x$(busybox id -g)
diff --git a/busybox/testsuite/id/id-u-works b/busybox/testsuite/id/id-u-works
new file mode 100644
index 0000000..2358cb0
--- /dev/null
+++ b/busybox/testsuite/id/id-u-works
@@ -0,0 +1 @@
+test x$(id -u) = x$(busybox id -u)
diff --git a/busybox/testsuite/id/id-un-works b/busybox/testsuite/id/id-un-works
new file mode 100644
index 0000000..db390e7
--- /dev/null
+++ b/busybox/testsuite/id/id-un-works
@@ -0,0 +1 @@
+test x$(id -un) = x$(busybox id -un)
diff --git a/busybox/testsuite/id/id-ur-works b/busybox/testsuite/id/id-ur-works
new file mode 100644
index 0000000..6b0fcb0
--- /dev/null
+++ b/busybox/testsuite/id/id-ur-works
@@ -0,0 +1 @@
+test x$(id -ur) = x$(busybox id -ur)
diff --git a/busybox/testsuite/ln/ln-creates-hard-links b/busybox/testsuite/ln/ln-creates-hard-links
new file mode 100644
index 0000000..2f6e23f
--- /dev/null
+++ b/busybox/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/busybox/testsuite/ln/ln-creates-soft-links b/busybox/testsuite/ln/ln-creates-soft-links
new file mode 100644
index 0000000..e875e4c
--- /dev/null
+++ b/busybox/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/busybox/testsuite/ln/ln-force-creates-hard-links b/busybox/testsuite/ln/ln-force-creates-hard-links
new file mode 100644
index 0000000..c96b7d6
--- /dev/null
+++ b/busybox/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/busybox/testsuite/ln/ln-force-creates-soft-links b/busybox/testsuite/ln/ln-force-creates-soft-links
new file mode 100644
index 0000000..cab8d1d
--- /dev/null
+++ b/busybox/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/busybox/testsuite/ln/ln-preserves-hard-links b/busybox/testsuite/ln/ln-preserves-hard-links
new file mode 100644
index 0000000..47fb989
--- /dev/null
+++ b/busybox/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/busybox/testsuite/ln/ln-preserves-soft-links b/busybox/testsuite/ln/ln-preserves-soft-links
new file mode 100644
index 0000000..a8123ec
--- /dev/null
+++ b/busybox/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/busybox/testsuite/ls/ls-1-works b/busybox/testsuite/ls/ls-1-works
new file mode 100644
index 0000000..8ad484f
--- /dev/null
+++ b/busybox/testsuite/ls/ls-1-works
@@ -0,0 +1,4 @@
+[ -n "$d" ] || d=..
+ls -1 "$d" > logfile.gnu
+busybox ls -1 "$d" > logfile.bb
+cmp logfile.gnu logfile.bb
diff --git a/busybox/testsuite/ls/ls-h-works b/busybox/testsuite/ls/ls-h-works
new file mode 100644
index 0000000..7331262
--- /dev/null
+++ b/busybox/testsuite/ls/ls-h-works
@@ -0,0 +1,4 @@
+[ -n "$d" ] || d=..
+ls -h "$d" > logfile.gnu
+busybox ls -h "$d" > logfile.bb
+cmp logfile.gnu logfile.bb
diff --git a/busybox/testsuite/ls/ls-l-works b/busybox/testsuite/ls/ls-l-works
new file mode 100644
index 0000000..ae5141d
--- /dev/null
+++ b/busybox/testsuite/ls/ls-l-works
@@ -0,0 +1,4 @@
+[ -n "$d" ] || d=..
+ls -l "$d" > logfile.gnu
+busybox ls -l "$d" > logfile.bb
+cmp logfile.gnu logfile.bb
diff --git a/busybox/testsuite/ls/ls-s-works b/busybox/testsuite/ls/ls-s-works
new file mode 100644
index 0000000..d82f328
--- /dev/null
+++ b/busybox/testsuite/ls/ls-s-works
@@ -0,0 +1,4 @@
+[ -n "$d" ] || d=..
+ls -1s "$d" > logfile.gnu
+busybox ls -1s "$d" > logfile.bb
+cmp logfile.gnu logfile.bb
diff --git a/busybox/testsuite/md5sum/md5sum-verifies-non-binary-file b/busybox/testsuite/md5sum/md5sum-verifies-non-binary-file
new file mode 100644
index 0000000..8566a23
--- /dev/null
+++ b/busybox/testsuite/md5sum/md5sum-verifies-non-binary-file
@@ -0,0 +1,3 @@
+touch foo
+md5sum foo > bar
+busybox md5sum -c bar
diff --git a/busybox/testsuite/mkdir/mkdir-makes-a-directory b/busybox/testsuite/mkdir/mkdir-makes-a-directory
new file mode 100644
index 0000000..6ca5c4d
--- /dev/null
+++ b/busybox/testsuite/mkdir/mkdir-makes-a-directory
@@ -0,0 +1,2 @@
+busybox mkdir foo
+test -d foo
diff --git a/busybox/testsuite/mkdir/mkdir-makes-parent-directories b/busybox/testsuite/mkdir/mkdir-makes-parent-directories
new file mode 100644
index 0000000..992facb
--- /dev/null
+++ b/busybox/testsuite/mkdir/mkdir-makes-parent-directories
@@ -0,0 +1,2 @@
+busybox mkdir -p foo/bar
+test -d foo -a -d foo/bar
diff --git a/busybox/testsuite/msh/msh-supports-underscores-in-variable-names b/busybox/testsuite/msh/msh-supports-underscores-in-variable-names
new file mode 100644
index 0000000..9c7834b
--- /dev/null
+++ b/busybox/testsuite/msh/msh-supports-underscores-in-variable-names
@@ -0,0 +1 @@
+test "`busybox msh -c 'FOO_BAR=foo; echo $FOO_BAR'`" = foo
diff --git a/busybox/testsuite/mv/mv-files-to-dir b/busybox/testsuite/mv/mv-files-to-dir
new file mode 100644
index 0000000..c8eaba8
--- /dev/null
+++ b/busybox/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/busybox/testsuite/mv/mv-follows-links b/busybox/testsuite/mv/mv-follows-links
new file mode 100644
index 0000000..1fb355b
--- /dev/null
+++ b/busybox/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/busybox/testsuite/mv/mv-moves-empty-file b/busybox/testsuite/mv/mv-moves-empty-file
new file mode 100644
index 0000000..48afca4
--- /dev/null
+++ b/busybox/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/busybox/testsuite/mv/mv-moves-file b/busybox/testsuite/mv/mv-moves-file
new file mode 100644
index 0000000..edb4c37
--- /dev/null
+++ b/busybox/testsuite/mv/mv-moves-file
@@ -0,0 +1,3 @@
+touch foo
+busybox mv foo bar
+test ! -f foo -a -f bar
diff --git a/busybox/testsuite/mv/mv-moves-hardlinks b/busybox/testsuite/mv/mv-moves-hardlinks
new file mode 100644
index 0000000..eaa8215
--- /dev/null
+++ b/busybox/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/busybox/testsuite/mv/mv-moves-large-file b/busybox/testsuite/mv/mv-moves-large-file
new file mode 100644
index 0000000..77d088f
--- /dev/null
+++ b/busybox/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/busybox/testsuite/mv/mv-moves-small-file b/busybox/testsuite/mv/mv-moves-small-file
new file mode 100644
index 0000000..065c7f1
--- /dev/null
+++ b/busybox/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/busybox/testsuite/mv/mv-moves-symlinks b/busybox/testsuite/mv/mv-moves-symlinks
new file mode 100644
index 0000000..c413af0
--- /dev/null
+++ b/busybox/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/busybox/testsuite/mv/mv-moves-unreadable-files b/busybox/testsuite/mv/mv-moves-unreadable-files
new file mode 100644
index 0000000..bc9c313
--- /dev/null
+++ b/busybox/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/busybox/testsuite/mv/mv-preserves-hard-links b/busybox/testsuite/mv/mv-preserves-hard-links
new file mode 100644
index 0000000..b3ba3aa
--- /dev/null
+++ b/busybox/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/busybox/testsuite/mv/mv-preserves-links b/busybox/testsuite/mv/mv-preserves-links
new file mode 100644
index 0000000..ea565d2
--- /dev/null
+++ b/busybox/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/busybox/testsuite/mv/mv-refuses-mv-dir-to-subdir b/busybox/testsuite/mv/mv-refuses-mv-dir-to-subdir
new file mode 100644
index 0000000..7c572c4
--- /dev/null
+++ b/busybox/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/busybox/testsuite/mv/mv-removes-source-file b/busybox/testsuite/mv/mv-removes-source-file
new file mode 100644
index 0000000..48afca4
--- /dev/null
+++ b/busybox/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/busybox/testsuite/pwd/pwd-prints-working-directory b/busybox/testsuite/pwd/pwd-prints-working-directory
new file mode 100644
index 0000000..8575347
--- /dev/null
+++ b/busybox/testsuite/pwd/pwd-prints-working-directory
@@ -0,0 +1 @@
+test $(pwd) = $(busybox pwd)
diff --git a/busybox/testsuite/rm/rm-removes-file b/busybox/testsuite/rm/rm-removes-file
new file mode 100644
index 0000000..46571a9
--- /dev/null
+++ b/busybox/testsuite/rm/rm-removes-file
@@ -0,0 +1,3 @@
+touch foo
+busybox rm foo
+test ! -f foo
diff --git a/busybox/testsuite/rmdir/rmdir-removes-parent-directories b/busybox/testsuite/rmdir/rmdir-removes-parent-directories
new file mode 100644
index 0000000..222f5de
--- /dev/null
+++ b/busybox/testsuite/rmdir/rmdir-removes-parent-directories
@@ -0,0 +1,3 @@
+mkdir -p foo/bar
+busybox rmdir -p foo/bar
+test ! -d foo
diff --git a/busybox/testsuite/runtest b/busybox/testsuite/runtest
new file mode 100755
index 0000000..6ba334b
--- /dev/null
+++ b/busybox/testsuite/runtest
@@ -0,0 +1,102 @@
+#!/bin/sh
+
+[ -n "$srcdir" ] || srcdir=$(pwd)
+[ -n "$bindir" ] || bindir=$(dirname $(pwd))
+PATH=$bindir:$PATH
+
+run_applet_testcase ()
+{
+ local applet=$1
+ local testcase=$2
+
+ local status=0
+ 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$" $bindir/.config; then
+ echo UNTESTED: $testname
+ return 0
+ fi
+
+ if grep -q "^# FEATURE: " $testcase; then
+ local feature=`sed -ne 's/^# FEATURE: //p' $testcase`
+
+ if grep -q "^# ${feature} is not set$" $bindir/.config; then
+ echo UNTESTED: $testname
+ return 0
+ fi
+ fi
+
+ rm -rf tmp
+ mkdir -p tmp
+ pushd tmp >/dev/null
+
+ d=$srcdir sh -x -e $testcase >.logfile.txt 2>&1
+
+ if [ $? != 0 ] ; then
+ echo FAIL: $testname
+ if [ "$verbose" = 1 ]; then
+ cat .logfile.txt
+ #exit 1;
+ fi;
+ status=$?
+ else
+ echo PASS: $testname
+ rm -f .logfile.txt
+ status=$?
+ fi
+
+ popd >/dev/null
+ rm -rf tmp
+
+ return $status
+}
+
+run_applet_tests ()
+{
+ local applet=$1
+
+ local status=0
+
+ for testcase in $srcdir/$applet/*; do
+ if [ "$testcase" = "$srcdir/$applet/CVS" ]; then
+ continue
+ fi
+
+ if run_applet_testcase $applet $testcase; then
+ :
+ else
+ status=1
+ fi
+ done
+
+ return $status
+}
+
+
+status=0
+
+if [ x"$1" = x"-v" ]; then
+ verbose=1
+ shift
+fi
+
+if [ $# -ne 0 ]; then
+ applets="$@"
+else
+ applets=$(ls $srcdir)
+fi
+
+for applet in $applets; do
+ if [ "$applet" != CVS -a -d "$srcdir/$applet" ]; then
+ if run_applet_tests $applet; then
+ :
+ else
+ status=1
+ fi
+ fi
+done
+
+exit $status
diff --git a/busybox/testsuite/sed/sed-accepts-blanks-before-command b/busybox/testsuite/sed/sed-accepts-blanks-before-command
new file mode 100644
index 0000000..9597c2f
--- /dev/null
+++ b/busybox/testsuite/sed/sed-accepts-blanks-before-command
@@ -0,0 +1 @@
+busybox sed -e '1 d' </dev/null
diff --git a/busybox/testsuite/sed/sed-aic-commands b/busybox/testsuite/sed/sed-aic-commands
new file mode 100644
index 0000000..b41c14a
--- /dev/null
+++ b/busybox/testsuite/sed/sed-aic-commands
@@ -0,0 +1,134 @@
+cat - >input <<EOF
+2i\\
+before 2
+5c\\
+Change 5
+10a\\
+After 10
+22i\\
+before 22\\
+Continued
+25c\\
+Change 25\\
+Continued
+20a\\
+After 20\\
+Continued
+ 32i\\
+before 32\\
+Continued 1\\
+Continued 2\\
+Continued 3
+ 35c\\
+Change 35\\
+Continued 1\\
+Continued 2\\
+Continued 3
+ 30a\\
+After 30\\
+Continued 1\\
+Continued 2\\
+Continued 3
+EOF
+busybox sed -f input >output <<EOF
+ 1 y
+ 2 y
+ 3 y
+ 4 y
+ 5 y
+ 6 y
+ 7 y
+ 8 y
+ 9 y
+ 10 y
+ 11 y
+ 12 y
+ 13 y
+ 14 y
+ 15 y
+ 16 y
+ 17 y
+ 18 y
+ 19 y
+ 20 y
+ 21 y
+ 22 y
+ 23 y
+ 24 y
+ 25 y
+ 26 y
+ 27 y
+ 28 y
+ 29 y
+ 30 y
+ 31 y
+ 32 y
+ 33 y
+ 34 y
+ 35 y
+ 36 y
+ 37 y
+ 38 y
+ 39 y
+ 40 y
+EOF
+cmp -s output - <<EOF
+ 1 y
+before 2
+ 2 y
+ 3 y
+ 4 y
+Change 5
+ 6 y
+ 7 y
+ 8 y
+ 9 y
+ 10 y
+After 10
+ 11 y
+ 12 y
+ 13 y
+ 14 y
+ 15 y
+ 16 y
+ 17 y
+ 18 y
+ 19 y
+ 20 y
+After 20
+Continued
+ 21 y
+before 22
+Continued
+ 22 y
+ 23 y
+ 24 y
+Change 25
+Continued
+ 26 y
+ 27 y
+ 28 y
+ 29 y
+ 30 y
+After 30
+Continued 1
+Continued 2
+Continued 3
+ 31 y
+before 32
+Continued 1
+Continued 2
+Continued 3
+ 32 y
+ 33 y
+ 34 y
+Change 35
+Continued 1
+Continued 2
+Continued 3
+ 36 y
+ 37 y
+ 38 y
+ 39 y
+ 40 y
+EOF
diff --git a/busybox/testsuite/sed/sed-append-hold-space-to-pattern-space b/busybox/testsuite/sed/sed-append-hold-space-to-pattern-space
new file mode 100644
index 0000000..6dda80f
--- /dev/null
+++ b/busybox/testsuite/sed/sed-append-hold-space-to-pattern-space
@@ -0,0 +1,13 @@
+busybox sed 'G'>output <<EOF
+a
+b
+c
+EOF
+cmp -s output - <<EOF
+a
+
+b
+
+c
+
+EOF
diff --git a/busybox/testsuite/sed/sed-append-next-line b/busybox/testsuite/sed/sed-append-next-line
new file mode 100644
index 0000000..0621a31
--- /dev/null
+++ b/busybox/testsuite/sed/sed-append-next-line
@@ -0,0 +1,19 @@
+# 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
+a
+b
+c
+EOF
+if [ $? != 0 ] ; then
+ exit 0;
+fi
+exit 1;
diff --git a/busybox/testsuite/sed/sed-branch b/busybox/testsuite/sed/sed-branch
new file mode 100644
index 0000000..4167569
--- /dev/null
+++ b/busybox/testsuite/sed/sed-branch
@@ -0,0 +1 @@
+test "$(echo foo | busybox sed 'b one;p;: one')" = foo
diff --git a/busybox/testsuite/sed/sed-branch-conditional b/busybox/testsuite/sed/sed-branch-conditional
new file mode 100644
index 0000000..47d0a5f
--- /dev/null
+++ b/busybox/testsuite/sed/sed-branch-conditional
@@ -0,0 +1,15 @@
+busybox sed 's/a/1/;t one;p;: one;p'>output <<EOF
+a
+b
+c
+EOF
+cmp -s output - <<EOF
+1
+1
+b
+b
+b
+c
+c
+c
+EOF
diff --git a/busybox/testsuite/sed/sed-branch-conditional2 b/busybox/testsuite/sed/sed-branch-conditional2
new file mode 100644
index 0000000..f4b11f0
--- /dev/null
+++ b/busybox/testsuite/sed/sed-branch-conditional2
@@ -0,0 +1,11 @@
+#XFAIL
+busybox sed 's/a/b/;:loop;t loop'>output <<EOF
+a
+b
+c
+EOF
+cmp -s output - <<EOF
+b
+b
+c
+EOF
diff --git a/busybox/testsuite/sed/sed-branch-no-label b/busybox/testsuite/sed/sed-branch-no-label
new file mode 100644
index 0000000..446c1bc
--- /dev/null
+++ b/busybox/testsuite/sed/sed-branch-no-label
@@ -0,0 +1 @@
+test "$(echo foo | busybox sed 'b;p')" = foo
diff --git a/busybox/testsuite/sed/sed-chains-substs b/busybox/testsuite/sed/sed-chains-substs
new file mode 100644
index 0000000..266936a
--- /dev/null
+++ b/busybox/testsuite/sed/sed-chains-substs
@@ -0,0 +1 @@
+test "$(echo foo | busybox sed -e s/foo/bar/ -e s/bar/baz/)" = baz
diff --git a/busybox/testsuite/sed/sed-chains-substs2 b/busybox/testsuite/sed/sed-chains-substs2
new file mode 100644
index 0000000..90568f6
--- /dev/null
+++ b/busybox/testsuite/sed/sed-chains-substs2
@@ -0,0 +1 @@
+test x"$(echo foo | busybox -n sed -e s/foo/bar/ -e s/foo/baz/)" = x
diff --git a/busybox/testsuite/sed/sed-does-not-substitute-in-deleted-line b/busybox/testsuite/sed/sed-does-not-substitute-in-deleted-line
new file mode 100644
index 0000000..6f106e1
--- /dev/null
+++ b/busybox/testsuite/sed/sed-does-not-substitute-in-deleted-line
@@ -0,0 +1,2 @@
+echo foo | busybox sed -e /foo/d -e s/foo/bar/ >foo
+cmp foo /dev/null
diff --git a/busybox/testsuite/sed/sed-handles-embedded-slashes b/busybox/testsuite/sed/sed-handles-embedded-slashes
new file mode 100644
index 0000000..cc28761
--- /dev/null
+++ b/busybox/testsuite/sed/sed-handles-embedded-slashes
@@ -0,0 +1 @@
+test "$(echo fu/bar | busybox sed -e 's/[/]//')" = fubar
diff --git a/busybox/testsuite/sed/sed-handles-empty-lines b/busybox/testsuite/sed/sed-handles-empty-lines
new file mode 100644
index 0000000..2bb8f04
--- /dev/null
+++ b/busybox/testsuite/sed/sed-handles-empty-lines
@@ -0,0 +1 @@
+test `echo | busybox sed -e 's/$/@/'` = @
diff --git a/busybox/testsuite/sed/sed-handles-unsatisfied-backrefs b/busybox/testsuite/sed/sed-handles-unsatisfied-backrefs
new file mode 100644
index 0000000..61bff88
--- /dev/null
+++ b/busybox/testsuite/sed/sed-handles-unsatisfied-backrefs
@@ -0,0 +1,6 @@
+busybox sed -e 's/.*root=/\1/' >output <<EOF
+BOOT_IMAGE=vmlinuz root=/dev/hda5 initrd=init1
+EOF
+cmp -s output - <<EOF
+/dev/hda5 initrd=init1
+EOF
diff --git a/busybox/testsuite/sed/sed-next-line b/busybox/testsuite/sed/sed-next-line
new file mode 100644
index 0000000..38fe20c
--- /dev/null
+++ b/busybox/testsuite/sed/sed-next-line
@@ -0,0 +1,12 @@
+busybox sed 'n;p'>output <<EOF
+a
+b
+c
+EOF
+cmp -s output - <<EOF
+a
+b
+b
+c
+c
+EOF
diff --git a/busybox/testsuite/sed/sed-prints-line-once-for-multiple-substs b/busybox/testsuite/sed/sed-prints-line-once-for-multiple-substs
new file mode 100644
index 0000000..ba8955d
--- /dev/null
+++ b/busybox/testsuite/sed/sed-prints-line-once-for-multiple-substs
@@ -0,0 +1,4 @@
+busybox sed -e s/1/2/g -e s/3/4/g >output <<EOF
+1
+EOF
+echo 2 | cmp -s output -
diff --git a/busybox/testsuite/sed/sed-recurses-properly b/busybox/testsuite/sed/sed-recurses-properly
new file mode 100644
index 0000000..a02667b
--- /dev/null
+++ b/busybox/testsuite/sed/sed-recurses-properly
@@ -0,0 +1 @@
+test "`echo '12345' | busybox sed -e 's/[[:space:]]*/,/g')` = ',1,2,3,4,5,'"
diff --git a/busybox/testsuite/sed/sed-regex-match-newline b/busybox/testsuite/sed/sed-regex-match-newline
new file mode 100644
index 0000000..1057e17
--- /dev/null
+++ b/busybox/testsuite/sed/sed-regex-match-newline
@@ -0,0 +1,10 @@
+# FEATURE: CONFIG_FEATURE_SED_EMBEDED_NEWLINE
+busybox sed -n 'N;/a\nb/p'>output <<EOF
+a
+b
+c
+EOF
+cmp -s output - <<EOF
+a
+b
+EOF
diff --git a/busybox/testsuite/sed/sed-splits-edit-commands-on-command-line b/busybox/testsuite/sed/sed-splits-edit-commands-on-command-line
new file mode 100644
index 0000000..6421fa5
--- /dev/null
+++ b/busybox/testsuite/sed/sed-splits-edit-commands-on-command-line
@@ -0,0 +1,9 @@
+echo 2 | busybox sed -e 'i\
+1
+a\
+3' > output
+cmp output - <<EOF
+1
+2
+3
+EOF
diff --git a/busybox/testsuite/sed/sed-subst-subprint b/busybox/testsuite/sed/sed-subst-subprint
new file mode 100644
index 0000000..24f8bad
--- /dev/null
+++ b/busybox/testsuite/sed/sed-subst-subprint
@@ -0,0 +1,9 @@
+busybox sed 's/foo/bar/p'>output <<EOF
+foo
+bar
+EOF
+cmp -s output - <<EOF
+bar
+bar
+bar
+EOF
diff --git a/busybox/testsuite/sed/sed-write-to-stdout b/busybox/testsuite/sed/sed-write-to-stdout
new file mode 100644
index 0000000..95b4d72
--- /dev/null
+++ b/busybox/testsuite/sed/sed-write-to-stdout
@@ -0,0 +1,10 @@
+busybox sed -n 'N;P;p'>output <<EOF
+a
+b
+c
+EOF
+cmp -s output - <<EOF
+a
+a
+b
+EOF
diff --git a/busybox/testsuite/sort/sort-n-works b/busybox/testsuite/sort/sort-n-works
new file mode 100644
index 0000000..878108d
--- /dev/null
+++ b/busybox/testsuite/sort/sort-n-works
@@ -0,0 +1,4 @@
+[ -n "$d" ] || d=..
+sort -n "$d/README" > logfile.gnu
+busybox sort -n "$d/README" > logfile.bb
+cmp logfile.gnu logfile.bb
diff --git a/busybox/testsuite/sort/sort-r-works b/busybox/testsuite/sort/sort-r-works
new file mode 100644
index 0000000..6ee0ceb
--- /dev/null
+++ b/busybox/testsuite/sort/sort-r-works
@@ -0,0 +1,4 @@
+[ -n "$d" ] || d=..
+sort -r "$d/README" > logfile.gnu
+busybox sort -r "$d/README" > logfile.bb
+cmp logfile.gnu logfile.bb
diff --git a/busybox/testsuite/sort/sort-works b/busybox/testsuite/sort/sort-works
new file mode 100644
index 0000000..14a115a
--- /dev/null
+++ b/busybox/testsuite/sort/sort-works
@@ -0,0 +1,4 @@
+[ -n "$d" ] || d=..
+sort "$d/README" > logfile.gnu
+busybox sort "$d/README" > logfile.bb
+cmp logfile.gnu logfile.bb
diff --git a/busybox/testsuite/strings/strings-works-like-GNU b/busybox/testsuite/strings/strings-works-like-GNU
new file mode 100644
index 0000000..2d64710
--- /dev/null
+++ b/busybox/testsuite/strings/strings-works-like-GNU
@@ -0,0 +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
+ set -e
+ diff -q foo bar
+fi
diff --git a/busybox/testsuite/tail/tail-n-works b/busybox/testsuite/tail/tail-n-works
new file mode 100644
index 0000000..27a905f
--- /dev/null
+++ b/busybox/testsuite/tail/tail-n-works
@@ -0,0 +1,4 @@
+[ -n "$d" ] || d=..
+tail -n 2 "$d/README" > logfile.gnu
+busybox tail -n 2 "$d/README" > logfile.bb
+cmp logfile.gnu logfile.bb
diff --git a/busybox/testsuite/tail/tail-works b/busybox/testsuite/tail/tail-works
new file mode 100644
index 0000000..27a905f
--- /dev/null
+++ b/busybox/testsuite/tail/tail-works
@@ -0,0 +1,4 @@
+[ -n "$d" ] || d=..
+tail -n 2 "$d/README" > logfile.gnu
+busybox tail -n 2 "$d/README" > logfile.bb
+cmp logfile.gnu logfile.bb
diff --git a/busybox/testsuite/tar/tar-archives-multiple-files b/busybox/testsuite/tar/tar-archives-multiple-files
new file mode 100644
index 0000000..245d9e9
--- /dev/null
+++ b/busybox/testsuite/tar/tar-archives-multiple-files
@@ -0,0 +1,6 @@
+# FEATURE: CONFIG_FEATURE_TAR_CREATE
+touch foo bar
+busybox tar cf foo.tar foo bar
+rm foo bar
+tar xf foo.tar
+test -f foo -a -f bar
diff --git a/busybox/testsuite/tar/tar-complains-about-missing-file b/busybox/testsuite/tar/tar-complains-about-missing-file
new file mode 100644
index 0000000..26e8cbb
--- /dev/null
+++ b/busybox/testsuite/tar/tar-complains-about-missing-file
@@ -0,0 +1,3 @@
+touch foo
+tar cf foo.tar foo
+! busybox tar xf foo.tar bar
diff --git a/busybox/testsuite/tar/tar-demands-at-least-one-ctx b/busybox/testsuite/tar/tar-demands-at-least-one-ctx
new file mode 100644
index 0000000..85e7f60
--- /dev/null
+++ b/busybox/testsuite/tar/tar-demands-at-least-one-ctx
@@ -0,0 +1 @@
+! busybox tar v
diff --git a/busybox/testsuite/tar/tar-demands-at-most-one-ctx b/busybox/testsuite/tar/tar-demands-at-most-one-ctx
new file mode 100644
index 0000000..130d0e7
--- /dev/null
+++ b/busybox/testsuite/tar/tar-demands-at-most-one-ctx
@@ -0,0 +1 @@
+! busybox tar tx
diff --git a/busybox/testsuite/tar/tar-extracts-file b/busybox/testsuite/tar/tar-extracts-file
new file mode 100644
index 0000000..ca72f24
--- /dev/null
+++ b/busybox/testsuite/tar/tar-extracts-file
@@ -0,0 +1,5 @@
+touch foo
+tar cf foo.tar foo
+rm foo
+busybox tar xf foo.tar
+test -f foo
diff --git a/busybox/testsuite/tar/tar-extracts-from-standard-input b/busybox/testsuite/tar/tar-extracts-from-standard-input
new file mode 100644
index 0000000..a30e9f0
--- /dev/null
+++ b/busybox/testsuite/tar/tar-extracts-from-standard-input
@@ -0,0 +1,5 @@
+touch foo
+tar cf foo.tar foo
+rm foo
+cat foo.tar | busybox tar x
+test -f foo
diff --git a/busybox/testsuite/tar/tar-extracts-multiple-files b/busybox/testsuite/tar/tar-extracts-multiple-files
new file mode 100644
index 0000000..8ae8cdd
--- /dev/null
+++ b/busybox/testsuite/tar/tar-extracts-multiple-files
@@ -0,0 +1,6 @@
+touch foo bar
+busybox tar cf foo.tar foo bar
+rm foo bar
+busybox tar -xf foo.tar
+test -f foo
+test -f bar
diff --git a/busybox/testsuite/tar/tar-extracts-to-standard-output b/busybox/testsuite/tar/tar-extracts-to-standard-output
new file mode 100644
index 0000000..ca48e36
--- /dev/null
+++ b/busybox/testsuite/tar/tar-extracts-to-standard-output
@@ -0,0 +1,3 @@
+echo foo > foo
+tar cf foo.tar foo
+cat foo.tar | busybox tar Ox | cmp foo -
diff --git a/busybox/testsuite/tar/tar-handles-cz-options b/busybox/testsuite/tar/tar-handles-cz-options
new file mode 100644
index 0000000..5b55e46
--- /dev/null
+++ b/busybox/testsuite/tar/tar-handles-cz-options
@@ -0,0 +1,5 @@
+# FEATURE: CONFIG_FEATURE_TAR_CREATE
+# FEATURE: CONFIG_FEATURE_TAR_GZIP
+touch foo
+busybox tar czf foo.tar.gz foo
+gzip -d foo.tar.gz
diff --git a/busybox/testsuite/tar/tar-handles-empty-include-and-non-empty-exclude-list b/busybox/testsuite/tar/tar-handles-empty-include-and-non-empty-exclude-list
new file mode 100644
index 0000000..5033642
--- /dev/null
+++ b/busybox/testsuite/tar/tar-handles-empty-include-and-non-empty-exclude-list
@@ -0,0 +1,6 @@
+# FEATURE: CONFIG_FEATURE_TAR_FROM
+# FEATURE: CONFIG_FEATURE_TAR_CREATE
+touch foo
+tar cf foo.tar foo
+echo foo >foo.exclude
+busybox tar xf foo.tar -X foo.exclude
diff --git a/busybox/testsuite/tar/tar-handles-exclude-and-extract-lists b/busybox/testsuite/tar/tar-handles-exclude-and-extract-lists
new file mode 100644
index 0000000..2de0f0e
--- /dev/null
+++ b/busybox/testsuite/tar/tar-handles-exclude-and-extract-lists
@@ -0,0 +1,8 @@
+# FEATURE: CONFIG_FEATURE_TAR_FROM
+# FEATURE: CONFIG_FEATURE_TAR_CREATE
+touch foo bar baz
+tar cf foo.tar foo bar baz
+echo foo >foo.exclude
+rm foo bar baz
+busybox tar xf foo.tar foo bar -X foo.exclude
+test ! -f foo -a -f bar -a ! -f baz
diff --git a/busybox/testsuite/tar/tar-handles-multiple-X-options b/busybox/testsuite/tar/tar-handles-multiple-X-options
new file mode 100644
index 0000000..155b27e
--- /dev/null
+++ b/busybox/testsuite/tar/tar-handles-multiple-X-options
@@ -0,0 +1,10 @@
+# FEATURE: CONFIG_FEATURE_TAR_FROM
+# FEATURE: CONFIG_FEATURE_TAR_CREATE
+touch foo
+touch bar
+tar cf foo.tar foo bar
+echo foo > foo.exclude
+echo bar > bar.exclude
+rm foo bar
+busybox tar xf foo.tar -X foo.exclude -X bar.exclude
+test ! -f foo -a ! -f bar
diff --git a/busybox/testsuite/tar/tar-handles-nested-exclude b/busybox/testsuite/tar/tar-handles-nested-exclude
new file mode 100644
index 0000000..39013a1
--- /dev/null
+++ b/busybox/testsuite/tar/tar-handles-nested-exclude
@@ -0,0 +1,9 @@
+# FEATURE: CONFIG_FEATURE_TAR_FROM
+# FEATURE: CONFIG_FEATURE_TAR_CREATE
+mkdir foo
+touch foo/bar
+tar cf foo.tar foo
+rm -rf foo
+echo foo/bar >foobar.exclude
+busybox tar xf foo.tar foo -X foobar.exclude
+test -d foo -a ! -f foo/bar
diff --git a/busybox/testsuite/tee/tee-appends-input b/busybox/testsuite/tee/tee-appends-input
new file mode 100644
index 0000000..cff20bf
--- /dev/null
+++ b/busybox/testsuite/tee/tee-appends-input
@@ -0,0 +1,5 @@
+echo i\'m a little teapot >foo
+cp foo bar
+echo i\'m a little teapot >>foo
+echo i\'m a little teapot | busybox tee -a bar >/dev/null
+cmp foo bar
diff --git a/busybox/testsuite/tee/tee-tees-input b/busybox/testsuite/tee/tee-tees-input
new file mode 100644
index 0000000..26e2173
--- /dev/null
+++ b/busybox/testsuite/tee/tee-tees-input
@@ -0,0 +1,3 @@
+echo i\'m a little teapot >foo
+echo i\'m a little teapot | busybox tee bar >baz
+cmp foo bar && cmp foo baz
diff --git a/busybox/testsuite/touch/touch-creates-file b/busybox/testsuite/touch/touch-creates-file
new file mode 100644
index 0000000..4b49354
--- /dev/null
+++ b/busybox/testsuite/touch/touch-creates-file
@@ -0,0 +1,2 @@
+busybox touch foo
+test -f foo
diff --git a/busybox/testsuite/touch/touch-does-not-create-file b/busybox/testsuite/touch/touch-does-not-create-file
new file mode 100644
index 0000000..8852592
--- /dev/null
+++ b/busybox/testsuite/touch/touch-does-not-create-file
@@ -0,0 +1,2 @@
+busybox touch -c foo
+test ! -f foo
diff --git a/busybox/testsuite/touch/touch-touches-files-after-non-existent-file b/busybox/testsuite/touch/touch-touches-files-after-non-existent-file
new file mode 100644
index 0000000..a869ec2
--- /dev/null
+++ b/busybox/testsuite/touch/touch-touches-files-after-non-existent-file
@@ -0,0 +1,3 @@
+touch -t 198001010000 bar
+busybox touch -c foo bar
+test x"`find bar -mtime -1`" = xbar
diff --git a/busybox/testsuite/tr/tr-d-works b/busybox/testsuite/tr/tr-d-works
new file mode 100644
index 0000000..d939e8b
--- /dev/null
+++ b/busybox/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/busybox/testsuite/tr/tr-non-gnu b/busybox/testsuite/tr/tr-non-gnu
new file mode 100644
index 0000000..ffa6951
--- /dev/null
+++ b/busybox/testsuite/tr/tr-non-gnu
@@ -0,0 +1 @@
+echo fdhrnzvfu bffvsentr | busybox tr '[a-z]' '[n-z][a-m]'
diff --git a/busybox/testsuite/tr/tr-works b/busybox/testsuite/tr/tr-works
new file mode 100644
index 0000000..8753a3f
--- /dev/null
+++ b/busybox/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/busybox/testsuite/true/true-is-silent b/busybox/testsuite/true/true-is-silent
new file mode 100644
index 0000000..1d1bdb2
--- /dev/null
+++ b/busybox/testsuite/true/true-is-silent
@@ -0,0 +1 @@
+busybox true 2>&1 | cmp - /dev/null
diff --git a/busybox/testsuite/true/true-returns-success b/busybox/testsuite/true/true-returns-success
new file mode 100644
index 0000000..cdf2d55
--- /dev/null
+++ b/busybox/testsuite/true/true-returns-success
@@ -0,0 +1 @@
+busybox true
diff --git a/busybox/testsuite/uptime/uptime-works b/busybox/testsuite/uptime/uptime-works
new file mode 100644
index 0000000..80e5787
--- /dev/null
+++ b/busybox/testsuite/uptime/uptime-works
@@ -0,0 +1,2 @@
+busybox uptime
+
diff --git a/busybox/testsuite/uuencode/uuencode-sets-standard-input-mode-correctly b/busybox/testsuite/uuencode/uuencode-sets-standard-input-mode-correctly
new file mode 100644
index 0000000..1a48a66
--- /dev/null
+++ b/busybox/testsuite/uuencode/uuencode-sets-standard-input-mode-correctly
@@ -0,0 +1,4 @@
+saved_umask=$(umask)
+umask 0
+busybox uuencode foo </dev/null | head -n 1 | grep -q 666
+umask $saved_umask
diff --git a/busybox/testsuite/wc/wc-counts-all b/busybox/testsuite/wc/wc-counts-all
new file mode 100644
index 0000000..5e2cb6e
--- /dev/null
+++ b/busybox/testsuite/wc/wc-counts-all
@@ -0,0 +1 @@
+test "`echo i\'m a little teapot | busybox wc`" = ' 1 4 20'
diff --git a/busybox/testsuite/wc/wc-counts-characters b/busybox/testsuite/wc/wc-counts-characters
new file mode 100644
index 0000000..7558646
--- /dev/null
+++ b/busybox/testsuite/wc/wc-counts-characters
@@ -0,0 +1 @@
+test `echo i\'m a little teapot | busybox wc -c` -eq 20
diff --git a/busybox/testsuite/wc/wc-counts-lines b/busybox/testsuite/wc/wc-counts-lines
new file mode 100644
index 0000000..5be6ed0
--- /dev/null
+++ b/busybox/testsuite/wc/wc-counts-lines
@@ -0,0 +1 @@
+test `echo i\'m a little teapot | busybox wc -l` -eq 1
diff --git a/busybox/testsuite/wc/wc-counts-words b/busybox/testsuite/wc/wc-counts-words
new file mode 100644
index 0000000..331650e
--- /dev/null
+++ b/busybox/testsuite/wc/wc-counts-words
@@ -0,0 +1 @@
+test `echo i\'m a little teapot | busybox wc -w` -eq 4
diff --git a/busybox/testsuite/wc/wc-prints-longest-line-length b/busybox/testsuite/wc/wc-prints-longest-line-length
new file mode 100644
index 0000000..78831fc
--- /dev/null
+++ b/busybox/testsuite/wc/wc-prints-longest-line-length
@@ -0,0 +1 @@
+test `echo i\'m a little teapot | busybox wc -L` -eq 19
diff --git a/busybox/testsuite/wget/wget--O-overrides--P b/busybox/testsuite/wget/wget--O-overrides--P
new file mode 100644
index 0000000..fdb5d47
--- /dev/null
+++ b/busybox/testsuite/wget/wget--O-overrides--P
@@ -0,0 +1,3 @@
+mkdir foo
+busybox wget -q -O index.html -P foo http://www.google.com/
+test -s index.html
diff --git a/busybox/testsuite/wget/wget-handles-empty-path b/busybox/testsuite/wget/wget-handles-empty-path
new file mode 100644
index 0000000..5b59183
--- /dev/null
+++ b/busybox/testsuite/wget/wget-handles-empty-path
@@ -0,0 +1 @@
+busybox wget http://www.google.com
diff --git a/busybox/testsuite/wget/wget-retrieves-google-index b/busybox/testsuite/wget/wget-retrieves-google-index
new file mode 100644
index 0000000..7be9a80
--- /dev/null
+++ b/busybox/testsuite/wget/wget-retrieves-google-index
@@ -0,0 +1,2 @@
+busybox wget -q -O foo http://www.google.com/
+test -s foo
diff --git a/busybox/testsuite/wget/wget-supports--P b/busybox/testsuite/wget/wget-supports--P
new file mode 100644
index 0000000..9b4d095
--- /dev/null
+++ b/busybox/testsuite/wget/wget-supports--P
@@ -0,0 +1,3 @@
+mkdir foo
+busybox wget -q -P foo http://www.google.com/
+test -s foo/index.html
diff --git a/busybox/testsuite/which/which-uses-default-path b/busybox/testsuite/which/which-uses-default-path
new file mode 100644
index 0000000..63ceb9f
--- /dev/null
+++ b/busybox/testsuite/which/which-uses-default-path
@@ -0,0 +1,4 @@
+BUSYBOX=$(type -p busybox)
+SAVED_PATH=$PATH
+unset PATH
+$BUSYBOX which ls
diff --git a/busybox/testsuite/xargs/xargs-works b/busybox/testsuite/xargs/xargs-works
new file mode 100644
index 0000000..c95869e
--- /dev/null
+++ b/busybox/testsuite/xargs/xargs-works
@@ -0,0 +1,4 @@
+[ -n "$d" ] || d=..
+find "$d" -name \*works -type f | xargs md5sum > logfile.gnu
+find "$d" -name \*works -type f | busybox xargs md5sum > logfile.bb
+diff -u logfile.gnu logfile.bb