aboutsummaryrefslogtreecommitdiff
path: root/testsuite
diff options
context:
space:
mode:
authorBjørn Mork <bjorn@mork.no>2015-05-15 10:20:47 +0200
committerBjørn Mork <bjorn@mork.no>2015-05-15 10:20:47 +0200
commit73b16af8feec390afbabd9356d6e5e83c0390838 (patch)
tree3730020ba2f9caeb9d7815a975af51830b51ce11 /testsuite
busybox: imported from http://www.busybox.net/downloads/busybox-1.13.3.tar.bz2busybox-1.13.3
Signed-off-by: Bjørn Mork <bjorn@mork.no>
Diffstat (limited to 'testsuite')
-rw-r--r--testsuite/README33
-rw-r--r--testsuite/TODO26
-rwxr-xr-xtestsuite/all_sourcecode.tests92
-rwxr-xr-xtestsuite/awk.tests32
-rw-r--r--testsuite/awk_t1.tar.bz2bin0 -> 15955 bytes
-rw-r--r--testsuite/basename/basename-does-not-remove-identical-extension1
-rw-r--r--testsuite/basename/basename-works2
-rwxr-xr-xtestsuite/bunzip2.tests524
-rw-r--r--testsuite/bunzip2/bunzip2-reads-from-standard-input2
-rw-r--r--testsuite/bunzip2/bunzip2-removes-compressed-file3
-rw-r--r--testsuite/bunzip2/bzcat-does-not-remove-compressed-file3
-rwxr-xr-xtestsuite/busybox.tests46
-rwxr-xr-xtestsuite/bzcat.tests49
-rw-r--r--testsuite/cat/cat-prints-a-file3
-rw-r--r--testsuite/cat/cat-prints-a-file-and-standard-input7
-rw-r--r--testsuite/cmp/cmp-detects-difference9
-rwxr-xr-xtestsuite/comm.tests19
-rw-r--r--testsuite/cp/cp-RHL-does_not_preserve-links6
-rw-r--r--testsuite/cp/cp-a-files-to-dir15
-rw-r--r--testsuite/cp/cp-a-preserves-links5
-rw-r--r--testsuite/cp/cp-copies-empty-file3
-rw-r--r--testsuite/cp/cp-copies-large-file3
-rw-r--r--testsuite/cp/cp-copies-small-file3
-rw-r--r--testsuite/cp/cp-d-files-to-dir11
-rw-r--r--testsuite/cp/cp-dev-file2
-rw-r--r--testsuite/cp/cp-dir-create-dir4
-rw-r--r--testsuite/cp/cp-dir-existing-dir5
-rw-r--r--testsuite/cp/cp-does-not-copy-unreadable-file11
-rw-r--r--testsuite/cp/cp-files-to-dir11
-rw-r--r--testsuite/cp/cp-follows-links4
-rw-r--r--testsuite/cp/cp-preserves-hard-links6
-rw-r--r--testsuite/cp/cp-preserves-links5
-rw-r--r--testsuite/cp/cp-preserves-source-file3
-rwxr-xr-xtestsuite/cpio.tests83
-rwxr-xr-xtestsuite/cut.tests18
-rw-r--r--testsuite/cut/cut-cuts-a-character1
-rw-r--r--testsuite/cut/cut-cuts-a-closed-range1
-rw-r--r--testsuite/cut/cut-cuts-a-field1
-rw-r--r--testsuite/cut/cut-cuts-an-open-range1
-rw-r--r--testsuite/cut/cut-cuts-an-unclosed-range1
-rw-r--r--testsuite/date/date-R-works1
-rw-r--r--testsuite/date/date-format-works4
-rw-r--r--testsuite/date/date-u-works1
-rw-r--r--testsuite/date/date-works44
-rw-r--r--testsuite/date/date-works-1129
-rw-r--r--testsuite/dd/dd-accepts-if2
-rw-r--r--testsuite/dd/dd-accepts-of2
-rw-r--r--testsuite/dd/dd-copies-from-standard-input-to-standard-output1
-rw-r--r--testsuite/dd/dd-prints-count-to-standard-error2
-rw-r--r--testsuite/dd/dd-reports-write-errors2
-rwxr-xr-xtestsuite/diff.tests124
-rw-r--r--testsuite/dirname/dirname-handles-absolute-path1
-rw-r--r--testsuite/dirname/dirname-handles-empty-path1
-rw-r--r--testsuite/dirname/dirname-handles-multiple-slashes1
-rw-r--r--testsuite/dirname/dirname-handles-relative-path1
-rw-r--r--testsuite/dirname/dirname-handles-root1
-rw-r--r--testsuite/dirname/dirname-handles-single-component1
-rw-r--r--testsuite/dirname/dirname-works2
-rw-r--r--testsuite/du/du-h-works4
-rw-r--r--testsuite/du/du-k-works4
-rw-r--r--testsuite/du/du-l-works4
-rw-r--r--testsuite/du/du-m-works4
-rw-r--r--testsuite/du/du-s-works4
-rw-r--r--testsuite/du/du-works4
-rw-r--r--testsuite/echo/echo-does-not-print-newline1
-rw-r--r--testsuite/echo/echo-prints-argument1
-rw-r--r--testsuite/echo/echo-prints-arguments1
-rw-r--r--testsuite/echo/echo-prints-newline1
-rw-r--r--testsuite/echo/echo-prints-slash-zero1
-rw-r--r--testsuite/expand/expand-works-like-GNU18
-rw-r--r--testsuite/expr/expr-big16
-rw-r--r--testsuite/expr/expr-works59
-rw-r--r--testsuite/false/false-is-silent1
-rw-r--r--testsuite/false/false-returns-failure1
-rw-r--r--testsuite/find/find-supports-minus-xdev1
-rwxr-xr-xtestsuite/grep.tests88
-rwxr-xr-xtestsuite/gunzip.tests3
-rw-r--r--testsuite/gunzip/gunzip-reads-from-standard-input2
-rw-r--r--testsuite/gzip/gzip-accepts-multiple-files3
-rw-r--r--testsuite/gzip/gzip-accepts-single-minus1
-rw-r--r--testsuite/gzip/gzip-removes-original-file3
-rw-r--r--testsuite/head/head-n-works4
-rw-r--r--testsuite/head/head-works4
-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-works4
-rw-r--r--testsuite/ls/ls-h-works4
-rw-r--r--testsuite/ls/ls-l-works4
-rw-r--r--testsuite/ls/ls-s-works4
-rw-r--r--testsuite/makedevs.device_table.txt172
-rwxr-xr-xtestsuite/makedevs.tests139
-rw-r--r--testsuite/md5sum/md5sum-verifies-non-binary-file3
-rwxr-xr-xtestsuite/mdev.tests143
-rw-r--r--testsuite/mkdir/mkdir-makes-a-directory2
-rw-r--r--testsuite/mkdir/mkdir-makes-parent-directories2
-rwxr-xr-xtestsuite/mkfs.minix.tests22
-rwxr-xr-xtestsuite/mount.testroot183
-rwxr-xr-xtestsuite/mount.tests35
-rw-r--r--testsuite/msh/msh-supports-underscores-in-variable-names1
-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-file3
-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
-rwxr-xr-xtestsuite/od.tests17
-rwxr-xr-xtestsuite/parse.tests109
-rwxr-xr-xtestsuite/patch.tests65
-rwxr-xr-xtestsuite/pidof.tests31
-rwxr-xr-xtestsuite/printf.tests108
-rw-r--r--testsuite/pwd/pwd-prints-working-directory1
-rwxr-xr-xtestsuite/readlink.tests32
-rw-r--r--testsuite/rm/rm-removes-file3
-rw-r--r--testsuite/rmdir/rmdir-removes-parent-directories3
-rwxr-xr-xtestsuite/runtest164
-rwxr-xr-xtestsuite/sed.tests210
-rwxr-xr-xtestsuite/seq.tests36
-rwxr-xr-xtestsuite/sort.tests119
-rwxr-xr-xtestsuite/start-stop-daemon.tests19
-rw-r--r--testsuite/strings/strings-works-like-GNU9
-rwxr-xr-xtestsuite/sum.tests24
-rw-r--r--testsuite/tail/tail-n-works4
-rw-r--r--testsuite/tail/tail-works4
-rw-r--r--testsuite/tar/tar-archives-multiple-files6
-rw-r--r--testsuite/tar/tar-complains-about-missing-file3
-rw-r--r--testsuite/tar/tar-demands-at-least-one-ctx1
-rw-r--r--testsuite/tar/tar-demands-at-most-one-ctx1
-rw-r--r--testsuite/tar/tar-extracts-all-subdirs12
-rw-r--r--testsuite/tar/tar-extracts-file5
-rw-r--r--testsuite/tar/tar-extracts-from-standard-input5
-rw-r--r--testsuite/tar/tar-extracts-multiple-files6
-rw-r--r--testsuite/tar/tar-extracts-to-standard-output3
-rw-r--r--testsuite/tar/tar-handles-cz-options5
-rw-r--r--testsuite/tar/tar-handles-empty-include-and-non-empty-exclude-list6
-rw-r--r--testsuite/tar/tar-handles-exclude-and-extract-lists8
-rw-r--r--testsuite/tar/tar-handles-multiple-X-options10
-rw-r--r--testsuite/tar/tar-handles-nested-exclude9
-rw-r--r--testsuite/tar/tar_with_link_with_size29
-rw-r--r--testsuite/tar/tar_with_prefix_fields261
-rwxr-xr-xtestsuite/taskset.tests17
-rw-r--r--testsuite/tee/tee-appends-input5
-rw-r--r--testsuite/tee/tee-tees-input3
-rwxr-xr-xtestsuite/test.tests69
-rwxr-xr-xtestsuite/testing.sh154
-rw-r--r--testsuite/touch/touch-creates-file2
-rw-r--r--testsuite/touch/touch-does-not-create-file2
-rw-r--r--testsuite/touch/touch-touches-files-after-non-existent-file3
-rw-r--r--testsuite/tr/tr-d-alnum-works4
-rw-r--r--testsuite/tr/tr-d-works4
-rw-r--r--testsuite/tr/tr-non-gnu1
-rw-r--r--testsuite/tr/tr-rejects-wrong-class19
-rw-r--r--testsuite/tr/tr-works26
-rw-r--r--testsuite/true/true-is-silent1
-rw-r--r--testsuite/true/true-returns-success1
-rwxr-xr-xtestsuite/umlwrapper.sh20
-rw-r--r--testsuite/unexpand/unexpand-works-like-GNU52
-rwxr-xr-xtestsuite/uniq.tests87
-rwxr-xr-xtestsuite/unzip.tests38
-rw-r--r--testsuite/uptime/uptime-works2
-rwxr-xr-xtestsuite/uuencode.tests28
-rw-r--r--testsuite/wc/wc-counts-all2
-rw-r--r--testsuite/wc/wc-counts-characters1
-rw-r--r--testsuite/wc/wc-counts-lines1
-rw-r--r--testsuite/wc/wc-counts-words1
-rw-r--r--testsuite/wc/wc-prints-longest-line-length1
-rw-r--r--testsuite/wget/wget--O-overrides--P3
-rw-r--r--testsuite/wget/wget-handles-empty-path1
-rw-r--r--testsuite/wget/wget-retrieves-google-index2
-rw-r--r--testsuite/wget/wget-supports--P3
-rw-r--r--testsuite/which/which-uses-default-path4
-rwxr-xr-xtestsuite/xargs.tests29
-rw-r--r--testsuite/xargs/xargs-works4
192 files changed, 4378 insertions, 0 deletions
diff --git a/testsuite/README b/testsuite/README
new file mode 100644
index 0000000..b4719e6
--- /dev/null
+++ b/testsuite/README
@@ -0,0 +1,33 @@
+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:
+
+./runtest <applet1> <applet2>...
+
+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/testsuite/TODO b/testsuite/TODO
new file mode 100644
index 0000000..b8957f4
--- /dev/null
+++ b/testsuite/TODO
@@ -0,0 +1,26 @@
+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:
+
+Moving to the new format.
+ The old way was "lots of little tests files in a directory", which
+ doesn't interact well with source control systems. The new test
+ format is command.tests files that use testing.sh.
+
+Every busybox applet needs a corresponding applet.tests.
+
+Full SUSv3 test suite.
+ Let's make the Linux Test Project jealous, shall we? Don't just
+ audit programs for standards compliance, _prove_ it with a regression
+ test harness.
+
+ http://www.opengroup.org/onlinepubs/009695399/utilities/
+
+Some tests need root access.
+ It's hard to test things like mount or init as a normal user.
+ Possibly User Mode Linux could be used for this, or perhaps
+ Erik's buildroot.
+
+libbb unit testing
+ Being able to test the functions of libbb individually may
+ help to prevent regressions.
diff --git a/testsuite/all_sourcecode.tests b/testsuite/all_sourcecode.tests
new file mode 100755
index 0000000..45f4011
--- /dev/null
+++ b/testsuite/all_sourcecode.tests
@@ -0,0 +1,92 @@
+#!/bin/sh
+
+# Tests for the sourcecode base itself.
+# Copyright 2006 by Mike Frysinger <vapier@gentoo.org>
+# Licensed under GPL v2, see file LICENSE for details.
+
+[ -n "$srcdir" ] || srcdir=$(pwd)
+. testing.sh
+
+
+#
+# if we don't have the sourcecode available, let's just bail
+#
+[ -s "$srcdir/../Makefile" ] || exit 0
+[ -s "$srcdir/../include/applets.h" ] || exit 0
+
+
+#
+# make sure all usage strings are properly escaped. oftentimes people miss
+# an escape sequence so we end up with:
+# #define foo_usage \
+# " this line is ok" \
+# " as is this line"
+# " but this one is broken as the \ is missing from above"
+#
+${CROSS_COMPILE}cpp -dD -P $srcdir/../include/usage.h \
+ | sed -e '/^#define/d' -e '/^$/d' > src.usage.escaped
+testing "Usage strings escaped" "cat src.usage.escaped" "" "" ""
+rm -f src.usage.escaped
+
+
+#
+# verify the applet order is correct in applets.h, otherwise
+# applets won't be called properly.
+#
+sed -n -e '/^USE_[A-Z]*(APPLET/{s:,.*::;s:.*(::;s:"::g;p}' \
+ $srcdir/../include/applets.h > applet.order.current
+LC_ALL=C sort applet.order.current > applet.order.correct
+testing "Applet order" "diff -u applet.order.current applet.order.correct" "" "" ""
+rm -f applet.order.current applet.order.correct
+
+
+#
+# check for misc common typos
+#
+find $srcdir/../ \
+ '(' -type d -a '(' -name .svn -o -name testsuite ')' -prune ')' \
+ -o '(' -type f -a -print0 ')' | xargs -0 \
+ grep -I \
+ -e '\<compatability\>' \
+ -e '\<compatable\>' \
+ -e '\<fordeground\>' \
+ -e '\<depency\>' -e '\<dependancy\>' -e '\<dependancies\>' \
+ -e '\<defalt\>' \
+ -e '\<remaing\>' \
+ -e '\<queueing\>' \
+ -e '\<detatch\>' \
+ -e '\<sempahore\>' \
+ -e '\<reprenstative\>' \
+ -e '\<overriden\>' \
+ -e '\<readed\>' \
+ -e '\<formated\>' \
+ -e '\<algorithic\>' \
+ -e '\<deamon\>' \
+ -e '\<derefernce\>' \
+ -e '\<acomadate\>' \
+ | sed -e "s:^$srcdir/\.\./::g" > src.typos
+testing "Common typos" "cat src.typos" "" "" ""
+rm -f src.typos
+
+
+#
+# don't allow obsolete functions
+#
+find $srcdir/.. '(' -name '*.c' -o -name '*.h' ')' -print0 | xargs -0 \
+ grep -E -e '\<(bcmp|bcopy|bzero|getwd|index|mktemp|rindex|utimes|sigblock|siggetmask|sigsetmask)\>[[:space:]]*\(' \
+ | sed -e "s:^$srcdir/\.\./::g" > src.obsolete.funcs
+testing "Obsolete function usage" "cat src.obsolete.funcs" "" "" ""
+rm -f src.obsolete.funcs
+
+
+#
+# don't allow obsolete headers
+#
+find $srcdir/.. '(' -name '*.c' -o -name '*.h' ')' -print0 | xargs -0 \
+ grep -E -e '\<(malloc|memory|sys/(errno|fcntl|signal|stropts|termios|unistd))\.h\>' \
+ | sed -e "s:^$srcdir/\.\./::g" > src.obsolete.headers
+testing "Obsolete headers" "cat src.obsolete.headers" "" "" ""
+rm -f src.obsolete.headers
+
+
+exit $FAILCOUNT
diff --git a/testsuite/awk.tests b/testsuite/awk.tests
new file mode 100755
index 0000000..aa38636
--- /dev/null
+++ b/testsuite/awk.tests
@@ -0,0 +1,32 @@
+#!/bin/sh
+
+# Copyright 2007 by Denys Vlasenko <vda.linux@googlemail.com>
+# Licensed under GPL v2, see file LICENSE for details.
+
+. testing.sh
+
+# testing "description" "command" "result" "infile" "stdin"
+
+testing "awk -F case 0" "awk -F '[#]' '{ print NF }'" "" "" ""
+testing "awk -F case 1" "awk -F '[#]' '{ print NF }'" "0\n" "" "\n"
+testing "awk -F case 2" "awk -F '[#]' '{ print NF }'" "2\n" "" "#\n"
+testing "awk -F case 3" "awk -F '[#]' '{ print NF }'" "3\n" "" "#abc#\n"
+testing "awk -F case 4" "awk -F '[#]' '{ print NF }'" "3\n" "" "#abc#zz\n"
+testing "awk -F case 5" "awk -F '[#]' '{ print NF }'" "4\n" "" "#abc##zz\n"
+testing "awk -F case 6" "awk -F '[#]' '{ print NF }'" "4\n" "" "z#abc##zz\n"
+testing "awk -F case 7" "awk -F '[#]' '{ print NF }'" "5\n" "" "z##abc##zz\n"
+
+# 4294967295 = 0xffffffff
+testing "awk bitwise op" "awk '{ print or(4294967295,1) }'" "4.29497e+09\n" "" "\n"
+testing "awk hex const 1" "awk '{ print or(0xffffffff,1) }'" "4.29497e+09\n" "" "\n"
+testing "awk hex const 2" "awk '{ print or(0x80000000,1) }'" "2.14748e+09\n" "" "\n"
+testing "awk oct const" "awk '{ print or(01234,1) }'" "669\n" "" "\n"
+
+tar xjf awk_t1.tar.bz2
+testing "awk 'gcc build bug'" \
+ "awk -f awk_t1_opt-functions.awk -f awk_t1_opth-gen.awk <awk_t1_input | md5sum" \
+ "f842e256461a5ab1ec60b58d16f1114f -\n" \
+ "" ""
+rm -rf awk_t1_*
+
+exit $FAILCOUNT
diff --git a/testsuite/awk_t1.tar.bz2 b/testsuite/awk_t1.tar.bz2
new file mode 100644
index 0000000..0fb8a07
--- /dev/null
+++ b/testsuite/awk_t1.tar.bz2
Binary files differ
diff --git a/testsuite/basename/basename-does-not-remove-identical-extension b/testsuite/basename/basename-does-not-remove-identical-extension
new file mode 100644
index 0000000..4448fde
--- /dev/null
+++ b/testsuite/basename/basename-does-not-remove-identical-extension
@@ -0,0 +1 @@
+test xfoo = x`busybox basename foo foo`
diff --git a/testsuite/basename/basename-works b/testsuite/basename/basename-works
new file mode 100644
index 0000000..38907d4
--- /dev/null
+++ b/testsuite/basename/basename-works
@@ -0,0 +1,2 @@
+test x$(basename $(pwd)) = x$(busybox basename $(pwd))
+
diff --git a/testsuite/bunzip2.tests b/testsuite/bunzip2.tests
new file mode 100755
index 0000000..3105ba4
--- /dev/null
+++ b/testsuite/bunzip2.tests
@@ -0,0 +1,524 @@
+#!/bin/sh
+# Used by both gunzip and bunzip2 tests
+
+if test "${0##*/}" = "gunzip.tests"; then
+ unpack=gunzip
+ ext=gz
+elif test "${0##*/}" = "bunzip2.tests"; then
+ unpack=bunzip2
+ ext=bz2
+else
+ echo "WTF? argv0='$0'"
+ exit 1
+fi
+
+bb="busybox "
+
+unset LC_ALL
+unset LC_MESSAGES
+unset LANG
+unset LANGUAGE
+
+hello_gz() {
+# Gzipped "HELLO\n"
+#_________________________ vvv vvv vvv vvv - mtime
+$ECHO -ne "\x1f\x8b\x08\x00\x85\x1d\xef\x45\x02\x03\xf3\x70\xf5\xf1\xf1\xe7"
+$ECHO -ne "\x02\x00\x6e\xd7\xac\xfd\x06\x00\x00\x00"
+}
+
+hello_bz2() {
+# Bzipped "HELLO\n"
+$ECHO -ne "\x42\x5a\x68\x39\x31\x41\x59\x26\x53\x59\x5b\xb8\xe8\xa3\x00\x00"
+$ECHO -ne "\x01\x44\x00\x00\x10\x02\x44\xa0\x00\x30\xcd\x00\xc3\x46\x29\x97"
+$ECHO -ne "\x17\x72\x45\x38\x50\x90\x5b\xb8\xe8\xa3"
+}
+
+# We had bunzip2 error on this .bz2 file (fixed in rev 22521)
+test1_bz2()
+{
+$ECHO -ne "\x42\x5a\x68\x39\x31\x41\x59\x26\x53\x59\xbf\x4b\x95\xe7\x00\x15"
+$ECHO -ne "\xa1\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff"
+$ECHO -ne "\xff\xff\xff\xff\xff\xff\xff\xff\xff\xef\xff\xff\xfb\xff\xff\xff"
+$ECHO -ne "\xff\xff\xff\xe0\x16\xe6\x37\xb7\x77\xb0\xfb\x22\xb5\x81\x40\xf5"
+$ECHO -ne "\xa7\x69\xa4\x47\xab\x61\x4d\x6a\x3d\xef\x75\x7b\x22\xaf\x71\x9b"
+$ECHO -ne "\xb3\x5a\x93\xbb\x78\x00\x79\xbd\xc0\x07\xae\x1b\xdb\xc5\xc6\x6b"
+$ECHO -ne "\x7a\x7b\xd3\xd7\x38\xbb\x70\x5e\xf0\xd1\x08\x9a\x64\x26\x53\x68"
+$ECHO -ne "\x03\x53\x4d\x32\x30\xd2\x61\x31\x13\x68\xd1\xa6\x4c\x41\x89\x84"
+$ECHO -ne "\x31\x4f\x40\xd2\x79\x14\xf0\xa3\xda\x1a\x00\x65\x4f\x53\xd9\x28"
+$ECHO -ne "\xd3\xf4\x4c\x13\x26\x4c\x4c\x64\x34\x9a\x6a\x7a\x99\x3c\x12\x78"
+$ECHO -ne "\xd2\x68\xd4\xda\x6a\x79\x32\x64\xd1\xa8\x1b\x13\x01\x4f\x29\xea"
+$ECHO -ne "\x6c\xa3\xd2\x07\x94\x06\xa6\x44\x01\x4f\x11\xa3\x4d\x13\x4d\x31"
+$ECHO -ne "\x32\x4c\x98\x0c\x9a\xa6\xda\x29\x3d\xa4\xf1\x24\xfd\x1a\xa3\x7a"
+$ECHO -ne "\x93\xf4\xa7\xb5\x3d\x51\xe2\x47\x94\xf2\x8f\x29\xb2\x9b\x29\xe9"
+$ECHO -ne "\x34\x79\x4f\x46\x9e\x84\x6a\x69\xea\x69\xa7\xa9\xb5\x03\x27\xa8"
+$ECHO -ne "\xf1\x40\x32\x7a\x13\x10\x00\x3d\x41\x90\x00\xd0\x1e\x84\x0d\x1b"
+$ECHO -ne "\x53\x41\xa3\x21\x93\xd0\x83\x53\x10\x99\x34\x24\xf5\x32\x99\x34"
+$ECHO -ne "\xd2\x7a\x86\xca\x6c\x28\xda\x6d\x29\xa6\x4d\x31\x0c\xd4\x7a\x69"
+$ECHO -ne "\x1e\x93\x23\xca\x1e\x93\x4d\x03\x26\x9a\x68\x01\xa0\xc9\xa0\x1a"
+$ECHO -ne "\x00\x34\x00\x00\x69\xa0\xf4\x80\x0d\x00\x00\x34\x06\x86\x80\x34"
+$ECHO -ne "\x00\x00\x00\x34\x00\x48\x88\x84\x53\x68\x4f\x45\x3d\x51\xfa\x4d"
+$ECHO -ne "\x4c\xda\x9a\x8d\xb5\x4c\xd4\xf2\x35\x1b\x51\xb4\xd3\x14\xf5\x0f"
+$ECHO -ne "\x50\xf5\x0f\x24\xd3\x32\x23\xd4\xcd\x21\xa6\xd4\xd0\xd0\x69\xa0"
+$ECHO -ne "\xf4\x8d\x3d\x43\xd3\x51\xea\x6c\x90\xd0\x68\xf4\x40\x00\x07\xa8"
+$ECHO -ne "\x19\x3d\x47\xa8\x1e\xa0\xd0\x34\x00\x0d\x1a\x06\x80\x01\xe9\x00"
+$ECHO -ne "\x64\x20\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
+$ECHO -ne "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
+$ECHO -ne "\x00\x00\x48\x92\x1a\x46\x9a\x02\x9e\x24\xc5\x4f\xc9\x91\x4f\x29"
+$ECHO -ne "\xec\xa9\xea\x34\xd3\xd2\x68\x68\x00\xf4\xd4\xf5\x19\x00\x34\x00"
+$ECHO -ne "\x06\x4d\x00\xd0\x1a\x1a\x03\x20\x01\xa0\x00\xf5\x00\x0d\x06\x9b"
+$ECHO -ne "\x50\x36\xa3\x35\x00\x03\x40\x03\x40\x68\xf5\x34\x00\x00\x00\x71"
+$ECHO -ne "\xe4\x3c\x0c\x0f\x0f\x3d\x23\x9a\x7f\x31\x80\xae\x1a\xe1\x09\x03"
+$ECHO -ne "\x2c\x61\x63\x18\xfc\x1a\x28\x0e\x9a\x85\xc3\x86\x96\x11\x94\x88"
+$ECHO -ne "\x0f\x92\x11\x8a\x1a\xb4\x61\x8c\x38\x30\xf3\xa9\xfb\xbe\xcd\x8d"
+$ECHO -ne "\xc4\xb7\x7a\x52\xad\x92\x9f\xde\xe6\x75\x74\xb7\xbb\x0b\xf5\x4c"
+$ECHO -ne "\x97\xd9\x49\xc8\x63\x9b\xa6\xba\x95\xe8\x46\x70\x11\x71\x55\x67"
+$ECHO -ne "\x17\xe3\xab\x91\x7d\xbe\x0d\x56\x78\x61\x98\x41\x28\x2c\xb5\xa3"
+$ECHO -ne "\xd1\xb8\x76\x80\xc8\xad\x9b\x79\x6f\x8a\x7a\x84\x44\x35\x24\x64"
+$ECHO -ne "\xa0\xde\x18\x80\x11\x14\xcd\xb0\xc6\xe4\x31\x49\x71\x53\xaf\x5d"
+$ECHO -ne "\x20\xc9\x59\xdc\xa2\x53\x06\xf0\x4f\xc8\x09\x21\x92\x6b\xf2\x37"
+$ECHO -ne "\x32\xcb\x75\x91\x75\x41\xc0\xe8\x47\x02\xb3\x8e\x0b\x17\x47\x42"
+$ECHO -ne "\x79\x21\x3c\xec\x6c\xb0\x84\x24\x96\x45\x4a\x8e\xbb\xbe\xc2\xe0"
+$ECHO -ne "\x16\x85\x76\x43\x26\xd5\xd0\x58\xdd\xf7\x83\x65\x44\x8f\xbe\x6c"
+$ECHO -ne "\x72\xe1\x5b\x1a\x0e\x3a\xbb\x51\xcf\xbd\x9b\x3a\xd0\xd5\x39\x5b"
+$ECHO -ne "\x23\x7d\xc9\x0b\x08\x0a\x23\x7b\x3a\x00\x67\xa1\x76\xa5\x19\xab"
+$ECHO -ne "\x48\xbd\x54\xaa\x8f\xaf\xb6\xe8\xd5\x91\x0f\x3e\x4b\x3a\x8d\xc9"
+$ECHO -ne "\x48\x02\xc2\x6b\xfc\xef\x0a\x9b\xf1\x67\xd0\x45\x48\x45\x05\xc0"
+$ECHO -ne "\x07\xc4\x47\x96\x6e\x79\xac\x31\x49\xcf\x1f\xa8\x3b\xdc\x1d\x44"
+$ECHO -ne "\x83\x84\x04\x49\x9f\x25\x01\x4b\x41\x80\x14\x1b\x9d\xaf\xfc\xb5"
+$ECHO -ne "\x46\x22\xca\x96\x4e\xd5\xe3\x08\x7d\xab\x17\x0b\x65\xcd\xa7\xd4"
+$ECHO -ne "\x5e\xd1\x8a\x27\xc8\x60\xe9\x17\xa3\xc9\xb4\x26\xf8\x58\xb2\x4a"
+$ECHO -ne "\x15\x52\x8e\x15\x20\x72\xb2\x0e\x4f\x64\xcb\x2b\xa3\xd9\xf0\xa6"
+$ECHO -ne "\x6f\x0b\x50\xed\x4e\xa4\x28\xe8\xe0\x05\x2d\x15\x26\x2c\x3d\x9f"
+$ECHO -ne "\x87\xc4\xd1\xd3\x69\xe2\x1c\xea\x41\x99\xbd\x43\x59\x9f\x06\x57"
+$ECHO -ne "\x06\xb4\x72\xe7\x45\x2c\xd2\xcf\x5f\x66\xa5\xeb\x58\x6a\xc0\x37"
+$ECHO -ne "\x82\x81\xf6\xdc\x1c\x35\x5b\xc6\xf1\x92\x4e\xe0\xe2\xd2\x12\x82"
+$ECHO -ne "\x92\x97\x14\xe5\xac\x49\x9f\xfd\x16\x46\xc6\xc2\xf1\x48\x86\x05"
+$ECHO -ne "\xe6\x74\xac\x9a\x52\x49\x64\x45\x25\x43\x08\x06\x03\x63\x49\x91"
+$ECHO -ne "\x9a\x92\x96\x5b\xe3\x2f\x11\x51\xcd\xe3\xa3\x9f\x3e\x8f\x9f\xab"
+$ECHO -ne "\x92\xbc\x6d\x36\xa3\xd1\x71\xa4\x4a\xb6\xe1\x49\xb8\xdc\x2c\x90"
+$ECHO -ne "\xb2\xd6\xfb\xa6\xc6\xd9\xa4\x5b\x9b\xe5\xd6\x59\xb3\x76\x37\xeb"
+$ECHO -ne "\xa6\x3e\xf0\x4c\x98\x1d\x73\x04\x01\x06\x8c\x10\x00\x3b\x2b\x04"
+$ECHO -ne "\x55\xf4\xfd\xec\x9d\xad\xc7\x2b\xbd\xe3\xda\x4b\xee\x28\x5d\x7a"
+$ECHO -ne "\xbe\xa6\xb9\xe0\x81\x15\xa6\x09\x26\x52\x60\xcc\x03\x30\x66\x60"
+$ECHO -ne "\xb9\xd0\x79\xfd\xb6\xb3\x85\xac\xd1\xc4\x4c\xbf\x80\x20\x44\x45"
+$ECHO -ne "\x7f\x72\x27\xff\x14\xc2\xc0\x81\x02\xab\x32\x20\x43\x46\x06\x7f"
+$ECHO -ne "\xb7\xc2\xb9\xf6\x39\x7b\x0b\x0c\xcb\xe7\x6e\x03\xe3\x20\x46\x82"
+$ECHO -ne "\x4a\x01\x23\xbb\xb0\x0c\xb5\x6f\xf7\xfb\xfc\xf5\xf2\x3c\x8e\x7e"
+$ECHO -ne "\xcb\x77\x6f\x7e\xc3\x71\x7c\x44\x3f\xbc\x3c\x54\xb8\x40\x27\x78"
+$ECHO -ne "\x63\x4d\x83\x22\x6a\x0a\x00\x0e\x8d\xa5\xfa\x5e\xe5\x89\x55\xa4"
+$ECHO -ne "\x18\x60\xc2\xa6\xd6\x17\x98\x23\xf0\x07\x44\x45\x18\xa4\x68\xd9"
+$ECHO -ne "\xcc\x0d\xe3\x81\x06\x09\x0c\x17\xaf\x52\xad\x85\x83\x5d\x09\x30"
+$ECHO -ne "\x0d\xa9\xb3\xe6\x45\x85\x9e\x26\x47\xab\x7d\x14\xe1\x8a\xb9\xfe"
+$ECHO -ne "\x0a\x0f\x8d\x68\x73\x73\x5c\xa3\x0b\xb5\x29\x0c\xd8\xde\xc2\x30"
+$ECHO -ne "\xbe\x61\xce\xbd\x4d\x3a\x03\xef\xe9\x45\xef\xeb\x07\xe8\x6b\x7d"
+$ECHO -ne "\xd2\xf4\x92\x8f\x91\xa1\x6e\x85\x2b\x73\xaf\x01\x8a\xd2\x0f\x52"
+$ECHO -ne "\xed\x65\x9f\xe6\x15\x47\xb2\x71\xd3\xbc\xee\xde\xff\x10\xfa\x4d"
+$ECHO -ne "\x7f\x9d\x5a\x4b\x13\x4a\x92\xd6\x85\xb2\xef\xe1\xbb\x92\x80\x4a"
+$ECHO -ne "\x45\x70\xa0\x4e\xe6\xf3\x39\x9a\xf6\x55\xee\x80\xc5\xa0\xff\x9d"
+$ECHO -ne "\xb6\x66\xe6\xcc\x81\xb2\xdc\xd6\x39\xb7\x06\x2c\xd6\x3b\x27\x0e"
+$ECHO -ne "\x5d\x01\x92\x5c\xf3\xbe\x3d\x46\x8a\x46\xa4\xd4\x03\x21\x86\x8e"
+$ECHO -ne "\x68\x05\x3b\xf0\x66\x69\x4c\x61\xf0\x39\x1c\x9d\xe2\x74\x3b\x5f"
+$ECHO -ne "\xd7\x87\xdc\xd3\xeb\x59\x50\xb6\x6d\x75\xc9\x5b\xdc\x4d\xb7\x29"
+$ECHO -ne "\x0c\x64\x9c\x5c\x22\xd1\x44\xd7\x01\x68\x0a\x26\x25\x7d\x6a\x76"
+$ECHO -ne "\x1c\x1b\xbf\x7a\xa5\xeb\x42\x8f\x2f\x93\xa3\xc1\xca\xe3\x9f\x46"
+$ECHO -ne "\xfd\x77\x07\x27\x2d\xaf\xbb\x1a\x13\x5b\x86\x94\x00\x90\x86\xc1"
+$ECHO -ne "\x24\x8d\x86\x22\x56\xbe\x06\xe1\xa1\x44\x4c\x36\xe2\x22\x08\x21"
+$ECHO -ne "\xb2\x20\x6d\xb6\xdb\x6c\x6e\x26\x26\x06\xc0\x26\x09\x94\x09\x75"
+$ECHO -ne "\x2c\x10\x4b\x44\xb0\x1b\x44\x26\x11\x58\x10\xdf\x2c\xc1\x55\x8a"
+$ECHO -ne "\xad\xb2\xa3\x08\x67\x34\xe5\x83\x95\x0a\x08\x82\xc1\x8a\x06\xdd"
+$ECHO -ne "\xb1\x32\x14\xa5\x27\x78\xca\xb6\xd1\x57\x5a\xc9\x2a\x06\x05\x29"
+$ECHO -ne "\x0c\x88\x28\xd2\x86\xa5\xa9\x69\x51\x81\x46\xa1\xa4\x81\xb1\x8d"
+$ECHO -ne "\xb1\xb0\x01\x83\x49\x4b\x15\x1a\x6e\x13\x24\x68\x54\x60\x4b\x4e"
+$ECHO -ne "\x21\x39\x82\x1c\x8d\x02\x6d\x23\xc3\x30\x25\x83\x69\x05\x11\x05"
+$ECHO -ne "\x4d\x24\x04\x4e\x0c\x53\x81\x25\xce\x34\x10\xd0\x04\xd4\x98\xa1"
+$ECHO -ne "\x21\x0b\x7e\xc4\x09\x11\x30\x82\x8f\x68\xc4\x13\x48\x0a\x30\x17"
+$ECHO -ne "\x4f\xaf\x80\x52\xd0\x36\x22\xd6\x43\x48\x15\xf6\xa1\x82\x84\xdc"
+$ECHO -ne "\x44\x34\x07\x52\xc4\x2c\x56\xb7\xaf\xa8\x3b\xb1\x08\x4b\x6b\x6c"
+$ECHO -ne "\x24\x05\xce\x1a\x10\xe2\x02\x31\x22\x25\xb8\x23\x65\xd0\x52\x9b"
+$ECHO -ne "\x4a\xcb\x64\xae\xbd\xe8\xda\x30\xb4\x25\x79\xa4\xbc\xe6\xe0\xf3"
+$ECHO -ne "\xde\x82\x23\x84\xce\xe5\xb9\xc9\xe9\xeb\x69\x78\x2f\xbc\x76\x6d"
+$ECHO -ne "\x58\x86\xc4\xa5\x82\xfa\xad\x61\x75\x62\x0c\xb6\x9b\x00\xdf\x30"
+$ECHO -ne "\x4a\xd6\x83\xaa\x60\x8a\x33\x7c\xd2\x12\xf5\x6c\x48\x52\xc5\x85"
+$ECHO -ne "\xe2\x6f\x37\x73\xc7\xbc\xad\xea\x27\x27\xa8\xef\xf7\xef\x59\x17"
+$ECHO -ne "\x65\xb6\xe1\xd8\xdd\xb5\x93\x42\xd0\x29\x5a\x18\x76\x08\xdb\xe5"
+$ECHO -ne "\x38\xf9\xa8\xe4\xa1\xa2\xd4\x40\xa0\xfd\x45\x18\x4b\x3c\xa6\x85"
+$ECHO -ne "\x02\x94\x8c\x88\xa9\x71\x87\x40\x96\x4d\x23\x26\xf4\x17\x44\xb8"
+$ECHO -ne "\x78\x1e\x71\xe3\x3b\xee\xc6\x4b\x87\x88\xfd\x2b\xb5\x8b\x1b\x53"
+$ECHO -ne "\x0b\xab\xd6\x47\x23\xa7\xcf\x78\x3a\x25\xd7\x3c\x77\xb3\x8e\x00"
+$ECHO -ne "\x37\x83\x11\xbb\x68\xf5\xed\x0a\x1a\x4d\xa3\x90\x68\xea\xed\x49"
+$ECHO -ne "\x8d\xb6\x80\x69\x83\x67\xcf\x65\x5a\xec\xda\x12\xe6\x5a\x47\x5a"
+$ECHO -ne "\x3c\x63\x50\x41\x73\x40\x83\xc7\x69\xbc\x46\xa7\xb1\xed\x79\x3c"
+$ECHO -ne "\xfe\xdf\x27\x4b\xbe\xeb\x68\xec\x83\x00\x6b\x7b\x08\x4a\x6e\x0c"
+$ECHO -ne "\x2d\x16\xba\x1a\x96\xa1\x03\xc3\x63\x9e\x7a\xce\x8b\xe2\xae\x51"
+$ECHO -ne "\xfb\x7d\xed\x5d\xfb\xbc\xed\x04\x6f\x1f\x21\xfc\x69\x3c\xb1\xaa"
+$ECHO -ne "\xdf\xbf\xa0\xab\xc3\xcc\x6a\xbf\xe7\x96\xbe\x36\xb3\x23\x32\x1c"
+$ECHO -ne "\xb5\x18\x44\x54\x51\x81\xb4\x63\xc7\x99\x84\x06\xcb\xaf\x5b\x05"
+$ECHO -ne "\x4f\x82\xf5\x93\xb4\xc3\xcf\xdb\x65\xb8\x8d\xae\xa1\xc2\xf0\xdf"
+$ECHO -ne "\xa7\xe5\xf3\x37\xd2\x57\x73\x0d\x89\xb8\x21\x10\x9a\x43\xe9\xe0"
+$ECHO -ne "\x09\x1a\x40\x49\xa0\xcc\x03\x30\x46\x66\x66\x0c\x12\x48\x89\xff"
+$ECHO -ne "\x57\xe8\xd2\x7c\x3e\x8d\x9e\x46\x7f\x97\xfc\x3b\x12\x95\xd2\xdf"
+$ECHO -ne "\x2f\xb1\xc8\x7d\x61\xdb\xb2\x8a\xdd\xbf\xf3\x7e\x08\xcc\xad\x16"
+$ECHO -ne "\xbe\x45\x13\xf2\x7f\x14\x5a\x79\x2e\xb5\xbb\x78\x0c\x22\xc6\x10"
+$ECHO -ne "\x31\xce\x9c\x6b\x1d\x48\x11\x16\x4c\xdf\x98\x12\xf3\x41\x05\x81"
+$ECHO -ne "\xd3\x24\x94\x92\x37\x51\x5d\xdc\x51\x08\xd3\x73\xba\x89\x42\x3f"
+$ECHO -ne "\xcb\x5c\x4c\xb2\x16\xcb\x04\xcd\x86\xb2\x05\x8a\xc3\x56\xc8\x83"
+$ECHO -ne "\x0b\x2e\x90\x31\x86\x5c\x68\xb9\x8d\xbc\xbf\xf2\xe2\xd2\xb0\x0b"
+$ECHO -ne "\x76\x2b\x3d\x79\xba\x3f\x9b\xe3\x8e\xc4\xf5\xed\xe0\xf7\xdd\xdb"
+$ECHO -ne "\x97\x5f\x9a\xb3\xfc\x50\xbf\x89\xf4\x7a\x38\xa3\x44\x0c\x50\x5d"
+$ECHO -ne "\x7c\xbb\x65\x47\xf1\x33\xd6\x67\xa4\xe0\xf0\x68\x58\xe9\x6c\x40"
+$ECHO -ne "\x02\x6b\x01\x20\x40\x84\x89\x80\x08\xcc\x52\xa0\x20\x81\x98\x16"
+$ECHO -ne "\xa1\x90\xf8\xcd\xbe\x1e\xc7\x6b\x1d\xb5\x81\x6b\x04\xdb\x4c\x43"
+$ECHO -ne "\x1a\xbc\xd4\x0d\xb6\x0d\xb3\x82\xc8\xc7\xf0\x13\xa8\xc5\x20\xd5"
+$ECHO -ne "\xbd\xb4\xc0\x5a\xdd\xe8\xd1\x31\x4f\xad\x88\x63\x30\x44\x0d\xd5"
+$ECHO -ne "\xc6\x56\x96\x28\xe2\xe8\xa8\xa9\x10\xdb\x1a\xa3\x21\xa6\xc5\xe6"
+$ECHO -ne "\xf5\xb2\xa4\x6d\x8d\xb4\x31\xb5\xc3\xec\x3e\x8f\xd0\xeb\x35\xce"
+$ECHO -ne "\xdb\x02\x9c\x4e\x96\xcd\x40\x14\xcd\x97\xb9\x0a\xe3\x09\xf5\x49"
+$ECHO -ne "\xfe\x1e\xc7\xc5\x57\xb9\x96\xe9\xf5\x8a\x56\xdf\x63\xda\x8a\xea"
+$ECHO -ne "\x41\x97\x74\x7b\xa6\x57\x99\x8d\xb0\x78\x60\xe4\x04\xd7\xe4\xbf"
+$ECHO -ne "\x89\x71\xa5\xc8\x93\x42\x02\x53\x7a\x6a\x9d\x99\xc9\xd3\x2b\x87"
+$ECHO -ne "\x75\xb2\x8f\x19\x86\x28\x2b\xc3\x2b\x67\x95\x72\xfb\x13\x39\xb5"
+$ECHO -ne "\xca\x8c\x43\x88\x1c\xdc\x47\xb6\xdb\x05\xaf\x8e\x31\x54\xb8\xbd"
+$ECHO -ne "\x98\x8b\x1d\x1f\x17\x87\x9d\x6d\x05\xca\xa8\x90\x49\x10\xbb\x67"
+$ECHO -ne "\x2f\x92\x61\x43\xfe\xe2\xd6\x18\x6d\x2a\xc0\x14\x96\x9a\x2a\x65"
+$ECHO -ne "\x48\x04\xc7\x2d\x76\xa6\x1f\xc5\x79\x36\x28\x69\x6f\x09\xb6\x90"
+$ECHO -ne "\xc3\x55\x6d\x98\xf0\xbd\xce\xb1\x37\xf4\xc4\x90\x1c\xdf\x5a\x27"
+$ECHO -ne "\xbc\x24\x38\x52\x75\xc0\xee\xc9\x05\x5a\xd7\x2b\x61\xfd\xba\xfb"
+$ECHO -ne "\xea\x9f\x65\x39\x9f\xe7\xc9\xc3\x0e\xa9\x3a\x20\x50\x87\xb6\x08"
+$ECHO -ne "\xc7\x80\x92\xe2\x60\x21\xd2\x2d\x51\x12\xf8\x46\x60\xbd\xf4\x65"
+$ECHO -ne "\xd5\x7b\x1a\xa7\x79\xb7\x73\x79\xe9\x0d\x60\x34\xc3\xb0\x58\xc8"
+$ECHO -ne "\xcc\x42\x7b\xb0\x56\x8c\xde\x66\x72\x23\xc2\x59\xe6\x9f\x83\x6a"
+$ECHO -ne "\xef\x4a\x9e\x1e\xf3\xd5\xde\x52\x32\x14\x8a\x2d\x0b\xf0\x1e\x5b"
+$ECHO -ne "\x7c\x4a\x34\x4d\x72\x4f\x1d\x8f\x97\xe8\xc9\xcd\xe2\xb9\x03\x36"
+$ECHO -ne "\x9f\x89\x97\xc3\x19\x8d\x8d\x84\x41\x0c\x03\x34\x18\x41\x20\x10"
+$ECHO -ne "\x26\x4c\x10\x18\x50\x5e\xd7\x93\x1f\x31\xf7\x54\xb3\x43\x4d\xd7"
+$ECHO -ne "\x48\x69\xcf\x7d\x29\x2f\x7f\x8f\x11\xf2\x4c\x3f\xcd\xe7\xa2\xe1"
+$ECHO -ne "\x09\x9a\x1a\x6c\xc6\xf3\xcf\x33\xe5\xb5\x8f\x6e\x41\xf1\x80\x07"
+$ECHO -ne "\x4d\x7f\xbe\x1b\x37\xdd\xe3\x64\xb8\xa2\x59\x90\x2c\xa2\xbe\xf4"
+$ECHO -ne "\x82\x2a\x80\x46\x4d\x1a\x8c\x88\x5a\x18\x30\x64\x0a\x5a\x57\x37"
+$ECHO -ne "\x63\xe9\x6d\x8a\x6d\x5f\x88\x5e\x6d\x41\x33\x60\xfd\x45\x90\x7e"
+$ECHO -ne "\x15\xaa\x95\x6f\xbd\xfc\xe9\x0b\x34\xe4\x3b\xa8\x41\x78\x1c\x55"
+$ECHO -ne "\x62\x5d\xb2\x19\xdd\xeb\x69\xeb\xef\xe1\xbf\x7b\xeb\x62\x23\x8a"
+$ECHO -ne "\x61\x14\x9f\x22\x53\x08\x6a\x31\xba\x30\x24\x1e\x54\x83\xae\xbd"
+$ECHO -ne "\x87\xa1\x71\xf0\x3c\x7d\x94\xa1\x2c\xea\xff\x84\x76\x77\xd2\xc9"
+$ECHO -ne "\x9f\x2f\x9c\xc7\x83\x3f\x89\x5d\x1b\x5c\xc3\x0f\xfa\xd2\x93\x32"
+$ECHO -ne "\xfc\xed\xa6\x26\x86\x98\x1b\x05\x10\x20\x27\x4c\x95\x3f\x6d\x94"
+$ECHO -ne "\x82\x5a\xa8\x68\x72\xae\xd7\xae\xdb\xaf\x26\xb6\x5a\x89\x30\xe7"
+$ECHO -ne "\xd0\x5a\x7c\xc6\x66\xfa\xc3\x85\x7d\x26\xee\xb3\x34\xc2\xac\x70"
+$ECHO -ne "\x88\x03\x15\xc6\xee\x55\x45\xde\x1c\x10\x01\xe6\x3b\x36\x26\x11"
+$ECHO -ne "\xbe\xec\x54\xea\xd8\x20\x1d\x35\x00\xd1\x8c\x00\xe8\xf5\x21\x97"
+$ECHO -ne "\x26\x06\x69\x87\x55\xa3\xc8\xf6\x58\xcc\x60\x12\x30\x0b\x8a\x50"
+$ECHO -ne "\x01\x57\x30\xdc\x9a\x01\xd4\xa4\xcd\xd6\x69\x23\x0f\xc3\xb8\x85"
+$ECHO -ne "\x12\xbb\x8e\xdf\xc5\xf1\xf3\x7c\xc9\x7a\x24\x25\x07\x9c\x86\x97"
+$ECHO -ne "\x68\xb5\xad\x0b\xba\x2e\xe8\x6f\x7f\xa1\xed\x4f\x0c\x34\x7b\xc8"
+$ECHO -ne "\x84\x10\x08\x2a\xcc\x19\x59\xbd\xbc\xe4\x3d\xa8\xd9\x35\xaf\x8b"
+$ECHO -ne "\xa7\x0a\xad\x42\xe8\x02\x90\xe6\x8e\x76\x5d\x0f\x3b\x87\xb8\xe4"
+$ECHO -ne "\x65\x4e\x5f\x0d\xe8\x26\xaf\x2a\x94\x9a\x2e\x21\x9a\x19\xb9\xa0"
+$ECHO -ne "\x8d\x26\x78\xa1\x4b\x6e\xf6\xd7\x29\x66\xdb\x49\x09\xa0\xca\x4d"
+$ECHO -ne "\x32\xb0\x31\xf5\x73\xe1\x67\xce\xe0\x5a\x79\x84\xa4\x22\xd4\xc9"
+$ECHO -ne "\x43\x59\x08\xa8\xd5\x5e\x8c\x72\x61\x70\x9a\xa6\x42\xc0\x42\x22"
+$ECHO -ne "\x2d\xd0\xbe\xb1\x49\x6e\x36\xbb\x8d\x8f\x03\x9b\xb4\xdb\x5a\x77"
+$ECHO -ne "\x3e\x29\x91\xc6\x73\x88\xef\x8c\xf7\xde\xe2\x2b\xc2\xce\xcd\x8c"
+$ECHO -ne "\x92\x60\x96\x29\x89\x99\x62\x99\x81\x36\x9b\x50\xc8\x70\xd6\x8d"
+$ECHO -ne "\xaf\x6b\x30\xba\xc7\x7a\xca\x4c\x56\x66\x66\x2d\xc7\xa5\xf7\x63"
+$ECHO -ne "\xa4\x55\x8d\xd4\x92\xdb\x2b\x6b\xb1\xa1\x96\x99\xd9\x25\xdb\x14"
+$ECHO -ne "\x1c\x49\x04\x67\x25\x45\x0a\x50\x1d\x20\xd8\x8d\xcf\xe7\x03\x20"
+$ECHO -ne "\xf0\xd7\xc0\xcc\x84\x20\x68\x4a\x63\x41\xa4\x6c\x32\x08\xa2\x37"
+$ECHO -ne "\x03\x6b\x42\x12\xbe\xa9\x4e\x9b\x97\x16\x92\x48\x56\x32\xae\x2c"
+$ECHO -ne "\x10\xc6\x31\x14\x8c\xcc\xd6\x23\x09\xf4\x64\x15\x9e\xf1\x35\x75"
+$ECHO -ne "\x98\x3a\x0c\x12\x29\xaa\xb7\x2b\x82\xe0\xf9\xcd\x05\xed\xb8\xbe"
+$ECHO -ne "\xb6\xf5\x6f\xcc\x41\xbc\x3a\x81\x39\x3b\x03\xe8\xb2\xab\xb6\xaa"
+$ECHO -ne "\xed\xa8\x58\xdf\xca\x06\xba\x64\x7b\xc4\xef\xec\x23\x38\x77\xec"
+$ECHO -ne "\xcf\xd7\xd2\xeb\x75\x3d\x26\xe2\xfa\x66\x49\x0b\x4a\xdc\xe3\x48"
+$ECHO -ne "\x64\x33\xc4\xb3\x93\xda\xdd\x3c\x08\x83\x7d\x91\x78\xe5\x61\x57"
+$ECHO -ne "\x67\x37\x73\xe1\x05\xbb\x96\x3e\x26\xc7\x6c\x44\xb5\xfb\x80\xb2"
+$ECHO -ne "\xd9\xa0\x99\x6b\xbf\x74\x62\xb7\xf7\x14\xec\x07\x12\xfc\xe6\x1b"
+$ECHO -ne "\xf1\x1d\x24\xfe\xd0\xb9\x61\x76\x56\xa0\xa5\x8c\x63\xce\x96\x5d"
+$ECHO -ne "\x65\x4f\xae\xcc\x7d\x86\x2d\xd7\x74\x96\x67\xb7\x5c\x94\xa6\x30"
+$ECHO -ne "\xbd\xb3\x84\x56\x93\x1e\x44\xc5\x43\x5f\x65\x9d\x1a\x92\xb1\x9a"
+$ECHO -ne "\x4c\x46\x1f\xd2\x64\x54\xb6\x4e\x7e\xb2\x71\x75\xf6\xce\xac\xdc"
+$ECHO -ne "\x5a\xa1\xd4\xf1\xf5\x71\x6a\x93\x50\xd2\x8b\xb2\xb1\x7f\xaf\x20"
+$ECHO -ne "\xd2\xc9\xce\xeb\xfb\x1d\x4a\xff\x26\x89\xa2\x60\xed\x8a\xeb\xa7"
+$ECHO -ne "\x6e\x92\xea\xb7\xef\x7a\xcc\xd9\x4b\xbb\x3e\xad\xc6\x7a\xfa\xbb"
+$ECHO -ne "\xe0\x25\x0c\x0f\xe2\x14\xf9\x2e\x0b\x5f\xd4\xbd\x8f\x5a\xae\xb6"
+$ECHO -ne "\xca\xc1\x5a\x89\x4c\x74\x36\xd3\x32\xab\x87\xa7\x7d\x57\x7f\x45"
+$ECHO -ne "\x1a\x1d\x45\xcc\xc8\xf1\x36\x8c\x4d\x6e\xc9\x01\xb8\x7a\x99\xdc"
+$ECHO -ne "\x4d\x9a\xa1\xc3\x7a\x81\xac\xa9\x40\x20\xc1\x18\xc7\x1e\x0d\xeb"
+$ECHO -ne "\xf7\x53\x9b\xcb\xe2\x64\x4e\x17\x1c\x6a\xd7\x74\x6b\xe4\x4b\xe7"
+$ECHO -ne "\x5f\x06\x31\xac\xe7\x5c\x64\x93\x05\x69\x13\x1a\x34\x52\x3e\x1a"
+$ECHO -ne "\xc8\xf6\xed\xde\x5e\x79\xf4\xe2\x04\xc3\xb6\xb3\x49\xdc\x7a\xe3"
+$ECHO -ne "\x52\x12\x1b\x32\xd9\xe2\x5c\x95\x5f\x69\x01\xde\x77\x16\x34\xf7"
+$ECHO -ne "\xda\x43\x2c\x56\x77\x21\xcc\x86\xc4\x4a\x14\xb8\x29\x28\x0a\xf1"
+$ECHO -ne "\x79\x8a\x9e\x94\x86\x6c\x6a\x6c\x0f\x15\xe6\xb4\x57\x92\xfc\x1f"
+$ECHO -ne "\x6d\x98\xbf\x2f\x0b\x97\xb3\x4b\xec\xe6\xd3\xf7\x94\xe4\x2c\xf3"
+$ECHO -ne "\x20\xfa\x42\x69\xd9\xb6\xb2\x96\x31\x09\x6b\xcb\xd2\x92\x14\x40"
+$ECHO -ne "\x69\x75\x9a\x83\x49\x44\xed\xe0\xdd\xa3\x3d\x09\xe0\xe4\xcf\x4f"
+$ECHO -ne "\x3b\x12\x84\xb6\x47\x2b\x1b\x7e\xc2\xac\x8d\xf6\x1c\x74\x26\xb0"
+$ECHO -ne "\x2a\x27\xf6\x03\xe3\xf9\xe3\xbb\x4a\x1a\x6f\xa2\xf4\x10\xb0\xe5"
+$ECHO -ne "\x70\x9a\x9b\xdf\xac\x42\x6a\xdc\x80\xc3\x80\x0c\x84\x26\xf0\x23"
+$ECHO -ne "\xd6\x5b\xcb\x8b\x3b\xe1\x65\xfe\xba\xad\x85\xe9\x1d\x88\xa4\xf8"
+$ECHO -ne "\x05\xb8\x58\x0b\xb1\x13\xa8\xd8\xea\xfd\x07\x68\xee\x6b\x5c\x88"
+$ECHO -ne "\x17\x49\x89\x0e\xa5\x7a\xe6\xa0\x9c\x3a\x06\x2d\x71\x84\x2c\xd2"
+$ECHO -ne "\x1b\x07\xfd\x43\x9b\x48\x9b\xae\x60\x54\x5d\xd3\x2b\xf1\xc0\x0d"
+$ECHO -ne "\x49\x01\x64\x34\x36\x77\x2f\x0e\xe7\x72\x35\x48\x2f\x05\xaa\xd5"
+$ECHO -ne "\xb4\x98\x77\xa3\x19\xa2\xf4\xb8\x11\xa7\xa6\x24\x91\xac\x1e\x09"
+$ECHO -ne "\x38\x04\xc6\xff\x0b\x7d\x36\xc2\xcb\xb8\x9c\x7e\x7b\x49\x8c\x4e"
+$ECHO -ne "\xbb\x37\x19\x18\x83\xc5\x23\x03\x6c\xcb\x51\x24\xe5\x42\x85\xc7"
+$ECHO -ne "\x73\x13\x2c\xc8\x22\x28\x50\x83\xbc\x3a\x8e\x60\xac\xb1\xda\x18"
+$ECHO -ne "\x24\x6d\x64\xd0\xa9\x65\xcd\xd6\x5a\xa7\xaa\xc6\xed\x32\x76\x7b"
+$ECHO -ne "\x07\x90\xb4\x7b\x5d\x16\x88\x9b\xd7\x5e\x0a\xb7\xbf\xbf\xc4\x5d"
+$ECHO -ne "\x1c\xbd\x39\xf3\x17\xae\x50\xaa\xc7\xa4\xe9\xad\xa5\xac\x04\xd9"
+$ECHO -ne "\xa4\x27\x5f\x79\x75\x29\x10\x69\x75\xe9\x06\x53\x7c\x66\x8b\x83"
+$ECHO -ne "\xf7\x7c\xfd\xcd\x16\xc3\x8c\x8e\x51\x6f\xcb\x68\x0a\x9c\x39\x39"
+$ECHO -ne "\xb9\x0b\x6a\x16\xc5\x4a\x22\xc0\x31\x09\x22\x28\xa0\x65\x69\x05"
+$ECHO -ne "\x30\x90\xc1\x18\x22\x05\x9e\xad\xa9\xc3\x54\x3e\x27\xa9\xc4\x41"
+$ECHO -ne "\x2c\x39\x03\xd2\x8e\x3f\x91\x9a\x4c\xc8\x68\x14\xe4\x1c\xa6\x5f"
+$ECHO -ne "\x0b\x57\x27\x09\x8a\x7d\xff\x47\x63\xa7\x5a\x29\x82\xa0\x3a\x28"
+$ECHO -ne "\x30\x9a\x2b\xf3\x69\x63\x18\xcd\xe2\x32\x66\x3c\xd7\x79\xdd\x12"
+$ECHO -ne "\x86\x34\xc6\x9e\x75\x05\x87\x39\x23\x72\x97\x71\x27\x64\xcd\xd9"
+$ECHO -ne "\xa6\x2e\x61\xd2\x37\xe4\xae\xc6\xc9\x81\xc0\x2e\x9f\xc6\xf9\x7f"
+$ECHO -ne "\xd9\x5e\xd0\xa9\x09\x97\x35\xa2\xe3\x4f\xe9\x19\x7c\xa5\xc7\x4d"
+$ECHO -ne "\x2d\x92\xec\xd6\xef\xda\x55\xf3\xa2\x95\x17\x1b\xce\xbe\x6b\x74"
+$ECHO -ne "\x70\xee\xdb\xa8\x42\x26\xb1\xcc\xc1\x31\x0a\x67\x92\x13\x9d\x9c"
+$ECHO -ne "\x12\x18\xa4\x08\x4d\x4d\xfc\x7c\xeb\x59\x6b\x22\x03\xaa\x97\xc3"
+$ECHO -ne "\x27\xa5\x21\x35\x68\xd2\x57\x54\xca\x58\x38\x82\xc5\x05\xa0\x71"
+$ECHO -ne "\x01\x1b\xce\x57\x1e\x20\xbf\x89\x96\x2a\x31\x8e\x6e\xaf\x7f\x35"
+$ECHO -ne "\x08\x10\xd9\x0e\x8a\x78\xb0\x48\x98\xa4\x64\x14\xa2\xcf\x23\x2d"
+$ECHO -ne "\x0a\x7b\x84\xe5\xfd\x29\x49\x15\x3d\x75\x39\xfd\xaa\xd6\xa4\xb9"
+$ECHO -ne "\x05\x12\x57\x31\x04\xdc\x26\x34\x16\x3f\xa7\x03\x32\x1d\x4b\x1d"
+$ECHO -ne "\x78\xdc\x9b\x79\x96\x9a\x87\x6e\xb4\x80\xaa\x01\x19\x33\x92\xb0"
+$ECHO -ne "\x16\xc9\x94\x9c\xe7\xa5\x63\xe6\x18\x13\xb2\x34\xbd\x98\x41\xd6"
+$ECHO -ne "\xa4\xc8\xb9\x6e\x06\x9c\x72\xf8\x49\xab\xd5\x47\x9e\xa1\xe6\xde"
+$ECHO -ne "\x62\xd0\xec\xaf\xbf\x1b\x8a\xaf\x63\xa0\x29\xbe\x3d\x87\xa0\x22"
+$ECHO -ne "\xce\x46\x4e\x18\x30\x7b\x3c\x3d\x86\xe1\x9e\xb6\x59\xef\x1c\x43"
+$ECHO -ne "\x65\xd0\x3d\x53\xd0\x41\x20\x40\xb7\x2b\xb1\xdd\x52\x2c\xdd\x68"
+$ECHO -ne "\x44\xc1\xbe\x40\x72\x61\xd7\x25\x5d\xf5\x69\xce\x3a\x3b\x2e\x9b"
+$ECHO -ne "\x13\x19\x79\x1a\xf0\xee\xb0\xe7\x17\x44\x45\xe8\x2d\x59\x50\xbc"
+$ECHO -ne "\x40\x67\x66\x12\x20\xcc\x43\x8a\x9c\x1d\xde\xac\x2d\x00\x76\xb2"
+$ECHO -ne "\x98\x8a\xa9\xde\x1c\xb6\x8b\x32\x19\x67\x1c\x67\x95\x41\x40\x60"
+$ECHO -ne "\xf3\x13\x44\xb8\xc5\x18\xa7\xca\xdd\x8c\x5a\x8f\x72\x69\xf1\x31"
+$ECHO -ne "\xa9\xd2\xeb\xac\x3e\x2f\xdc\xc7\xe0\x00\x78\x5d\x72\xff\x01\x95"
+$ECHO -ne "\x86\x4a\x90\x2b\xf8\x10\xc5\xc2\xd1\x9d\x7a\xc3\x65\xb1\xfd\x2d"
+$ECHO -ne "\x09\x0b\xcd\xdf\x03\x80\x3e\x44\x81\x65\x49\x4f\x50\x7e\x1f\x75"
+$ECHO -ne "\x97\xc6\x05\xda\x5a\xe9\xf6\xee\xe5\x66\xcc\x5e\x17\xe2\x8c\xb2"
+$ECHO -ne "\x06\x5b\xdd\x41\x0d\x26\xcc\x87\x0d\x37\x2e\x2d\x35\xe0\x5d\x93"
+$ECHO -ne "\xc5\xdf\x2d\xb4\xa2\xb1\x1b\x0e\x9b\xe6\x76\xb4\x28\x69\x5c\xe9"
+$ECHO -ne "\x4e\x27\x6f\x52\xcb\x4d\xb3\xc8\xaa\xea\xd3\x1a\x57\x00\xdf\x20"
+$ECHO -ne "\x2d\x42\xea\x6a\x18\x0a\xac\xae\x9a\x32\x08\x23\x99\xb7\xd8\xe5"
+$ECHO -ne "\x75\x3a\x65\x8b\x2f\xaa\x4f\x7b\x68\xd5\x66\x76\xf4\xec\x3d\xdb"
+$ECHO -ne "\xe9\x37\xdb\x69\x40\x6d\x35\x4f\x77\xfa\x8f\x07\x60\xac\x8e\x3b"
+$ECHO -ne "\x89\x46\x3c\x16\xd4\x4b\x6e\x71\x4f\x00\x10\x22\x14\x12\xca\x72"
+$ECHO -ne "\xe0\x6c\x54\x2f\x0e\x32\x8c\xba\x53\xad\x51\x48\xaf\xee\xb2\xca"
+$ECHO -ne "\x93\x4a\x46\x24\x1f\x09\x83\x69\x1c\x3f\x72\x50\x70\xff\x10\x74"
+$ECHO -ne "\x21\xef\x4a\x08\x38\x25\x4c\x54\xb6\x34\x83\x64\x99\x22\x0f\x02"
+$ECHO -ne "\x49\x58\x50\x74\xa3\xbe\xc2\x17\x05\xa7\x60\x55\xc4\x21\x52\x0c"
+$ECHO -ne "\x57\xee\x0f\x64\x6a\xa9\x73\x25\xa1\x2a\x94\x1d\x00\xca\x65\xc4"
+$ECHO -ne "\x39\xfc\x53\xa8\xe7\x4c\x07\x44\x5f\x29\x19\x98\x08\x16\x53\x1a"
+$ECHO -ne "\xba\xee\x8e\x2e\x16\x97\x66\x5b\x7c\xb5\x63\x2d\x31\x18\xdb\x64"
+$ECHO -ne "\xc5\x69\x15\xa9\xe8\x23\x5f\x92\xdb\x75\x60\x90\x6a\xbf\xb5\xba"
+$ECHO -ne "\xe5\xa5\x70\xce\x26\xd0\xc1\x63\xcb\x0e\x21\x67\x1e\x8e\x20\x32"
+$ECHO -ne "\xa1\x2d\x51\xfc\x32\xa0\xc9\xd0\x32\x91\x9a\xda\x45\x73\x2e\x97"
+$ECHO -ne "\x09\x17\x0c\xea\xe4\x89\x94\xe8\xad\x64\xd6\x78\x02\x07\x79\x06"
+$ECHO -ne "\xa4\x01\xce\xd0\xcc\x33\x20\x8d\xc9\x2d\x67\xdf\x85\x06\xb5\x21"
+$ECHO -ne "\x74\x61\x49\x99\x98\xec\x28\x06\xc4\xbd\x25\xb5\x62\x2d\xb0\xba"
+$ECHO -ne "\x5f\x4c\xc4\x33\x85\x42\x58\x11\xd4\xff\x27\x21\x3c\x57\x9e\xd9"
+$ECHO -ne "\xc4\xb1\x6d\x8d\x4a\x8c\x8a\x80\x6c\x1e\x16\x5f\xc1\xc4\x68\x4a"
+$ECHO -ne "\xca\x20\xb1\x40\x10\x1b\x1b\x6c\xf7\x82\xf8\xd4\x35\x29\x10\x76"
+$ECHO -ne "\x7d\x3a\x4d\x4d\x49\x9b\x62\x65\x66\xd4\xda\x81\x24\xca\x4a\x48"
+$ECHO -ne "\x48\x2f\x83\x48\xd1\x09\xdf\x2f\x17\x8b\xc5\x37\x89\x94\x15\xb1"
+$ECHO -ne "\x36\x58\xcd\x80\xb4\x19\xc5\xc6\xda\xda\x16\x95\x82\x14\xc5\x19"
+$ECHO -ne "\x61\x6e\xb5\xcc\x27\xb5\xf3\xdb\xef\x6e\x44\x37\xbf\xdc\x11\xf9"
+$ECHO -ne "\xa0\xf2\x78\x30\x85\xc0\xc0\x07\x67\x02\x66\x56\x7c\x76\xee\x7a"
+$ECHO -ne "\x97\x6e\x02\x5e\x08\xc0\x35\x02\x4a\x87\x39\x4c\xd6\xc4\xe0\x99"
+$ECHO -ne "\xcd\xd9\xda\x2c\x49\x18\x5c\x22\xb6\x51\x4b\xa0\x58\x8b\x7a\x55"
+$ECHO -ne "\x61\xdc\xa5\x21\x83\x1d\x47\x9c\x0b\xf4\x74\xba\x08\x85\xe4\xc8"
+$ECHO -ne "\x80\xbe\x80\x46\xfc\x46\x85\x60\x64\xa6\xc4\xc1\xae\x69\x67\x0b"
+$ECHO -ne "\x8e\xac\xa2\xc0\xf4\x6b\x6f\x7a\x9e\x00\xdd\x4d\x59\x57\x4a\x78"
+$ECHO -ne "\x08\x64\x08\x84\x80\x50\x34\xb1\x3b\xc7\x71\x3f\x3e\x1c\x1d\x4e"
+$ECHO -ne "\x4e\xa9\xb0\x32\x02\x10\x8e\x88\x71\xed\x87\x2c\x32\x4d\x57\x05"
+$ECHO -ne "\xf1\xba\xa0\xf9\x61\x30\x4b\x18\x65\x6e\x38\xf9\x41\xdd\xf1\x48"
+$ECHO -ne "\x63\x38\x50\x10\xc1\xac\x1b\xf2\x5b\xaa\x15\xf4\x89\x0e\xe9\x77"
+$ECHO -ne "\x80\x56\x50\x18\x81\x71\xd8\xdb\x0d\x6a\xce\xd2\xb6\x76\xbd\x35"
+$ECHO -ne "\xf0\x96\xe1\x06\x8b\x09\xab\x83\x21\x10\x10\x30\x68\x30\xad\xe0"
+$ECHO -ne "\xc2\x62\xa2\x99\x0b\x92\x17\x19\xab\xe3\x7a\xd1\x90\xae\x5c\x2b"
+$ECHO -ne "\x6e\xbe\x31\xec\x72\x78\x03\x7a\x85\x70\xe0\x67\x36\xe0\xdb\x63"
+$ECHO -ne "\x6e\xed\x26\x94\xcc\x9b\x4e\xa8\x23\x57\x56\xe1\x49\x61\x31\x5e"
+$ECHO -ne "\xc8\x2b\x81\x05\x23\x18\xdb\x68\x34\x0b\x6c\xf1\xfc\xc7\xdd\xdf"
+$ECHO -ne "\x1a\x39\xf8\xf6\x72\xb9\x4d\xc9\x80\xbf\x23\x93\x24\x76\xdd\x6d"
+$ECHO -ne "\x0a\x8f\x18\xe1\x81\x8f\x48\x7b\x48\x2e\xd0\xb5\xd0\xcb\xa1\x46"
+$ECHO -ne "\xae\x1c\x26\x02\xd2\xe0\xf4\x56\x8c\x8a\x01\x97\x4e\x5f\xd1\xde"
+$ECHO -ne "\x9a\x10\x31\x0d\x4c\xbc\x40\x06\xc5\x04\x92\x91\x88\x81\x58\x5d"
+$ECHO -ne "\x55\x13\xab\x4f\xaa\xbd\xee\xa0\x6a\x80\xb2\x83\xd0\x46\x31\xa0"
+$ECHO -ne "\xbc\x2c\xf9\x0d\xad\xe2\x62\xb0\xac\xa4\x91\x84\xb8\x31\x99\xb9"
+$ECHO -ne "\x45\xb3\x47\x1e\xc2\x96\xc9\x9d\xcc\xd3\xcc\x71\xc4\xf3\x9a\x92"
+$ECHO -ne "\x2b\xac\xc3\x8c\xe1\xdc\x40\x66\x64\xe8\x24\x35\x50\x26\x68\x0b"
+$ECHO -ne "\x79\x96\x81\xb6\x36\xc7\xa4\x82\x0d\x32\x65\xc3\x4c\x61\x49\x32"
+$ECHO -ne "\x09\x14\x22\xac\x37\x69\x34\xb4\x6c\xdd\xbc\x95\x54\x6b\x59\x53"
+$ECHO -ne "\xc6\x50\x32\x09\x99\x14\x8c\x18\x74\xcc\x05\x86\x7a\x06\x48\x50"
+$ECHO -ne "\x6e\xe0\xaa\x41\xbb\xb0\xbc\x19\xaa\x2c\x12\x9c\xcd\xa5\x1c\x6d"
+$ECHO -ne "\x19\x0a\x62\x02\xfe\xd3\x4a\xcc\x7c\x6a\xa5\x72\x06\x35\xfb\x8d"
+$ECHO -ne "\xf9\xab\x1e\x0b\x29\x73\x70\xb5\xe8\xf6\x54\xb6\x4c\xc8\xea\x30"
+$ECHO -ne "\x8c\xaf\xd0\xd3\xb0\x20\x59\x80\x61\x40\xc8\x19\x99\x6d\x97\xb3"
+$ECHO -ne "\xca\x66\x1e\x16\x3d\xa7\x74\xa6\x58\xf0\xd4\x00\x67\xdc\xbb\x8a"
+$ECHO -ne "\x4a\x7b\x75\xa4\x6e\x89\xc4\x44\x44\x3d\x72\xb4\x52\x8a\xc0\xc2"
+$ECHO -ne "\x11\x40\x22\x9a\x14\x09\x66\xc2\x03\xcc\x04\x86\x02\x03\xa6\x8a"
+$ECHO -ne "\xab\x60\xe0\xe8\xdc\x2b\x5d\x0d\x73\xb5\x8f\x74\xc6\xce\xdb\xb5"
+$ECHO -ne "\xa8\xe7\x95\x3f\x8b\xaf\xb9\x87\xbc\x63\xab\x84\xea\x93\x1e\x9d"
+$ECHO -ne "\xb4\xe0\x83\xc8\x4a\xc9\xc7\xb9\xc7\xf2\xc6\x25\x10\x58\xc0\x21"
+$ECHO -ne "\x64\xa1\x08\xd3\x10\x2f\x94\x40\x5a\x56\x17\xa1\x0f\xa6\xfb\xda"
+$ECHO -ne "\xd3\x12\x42\x31\x71\x09\xa5\x2e\x8b\xd1\x69\x5c\x99\x5b\x09\x52"
+$ECHO -ne "\xc6\x9b\x5a\x18\x0c\x06\x47\x42\x8a\xc3\xad\xef\x9a\xe9\x9d\xf6"
+$ECHO -ne "\x2b\x81\x72\x48\x05\x20\x16\x10\xa3\xc3\xc5\xd2\x71\x0e\xca\x04"
+$ECHO -ne "\x17\xef\xdf\x39\x64\x26\x4c\x9f\x22\xb4\x13\x1c\x3d\xe7\x55\x40"
+$ECHO -ne "\x2e\xd1\x91\x28\xc8\x1c\x68\x69\x65\x97\x13\x75\xfe\x5b\x5c\xb1"
+$ECHO -ne "\x9b\x5a\xf7\xd2\x02\xb2\x0b\x41\x36\x67\xe7\xa9\x10\x80\xd0\x5c"
+$ECHO -ne "\x64\x08\x67\xda\x56\x36\x53\x4a\xa8\xca\x16\x88\xc5\x79\xdd\x3e"
+$ECHO -ne "\x87\x71\x13\x39\xae\xfd\x2a\x93\x6e\xbb\x96\x02\x39\xea\xda\x5a"
+$ECHO -ne "\x87\xb8\xfa\x54\x2c\x49\xa3\xa0\xbb\xa5\xc4\x10\x5c\xd2\x10\x10"
+$ECHO -ne "\x0c\x88\xb2\xd4\xf4\x67\x6a\x93\x5b\xbb\x20\x06\xdc\x75\x7f\x3a"
+$ECHO -ne "\x9b\xa3\xb0\x76\x98\xd9\x77\x32\x97\xa5\xdc\x64\xa4\x7b\xa5\xae"
+$ECHO -ne "\xaa\x15\x2d\x59\x0c\xc1\x7a\x40\xd2\xc2\xbb\x45\x10\xe1\x9a\x46"
+$ECHO -ne "\x52\x91\xe4\x24\x21\x9c\x46\xee\x05\x57\x44\x5e\x41\xad\x5a\x08"
+$ECHO -ne "\x46\x0b\xa0\xdf\xb4\x59\x7a\xe4\x41\xa3\x0a\x59\x5e\x2b\x17\x20"
+$ECHO -ne "\x19\x02\x6c\xe6\xe2\x48\x85\x99\xb3\xba\xfc\x9c\xe3\xcd\xf9\x31"
+$ECHO -ne "\x5b\xf1\x86\x64\x9d\x8f\x93\x24\xa3\x29\x38\x94\xcb\x1e\x71\x87"
+$ECHO -ne "\x54\xf2\x27\x22\x4e\x57\x26\x9a\x82\xb5\x6e\x6c\x1c\xad\x2d\x2b"
+$ECHO -ne "\x22\x62\x0a\xd0\x23\x5d\x5a\x75\x15\xae\xa0\x26\x04\x21\x6d\x2c"
+$ECHO -ne "\xfe\x06\xd9\x60\x61\x20\x8e\xea\xef\xba\x59\x03\x64\xda\xe5\xb2"
+$ECHO -ne "\x30\xc0\x9c\xdc\xcf\x11\x77\xe9\x23\x54\x33\xb8\xe9\x05\xab\x4c"
+$ECHO -ne "\x5b\xb5\x4b\x2d\x03\x0c\x51\xc5\x80\x11\x51\xac\xeb\x8d\x4c\x25"
+$ECHO -ne "\x21\x98\x79\xb0\x38\x99\x9c\xbc\xe2\x96\xe9\x4a\xd0\xad\x56\x6a"
+$ECHO -ne "\x65\xe1\xd4\x90\x12\x4a\xa5\x48\x06\xc6\x48\x31\xac\xaf\x21\x0a"
+$ECHO -ne "\x56\xa2\x90\x12\xd7\x53\xa8\x48\x03\x75\x2e\x36\x14\xf4\x50\x89"
+$ECHO -ne "\x7c\x49\x4e\x4a\x2a\xbc\x46\xc3\x2d\x16\x4e\x42\x25\x28\xd4\xf2"
+$ECHO -ne "\x01\x47\xa3\x5a\xd1\x6a\x0c\x1c\x35\x9c\x52\xc8\x2d\xeb\xab\x15"
+$ECHO -ne "\x2a\x99\x51\x45\x22\x9c\x77\xaf\x85\x77\xbc\x84\xb2\xf5\x99\xe9"
+$ECHO -ne "\xd8\xd9\xc1\x90\x83\x02\xeb\xde\x8f\x91\x82\xa3\x0c\x73\x1a\x05"
+$ECHO -ne "\x6b\x9c\x98\x28\xc5\x56\x55\xe9\xf3\x74\x24\x81\x48\xaf\x21\xb4"
+$ECHO -ne "\x84\x2d\x6b\x45\x88\xc2\x90\xb1\x12\x12\x60\xc8\x6a\xec\x61\x33"
+$ECHO -ne "\xa2\xc3\xb3\x58\xbf\x29\x1c\x48\x97\x7a\xea\x20\x65\x03\x7f\x22"
+$ECHO -ne "\x45\xa5\xdd\x03\x5c\x52\xdc\x30\x85\xde\xd9\x47\x5e\xeb\x31\x65"
+$ECHO -ne "\x0b\xf3\x13\x80\xae\x3e\x07\x52\x2a\x47\xb9\x7b\x7c\xa8\x41\x79"
+$ECHO -ne "\x95\x2e\xcf\x3d\x60\x08\xe6\x26\x00\xd1\x82\x60\x70\x45\xa1\x4a"
+$ECHO -ne "\x48\xa2\x18\x76\x35\xb5\xe8\x6c\x0d\x42\xd2\xba\x2c\x13\x5b\x25"
+$ECHO -ne "\x27\xd4\x8d\x73\x7a\xf8\xd9\xfe\xf3\xd3\x81\x73\x83\xe8\x65\x60"
+$ECHO -ne "\xf3\x5b\x18\x07\x15\x04\x60\x67\x51\xca\xab\x91\x85\xdc\x61\x3a"
+$ECHO -ne "\xe9\x72\xc2\xd1\xa4\x68\xe2\x00\xc8\x0c\x5e\x82\xa0\x0b\x82\x16"
+$ECHO -ne "\x40\x82\xb2\x98\x7b\x76\xf8\x5b\xb5\xf6\x8d\xfb\xc9\x36\x8c\x1e"
+$ECHO -ne "\xa6\xc9\xb5\x95\xd8\x36\x28\x36\xee\xa9\xa2\x72\x66\x58\xf5\x90"
+$ECHO -ne "\x02\x95\xee\xa8\xfc\x79\xfa\x6f\x66\xf6\x47\xd6\x4f\x10\x95\x86"
+$ECHO -ne "\x54\x0d\xa0\x22\x26\x01\xbe\x63\xc5\xf1\xac\x36\x4a\xe1\x0f\x6b"
+$ECHO -ne "\xe7\xba\x4f\x20\x17\xc0\xf9\x02\x5d\xc4\xc0\xaf\xf0\x1f\x88\x54"
+$ECHO -ne "\xe4\x6e\xc0\xa2\xbb\x59\x6f\x82\x21\xbb\x50\x9c\x4e\x92\x83\x24"
+$ECHO -ne "\x23\xf8\x28\x4c\x45\x79\x88\x71\x3b\x05\x79\x98\x4f\xa1\x00\x2d"
+$ECHO -ne "\x6e\x68\x08\x46\x3b\xfb\xf0\x5c\x22\xf3\x42\x40\x7d\x5e\x67\x3f"
+$ECHO -ne "\xdf\xff\x2e\x73\x0d\x31\xb5\xc0\x78\x4c\x0f\x85\x0f\xdb\xe6\x2b"
+$ECHO -ne "\x86\x0f\xb3\x8f\x9d\x1a\xe6\xe2\xdb\x32\x68\xfb\x5a\x79\x0a\xf4"
+$ECHO -ne "\x25\x28\x01\x39\xd2\x7c\x05\x7b\x0b\x18\xbb\x9c\x68\x31\x8d\xb0"
+$ECHO -ne "\xfc\x69\x2d\x17\x2c\x33\x62\xa6\x24\x6f\x0e\xcc\xdc\xff\x7b\xdf"
+$ECHO -ne "\x78\xd3\x88\x5c\x4a\xbd\xeb\x14\xda\xe0\x0e\xd3\xf3\x5b\xd2\xaa"
+$ECHO -ne "\xd1\x64\x82\x42\x0c\xfe\x54\x90\x40\xeb\x75\x13\x63\x68\xb5\x52"
+$ECHO -ne "\x0a\xd9\x3b\xc5\xd0\x14\xe1\xd2\x35\xab\x2b\x8b\xed\x21\xf3\xe1"
+$ECHO -ne "\xcb\xed\xbc\x3e\x64\x81\x63\x5f\xaa\xf3\xb8\x05\x10\x29\xe1\x67"
+$ECHO -ne "\xae\x0a\x16\xbb\x71\x05\x02\x46\xba\xef\x30\xda\xe7\x3a\x18\x4b"
+$ECHO -ne "\xcb\x0e\x97\xd1\xe9\xf5\x7a\x73\xc1\x60\x91\xaf\x63\x4a\xc8\x57"
+$ECHO -ne "\xa6\xb0\x09\xb4\x95\x98\x87\xa9\xc4\x5e\x04\xe7\xef\xbf\xe5\x8c"
+$ECHO -ne "\x39\x8e\xe2\xdd\x9a\xc0\xbf\x37\x9c\x38\xa3\xad\xc6\x14\x86\x3f"
+$ECHO -ne "\x7d\xc1\x9d\xb5\xbb\x68\x58\x4c\x14\x03\xf1\x36\xd4\xf2\xce\xb6"
+$ECHO -ne "\xbc\x9d\xb3\x31\x55\x68\x0c\x5f\xd0\x30\xe2\x05\xae\x68\x4e\x11"
+$ECHO -ne "\x5a\x28\x15\x68\x8f\xac\xa3\x1b\x89\xad\x48\x89\x08\x08\xa3\x3b"
+$ECHO -ne "\x26\x5e\x32\x1d\x6d\x73\x2b\x20\x90\x08\x4a\x12\xb0\x1f\xf1\xa3"
+$ECHO -ne "\x37\xf8\xec\x30\x21\x06\xf3\xbb\x3b\x46\xf9\xaa\xeb\x1a\x31\x33"
+$ECHO -ne "\x2b\xa5\x87\x4d\x4d\xbc\x13\xda\xa9\xa0\x4c\xca\x0b\x46\xa6\x09"
+$ECHO -ne "\x41\x73\xbb\x3f\x71\x9f\x6a\x88\x41\x02\x20\x3f\x54\x6d\x42\xc8"
+$ECHO -ne "\x70\x6e\x64\xd0\x50\x88\x83\xc4\x33\x78\x6d\x04\xb6\x43\xed\x5e"
+$ECHO -ne "\x72\x71\x6b\xd5\x65\x80\xcf\x66\x46\x29\x10\xdb\x79\xd1\xa9\x95"
+$ECHO -ne "\xb7\x9d\xf4\xa9\x93\xb4\x5a\x00\xc6\xb2\xad\xbf\x7e\xaa\xe6\x8d"
+$ECHO -ne "\x8c\xc0\x6b\xf5\xc2\xad\x00\xfb\x08\x63\xe2\xb5\xb1\xe0\x76\xac"
+$ECHO -ne "\x0a\xe4\x72\xb5\x72\xbc\x24\x6b\xef\x62\x0f\xaa\xb9\x28\xd2\x3c"
+$ECHO -ne "\xf6\x3e\x26\x20\x8b\xcc\xd2\x61\xcd\xd4\xc7\xed\x39\xa8\x39\x4e"
+$ECHO -ne "\x7e\x05\x97\xeb\x29\x24\x3a\xb2\xc9\xbd\xad\xcf\xf0\x22\xbc\xdd"
+$ECHO -ne "\xb8\x8c\x2e\x6a\xbf\x4f\x67\x2f\xfc\x07\xd0\x53\x0c\x54\x30\x35"
+$ECHO -ne "\xf8\xf1\x76\x45\x26\x5a\x86\x11\x1e\xeb\x58\xc0\x2d\x6c\x3d\x87"
+$ECHO -ne "\xa6\xca\x8e\x89\x4f\x75\x88\xf9\xb9\x9a\x99\x8b\x68\x22\xe2\x52"
+$ECHO -ne "\x4d\x46\x8d\x44\x31\x2b\xc1\xb0\x19\xa7\x90\xfb\x95\xda\x19\x2f"
+$ECHO -ne "\x6e\x0d\xe2\xc1\x85\xd0\x1f\x9b\xd3\xae\x33\xe3\x55\xa4\x77\xf2"
+$ECHO -ne "\xf1\xd7\xa8\xf0\x57\x30\xc4\x3b\xe6\x55\x97\xf9\xe3\x89\x82\xda"
+$ECHO -ne "\xae\x02\x45\xb1\x86\x8c\x84\x4c\xb2\xcf\x82\xdb\x4e\x04\x45\xcc"
+$ECHO -ne "\x19\x53\x9e\x2f\x95\xa9\xc7\xa8\x08\x17\x61\xc1\x8c\x26\x7f\x9b"
+$ECHO -ne "\x07\x8c\xe7\x77\x2d\x12\xd2\xcd\xc6\x97\xcf\x29\x3a\x1e\xac\x2b"
+$ECHO -ne "\x69\xb9\xb4\x61\xee\xeb\xb3\xae\x60\x18\xa0\x3a\xe5\xc0\xb9\x58"
+$ECHO -ne "\x38\x4d\x32\x57\x81\x89\x99\x29\x73\xdd\x47\x43\x2f\x1e\x39\xc6"
+$ECHO -ne "\x06\xbf\x7f\x64\x9e\x91\xc3\x9f\x18\x1b\xba\xf8\xb5\x29\x5d\xe3"
+$ECHO -ne "\x46\x7e\xb5\x1a\xfd\x9b\xb0\x1b\x85\x06\xc3\xc5\x09\xdb\x82\xd0"
+$ECHO -ne "\xd1\xff\xe1\x0f\xeb\x37\x1d\xce\x65\x6d\x26\x55\xe0\x20\x00\xc4"
+$ECHO -ne "\x36\x2f\xba\x86\x26\xc6\x7b\xa4\xe9\xb1\x41\x20\x04\x11\xeb\x24"
+$ECHO -ne "\x3c\x72\xbf\xd3\xc5\xb3\xbd\xce\x14\x45\x2d\x50\x01\x00\x26\x39"
+$ECHO -ne "\x3c\x85\x17\x0e\x42\x66\x8a\x1c\x94\xa8\x90\x02\xc4\x42\xd8\xd1"
+$ECHO -ne "\xcc\x94\x7a\x25\xad\xfd\x8d\xa4\x0e\xe0\xcb\x92\x5e\x6f\x14\x2b"
+$ECHO -ne "\x29\xbd\xc0\x81\x20\x3f\x0b\x2c\x7a\x2c\xe7\xba\x6d\x99\x14\xbe"
+$ECHO -ne "\xd5\x39\xc8\x6f\x2e\xbd\x79\x59\x19\x75\xb6\xf5\x4f\x12\xf6\x8e"
+$ECHO -ne "\x40\xa0\x00\x8b\x12\xe8\xfb\xb7\x27\xaa\xd3\x36\x0c\xfc\xe1\x40"
+$ECHO -ne "\x01\xff\x8b\xb9\x22\x9c\x28\x48\x5f\xa5\xca\xf3\x80"
+}
+
+prep() {
+ rm -f t*
+ hello_$ext >t1.$ext
+ hello_$ext >t2.$ext
+}
+
+check() {
+ eval $2 >t_actual 2>&1
+ if $ECHO -ne "$expected" | cmp - t_actual; then
+ echo "$1: PASS"
+ else
+ echo "$1: FAIL"
+ fi
+}
+
+mkdir testdir 2>/dev/null
+(
+cd testdir || { echo "cannot cd testdir!"; exit 1; }
+
+expected="$unpack: z: No such file or directory
+1
+HELLO
+"
+prep; check "$unpack: doesnt exist" "${bb}$unpack z t1.$ext; echo \$?; cat t1"
+
+
+expected="$unpack: t.zz: unknown suffix - ignored
+1
+HELLO
+"
+prep; >t.zz; check "$unpack: unknown suffix" "${bb}$unpack t.zz t1.$ext; echo \$?; cat t1"
+
+
+# In this case file "t1" exists, and we skip t1.gz and unpack t2.gz
+expected="$unpack: can't open 't1': File exists
+1
+HELLO
+"
+prep; >t1; check "$unpack: already exists" "${bb}$unpack t1.$ext t2.$ext; echo \$?; cat t1 t2"
+
+
+# From old testsuite
+expected="HELLO\n0\n"
+prep; check "$unpack: stream unpack" "cat t1.$ext | ${bb}$unpack; echo $?"
+
+expected="ok\n"
+prep; check "$unpack: delete src" "${bb}$unpack t2.$ext; test ! -f t2.$ext && echo ok"
+
+)
+rm -rf testdir
+
+# This test is only for bunzip2
+if test "${0##*/}" = "bunzip2.tests"; then
+ if test1_bz2 | ${bb}bunzip2 >/dev/null \
+ && test "`test1_bz2 | ${bb}bunzip2 | md5sum`" = "61bbeee4be9c6f110a71447f584fda7b -"
+ then
+ echo "$unpack: test bz2 file: PASS"
+ else
+ echo "$unpack: test bz2 file: FAIL"
+ fi
+fi
diff --git a/testsuite/bunzip2/bunzip2-reads-from-standard-input b/testsuite/bunzip2/bunzip2-reads-from-standard-input
new file mode 100644
index 0000000..e212a12
--- /dev/null
+++ b/testsuite/bunzip2/bunzip2-reads-from-standard-input
@@ -0,0 +1,2 @@
+echo foo | bzip2 | busybox bunzip2 > output
+echo foo | cmp - output
diff --git a/testsuite/bunzip2/bunzip2-removes-compressed-file b/testsuite/bunzip2/bunzip2-removes-compressed-file
new file mode 100644
index 0000000..f1d1550
--- /dev/null
+++ b/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/testsuite/bunzip2/bzcat-does-not-remove-compressed-file b/testsuite/bunzip2/bzcat-does-not-remove-compressed-file
new file mode 100644
index 0000000..7d4016e
--- /dev/null
+++ b/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/testsuite/busybox.tests b/testsuite/busybox.tests
new file mode 100755
index 0000000..26536c6
--- /dev/null
+++ b/testsuite/busybox.tests
@@ -0,0 +1,46 @@
+#!/bin/sh
+
+# Tests for busybox applet itself.
+# Copyright 2005 by Rob Landley <rob@landley.net>
+# Licensed under GPL v2, see file LICENSE for details.
+
+. testing.sh
+
+HELPDUMP=`busybox`
+
+# We need to test under calling the binary under other names.
+
+
+testing "busybox --help busybox" "busybox --help busybox" "$HELPDUMP\n\n" "" ""
+
+ln -s `which busybox` busybox-suffix
+for i in busybox ./busybox-suffix
+do
+ # The gratuitous "\n"s are due to a shell idiosyncrasy:
+ # environment variables seem to strip trailing whitespace.
+
+ testing "" "$i" "$HELPDUMP\n\n" "" ""
+
+ testing "$i unknown" "$i unknown 2>&1" \
+ "unknown: applet not found\n" "" ""
+
+ testing "$i --help" "$i --help 2>&1" "$HELPDUMP\n\n" "" ""
+
+ optional CAT
+ testing "" "$i cat" "moo" "" "moo"
+ testing "$i --help cat" "$i --help cat 2>&1 | grep prints" \
+ "Concatenates FILE(s) and prints them to stdout.\n" "" ""
+ optional ""
+
+ testing "$i --help unknown" "$i --help unknown 2>&1" \
+ "unknown: applet not found\n" "" ""
+done
+rm busybox-suffix
+
+ln -s `which busybox` unknown
+
+testing "busybox as unknown name" "./unknown 2>&1" \
+ "unknown: applet not found\n" "" ""
+rm unknown
+
+exit $FAILCOUNT
diff --git a/testsuite/bzcat.tests b/testsuite/bzcat.tests
new file mode 100755
index 0000000..0bc7442
--- /dev/null
+++ b/testsuite/bzcat.tests
@@ -0,0 +1,49 @@
+#!/bin/sh
+
+ext=bz2
+
+bb="busybox "
+
+unset LC_ALL
+unset LC_MESSAGES
+unset LANG
+unset LANGUAGE
+
+hello_gz() {
+ # Gzipped "HELLO\n"
+ #_________________________ vvv vvv vvv vvv - mtime
+ $ECHO -ne "\x1f\x8b\x08\x00\x85\x1d\xef\x45\x02\x03\xf3\x70\xf5\xf1\xf1\xe7"
+ $ECHO -ne "\x02\x00\x6e\xd7\xac\xfd\x06\x00\x00\x00"
+}
+
+hello_bz2() {
+ # Bzipped "HELLO\n"
+ $ECHO -ne "\x42\x5a\x68\x39\x31\x41\x59\x26\x53\x59\x5b\xb8\xe8\xa3\x00\x00"
+ $ECHO -ne "\x01\x44\x00\x00\x10\x02\x44\xa0\x00\x30\xcd\x00\xc3\x46\x29\x97"
+ $ECHO -ne "\x17\x72\x45\x38\x50\x90\x5b\xb8\xe8\xa3"
+}
+
+prep() {
+ rm -f t*
+ hello_$ext >t1.$ext
+ hello_$ext >t2.$ext
+}
+
+check() {
+ eval $2 >t_actual 2>&1
+ if $ECHO -ne "$expected" | cmp - t_actual; then
+ echo "$1: PASS"
+ else
+ echo "$1: FAIL"
+ fi
+}
+
+mkdir testdir 2>/dev/null
+(
+cd testdir || { echo "cannot cd testdir!"; exit 1; }
+
+expected="HELLO\nok\n"
+prep; check "bzcat: dont delete src" "${bb}bzcat t2.bz2; test -f t2.bz2 && echo ok"
+
+)
+rm -rf testdir
diff --git a/testsuite/cat/cat-prints-a-file b/testsuite/cat/cat-prints-a-file
new file mode 100644
index 0000000..e3f35a8
--- /dev/null
+++ b/testsuite/cat/cat-prints-a-file
@@ -0,0 +1,3 @@
+echo I WANT > foo
+busybox cat foo >bar
+cmp foo bar
diff --git a/testsuite/cat/cat-prints-a-file-and-standard-input b/testsuite/cat/cat-prints-a-file-and-standard-input
new file mode 100644
index 0000000..bc92318
--- /dev/null
+++ b/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/testsuite/cmp/cmp-detects-difference b/testsuite/cmp/cmp-detects-difference
new file mode 100644
index 0000000..b9bb628
--- /dev/null
+++ b/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/testsuite/comm.tests b/testsuite/comm.tests
new file mode 100755
index 0000000..44169f9
--- /dev/null
+++ b/testsuite/comm.tests
@@ -0,0 +1,19 @@
+#!/bin/sh
+
+# Copyright 2008 by Denys Vlasenko <vda.linux@googlemail.com>
+# Licensed under GPL v2, see file LICENSE for details.
+
+. testing.sh
+
+# testing "description" "command" "result" "infile" "stdin"
+
+testing "comm test 1" "comm input -" "\t123\n""456\n""abc\n""\tdef\n" "456\nabc\n" "123\ndef\n"
+testing "comm test 2" "comm - input" "123\n""\t456\n""\tabc\n""def\n" "456\nabc\n" "123\ndef\n"
+testing "comm test 3" "comm input -" "abc\n""\tdef\n""xyz\n" "abc\nxyz\n" "def\n"
+testing "comm test 4" "comm - input" "\tabc\n""def\n""\txyz\n" "abc\nxyz\n" "def\n"
+testing "comm test 5" "comm input -" "123\n""abc\n""\tdef\n" "123\nabc\n" "def\n"
+testing "comm test 6" "comm - input" "\t123\n""\tabc\n""def\n" "123\nabc\n" "def\n"
+testing "comm unterminated line 1" "comm input -" "abc\n""\tdef\n" "abc" "def"
+testing "comm unterminated line 2" "comm - input" "\tabc\n""def\n" "abc" "def"
+
+exit $FAILCOUNT
diff --git a/testsuite/cp/cp-RHL-does_not_preserve-links b/testsuite/cp/cp-RHL-does_not_preserve-links
new file mode 100644
index 0000000..eed6c3e
--- /dev/null
+++ b/testsuite/cp/cp-RHL-does_not_preserve-links
@@ -0,0 +1,6 @@
+mkdir a
+>a/file
+ln -s file a/link
+busybox cp -RHL a b
+test ! -L b/link
+#sh </dev/tty >/dev/tty 2>&1
diff --git a/testsuite/cp/cp-a-files-to-dir b/testsuite/cp/cp-a-files-to-dir
new file mode 100644
index 0000000..abdbdf7
--- /dev/null
+++ b/testsuite/cp/cp-a-files-to-dir
@@ -0,0 +1,15 @@
+echo file number one > file1
+echo file number two > file2
+ln -s file2 link1
+mkdir dir1
+# why???
+#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/testsuite/cp/cp-a-preserves-links b/testsuite/cp/cp-a-preserves-links
new file mode 100644
index 0000000..0c0cd96
--- /dev/null
+++ b/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/testsuite/cp/cp-copies-empty-file b/testsuite/cp/cp-copies-empty-file
new file mode 100644
index 0000000..ad25aa1
--- /dev/null
+++ b/testsuite/cp/cp-copies-empty-file
@@ -0,0 +1,3 @@
+touch foo
+busybox cp foo bar
+cmp foo bar
diff --git a/testsuite/cp/cp-copies-large-file b/testsuite/cp/cp-copies-large-file
new file mode 100644
index 0000000..c2225c6
--- /dev/null
+++ b/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/testsuite/cp/cp-copies-small-file b/testsuite/cp/cp-copies-small-file
new file mode 100644
index 0000000..d52a887
--- /dev/null
+++ b/testsuite/cp/cp-copies-small-file
@@ -0,0 +1,3 @@
+echo I WANT > foo
+busybox cp foo bar
+cmp foo bar
diff --git a/testsuite/cp/cp-d-files-to-dir b/testsuite/cp/cp-d-files-to-dir
new file mode 100644
index 0000000..9571a56
--- /dev/null
+++ b/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/testsuite/cp/cp-dev-file b/testsuite/cp/cp-dev-file
new file mode 100644
index 0000000..055f0d9
--- /dev/null
+++ b/testsuite/cp/cp-dev-file
@@ -0,0 +1,2 @@
+busybox cp /dev/null foo
+test -f foo
diff --git a/testsuite/cp/cp-dir-create-dir b/testsuite/cp/cp-dir-create-dir
new file mode 100644
index 0000000..a8d7b50
--- /dev/null
+++ b/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/testsuite/cp/cp-dir-existing-dir b/testsuite/cp/cp-dir-existing-dir
new file mode 100644
index 0000000..4c788ba
--- /dev/null
+++ b/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/testsuite/cp/cp-does-not-copy-unreadable-file b/testsuite/cp/cp-does-not-copy-unreadable-file
new file mode 100644
index 0000000..e17e8e6
--- /dev/null
+++ b/testsuite/cp/cp-does-not-copy-unreadable-file
@@ -0,0 +1,11 @@
+touch foo
+chmod a-r foo
+set +e
+if test `id -u` = 0; then
+ # run as user with nonzero uid
+ setuidgid 1 busybox cp foo bar
+else
+ busybox cp foo bar
+fi
+set -e
+test ! -f bar
diff --git a/testsuite/cp/cp-files-to-dir b/testsuite/cp/cp-files-to-dir
new file mode 100644
index 0000000..fdb8191
--- /dev/null
+++ b/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/testsuite/cp/cp-follows-links b/testsuite/cp/cp-follows-links
new file mode 100644
index 0000000..2d9f05e
--- /dev/null
+++ b/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/testsuite/cp/cp-preserves-hard-links b/testsuite/cp/cp-preserves-hard-links
new file mode 100644
index 0000000..4de7b85
--- /dev/null
+++ b/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/testsuite/cp/cp-preserves-links b/testsuite/cp/cp-preserves-links
new file mode 100644
index 0000000..301dc5f
--- /dev/null
+++ b/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/testsuite/cp/cp-preserves-source-file b/testsuite/cp/cp-preserves-source-file
new file mode 100644
index 0000000..f0f5065
--- /dev/null
+++ b/testsuite/cp/cp-preserves-source-file
@@ -0,0 +1,3 @@
+touch foo
+busybox cp foo bar
+test -f foo
diff --git a/testsuite/cpio.tests b/testsuite/cpio.tests
new file mode 100755
index 0000000..eb3e576
--- /dev/null
+++ b/testsuite/cpio.tests
@@ -0,0 +1,83 @@
+#!/bin/sh
+# Copyright 2008 by Denys Vlasenko
+# Licensed under GPL v2, see file LICENSE for details.
+
+. testing.sh
+
+# ls -ln shows date. Need to remove that, it's variable.
+# sed: coalesce spaces
+# cut: remove date
+FILTER_LS="sed 's/ */ /g' | cut -d' ' -f 1-5,9-"
+
+
+# newc cpio archive of directory cpio.testdir with empty x and y hardlinks
+hexdump="\
+\x42\x5a\x68\x39\x31\x41\x59\x26\x53\x59\x64\x1e\x91\x8c\x00\x00\
+\x48\x7f\x80\x4c\x48\x08\x00\x28\x01\xff\xe0\x3f\x24\x14\x00\x0e\
+\x20\xdc\x60\x20\x00\x92\x11\xea\xa0\x1a\x00\x00\x00\x03\x20\x8a\
+\x93\xd4\x9a\x68\x1a\x0d\x1e\x91\xa1\xa0\x06\x98\xe3\x5c\x2f\xd9\
+\x26\xa1\x25\x24\x20\xed\x47\xc7\x21\x40\x2b\x6e\xf2\xe6\xfe\x98\
+\x13\x68\xa8\xbd\x82\xb2\x4f\x26\x02\x24\x16\x5b\x22\x16\x72\x74\
+\x15\xcd\xc1\xa6\x9e\xa6\x5e\x6c\x16\x37\x35\x01\x99\xc4\x81\x21\
+\x29\x28\x4b\x69\x51\xa9\x3c\x1a\x9b\x0a\xe1\xe4\xb4\xaf\x85\x73\
+\xba\x23\x10\x59\xe8\xb3\xe1\xa1\x63\x05\x8c\x4f\xc5\xdc\x91\x4e\
+\x14\x24\x19\x07\xa4\x63\x00"
+
+user=$(id -u)
+group=$(id -g)
+
+rm -rf cpio.testdir cpio.testdir2 2>/dev/null
+
+# testing "test name" "command" "expected result" "file input" "stdin"
+
+testing "cpio extracts zero-sized hardlinks" \
+"$ECHO -ne '$hexdump' | bzcat | cpio -i; echo \$?;
+ls -ln cpio.testdir | $FILTER_LS" \
+"\
+1 blocks
+0
+-rw-r--r-- 2 $user $group 0 x
+-rw-r--r-- 2 $user $group 0 y
+" \
+ "" ""
+
+# Currently fails. Numerous: "1 blocks" versus "1 block",
+# "1 block" must go to stderr, does not list cpio.testdir/x and cpio.testdir/y
+testing "cpio lists hardlinks" \
+"$ECHO -ne '$hexdump' | bzcat | cpio -t 2>&1; echo \$?" \
+"\
+1 block
+cpio.testdir
+cpio.testdir/x
+cpio.testdir/y
+0
+" \
+ "" ""
+
+# More complex case
+rm -rf cpio.testdir cpio.testdir2 2>/dev/null
+mkdir cpio.testdir
+touch cpio.testdir/solo
+touch cpio.testdir/empty
+echo x >cpio.testdir/nonempty
+ln cpio.testdir/empty cpio.testdir/empty1
+ln cpio.testdir/nonempty cpio.testdir/nonempty1
+mkdir cpio.testdir2
+
+testing "cpio extracts zero-sized hardlinks 2" \
+"find cpio.testdir | cpio -H newc --create | (cd cpio.testdir2 && cpio -i); echo \$?;
+ls -ln cpio.testdir2/cpio.testdir | $FILTER_LS" \
+"\
+0
+-rw-r--r-- 2 $user $group 0 empty
+-rw-r--r-- 2 $user $group 0 empty1
+-rw-r--r-- 2 $user $group 2 nonempty
+-rw-r--r-- 2 $user $group 2 nonempty1
+-rw-r--r-- 1 $user $group 0 solo
+" \
+ "" ""
+
+# Clean up
+rm -rf cpio.testdir cpio.testdir2 2>/dev/null
+
+exit $FAILCOUNT
diff --git a/testsuite/cut.tests b/testsuite/cut.tests
new file mode 100755
index 0000000..2788d1f
--- /dev/null
+++ b/testsuite/cut.tests
@@ -0,0 +1,18 @@
+#!/bin/sh
+
+# Copyright 2007 by Denys Vlasenko <vda.linux@googlemail.com>
+# Licensed under GPL v2, see file LICENSE for details.
+
+. testing.sh
+
+# testing "test name" "options" "expected result" "file input" "stdin"
+# file input will be file called "input"
+# test can create a file "actual" instead of writing to stdout
+
+testing "cut '-' (stdin) and multi file handling" \
+ "cut -d' ' -f2 - input" \
+ "over\n""quick\n" \
+ "the quick brown fox\n" \
+ "jumps over the lazy dog\n" \
+
+exit $FAILCOUNT
diff --git a/testsuite/cut/cut-cuts-a-character b/testsuite/cut/cut-cuts-a-character
new file mode 100644
index 0000000..d6c5efa
--- /dev/null
+++ b/testsuite/cut/cut-cuts-a-character
@@ -0,0 +1 @@
+test $(echo abcd | busybox cut -c 3) = c
diff --git a/testsuite/cut/cut-cuts-a-closed-range b/testsuite/cut/cut-cuts-a-closed-range
new file mode 100644
index 0000000..9680b76
--- /dev/null
+++ b/testsuite/cut/cut-cuts-a-closed-range
@@ -0,0 +1 @@
+test $(echo abcd | busybox cut -c 1-2) = ab
diff --git a/testsuite/cut/cut-cuts-a-field b/testsuite/cut/cut-cuts-a-field
new file mode 100644
index 0000000..4c7f440
--- /dev/null
+++ b/testsuite/cut/cut-cuts-a-field
@@ -0,0 +1 @@
+test $(echo -e "f1\tf2\tf3" | busybox cut -f 2) = f2
diff --git a/testsuite/cut/cut-cuts-an-open-range b/testsuite/cut/cut-cuts-an-open-range
new file mode 100644
index 0000000..1fbf277
--- /dev/null
+++ b/testsuite/cut/cut-cuts-an-open-range
@@ -0,0 +1 @@
+test $(echo abcd | busybox cut -c -3) = abc
diff --git a/testsuite/cut/cut-cuts-an-unclosed-range b/testsuite/cut/cut-cuts-an-unclosed-range
new file mode 100644
index 0000000..a2b0cdb
--- /dev/null
+++ b/testsuite/cut/cut-cuts-an-unclosed-range
@@ -0,0 +1 @@
+test $(echo abcd | busybox cut -c 3-) = cd
diff --git a/testsuite/date/date-R-works b/testsuite/date/date-R-works
new file mode 100644
index 0000000..34cd735
--- /dev/null
+++ b/testsuite/date/date-R-works
@@ -0,0 +1 @@
+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 0000000..f2a2091
--- /dev/null
+++ b/testsuite/date/date-format-works
@@ -0,0 +1,4 @@
+# TODO: gnu date doesn't accept '2000.11.22-11:22:33' format,
+# but accepts '2000-11-22 11:22:33'. We must follow.
+test x"01/01/99" = x"`busybox date -d 1999.01.01-11:22:33 '+%d/%m/%y'`"
+test x"22/11/00" = x"`busybox date -d 2000.11.22-11:22:33 '+%d/%m/%y'`"
diff --git a/testsuite/date/date-u-works b/testsuite/date/date-u-works
new file mode 100644
index 0000000..eea6e5a
--- /dev/null
+++ b/testsuite/date/date-u-works
@@ -0,0 +1 @@
+test x"Sat Jan 1 11:22:33 UTC 2000" = x"`TZ=CET-1CEST-2 busybox date -u -d 2000.01.01-11:22:33`"
diff --git a/testsuite/date/date-works b/testsuite/date/date-works
new file mode 100644
index 0000000..0802e88
--- /dev/null
+++ b/testsuite/date/date-works
@@ -0,0 +1,44 @@
+dt=`busybox date`
+# Expected format: Fri Apr 25 03:47:55 CEST 2008
+dt=`echo "$dt" | sed 's/^[^ ][^ ][^ ] [^ ][^ ][^ ] [ 0123][0-9] [012][0-9]:[0-5][0-9]:[0-6][0-9] [A-Z][A-Z]* [012][0-9][0-9][0-9]$/OK/'`
+test x"$dt" = x"OK"
+
+dt=`busybox date -d 1:2`
+dt=`echo "$dt" | cut -b12-19`
+test x"$dt" = x"01:02:00"
+
+dt=`busybox date -d 1:2:3`
+dt=`echo "$dt" | cut -b12-19`
+test x"$dt" = x"01:02:03"
+
+dt=`busybox date -d 1.2-3:4`
+dt=`echo "$dt" | cut -b5-19`
+test x"$dt" = x"Jan 2 03:04:00"
+
+dt=`busybox date -d 1.2-3:4:5`
+dt=`echo "$dt" | cut -b5-19`
+test x"$dt" = x"Jan 2 03:04:05"
+
+dt=`busybox date -d 1999.1.2-3:4`
+dt=`echo "$dt" | cut -b1-19`
+test x"$dt" = x"Sat Jan 2 03:04:00"
+
+dt=`busybox date -d 1999.1.2-3:4:5`
+dt=`echo "$dt" | cut -b1-19`
+test x"$dt" = x"Sat Jan 2 03:04:05"
+
+dt=`busybox date -d '1999-1-2 3:4:5'`
+dt=`echo "$dt" | cut -b1-19`
+test x"$dt" = x"Sat Jan 2 03:04:05"
+
+dt=`busybox date -d 01231133`
+dt=`echo "$dt" | cut -b5-19`
+test x"$dt" = x"Jan 23 11:33:00"
+
+dt=`busybox date -d 012311332000`
+dt=`echo "$dt" | cut -b1-19`
+test x"$dt" = x"Sun Jan 23 11:33:00"
+
+dt=`busybox date -d 012311332000.30`
+dt=`echo "$dt" | cut -b1-19`
+test x"$dt" = x"Sun Jan 23 11:33:30"
diff --git a/testsuite/date/date-works-1 b/testsuite/date/date-works-1
new file mode 100644
index 0000000..e318944
--- /dev/null
+++ b/testsuite/date/date-works-1
@@ -0,0 +1,129 @@
+dt=`busybox date -d 1:2 +%T`
+test x"$dt" = x"01:02:00"
+
+dt=`busybox date -d 1:2:3 +%T`
+test x"$dt" = x"01:02:03"
+
+host_date=/bin/date
+
+# date (GNU coreutils) 6.10 reports:
+# date: invalid date '1.2-3:4'
+# busybox 1.11.0.svn date reports:
+# date: invalid date '1/2 3:4'
+
+# TODO: (1) compare with strings, not "host date"
+# (2) implement d/m[/y] hh:mm[:ss] fmt in date applet
+#hdt=`$host_date -d '1/2 3:4'`
+#dt=`busybox date -d 1.2-3:4`
+#test x"$hdt" = x"$dt"
+
+#hdt=`$host_date -d '1/2 3:4:5'`
+#dt=`busybox date -d 1.2-3:4:5`
+#test x"$hdt" = x"$dt"
+
+#hdt=`$host_date -d '1/2/1999 3:4'`
+#dt=`busybox date -d 1999.1.2-3:4`
+#test x"$hdt" = x"$dt"
+
+#hdt=`$host_date -d '1/2/1999 3:4:5'`
+#dt=`busybox date -d 1999.1.2-3:4:5`
+#test x"$hdt" = x"$dt"
+
+hdt=`$host_date -d '1999-1-2 3:4:5'`
+dt=`busybox date -d '1999-1-2 3:4:5'`
+test x"$hdt" = x"$dt"
+
+# Avoiding using week day in this evaluation, as it's mostly different every year
+# date (GNU coreutils) 6.10 reports:
+# date: invalid date '01231133'
+dt=`busybox date -d 01231133 +%c`
+dt=`echo "$dt" | cut -b5-19`
+test x"$dt" = x"Jan 23 11:33:00"
+
+# date (GNU coreutils) 6.10 reports:
+# date: invalid date '012311332000'
+dt=`busybox date -d 012311332000 +%c`
+test x"$dt" = x"Sun Jan 23 11:33:00 2000"
+
+# date (GNU coreutils) 6.10 reports:
+# date: invalid date '012311332000'
+dt=`busybox date -d 012311332000.30 +%c`
+test x"$dt" = x"Sun Jan 23 11:33:30 2000"
+
+lcbbd="LC_ALL=C busybox date"
+wd=$(eval $lcbbd +%a) # weekday name
+mn=$(eval $lcbbd +%b) # month name
+dm=$(eval $lcbbd +%e) # day of month, space padded
+h=$(eval $lcbbd +%H) # hour, zero padded
+m=$(eval $lcbbd +%M) # minute, zero padded
+s=$(eval $lcbbd +%S) # second, zero padded
+z=$(eval $lcbbd -u +%Z) # time zone abbreviation
+y=$(eval $lcbbd +%Y) # year
+
+res=OK
+case $wd in
+ Sun)
+ ;;
+ Mon)
+ ;;
+ Tue)
+ ;;
+ Wed)
+ ;;
+ Thu)
+ ;;
+ Fri)
+ ;;
+ Sat)
+ ;;
+ *)
+ res=BAD
+ ;;
+esac
+
+case $mn in
+ Jan)
+ ;;
+ Feb)
+ ;;
+ Mar)
+ ;;
+ Apr)
+ ;;
+ May)
+ ;;
+ Jun)
+ ;;
+ Jul)
+ ;;
+ Aug)
+ ;;
+ Sep)
+ ;;
+ Oct)
+ ;;
+ Nov)
+ ;;
+ Dec)
+ ;;
+ *)
+ res=BAD
+ ;;
+esac
+
+dm=${dm# *}
+[ $dm -ge 1 ] && [ $dm -le 31 ] || res=BAD
+h=${h#0}
+[ $h -ge 0 ] && [ $h -le 23 ] || res=BAD
+m=${m#0}
+[ $m -ge 0 ] && [ $m -le 59 ] || res=BAD
+s=${s#0}
+[ $s -ge 0 ] && [ $s -le 59 ] || res=BAD
+[ $z = UTC ] || res=BAD
+[ $y -ge 1970 ] || res=BAD
+
+test x"$res" = xOK
+
+# This should error out (by showing usage text). Testing for that
+dt=`busybox date -d 012311332000.30 %+c 2>&1 | head -n 1`
+test x"${dt#BusyBox * multi-call binary}" = x
diff --git a/testsuite/dd/dd-accepts-if b/testsuite/dd/dd-accepts-if
new file mode 100644
index 0000000..03d1af8
--- /dev/null
+++ b/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/testsuite/dd/dd-accepts-of b/testsuite/dd/dd-accepts-of
new file mode 100644
index 0000000..84405e6
--- /dev/null
+++ b/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/testsuite/dd/dd-copies-from-standard-input-to-standard-output b/testsuite/dd/dd-copies-from-standard-input-to-standard-output
new file mode 100644
index 0000000..d890eb0
--- /dev/null
+++ b/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/testsuite/dd/dd-prints-count-to-standard-error b/testsuite/dd/dd-prints-count-to-standard-error
new file mode 100644
index 0000000..2187dc0
--- /dev/null
+++ b/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/testsuite/dd/dd-reports-write-errors b/testsuite/dd/dd-reports-write-errors
new file mode 100644
index 0000000..4920600
--- /dev/null
+++ b/testsuite/dd/dd-reports-write-errors
@@ -0,0 +1,2 @@
+busybox dd if="$0" of=/dev/full 2>/dev/null || status=$?
+test $status = 1
diff --git a/testsuite/diff.tests b/testsuite/diff.tests
new file mode 100755
index 0000000..ac68a08
--- /dev/null
+++ b/testsuite/diff.tests
@@ -0,0 +1,124 @@
+#!/bin/sh
+# Copyright 2008 by Denys Vlasenko
+# Licensed under GPL v2, see file LICENSE for details.
+
+. testing.sh
+
+# testing "test name" "options" "expected result" "file input" "stdin"
+
+# diff outputs date/time in the header, which should not be analysed
+# NB: sed has tab character in s command!
+TRIM_TAB="sed 's/ .*//'"
+
+testing "diff of stdin" \
+ "diff -u - input | $TRIM_TAB" \
+"\
+--- -
++++ input
+@@ -1 +1,3 @@
++qwe
+ asd
++zxc
+" \
+ "qwe\nasd\nzxc\n" \
+ "asd\n"
+
+testing "diff of stdin, no newline in the file" \
+ "diff -u - input | $TRIM_TAB" \
+"\
+--- -
++++ input
+@@ -1 +1,3 @@
++qwe
+ asd
++zxc
+\\ No newline at end of file
+" \
+ "qwe\nasd\nzxc" \
+ "asd\n"
+
+# we also test that stdin is in fact NOT read
+testing "diff of stdin, twice" \
+ "diff - -; echo $?; wc -c" \
+ "0\n5\n" \
+ "" \
+ "stdin"
+
+# testing "test name" "options" "expected result" "file input" "stdin"
+
+rm -rf diff1 diff2
+mkdir diff1 diff2 diff2/subdir
+echo qwe >diff1/-
+echo asd >diff2/subdir/-
+testing "diff diff1 diff2/subdir" \
+ "diff -ur diff1 diff2/subdir | $TRIM_TAB" \
+"\
+--- diff1/-
++++ diff2/subdir/-
+@@ -1 +1 @@
+-qwe
++asd
+" \
+ "" ""
+
+# using directory structure from prev test...
+testing "diff dir dir2/file/-" \
+ "diff -ur diff1 diff2/subdir/- | $TRIM_TAB" \
+"\
+--- diff1/-
++++ diff2/subdir/-
+@@ -1 +1 @@
+-qwe
++asd
+" \
+ "" ""
+
+# using directory structure from prev test...
+mkdir diff1/test
+mkfifo diff2/subdir/test
+testing "diff of dir and fifo" \
+ "diff -ur diff1 diff2/subdir | $TRIM_TAB" \
+"\
+--- diff1/-
++++ diff2/subdir/-
+@@ -1 +1 @@
+-qwe
++asd
+Only in diff2/subdir: test
+" \
+ "" ""
+
+# using directory structure from prev test...
+rmdir diff1/test
+echo >diff1/test
+testing "diff of file and fifo" \
+ "diff -ur diff1 diff2/subdir | $TRIM_TAB" \
+"\
+--- diff1/-
++++ diff2/subdir/-
+@@ -1 +1 @@
+-qwe
++asd
+File diff2/subdir/test is not a regular file or directory and was skipped
+" \
+ "" ""
+
+# using directory structure from prev test...
+mkfifo diff1/test2
+testing "diff -rN does not read non-regular files" \
+ "diff -urN diff1 diff2/subdir | $TRIM_TAB" \
+"\
+--- diff1/-
++++ diff2/subdir/-
+@@ -1 +1 @@
+-qwe
++asd
+File diff2/subdir/test is not a regular file or directory and was skipped
+File diff1/test2 is not a regular file or directory and was skipped
+" \
+ "" ""
+
+# clean up
+rm -rf diff1 diff2
+
+exit $FAILCOUNT
diff --git a/testsuite/dirname/dirname-handles-absolute-path b/testsuite/dirname/dirname-handles-absolute-path
new file mode 100644
index 0000000..ca1a51b
--- /dev/null
+++ b/testsuite/dirname/dirname-handles-absolute-path
@@ -0,0 +1 @@
+test $(busybox dirname /foo/bar/baz) = /foo/bar
diff --git a/testsuite/dirname/dirname-handles-empty-path b/testsuite/dirname/dirname-handles-empty-path
new file mode 100644
index 0000000..04134a5
--- /dev/null
+++ b/testsuite/dirname/dirname-handles-empty-path
@@ -0,0 +1 @@
+test $(busybox dirname '') = .
diff --git a/testsuite/dirname/dirname-handles-multiple-slashes b/testsuite/dirname/dirname-handles-multiple-slashes
new file mode 100644
index 0000000..286f253
--- /dev/null
+++ b/testsuite/dirname/dirname-handles-multiple-slashes
@@ -0,0 +1 @@
+test $(busybox dirname foo/bar///baz) = foo/bar
diff --git a/testsuite/dirname/dirname-handles-relative-path b/testsuite/dirname/dirname-handles-relative-path
new file mode 100644
index 0000000..ffe4ab4
--- /dev/null
+++ b/testsuite/dirname/dirname-handles-relative-path
@@ -0,0 +1 @@
+test $(busybox dirname foo/bar/baz) = foo/bar
diff --git a/testsuite/dirname/dirname-handles-root b/testsuite/dirname/dirname-handles-root
new file mode 100644
index 0000000..6bd62b8
--- /dev/null
+++ b/testsuite/dirname/dirname-handles-root
@@ -0,0 +1 @@
+test $(busybox dirname /) = /
diff --git a/testsuite/dirname/dirname-handles-single-component b/testsuite/dirname/dirname-handles-single-component
new file mode 100644
index 0000000..24f9ae1
--- /dev/null
+++ b/testsuite/dirname/dirname-handles-single-component
@@ -0,0 +1 @@
+test $(busybox dirname foo) = .
diff --git a/testsuite/dirname/dirname-works b/testsuite/dirname/dirname-works
new file mode 100644
index 0000000..f339c8f
--- /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 0000000..3f8ff3d
--- /dev/null
+++ b/testsuite/du/du-h-works
@@ -0,0 +1,4 @@
+d=/bin
+du -h "$d" > logfile.gnu
+busybox du -h "$d" > 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 0000000..6c2c5d0
--- /dev/null
+++ b/testsuite/du/du-k-works
@@ -0,0 +1,4 @@
+d=/bin
+du -k "$d" > logfile.gnu
+busybox du -k "$d" > 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 0000000..c3d2ec0
--- /dev/null
+++ b/testsuite/du/du-l-works
@@ -0,0 +1,4 @@
+d=/bin
+du -l "$d" > logfile.gnu
+busybox du -l "$d" > 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 0000000..bf0a90e
--- /dev/null
+++ b/testsuite/du/du-m-works
@@ -0,0 +1,4 @@
+d=/bin
+du -m "$d" > logfile.gnu
+busybox du -m "$d" > 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 0000000..ae97077
--- /dev/null
+++ b/testsuite/du/du-s-works
@@ -0,0 +1,4 @@
+d=/bin
+du -s "$d" > logfile.gnu
+busybox du -s "$d" > logfile.bb
+cmp logfile.gnu logfile.bb
diff --git a/testsuite/du/du-works b/testsuite/du/du-works
new file mode 100644
index 0000000..46a336d
--- /dev/null
+++ b/testsuite/du/du-works
@@ -0,0 +1,4 @@
+d=/bin
+du "$d" > logfile.gnu
+busybox du "$d" > logfile.bb
+cmp logfile.gnu logfile.bb
diff --git a/testsuite/echo/echo-does-not-print-newline b/testsuite/echo/echo-does-not-print-newline
new file mode 100644
index 0000000..2ed03ca
--- /dev/null
+++ b/testsuite/echo/echo-does-not-print-newline
@@ -0,0 +1 @@
+test `busybox echo -n word | wc -c` -eq 4
diff --git a/testsuite/echo/echo-prints-argument b/testsuite/echo/echo-prints-argument
new file mode 100644
index 0000000..479dac8
--- /dev/null
+++ b/testsuite/echo/echo-prints-argument
@@ -0,0 +1 @@
+test xfubar = x`busybox echo fubar`
diff --git a/testsuite/echo/echo-prints-arguments b/testsuite/echo/echo-prints-arguments
new file mode 100644
index 0000000..4e4e3b4
--- /dev/null
+++ b/testsuite/echo/echo-prints-arguments
@@ -0,0 +1 @@
+test "`busybox echo foo bar`" = "foo bar"
diff --git a/testsuite/echo/echo-prints-newline b/testsuite/echo/echo-prints-newline
new file mode 100644
index 0000000..838671e
--- /dev/null
+++ b/testsuite/echo/echo-prints-newline
@@ -0,0 +1 @@
+test `busybox echo word | wc -c` -eq 5
diff --git a/testsuite/echo/echo-prints-slash-zero b/testsuite/echo/echo-prints-slash-zero
new file mode 100644
index 0000000..d246632
--- /dev/null
+++ b/testsuite/echo/echo-prints-slash-zero
@@ -0,0 +1 @@
+test "`busybox echo -e -n 'msg\n\0' | od -t x1 | head -n 1`" = "0000000 6d 73 67 0a 00"
diff --git a/testsuite/expand/expand-works-like-GNU b/testsuite/expand/expand-works-like-GNU
new file mode 100644
index 0000000..ee8c793
--- /dev/null
+++ b/testsuite/expand/expand-works-like-GNU
@@ -0,0 +1,18 @@
+rm -f foo bar
+echo -e "\ty" | expand -t 3 ../../busybox > foo
+echo -e "\ty" | busybox unexpand -t 3 ../../busybox > bar
+set +e
+test ! -f foo -a -f bar
+if [ $? = 0 ] ; then
+ set -e
+ diff -q foo bar
+fi
+rm -f foo bar
+echo -e "\ty\tx" | expand -it 3 ../../busybox > foo
+echo -e "\ty\tx" | busybox unexpand -it 3 ../../busybox > bar
+set +e
+test ! -f foo -a -f bar
+if [ $? = 0 ] ; then
+ set -e
+ diff -q foo bar
+fi
diff --git a/testsuite/expr/expr-big b/testsuite/expr/expr-big
new file mode 100644
index 0000000..23dbbb3
--- /dev/null
+++ b/testsuite/expr/expr-big
@@ -0,0 +1,16 @@
+# busybox expr
+
+# 3*1000*1000*1000 overflows 32-bit signed int
+res=`busybox expr 0 '<' 3000000000`
+[ x"$res" = x1 ] || exit 1
+
+# 9223372036854775807 = 2^31-1
+res=`busybox expr 0 '<' 9223372036854775807`
+[ x"$res" = x1 ] || exit 1
+# coreutils fails this one!
+res=`busybox expr -9223372036854775800 '<' 9223372036854775807`
+[ x"$res" = x1 ] || exit 1
+
+# This one works only by chance
+# res=`busybox expr 0 '<' 9223372036854775808`
+# [ x"$res" = x1 ] || exit 1
diff --git a/testsuite/expr/expr-works b/testsuite/expr/expr-works
new file mode 100644
index 0000000..af49ac4
--- /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/false/false-is-silent b/testsuite/false/false-is-silent
new file mode 100644
index 0000000..8a9aa0c
--- /dev/null
+++ b/testsuite/false/false-is-silent
@@ -0,0 +1 @@
+busybox false 2>&1 | cmp - /dev/null
diff --git a/testsuite/false/false-returns-failure b/testsuite/false/false-returns-failure
new file mode 100644
index 0000000..1a061f2
--- /dev/null
+++ b/testsuite/false/false-returns-failure
@@ -0,0 +1 @@
+! busybox false
diff --git a/testsuite/find/find-supports-minus-xdev b/testsuite/find/find-supports-minus-xdev
new file mode 100644
index 0000000..4c559a1
--- /dev/null
+++ b/testsuite/find/find-supports-minus-xdev
@@ -0,0 +1 @@
+busybox find . -xdev >/dev/null 2>&1
diff --git a/testsuite/grep.tests b/testsuite/grep.tests
new file mode 100755
index 0000000..8cee1b9
--- /dev/null
+++ b/testsuite/grep.tests
@@ -0,0 +1,88 @@
+#!/bin/sh
+
+# Copyright 2005 by Rob Landley <rob@landley.net>
+# Licensed under GPL v2, see file LICENSE for details.
+
+# AUDIT:
+
+. testing.sh
+
+# testing "test name" "options" "expected result" "file input" "stdin"
+# file input will be file called "input"
+# test can create a file "actual" instead of writing to stdout
+
+# Test exit status
+
+testing "grep (exit with error)" "grep nonexistent 2> /dev/null ; echo \$?" \
+ "1\n" "" ""
+testing "grep (exit success)" "grep grep $0 > /dev/null 2>&1 ; echo \$?" "0\n" \
+ "" ""
+# Test various data sources and destinations
+
+testing "grep (default to stdin)" "grep two" "two\n" "" \
+ "one\ntwo\nthree\nthree\nthree\n"
+testing "grep - (specify stdin)" "grep two -" "two\n" "" \
+ "one\ntwo\nthree\nthree\nthree\n"
+testing "grep input (specify file)" "grep two input" "two\n" \
+ "one\ntwo\nthree\nthree\nthree\n" ""
+
+# GNU grep 2.5.3 outputs a new line character after the located string
+# even if there is no new line character in the input
+testing "grep (no newline at EOL)" "grep bug input" "bug\n" "bug" ""
+
+>empty
+testing "grep two files" "grep two input empty 2>/dev/null" \
+ "input:two\n" "one\ntwo\nthree\nthree\nthree\n" ""
+rm empty
+
+testing "grep - infile (specify stdin and file)" "grep two - input" \
+ "(standard input):two\ninput:two\n" "one\ntwo\nthree\n" \
+ "one\ntwo\ntoo\nthree\nthree\n"
+
+# Check if we see the correct return value if both stdin and non-existing file
+# are given.
+testing "grep - nofile (specify stdin and nonexisting file)" \
+ "grep two - nonexistent 2> /dev/null ; echo \$?" \
+ "(standard input):two\n(standard input):two\n2\n" \
+ "" "one\ntwo\ntwo\nthree\nthree\nthree\n"
+testing "grep -q - nofile (specify stdin and nonexisting file, no match)" \
+ "grep -q nomatch - nonexistent 2> /dev/null ; echo \$?" \
+ "2\n" "" "one\ntwo\ntwo\nthree\nthree\nthree\n"
+# SUSv3: If the -q option is specified, the exit status shall be zero
+# if an input line is selected, even if an error was detected.
+testing "grep -q - nofile (specify stdin and nonexisting file, match)" \
+ "grep -q two - nonexistent ; echo \$?" \
+ "0\n" "" "one\ntwo\ntwo\nthree\nthree\nthree\n"
+
+# Test various command line options
+# -s no error messages
+testing "grep -s nofile (nonexisting file, no match)" \
+ "grep -s nomatch nonexistent ; echo \$?" "2\n" "" ""
+testing "grep -s nofile - (stdin and nonexisting file, match)" \
+ "grep -s domatch nonexistent - ; echo \$?" \
+ "(standard input):domatch\n2\n" "" "nomatch\ndomatch\nend\n"
+
+testing "grep handles NUL in files" "grep -a foo input" "\0foo\n" "\0foo\n\n" ""
+testing "grep handles NUL on stdin" "grep -a foo" "\0foo\n" "" "\0foo\n\n"
+
+testing "grep matches NUL" "grep . input > /dev/null 2>&1 ; echo \$?" \
+ "0\n" "\0\n" ""
+
+# -e regex
+testing "grep handles multiple regexps" "grep -e one -e two input ; echo \$?" \
+ "one\ntwo\n0\n" "one\ntwo\n" ""
+testing "grep -F handles multiple expessions" "grep -F -e one -e two input ; echo \$?" \
+ "one\ntwo\n0\n" "one\ntwo\n" ""
+
+# -f file/-
+testing "grep can read regexps from stdin" "grep -f - input ; echo \$?" \
+ "two\nthree\n0\n" "tw\ntwo\nthree\n" "tw.\nthr\n"
+
+optional FEATURE_GREP_EGREP_ALIAS
+testing "grep -E supports extended regexps" "grep -E fo+" "foo\n" "" \
+ "b\ar\nfoo\nbaz"
+testing "grep is also egrep" "egrep foo" "foo\n" "" "foo\nbar\n"
+testing "egrep is not case insensitive" \
+ "egrep foo ; [ \$? -ne 0 ] && echo yes" "yes\n" "" "FOO\n"
+
+exit $FAILCOUNT
diff --git a/testsuite/gunzip.tests b/testsuite/gunzip.tests
new file mode 100755
index 0000000..d781004
--- /dev/null
+++ b/testsuite/gunzip.tests
@@ -0,0 +1,3 @@
+#!/bin/sh
+
+. bunzip2.tests
diff --git a/testsuite/gunzip/gunzip-reads-from-standard-input b/testsuite/gunzip/gunzip-reads-from-standard-input
new file mode 100644
index 0000000..7c498c0
--- /dev/null
+++ b/testsuite/gunzip/gunzip-reads-from-standard-input
@@ -0,0 +1,2 @@
+echo foo | gzip | busybox gunzip > output
+echo foo | cmp - output
diff --git a/testsuite/gzip/gzip-accepts-multiple-files b/testsuite/gzip/gzip-accepts-multiple-files
new file mode 100644
index 0000000..8f0d9c8
--- /dev/null
+++ b/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/testsuite/gzip/gzip-accepts-single-minus b/testsuite/gzip/gzip-accepts-single-minus
new file mode 100644
index 0000000..8b51fdf
--- /dev/null
+++ b/testsuite/gzip/gzip-accepts-single-minus
@@ -0,0 +1 @@
+echo foo | busybox gzip - >/dev/null
diff --git a/testsuite/gzip/gzip-removes-original-file b/testsuite/gzip/gzip-removes-original-file
new file mode 100644
index 0000000..b9cb995
--- /dev/null
+++ b/testsuite/gzip/gzip-removes-original-file
@@ -0,0 +1,3 @@
+touch foo
+busybox gzip foo
+test ! -f foo
diff --git a/testsuite/head/head-n-works b/testsuite/head/head-n-works
new file mode 100644
index 0000000..db43255
--- /dev/null
+++ b/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/testsuite/head/head-works b/testsuite/head/head-works
new file mode 100644
index 0000000..56ad3e3
--- /dev/null
+++ b/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/testsuite/hostid/hostid-works b/testsuite/hostid/hostid-works
new file mode 100644
index 0000000..e85698e
--- /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 0000000..a9aeb92
--- /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 0000000..68a3e67
--- /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 0000000..172b944
--- /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 0000000..f51a406
--- /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 0000000..671fc53
--- /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 0000000..2358cb0
--- /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 0000000..db390e7
--- /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 0000000..6b0fcb0
--- /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 0000000..2f6e23f
--- /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 0000000..e875e4c
--- /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 0000000..c96b7d6
--- /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 0000000..cab8d1d
--- /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 0000000..47fb989
--- /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 0000000..a8123ec
--- /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 0000000..8ad484f
--- /dev/null
+++ b/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/testsuite/ls/ls-h-works b/testsuite/ls/ls-h-works
new file mode 100644
index 0000000..7331262
--- /dev/null
+++ b/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/testsuite/ls/ls-l-works b/testsuite/ls/ls-l-works
new file mode 100644
index 0000000..efc2b19
--- /dev/null
+++ b/testsuite/ls/ls-l-works
@@ -0,0 +1,4 @@
+[ -n "$d" ] || d=..
+LC_ALL=C ls -l "$d" > logfile.gnu
+busybox ls -l "$d" > logfile.bb
+diff -w logfile.gnu logfile.bb
diff --git a/testsuite/ls/ls-s-works b/testsuite/ls/ls-s-works
new file mode 100644
index 0000000..6c8bf36
--- /dev/null
+++ b/testsuite/ls/ls-s-works
@@ -0,0 +1,4 @@
+[ -n "$d" ] || d=..
+LC_ALL=C ls -1s "$d" > logfile.gnu
+busybox ls -1s "$d" > logfile.bb
+cmp logfile.gnu logfile.bb
diff --git a/testsuite/makedevs.device_table.txt b/testsuite/makedevs.device_table.txt
new file mode 100644
index 0000000..4400083
--- /dev/null
+++ b/testsuite/makedevs.device_table.txt
@@ -0,0 +1,172 @@
+# When building a target filesystem, it is desirable to not have to
+# become root and then run 'mknod' a thousand times. Using a device
+# table you can create device nodes and directories "on the fly".
+#
+# This is a sample device table file for use with genext2fs. You can
+# do all sorts of interesting things with a device table file. For
+# example, if you want to adjust the permissions on a particular file
+# you can just add an entry like:
+# /sbin/foobar f 2755 0 0 - - - - -
+# and (assuming the file /sbin/foobar exists) it will be made setuid
+# root (regardless of what its permissions are on the host filesystem.
+# Furthermore, you can use a single table entry to create a many device
+# minors. For example, if I wanted to create /dev/hda and /dev/hda[0-15]
+# I could just use the following two table entries:
+# /dev/hda b 640 0 0 3 0 0 0 -
+# /dev/hda b 640 0 0 3 1 1 1 15
+#
+# Device table entries take the form of:
+# <name> <type> <mode> <uid> <gid> <major> <minor> <start> <inc> <count>
+# where name is the file name, type can be one of:
+# f A regular file
+# d Directory
+# c Character special device file
+# b Block special device file
+# p Fifo (named pipe)
+# uid is the user id for the target file, gid is the group id for the
+# target file. The rest of the entries (major, minor, etc) apply only
+# to device special files.
+
+# Have fun
+# -Erik Andersen <andersen@codepoet.org>
+#
+
+#<name> <type> <mode> <uid> <gid> <major> <minor> <start> <inc> <count>
+/dev d 755 0 0 - - - - -
+/dev/pts d 755 0 0 - - - - -
+/dev/shm d 755 0 0 - - - - -
+/tmp d 1777 0 0 - - - - -
+/etc d 755 0 0 - - - - -
+/home/default d 2755 1000 1000 - - - - -
+#<name> <type> <mode> <uid> <gid> <major> <minor> <start> <inc> <count>
+###/bin/busybox f 4755 0 0 - - - - -
+###/etc/shadow f 600 0 0 - - - - -
+###/etc/passwd f 644 0 0 - - - - -
+/etc/network/if-up.d d 755 0 0 - - - - -
+/etc/network/if-pre-up.d d 755 0 0 - - - - -
+/etc/network/if-down.d d 755 0 0 - - - - -
+/etc/network/if-post-down.d d 755 0 0 - - - - -
+###/usr/share/udhcpc/default.script f 755 0 0 - - - - -
+# uncomment this to allow starting x as non-root
+#/usr/X11R6/bin/Xfbdev f 4755 0 0 - - - - -
+
+# Normal system devices
+# <name> <type> <mode> <uid> <gid> <major> <minor> <start> <inc> <count>
+/dev/mem c 640 0 0 1 1 0 0 -
+/dev/kmem c 640 0 0 1 2 0 0 -
+/dev/null c 666 0 0 1 3 0 0 -
+/dev/zero c 666 0 0 1 5 0 0 -
+/dev/random c 666 0 0 1 8 0 0 -
+/dev/urandom c 666 0 0 1 9 0 0 -
+/dev/ram b 640 0 0 1 1 0 0 -
+/dev/ram b 640 0 0 1 0 0 1 4
+/dev/loop b 640 0 0 7 0 0 1 2
+/dev/rtc c 640 0 0 10 135 - - -
+/dev/console c 666 0 0 5 1 - - -
+/dev/tty c 666 0 0 5 0 - - -
+/dev/tty c 666 0 0 4 0 0 1 8
+/dev/ttyp c 666 0 0 3 0 0 1 10
+/dev/ptyp c 666 0 0 2 0 0 1 10
+/dev/ptmx c 666 0 0 5 2 - - -
+/dev/ttyP c 666 0 0 57 0 0 1 4
+/dev/ttyS c 666 0 0 4 64 0 1 4
+/dev/fb c 640 0 5 29 0 0 32 4
+#/dev/ttySA c 666 0 0 204 5 0 1 3
+/dev/psaux c 666 0 0 10 1 0 0 -
+#/dev/ppp c 666 0 0 108 0 - - -
+
+# Input stuff
+/dev/input d 755 0 0 - - - - -
+/dev/input/mice c 640 0 0 13 63 0 0 -
+/dev/input/mouse c 660 0 0 13 32 0 1 4
+/dev/input/event c 660 0 0 13 64 0 1 4
+#/dev/input/js c 660 0 0 13 0 0 1 4
+
+
+# MTD stuff
+/dev/mtd c 640 0 0 90 0 0 2 4
+/dev/mtdblock b 640 0 0 31 0 0 1 4
+
+#Tun/tap driver
+/dev/net d 755 0 0 - - - - -
+/dev/net/tun c 660 0 0 10 200 - - -
+
+# Audio stuff
+#/dev/audio c 666 0 29 14 4 - - -
+#/dev/audio1 c 666 0 29 14 20 - - -
+#/dev/dsp c 666 0 29 14 3 - - -
+#/dev/dsp1 c 666 0 29 14 19 - - -
+#/dev/sndstat c 666 0 29 14 6 - - -
+
+# User-mode Linux stuff
+#/dev/ubda b 640 0 0 98 0 0 0 -
+#/dev/ubda b 640 0 0 98 1 1 1 15
+
+# IDE Devices
+/dev/hda b 640 0 0 3 0 0 0 -
+/dev/hda b 640 0 0 3 1 1 1 15
+/dev/hdb b 640 0 0 3 64 0 0 -
+/dev/hdb b 640 0 0 3 65 1 1 15
+#/dev/hdc b 640 0 0 22 0 0 0 -
+#/dev/hdc b 640 0 0 22 1 1 1 15
+#/dev/hdd b 640 0 0 22 64 0 0 -
+#/dev/hdd b 640 0 0 22 65 1 1 15
+#/dev/hde b 640 0 0 33 0 0 0 -
+#/dev/hde b 640 0 0 33 1 1 1 15
+#/dev/hdf b 640 0 0 33 64 0 0 -
+#/dev/hdf b 640 0 0 33 65 1 1 15
+#/dev/hdg b 640 0 0 34 0 0 0 -
+#/dev/hdg b 640 0 0 34 1 1 1 15
+#/dev/hdh b 640 0 0 34 64 0 0 -
+#/dev/hdh b 640 0 0 34 65 1 1 15
+
+# SCSI Devices
+#/dev/sda b 640 0 0 8 0 0 0 -
+#/dev/sda b 640 0 0 8 1 1 1 15
+#/dev/sdb b 640 0 0 8 16 0 0 -
+#/dev/sdb b 640 0 0 8 17 1 1 15
+#/dev/sdc b 640 0 0 8 32 0 0 -
+#/dev/sdc b 640 0 0 8 33 1 1 15
+#/dev/sdd b 640 0 0 8 48 0 0 -
+#/dev/sdd b 640 0 0 8 49 1 1 15
+#/dev/sde b 640 0 0 8 64 0 0 -
+#/dev/sde b 640 0 0 8 65 1 1 15
+#/dev/sdf b 640 0 0 8 80 0 0 -
+#/dev/sdf b 640 0 0 8 81 1 1 15
+#/dev/sdg b 640 0 0 8 96 0 0 -
+#/dev/sdg b 640 0 0 8 97 1 1 15
+#/dev/sdh b 640 0 0 8 112 0 0 -
+#/dev/sdh b 640 0 0 8 113 1 1 15
+#/dev/sg c 640 0 0 21 0 0 1 15
+#/dev/scd b 640 0 0 11 0 0 1 15
+#/dev/st c 640 0 0 9 0 0 1 8
+#/dev/nst c 640 0 0 9 128 0 1 8
+#/dev/st c 640 0 0 9 32 1 1 4
+#/dev/st c 640 0 0 9 64 1 1 4
+#/dev/st c 640 0 0 9 96 1 1 4
+
+# Floppy disk devices
+#/dev/fd b 640 0 0 2 0 0 1 2
+#/dev/fd0d360 b 640 0 0 2 4 0 0 -
+#/dev/fd1d360 b 640 0 0 2 5 0 0 -
+#/dev/fd0h1200 b 640 0 0 2 8 0 0 -
+#/dev/fd1h1200 b 640 0 0 2 9 0 0 -
+#/dev/fd0u1440 b 640 0 0 2 28 0 0 -
+#/dev/fd1u1440 b 640 0 0 2 29 0 0 -
+#/dev/fd0u2880 b 640 0 0 2 32 0 0 -
+#/dev/fd1u2880 b 640 0 0 2 33 0 0 -
+
+# All the proprietary cdrom devices in the world
+#/dev/aztcd b 640 0 0 29 0 0 0 -
+#/dev/bpcd b 640 0 0 41 0 0 0 -
+#/dev/capi20 c 640 0 0 68 0 0 1 2
+#/dev/cdu31a b 640 0 0 15 0 0 0 -
+#/dev/cdu535 b 640 0 0 24 0 0 0 -
+#/dev/cm206cd b 640 0 0 32 0 0 0 -
+#/dev/sjcd b 640 0 0 18 0 0 0 -
+#/dev/sonycd b 640 0 0 15 0 0 0 -
+#/dev/gscd b 640 0 0 16 0 0 0 -
+#/dev/sbpcd b 640 0 0 25 0 0 0 -
+#/dev/sbpcd b 640 0 0 25 0 0 1 4
+#/dev/mcd b 640 0 0 23 0 0 0 -
+#/dev/optcd b 640 0 0 17 0 0 0 -
diff --git a/testsuite/makedevs.tests b/testsuite/makedevs.tests
new file mode 100755
index 0000000..9e068bd
--- /dev/null
+++ b/testsuite/makedevs.tests
@@ -0,0 +1,139 @@
+#!/bin/sh
+# Copyright 2008 by Denys Vlasenko
+# Licensed under GPL v2, see file LICENSE for details.
+
+. testing.sh
+
+# ls -ln is showing date. Need to remove that, it's variable
+# sed: (1) "maj, min" -> "maj,min" (2) coalesce spaces
+# cut: remove date
+FILTER_LS="sed -e 's/, */,/g' -e 's/ */ /g' | cut -d' ' -f 1-5,9-"
+# cut: remove size+date
+FILTER_LS2="sed -e 's/, */,/g' -e 's/ */ /g' | cut -d' ' -f 1-4,9-"
+
+# testing "test name" "options" "expected result" "file input" "stdin"
+
+rm -rf makedevs.testdir
+mkdir makedevs.testdir
+
+testing "makedevs -d ../makedevs.device_table.txt ." \
+ "(cd makedevs.testdir && makedevs -d ../makedevs.device_table.txt . 2>&1);
+ find makedevs.testdir ! -type d | sort | xargs ls -lnR | $FILTER_LS" \
+"\
+rootdir=.
+table='../makedevs.device_table.txt'
+crw-rw-rw- 1 0 0 5,1 makedevs.testdir/dev/console
+crw-r----- 1 0 5 29,0 makedevs.testdir/dev/fb0
+crw-r----- 1 0 5 29,32 makedevs.testdir/dev/fb1
+crw-r----- 1 0 5 29,64 makedevs.testdir/dev/fb2
+crw-r----- 1 0 5 29,96 makedevs.testdir/dev/fb3
+brw-r----- 1 0 0 3,0 makedevs.testdir/dev/hda
+brw-r----- 1 0 0 3,1 makedevs.testdir/dev/hda1
+brw-r----- 1 0 0 3,10 makedevs.testdir/dev/hda10
+brw-r----- 1 0 0 3,11 makedevs.testdir/dev/hda11
+brw-r----- 1 0 0 3,12 makedevs.testdir/dev/hda12
+brw-r----- 1 0 0 3,13 makedevs.testdir/dev/hda13
+brw-r----- 1 0 0 3,14 makedevs.testdir/dev/hda14
+brw-r----- 1 0 0 3,15 makedevs.testdir/dev/hda15
+brw-r----- 1 0 0 3,2 makedevs.testdir/dev/hda2
+brw-r----- 1 0 0 3,3 makedevs.testdir/dev/hda3
+brw-r----- 1 0 0 3,4 makedevs.testdir/dev/hda4
+brw-r----- 1 0 0 3,5 makedevs.testdir/dev/hda5
+brw-r----- 1 0 0 3,6 makedevs.testdir/dev/hda6
+brw-r----- 1 0 0 3,7 makedevs.testdir/dev/hda7
+brw-r----- 1 0 0 3,8 makedevs.testdir/dev/hda8
+brw-r----- 1 0 0 3,9 makedevs.testdir/dev/hda9
+brw-r----- 1 0 0 3,64 makedevs.testdir/dev/hdb
+brw-r----- 1 0 0 3,65 makedevs.testdir/dev/hdb1
+brw-r----- 1 0 0 3,74 makedevs.testdir/dev/hdb10
+brw-r----- 1 0 0 3,75 makedevs.testdir/dev/hdb11
+brw-r----- 1 0 0 3,76 makedevs.testdir/dev/hdb12
+brw-r----- 1 0 0 3,77 makedevs.testdir/dev/hdb13
+brw-r----- 1 0 0 3,78 makedevs.testdir/dev/hdb14
+brw-r----- 1 0 0 3,79 makedevs.testdir/dev/hdb15
+brw-r----- 1 0 0 3,66 makedevs.testdir/dev/hdb2
+brw-r----- 1 0 0 3,67 makedevs.testdir/dev/hdb3
+brw-r----- 1 0 0 3,68 makedevs.testdir/dev/hdb4
+brw-r----- 1 0 0 3,69 makedevs.testdir/dev/hdb5
+brw-r----- 1 0 0 3,70 makedevs.testdir/dev/hdb6
+brw-r----- 1 0 0 3,71 makedevs.testdir/dev/hdb7
+brw-r----- 1 0 0 3,72 makedevs.testdir/dev/hdb8
+brw-r----- 1 0 0 3,73 makedevs.testdir/dev/hdb9
+crw-rw---- 1 0 0 13,64 makedevs.testdir/dev/input/event0
+crw-rw---- 1 0 0 13,65 makedevs.testdir/dev/input/event1
+crw-rw---- 1 0 0 13,66 makedevs.testdir/dev/input/event2
+crw-rw---- 1 0 0 13,67 makedevs.testdir/dev/input/event3
+crw-r----- 1 0 0 13,63 makedevs.testdir/dev/input/mice
+crw-rw---- 1 0 0 13,32 makedevs.testdir/dev/input/mouse0
+crw-rw---- 1 0 0 13,33 makedevs.testdir/dev/input/mouse1
+crw-rw---- 1 0 0 13,34 makedevs.testdir/dev/input/mouse2
+crw-rw---- 1 0 0 13,35 makedevs.testdir/dev/input/mouse3
+crw-r----- 1 0 0 1,2 makedevs.testdir/dev/kmem
+brw-r----- 1 0 0 7,0 makedevs.testdir/dev/loop0
+brw-r----- 1 0 0 7,1 makedevs.testdir/dev/loop1
+crw-r----- 1 0 0 1,1 makedevs.testdir/dev/mem
+crw-r----- 1 0 0 90,0 makedevs.testdir/dev/mtd0
+crw-r----- 1 0 0 90,2 makedevs.testdir/dev/mtd1
+crw-r----- 1 0 0 90,4 makedevs.testdir/dev/mtd2
+crw-r----- 1 0 0 90,6 makedevs.testdir/dev/mtd3
+brw-r----- 1 0 0 31,0 makedevs.testdir/dev/mtdblock0
+brw-r----- 1 0 0 31,1 makedevs.testdir/dev/mtdblock1
+brw-r----- 1 0 0 31,2 makedevs.testdir/dev/mtdblock2
+brw-r----- 1 0 0 31,3 makedevs.testdir/dev/mtdblock3
+crw-rw---- 1 0 0 10,200 makedevs.testdir/dev/net/tun
+crw-rw-rw- 1 0 0 1,3 makedevs.testdir/dev/null
+crw-rw-rw- 1 0 0 10,1 makedevs.testdir/dev/psaux
+crw-rw-rw- 1 0 0 5,2 makedevs.testdir/dev/ptmx
+crw-rw-rw- 1 0 0 2,0 makedevs.testdir/dev/ptyp0
+crw-rw-rw- 1 0 0 2,1 makedevs.testdir/dev/ptyp1
+crw-rw-rw- 1 0 0 2,2 makedevs.testdir/dev/ptyp2
+crw-rw-rw- 1 0 0 2,3 makedevs.testdir/dev/ptyp3
+crw-rw-rw- 1 0 0 2,4 makedevs.testdir/dev/ptyp4
+crw-rw-rw- 1 0 0 2,5 makedevs.testdir/dev/ptyp5
+crw-rw-rw- 1 0 0 2,6 makedevs.testdir/dev/ptyp6
+crw-rw-rw- 1 0 0 2,7 makedevs.testdir/dev/ptyp7
+crw-rw-rw- 1 0 0 2,8 makedevs.testdir/dev/ptyp8
+crw-rw-rw- 1 0 0 2,9 makedevs.testdir/dev/ptyp9
+brw-r----- 1 0 0 1,1 makedevs.testdir/dev/ram
+brw-r----- 1 0 0 1,0 makedevs.testdir/dev/ram0
+brw-r----- 1 0 0 1,1 makedevs.testdir/dev/ram1
+brw-r----- 1 0 0 1,2 makedevs.testdir/dev/ram2
+brw-r----- 1 0 0 1,3 makedevs.testdir/dev/ram3
+crw-rw-rw- 1 0 0 1,8 makedevs.testdir/dev/random
+crw-r----- 1 0 0 10,135 makedevs.testdir/dev/rtc
+crw-rw-rw- 1 0 0 5,0 makedevs.testdir/dev/tty
+crw-rw-rw- 1 0 0 4,0 makedevs.testdir/dev/tty0
+crw-rw-rw- 1 0 0 4,1 makedevs.testdir/dev/tty1
+crw-rw-rw- 1 0 0 4,2 makedevs.testdir/dev/tty2
+crw-rw-rw- 1 0 0 4,3 makedevs.testdir/dev/tty3
+crw-rw-rw- 1 0 0 4,4 makedevs.testdir/dev/tty4
+crw-rw-rw- 1 0 0 4,5 makedevs.testdir/dev/tty5
+crw-rw-rw- 1 0 0 4,6 makedevs.testdir/dev/tty6
+crw-rw-rw- 1 0 0 4,7 makedevs.testdir/dev/tty7
+crw-rw-rw- 1 0 0 57,0 makedevs.testdir/dev/ttyP0
+crw-rw-rw- 1 0 0 57,1 makedevs.testdir/dev/ttyP1
+crw-rw-rw- 1 0 0 57,2 makedevs.testdir/dev/ttyP2
+crw-rw-rw- 1 0 0 57,3 makedevs.testdir/dev/ttyP3
+crw-rw-rw- 1 0 0 4,64 makedevs.testdir/dev/ttyS0
+crw-rw-rw- 1 0 0 4,65 makedevs.testdir/dev/ttyS1
+crw-rw-rw- 1 0 0 4,66 makedevs.testdir/dev/ttyS2
+crw-rw-rw- 1 0 0 4,67 makedevs.testdir/dev/ttyS3
+crw-rw-rw- 1 0 0 3,0 makedevs.testdir/dev/ttyp0
+crw-rw-rw- 1 0 0 3,1 makedevs.testdir/dev/ttyp1
+crw-rw-rw- 1 0 0 3,2 makedevs.testdir/dev/ttyp2
+crw-rw-rw- 1 0 0 3,3 makedevs.testdir/dev/ttyp3
+crw-rw-rw- 1 0 0 3,4 makedevs.testdir/dev/ttyp4
+crw-rw-rw- 1 0 0 3,5 makedevs.testdir/dev/ttyp5
+crw-rw-rw- 1 0 0 3,6 makedevs.testdir/dev/ttyp6
+crw-rw-rw- 1 0 0 3,7 makedevs.testdir/dev/ttyp7
+crw-rw-rw- 1 0 0 3,8 makedevs.testdir/dev/ttyp8
+crw-rw-rw- 1 0 0 3,9 makedevs.testdir/dev/ttyp9
+crw-rw-rw- 1 0 0 1,9 makedevs.testdir/dev/urandom
+crw-rw-rw- 1 0 0 1,5 makedevs.testdir/dev/zero
+" \
+ "" ""
+
+# clean up
+rm -rf makedevs.testdir
+
+exit $FAILCOUNT
diff --git a/testsuite/md5sum/md5sum-verifies-non-binary-file b/testsuite/md5sum/md5sum-verifies-non-binary-file
new file mode 100644
index 0000000..8566a23
--- /dev/null
+++ b/testsuite/md5sum/md5sum-verifies-non-binary-file
@@ -0,0 +1,3 @@
+touch foo
+md5sum foo > bar
+busybox md5sum -c bar
diff --git a/testsuite/mdev.tests b/testsuite/mdev.tests
new file mode 100755
index 0000000..90379e6
--- /dev/null
+++ b/testsuite/mdev.tests
@@ -0,0 +1,143 @@
+#!/bin/sh
+# Copyright 2008 by Denys Vlasenko
+# Licensed under GPL v2, see file LICENSE for details.
+
+. testing.sh
+
+# ls -ln is showing date. Need to remove that, it's variable
+# sed: (1) "maj, min" -> "maj,min" (2) coalesce spaces
+# cut: remove date
+FILTER_LS="sed -e 's/, */,/g' -e 's/ */ /g' | cut -d' ' -f 1-5,9-"
+# cut: remove size+date
+FILTER_LS2="sed -e 's/, */,/g' -e 's/ */ /g' | cut -d' ' -f 1-4,9-"
+
+# testing "test name" "options" "expected result" "file input" "stdin"
+
+rm -rf mdev.testdir
+mkdir mdev.testdir
+# We need mdev executable to be in chroot jail!
+# (will still fail with dynamically linked one, though...)
+cp ../busybox mdev.testdir/mdev
+mkdir mdev.testdir/bin
+cp ../busybox mdev.testdir/bin/sh 2>/dev/null # for testing cmd feature
+mkdir mdev.testdir/etc
+mkdir mdev.testdir/dev
+mkdir -p mdev.testdir/sys/block/sda
+echo "8:0" >mdev.testdir/sys/block/sda/dev
+
+# env - PATH=$PATH: on some systems chroot binary won't otherwise be found
+
+testing "mdev add /block/sda" \
+ "env - PATH=$PATH ACTION=add DEVPATH=/block/sda chroot mdev.testdir /mdev 2>&1;
+ ls -ln mdev.testdir/dev | $FILTER_LS" \
+"\
+brw-rw---- 1 0 0 8,0 sda
+" \
+ "" ""
+
+# continuing to use directory structure from prev test
+rm -rf mdev.testdir/dev/*
+echo ".* 1:1 666" >mdev.testdir/etc/mdev.conf
+echo "sda 2:2 444" >>mdev.testdir/etc/mdev.conf
+testing "mdev stops on first rule" \
+ "env - PATH=$PATH ACTION=add DEVPATH=/block/sda chroot mdev.testdir /mdev 2>&1;
+ ls -ln mdev.testdir/dev | $FILTER_LS" \
+"\
+brw-rw-rw- 1 1 1 8,0 sda
+" \
+ "" ""
+
+# continuing to use directory structure from prev test
+rm -rf mdev.testdir/dev/*
+echo "sda 0:0 444 >disk/scsiA" >mdev.testdir/etc/mdev.conf
+testing "mdev move/symlink rule '>bar/baz'" \
+ "env - PATH=$PATH ACTION=add DEVPATH=/block/sda chroot mdev.testdir /mdev 2>&1;
+ ls -lnR mdev.testdir/dev | $FILTER_LS2" \
+"\
+mdev.testdir/dev:
+drwxr-xr-x 2 0 0 disk
+lrwxrwxrwx 1 0 0 sda -> disk/scsiA
+
+mdev.testdir/dev/disk:
+br--r--r-- 1 0 0 scsiA
+" \
+ "" ""
+
+# continuing to use directory structure from prev test
+rm -rf mdev.testdir/dev/*
+echo "sda 0:0 444 >disk/" >mdev.testdir/etc/mdev.conf
+testing "mdev move/symlink rule '>bar/'" \
+ "env - PATH=$PATH ACTION=add DEVPATH=/block/sda chroot mdev.testdir /mdev 2>&1;
+ ls -lnR mdev.testdir/dev | $FILTER_LS2" \
+"\
+mdev.testdir/dev:
+drwxr-xr-x 2 0 0 disk
+lrwxrwxrwx 1 0 0 sda -> disk/sda
+
+mdev.testdir/dev/disk:
+br--r--r-- 1 0 0 sda
+" \
+ "" ""
+
+# continuing to use directory structure from prev test
+rm -rf mdev.testdir/dev/*
+# here we complicate things by having non-matching group 1 and using %0
+echo "s([0-9])*d([a-z]+) 0:0 644 >sd/%2_%0" >mdev.testdir/etc/mdev.conf
+testing "mdev regexp substring match + replace" \
+ "env - PATH=$PATH ACTION=add DEVPATH=/block/sda chroot mdev.testdir /mdev 2>&1;
+ ls -lnR mdev.testdir/dev | $FILTER_LS2" \
+"\
+mdev.testdir/dev:
+drwxr-xr-x 2 0 0 sd
+lrwxrwxrwx 1 0 0 sda -> sd/a_sda
+
+mdev.testdir/dev/sd:
+brw-r--r-- 1 0 0 a_sda
+" \
+ "" ""
+
+# continuing to use directory structure from prev test
+rm -rf mdev.testdir/dev/*
+echo "sda 0:0 644 @echo @echo TEST" >mdev.testdir/etc/mdev.conf
+testing "mdev command" \
+ "env - PATH=$PATH ACTION=add DEVPATH=/block/sda chroot mdev.testdir /mdev 2>&1;
+ ls -lnR mdev.testdir/dev | $FILTER_LS" \
+"\
+@echo TEST
+mdev.testdir/dev:
+brw-r--r-- 1 0 0 8,0 sda
+" \
+ "" ""
+
+# continuing to use directory structure from prev test
+rm -rf mdev.testdir/dev/*
+echo "sda 0:0 644 =block/ @echo @echo TEST" >mdev.testdir/etc/mdev.conf
+testing "mdev move and command" \
+ "env - PATH=$PATH ACTION=add DEVPATH=/block/sda chroot mdev.testdir /mdev 2>&1;
+ ls -lnR mdev.testdir/dev | $FILTER_LS2" \
+"\
+@echo TEST
+mdev.testdir/dev:
+drwxr-xr-x 2 0 0 block
+
+mdev.testdir/dev/block:
+brw-r--r-- 1 0 0 sda
+" \
+ "" ""
+
+# continuing to use directory structure from prev test
+rm -rf mdev.testdir/dev/*
+echo "@8,0 :1 644" >mdev.testdir/etc/mdev.conf
+testing "mdev #maj,min and no explicit uid" \
+ "env - PATH=$PATH ACTION=add DEVPATH=/block/sda chroot mdev.testdir /mdev 2>&1;
+ ls -lnR mdev.testdir/dev | $FILTER_LS" \
+"\
+mdev.testdir/dev:
+brw-r--r-- 1 0 1 8,0 sda
+" \
+ "" ""
+
+# clean up
+rm -rf mdev.testdir
+
+exit $FAILCOUNT
diff --git a/testsuite/mkdir/mkdir-makes-a-directory b/testsuite/mkdir/mkdir-makes-a-directory
new file mode 100644
index 0000000..6ca5c4d
--- /dev/null
+++ b/testsuite/mkdir/mkdir-makes-a-directory
@@ -0,0 +1,2 @@
+busybox mkdir foo
+test -d foo
diff --git a/testsuite/mkdir/mkdir-makes-parent-directories b/testsuite/mkdir/mkdir-makes-parent-directories
new file mode 100644
index 0000000..992facb
--- /dev/null
+++ b/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/testsuite/mkfs.minix.tests b/testsuite/mkfs.minix.tests
new file mode 100755
index 0000000..90df931
--- /dev/null
+++ b/testsuite/mkfs.minix.tests
@@ -0,0 +1,22 @@
+#!/bin/sh
+
+# mkfs.minix tests.
+# Copyright 2007 by Denys Vlasenko
+# Licensed under GPL v2, see file LICENSE for details.
+
+. testing.sh
+
+# testing "test name" "options" "expected result" "file input" "stdin"
+
+testing "mkfs.minix" \
+ "dd if=/dev/zero of=input bs=1k count=1024 2>/dev/null; mkfs.minix input; md5sum <input" \
+"352 inodes\n"\
+"1024 blocks\n"\
+"Firstdatazone=15 (15)\n"\
+"Zonesize=1024\n"\
+"Maxsize=268966912\n"\
+"4f35f7afeba07d56055bed1f29ae20b7 -\n" \
+ "" \
+ ""
+
+exit $FAILCOUNT
diff --git a/testsuite/mount.testroot b/testsuite/mount.testroot
new file mode 100755
index 0000000..e18d046
--- /dev/null
+++ b/testsuite/mount.testroot
@@ -0,0 +1,183 @@
+#!/bin/sh
+
+# SUSv3 compliant mount and umount tests.
+# Copyright 2005 by Rob Landley <rob@landley.net>
+# Licensed under GPL v2, see file LICENSE for details.
+
+if [ -z "$TESTDIR" ]
+then
+ echo 'Need $TESTDIR'
+ exit 1
+fi
+
+cd "$TESTDIR"
+
+. testing.sh
+
+# If we aren't PID 1, barf.
+
+#if [ $$ -ne 1 ]
+#then
+# echo "SKIPPED: mount test requires emulation environment"
+# exit 0
+#fi
+
+# Run tests within the chroot environment.
+dochroot bash rm ls ln cat ps mknod mkdir dd grep cmp diff tail \
+ mkfs.ext2 mkfs.vfat mount umount losetup wc << EOF
+#!/bin/bash
+
+. /testing.sh
+
+mknod /dev/loop0 b 7 0
+mknod /dev/loop1 b 7 1
+
+# We need /proc to do much. Make sure we can mount it explicitly.
+
+testing "mount no proc [GNUFAIL]" "mount 2> /dev/null || echo yes" "yes\n" "" ""
+testing "mount /proc" "mount -t proc /proc /proc && ls -d /proc/1" \
+ "/proc/1\n" "" ""
+
+# Make sure the last thing in the list is /proc
+
+testing "mount list1" "mount | tail -n 1" "/proc on /proc type proc (rw)\n" \
+ "" ""
+
+
+# Create an ext2 image
+
+mkdir -p images/{ext2.dir,vfat.dir,test1,test2,test3}
+dd if=/dev/zero of=images/ext2.img bs=1M count=1 2> /dev/null
+mkfs.ext2 -F -b 1024 images/ext2.img > /dev/null 2> /dev/null
+dd if=/dev/zero of=images/vfat.img bs=1M count=1 2> /dev/null
+mkfs.vfat images/vfat.img > /dev/null
+
+# Test mount it
+
+testing "mount vfat image (explicitly autodetect type)" \
+ "mount -t auto images/vfat.img images/vfat.dir && mount | tail -n 1 | grep -o 'vfat.dir type vfat'" \
+ "vfat.dir type vfat\n" "" ""
+testing "mount ext2 image (autodetect type)" \
+ "mount images/ext2.img images/ext2.dir 2> /dev/null && mount | tail -n 1" \
+ "/dev/loop1 on /images/ext2.dir type ext2 (rw)\n" "" ""
+testing "mount remount ext2 image noatime" \
+ "mount -o remount,noatime images/ext2.dir && mount | tail -n 1" \
+ "/dev/loop1 on /images/ext2.dir type ext2 (rw,noatime)\n" "" ""
+testing "mount remount ext2 image ro remembers noatime" \
+ "mount -o remount,ro images/ext2.dir && mount | tail -n 1" \
+ "/dev/loop1 on /images/ext2.dir type ext2 (ro,noatime)\n" "" ""
+
+umount -d images/vfat.dir
+umount -d images/ext2.dir
+
+testing "mount umount freed loop device" \
+ "mount images/ext2.img images/ext2.dir && mount | tail -n 1" \
+ "/dev/loop0 on /images/ext2.dir type ext2 (rw)\n" "" ""
+
+testing "mount block device" \
+ "mount -t ext2 /dev/loop0 images/test1 && mount | tail -n 1" \
+ "/dev/loop0 on /images/test1 type ext2 (rw)\n" "" ""
+
+umount -d images/ext2.dir images/test1
+
+testing "mount remount nonexistent directory" \
+ "mount -o remount,noatime images/ext2.dir 2> /dev/null || echo yes" \
+ "yes\n" "" ""
+
+# Fun with mount -a
+
+testing "mount -a no fstab" "mount -a 2>/dev/null || echo yes" "yes\n" "" ""
+
+umount /proc
+
+# The first field is space delimited, the rest tabs.
+
+cat > /etc/fstab << FSTAB
+/proc /proc proc defaults 0 0
+# Autodetect loop, and provide flags with commas in them.
+/images/ext2.img /images/ext2.dir ext2 noatime,nodev 0 0
+# autodetect filesystem, flags without commas.
+/images/vfat.img /images/vfat.dir auto ro 0 0
+# A block device
+/dev/loop2 /images/test1 auto defaults 0 0
+# tmpfs, filesystem specific flag.
+walrus /images/test2 tmpfs size=42 0 0
+# Autodetect a bind mount.
+/images/test2 /images/test3 auto defaults 0 0
+FSTAB
+
+# Put something on loop2.
+mknod /dev/loop2 b 7 2
+cat images/ext2.img > images/ext2-2.img
+losetup /dev/loop2 images/ext2-2.img
+
+testing "mount -a" "mount -a && echo hello > /images/test2/abc && cat /images/test3/abc && (mount | wc -l)" "hello\n8\n" "" ""
+
+testing "umount -a" "umount -a && ls /proc" "" "" ""
+
+#/bin/bash < /dev/tty > /dev/tty 2> /dev/tty
+mknod /dev/console c 5 1
+/bin/bash < /dev/console > /dev/console 2> /dev/console
+EOF
+
+exit 0
+
+# Run some tests
+
+losetup nonexistent device (should return error 2)
+losetup unbound loop device (should return error 1)
+losetup bind file to loop device
+losetup bound loop device (display) (should return error 0)
+losetup filename (error)
+losetup nofile (file not found)
+losetup -d
+losetup bind with offset
+losetup -f (print first loop device)
+losetup -f filename (associate file with first loop device)
+losetup -o (past end of file) -f filename
+
+mount -a
+ with multiple entries in fstab
+ with duplicate entries in fstab
+ with relative paths in fstab
+ with user entries in fstab
+mount -o async,sync,atime,noatime,dev,nodev,exec,noexec,loop,suid,nosuid,remount,ro,rw,bind,move
+mount -r
+mount -o rw -r
+mount -w -o ro
+mount -t auto
+
+mount with relative path in fstab
+mount block device
+mount char device
+mount file (autoloop)
+mount directory (autobind)
+
+
+testing "umount with no /proc"
+testing "umount curdir"
+
+# The basic tests. These should work even with the small busybox.
+
+testing "sort" "input" "a\nb\nc\n" "c\na\nb\n" ""
+testing "sort #2" "input" "010\n1\n3\n" "3\n1\n010\n" ""
+testing "sort stdin" "" "a\nb\nc\n" "" "b\na\nc\n"
+testing "sort numeric" "-n input" "1\n3\n010\n" "3\n1\n010\n" ""
+testing "sort reverse" "-r input" "wook\nwalrus\npoint\npabst\naargh\n" \
+ "point\nwook\npabst\naargh\nwalrus\n" ""
+
+optional FEATURE_MOUNT_LOOP
+testing "umount -D"
+
+optional FEATURE_MTAB_SUPPORT
+optional FEATURE_MOUNT_NFS
+# No idea what to test here.
+
+optional UMOUNT
+optional FEATURE_UMOUNT_ALL
+testing "umount -a"
+testing "umount -r"
+testing "umount -l"
+testing "umount -f"
+
+exit $FAILCOUNT
diff --git a/testsuite/mount.tests b/testsuite/mount.tests
new file mode 100755
index 0000000..5374ecb
--- /dev/null
+++ b/testsuite/mount.tests
@@ -0,0 +1,35 @@
+#!/bin/sh
+
+# Copyright 2007 by Denys Vlasenko <vda.linux@googlemail.com>
+# Licensed under GPL v2, see file LICENSE for details.
+
+. testing.sh
+
+test "`id -u`" = 0 || {
+ echo "SKIPPED: must be root to test this"
+ exit 0
+}
+
+dd if=/dev/zero of=mount.image1m count=1 bs=1M 2>/dev/null || exit 1
+mkfs.minix -v mount.image1m >/dev/null 2>&1 || exit 1
+testdir=$PWD/testdir
+mkdir $testdir 2>/dev/null
+umount -d $testdir 2>/dev/null
+
+# testing "test name" "command" "expected result" "file input" "stdin"
+# file input will be file called "input"
+# test can create a file "actual" instead of writing to stdout
+
+testing "mount -o remount,mand" \
+"mount -o loop mount.image1m $testdir "\
+"&& grep -Fc $testdir </proc/mounts "\
+"&& mount -o remount,mand $testdir "\
+"&& grep -F $testdir </proc/mounts | grep -c '[, ]mand[, ]'" \
+ "1\n""1\n" \
+ "" ""
+
+umount -d $testdir
+rmdir $testdir
+rm mount.image1m
+
+exit $FAILCOUNT
diff --git a/testsuite/msh/msh-supports-underscores-in-variable-names b/testsuite/msh/msh-supports-underscores-in-variable-names
new file mode 100644
index 0000000..9c7834b
--- /dev/null
+++ b/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/testsuite/mv/mv-files-to-dir b/testsuite/mv/mv-files-to-dir
new file mode 100644
index 0000000..c8eaba8
--- /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 0000000..1fb355b
--- /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 0000000..48afca4
--- /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-file b/testsuite/mv/mv-moves-file
new file mode 100644
index 0000000..edb4c37
--- /dev/null
+++ b/testsuite/mv/mv-moves-file
@@ -0,0 +1,3 @@
+touch foo
+busybox mv foo bar
+test ! -f foo -a -f bar
diff --git a/testsuite/mv/mv-moves-hardlinks b/testsuite/mv/mv-moves-hardlinks
new file mode 100644
index 0000000..eaa8215
--- /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 0000000..77d088f
--- /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 0000000..065c7f1
--- /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 0000000..c413af0
--- /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 0000000..bc9c313
--- /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 0000000..b3ba3aa
--- /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 0000000..ea565d2
--- /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 0000000..7c572c4
--- /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 0000000..48afca4
--- /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/od.tests b/testsuite/od.tests
new file mode 100755
index 0000000..69c2995
--- /dev/null
+++ b/testsuite/od.tests
@@ -0,0 +1,17 @@
+#!/bin/sh
+# Copyright 2008 by Denys Vlasenko
+# Licensed under GPL v2, see file LICENSE for details.
+
+. testing.sh
+
+# testing "test name" "options" "expected result" "file input" "stdin"
+
+testing "od -b" \
+ "od -b" \
+"\
+0000000 110 105 114 114 117
+0000006
+" \
+ "" "HELLO"
+
+exit $FAILCOUNT
diff --git a/testsuite/parse.tests b/testsuite/parse.tests
new file mode 100755
index 0000000..f1ee7b8
--- /dev/null
+++ b/testsuite/parse.tests
@@ -0,0 +1,109 @@
+#!/bin/sh
+
+# Copyright 2008 by Denys Vlasenko <vda.linux@googlemail.com>
+# Licensed under GPL v2, see file LICENSE for details.
+
+. testing.sh
+
+COLLAPSE=$(( 0x00010000))
+TRIM=$(( 0x00020000))
+GREEDY=$(( 0x00040000))
+MIN_DIE=$(( 0x00100000))
+KEEP_COPY=$((0x00200000))
+ESCAPE=$(( 0x00400000))
+NORMAL=$(( COLLAPSE | TRIM | GREEDY))
+
+# testing "description" "command" "result" "infile" "stdin"
+
+testing "parse mdev.conf" \
+ "parse -n 4 -m 3 -f $((NORMAL)) -" \
+ "[sda][0:0][644][@echo @echo TEST]\n" \
+ "-" \
+ " sda 0:0 644 @echo @echo TEST # echo trap\n"
+
+testing "parse notrim" \
+ "parse -n 4 -m 3 -f $((NORMAL - TRIM - COLLAPSE)) -" \
+ "[][sda][0:0][644 @echo @echo TEST ]\n" \
+ "-" \
+ " sda 0:0 644 @echo @echo TEST \n"
+
+FILE=__parse
+cat >$FILE <<EOF
+#
+# Device Point System Options
+#_______________________________________________________________
+/dev/hdb3 / ext2 defaults 1 0
+ /dev/hdb1 /dosc hpfs ro 1 0
+ /dev/fd0 /dosa vfat rw,user,noauto,nohide 0 0
+ /dev/fd1 /dosb vfat rw,user,noauto,nohide 0 0
+#
+ /dev/cdrom /cdrom iso9660 ro,user,noauto,nohide 0 0
+/dev/hdb5 /redhat ext2 rw,root,noauto,nohide 0 0 #sssd
+ /dev/hdb6 /win2home ntfs rw,root,noauto,nohide 0 0# ssdsd
+/dev/hdb7 /win2skul ntfs rw,root,noauto,nohide none 0 0
+none /dev/pts devpts gid=5,mode=620 0 0
+ none /proc proc defaults 0 0
+EOF
+
+cat >$FILE.res <<EOF
+[/dev/hdb3][/][ext2][defaults][1][0]
+[/dev/hdb1][/dosc][hpfs][ro][1][0]
+[/dev/fd0][/dosa][vfat][rw,user,noauto,nohide][0][0]
+[/dev/fd1][/dosb][vfat][rw,user,noauto,nohide][0][0]
+[/dev/cdrom][/cdrom][iso9660][ro,user,noauto,nohide][0][0]
+[/dev/hdb5][/redhat][ext2][rw,root,noauto,nohide][0][0]
+[/dev/hdb6][/win2home][ntfs][rw,root,noauto,nohide][0][0]
+[/dev/hdb7][/win2skul][ntfs][rw,root,noauto,nohide][none][0 0]
+[none][/dev/pts][devpts][gid=5,mode=620][0][0]
+[none][/proc][proc][defaults][0][0]
+EOF
+
+testing "parse polluted fstab" \
+ "parse -n 6 -m 6 $FILE" \
+ "`cat $FILE.res`\n" \
+ "" \
+ ""
+cp ../examples/inittab $FILE
+cat >$FILE.res <<EOF
+[][][sysinit][/etc/init.d/rcS]
+[][][askfirst][-/bin/sh]
+[tty2][][askfirst][-/bin/sh]
+[tty3][][askfirst][-/bin/sh]
+[tty4][][askfirst][-/bin/sh]
+[tty4][][respawn][/sbin/getty 38400 tty5]
+[tty5][][respawn][/sbin/getty 38400 tty6]
+[][][restart][/sbin/init]
+[][][ctrlaltdel][/sbin/reboot]
+[][][shutdown][/bin/umount -a -r]
+[][][shutdown][/sbin/swapoff -a]
+EOF
+
+testing "parse inittab from examples" \
+ "parse -n 4 -m 4 -f $((NORMAL - TRIM - COLLAPSE)) -d'#:' $FILE" \
+ "`cat $FILE.res`\n" \
+ "" \
+ ""
+
+cp ../examples/udhcp/udhcpd.conf $FILE
+cat >$FILE.res <<EOF
+[start][192.168.0.20]
+[end][192.168.0.254]
+[interface][eth0]
+[opt][dns][192.168.10.2][192.168.10.10]
+[option][subnet][255.255.255.0]
+[opt][router][192.168.10.2]
+[opt][wins][192.168.10.10]
+[option][dns][129.219.13.81]
+[option][domain][local]
+[option][lease][864000]
+EOF
+
+testing "parse udhcpd.conf from examples" \
+ "parse -n 127 $FILE" \
+ "`cat $FILE.res`\n" \
+ "" \
+ ""
+
+rm -f $FILE $FILE.res
+
+exit $FAILCOUNT
diff --git a/testsuite/patch.tests b/testsuite/patch.tests
new file mode 100755
index 0000000..cfe69b7
--- /dev/null
+++ b/testsuite/patch.tests
@@ -0,0 +1,65 @@
+#!/bin/sh
+# Copyright 2008 by Denys Vlasenko
+# Licensed under GPL v2, see file LICENSE for details.
+
+. testing.sh
+
+# testing "test name" "options" "expected result" "file input" "stdin"
+
+testing "patch with old_file == new_file" \
+ "patch; echo $?; cat input" \
+"\
+patching file input
+0
+qwe
+asd
+zxc
+" \
+ "qwe\nzxc\n" \
+"\
+--- input Jan 01 01:01:01 2000
++++ input Jan 01 01:01:01 2000
+@@ -1,2 +1,3 @@
+ qwe
++asd
+ zxc
+" \
+
+testing "patch with nonexistent old_file" \
+ "patch; echo $?; cat input" \
+"\
+patching file input
+0
+qwe
+asd
+zxc
+" \
+ "qwe\nzxc\n" \
+"\
+--- input.doesnt_exist Jan 01 01:01:01 2000
++++ input Jan 01 01:01:01 2000
+@@ -1,2 +1,3 @@
+ qwe
++asd
+ zxc
+" \
+
+testing "patch -R with nonexistent old_file" \
+ "patch -R; echo $?; cat input" \
+"\
+patching file input
+0
+qwe
+zxc
+" \
+ "qwe\nasd\nzxc\n" \
+"\
+--- input.doesnt_exist Jan 01 01:01:01 2000
++++ input Jan 01 01:01:01 2000
+@@ -1,2 +1,3 @@
+ qwe
++asd
+ zxc
+" \
+
+exit $FAILCOUNT
diff --git a/testsuite/pidof.tests b/testsuite/pidof.tests
new file mode 100755
index 0000000..a05a302
--- /dev/null
+++ b/testsuite/pidof.tests
@@ -0,0 +1,31 @@
+#!/bin/sh
+
+# pidof tests.
+# Copyright 2005 by Bernhard Reutner-Fischer
+# Licensed under GPL v2, see file LICENSE for details.
+
+# AUDIT:
+
+. testing.sh
+
+# testing "test name" "options" "expected result" "file input" "stdin"
+
+testing "pidof (exit with error)" \
+ "pidof veryunlikelyoccuringbinaryname ; echo \$?" "1\n" "" ""
+testing "pidof (exit with success)" "pidof pidof > /dev/null; echo \$?" \
+ "0\n" "" ""
+# We can get away with this because it says #!/bin/sh up top.
+
+testing "pidof this" "pidof pidof.tests | grep -o -w $$" "$$\n" "" ""
+
+optional FEATURE_PIDOF_SINGLE
+testing "pidof -s" "pidof -s init" "1\n" "" ""
+
+optional FEATURE_PIDOF_OMIT
+# This test fails now because process name matching logic has changed,
+# but new logic is not "wrong" either... see find_pid_by_name.c comments
+#testing "pidof -o %PPID" "pidof -o %PPID pidof.tests | grep -o -w $$" "" "" ""
+testing "pidof -o %PPID NOP" "pidof -o %PPID -s init" "1\n" "" ""
+testing "pidof -o init" "pidof -o 1 init | grep -o -w 1" "" "" ""
+
+exit $FAILCOUNT
diff --git a/testsuite/printf.tests b/testsuite/printf.tests
new file mode 100755
index 0000000..f9d1dec
--- /dev/null
+++ b/testsuite/printf.tests
@@ -0,0 +1,108 @@
+#!/bin/sh
+# Copyright 2008 by Denys Vlasenko
+# Licensed under GPL v2, see file LICENSE for details.
+
+. testing.sh
+
+# Need this in order to not execute shell builtin
+bb="busybox "
+
+# testing "test name" "command" "expected result" "file input" "stdin"
+
+testing "printf produces no further output 1" \
+ "${bb}printf '\c' foo" \
+ "" \
+ "" ""
+
+testing "printf produces no further output 2" \
+ "${bb}printf '%s\c' foo bar" \
+ "foo" \
+ "" ""
+
+testing "printf repeatedly uses pattern for each argv" \
+ "${bb}printf '%s\n' foo \$HOME" \
+ "foo\n$HOME\n" \
+ "" ""
+
+testing "printf understands %b escaped_string" \
+ "${bb}printf '%b' 'a\tb' 'c\\d\n' 2>&1; echo \$?" \
+ "a\tbc\\d\n""0\n" \
+ "" ""
+
+testing "printf understands %d '\"x' \"'y\" \"'zTAIL\"" \
+ "${bb}printf '%d\n' '\"x' \"'y\" \"'zTAIL\" 2>&1; echo \$?" \
+ "120\n""121\n""122\n""0\n" \
+ "" ""
+
+testing "printf understands %s '\"x' \"'y\" \"'zTAIL\"" \
+ "${bb}printf '%s\n' '\"x' \"'y\" \"'zTAIL\" 2>&1; echo \$?" \
+ "\"x\n""'y\n""'zTAIL\n""0\n" \
+ "" ""
+
+testing "printf understands %23.12f" \
+ "${bb}printf '|%23.12f|\n' 5.25 2>&1; echo \$?" \
+ "| 5.250000000000|\n""0\n" \
+ "" ""
+
+testing "printf understands %*.*f" \
+ "${bb}printf '|%*.*f|\n' 23 12 5.25 2>&1; echo \$?" \
+ "| 5.250000000000|\n""0\n" \
+ "" ""
+
+testing "printf understands %*f with negative width" \
+ "${bb}printf '|%*f|\n' -23 5.25 2>&1; echo \$?" \
+ "|5.250000 |\n""0\n" \
+ "" ""
+
+testing "printf understands %.*f with negative precision" \
+ "${bb}printf '|%.*f|\n' -12 5.25 2>&1; echo \$?" \
+ "|5.250000|\n""0\n" \
+ "" ""
+
+testing "printf understands %*.*f with negative width/precision" \
+ "${bb}printf '|%*.*f|\n' -23 -12 5.25 2>&1; echo \$?" \
+ "|5.250000 |\n""0\n" \
+ "" ""
+
+testing "printf understands %zd" \
+ "${bb}printf '%zd\n' -5 2>&1; echo \$?" \
+ "-5\n""0\n" \
+ "" ""
+
+testing "printf understands %ld" \
+ "${bb}printf '%ld\n' -5 2>&1; echo \$?" \
+ "-5\n""0\n" \
+ "" ""
+
+testing "printf understands %Ld" \
+ "${bb}printf '%Ld\n' -5 2>&1; echo \$?" \
+ "-5\n""0\n" \
+ "" ""
+
+# We are "more correct" here than bash/coreutils: they happily print -2
+# as if it is a huge unsigned number
+testing "printf handles %u -N" \
+ "${bb}printf '%u\n' 1 -2 3 2>&1; echo \$?" \
+ "1\n""printf: -2: invalid number\n""0\n""3\n""0\n" \
+ "" ""
+
+# Actually, we are wrong here: exit code should be 1
+testing "printf handles %d bad_input" \
+ "${bb}printf '%d\n' 1 - 2 bad 3 123bad 4 2>&1; echo \$?" \
+"1\n""printf: -: invalid number\n""0\n"\
+"2\n""printf: bad: invalid number\n""0\n"\
+"3\n""printf: 123bad: invalid number\n""0\n"\
+"4\n""0\n" \
+ "" ""
+
+testing "printf aborts on bare %" \
+ "${bb}printf '%' a b c 2>&1; echo \$?" \
+ "printf: %: invalid format\n""1\n" \
+ "" ""
+
+testing "printf aborts on %r" \
+ "${bb}printf '%r' a b c 2>&1; echo \$?" \
+ "printf: %r: invalid format\n""1\n" \
+ "" ""
+
+exit $FAILCOUNT
diff --git a/testsuite/pwd/pwd-prints-working-directory b/testsuite/pwd/pwd-prints-working-directory
new file mode 100644
index 0000000..8575347
--- /dev/null
+++ b/testsuite/pwd/pwd-prints-working-directory
@@ -0,0 +1 @@
+test $(pwd) = $(busybox pwd)
diff --git a/testsuite/readlink.tests b/testsuite/readlink.tests
new file mode 100755
index 0000000..0faa6ed
--- /dev/null
+++ b/testsuite/readlink.tests
@@ -0,0 +1,32 @@
+#!/bin/sh
+
+# Readlink tests.
+# Copyright 2006 by Natanael Copa <n@tanael.org>
+# Licensed under GPL v2, see file LICENSE for details.
+
+. testing.sh
+
+TESTDIR=readlink_testdir
+TESTFILE="$TESTDIR/testfile"
+TESTLINK="testlink"
+FAILLINK="$TESTDIR/$TESTDIR/testlink"
+
+# create the dir and test files
+mkdir -p "./$TESTDIR"
+touch "./$TESTFILE"
+ln -s "./$TESTFILE" "./$TESTLINK"
+
+testing "readlink on a file" "readlink ./$TESTFILE" "" "" ""
+testing "readlink on a link" "readlink ./$TESTLINK" "./$TESTFILE\n" "" ""
+
+optional FEATURE_READLINK_FOLLOW
+
+testing "readlink -f on a file" "readlink -f ./$TESTFILE" "$PWD/$TESTFILE\n" "" ""
+testing "readlink -f on a link" "readlink -f ./$TESTLINK" "$PWD/$TESTFILE\n" "" ""
+testing "readlink -f on an invalid link" "readlink -f ./$FAILLINK" "" "" ""
+testing "readlink -f on a wierd dir" "readlink -f $TESTDIR/../$TESTFILE" "$PWD/$TESTFILE\n" "" ""
+
+
+# clean up
+rm -r "$TESTLINK" "$TESTDIR"
+
diff --git a/testsuite/rm/rm-removes-file b/testsuite/rm/rm-removes-file
new file mode 100644
index 0000000..46571a9
--- /dev/null
+++ b/testsuite/rm/rm-removes-file
@@ -0,0 +1,3 @@
+touch foo
+busybox rm foo
+test ! -f foo
diff --git a/testsuite/rmdir/rmdir-removes-parent-directories b/testsuite/rmdir/rmdir-removes-parent-directories
new file mode 100644
index 0000000..222f5de
--- /dev/null
+++ b/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/testsuite/runtest b/testsuite/runtest
new file mode 100755
index 0000000..cade871
--- /dev/null
+++ b/testsuite/runtest
@@ -0,0 +1,164 @@
+#!/bin/sh
+
+# Usage:
+# runtest [applet1] [applet2...]
+
+# Helper for helpers. Oh my...
+test x"$ECHO" != x"" || {
+ ECHO="echo"
+ test x"`echo -ne`" = x"" || {
+ # Compile and use a replacement 'echo' which understands -e -n
+ ECHO="$PWD/echo-ne"
+ test -x "$ECHO" || {
+ gcc -Os -o "$ECHO" ../scripts/echo.c || exit 1
+ }
+ }
+ export ECHO
+}
+
+# Run one old-style test.
+# Tests are stored in applet/testcase shell scripts.
+# They are run using "sh -x -e applet/testcase".
+# Option -e will make testcase stop on the first failed command.
+run_applet_testcase()
+{
+ local applet="$1"
+ local testcase="$2"
+
+ local status=0
+ local uc_applet=$(echo "$applet" | tr a-z A-Z)
+ local testname="$testcase"
+
+ testname="${testname##*/}" # take basename
+ if grep "^# CONFIG_$uc_applet is not set$" "$bindir/.config" >/dev/null; then
+ echo "UNTESTED: $testname"
+ return 0
+ fi
+
+ if grep "^# FEATURE: " "$testcase" >/dev/null; then
+ local feature=$(sed -ne 's/^# FEATURE: //p' "$testcase")
+
+ if grep "^# $feature is not set$" "$bindir/.config" >/dev/null; then
+ echo "UNTESTED: $testname"
+ return 0
+ fi
+ fi
+
+ rm -rf ".tmpdir.$applet"
+ mkdir -p ".tmpdir.$applet"
+ cd ".tmpdir.$applet" || return 1
+
+# echo "Running testcase $testcase"
+ d="$tsdir" \
+ sh -x -e "$testcase" >"$testname.stdout.txt" 2>&1 || status=$?
+ if [ $status -ne 0 ]; then
+ echo "FAIL: $testname"
+ if [ x"$VERBOSE" != x ]; then
+ cat "$testname.stdout.txt"
+ fi
+ else
+ echo "PASS: $testname"
+ fi
+
+ cd ..
+ rm -rf ".tmpdir.$applet"
+
+ return $status
+}
+
+# Run all old-style tests for given applet
+run_oldstyle_applet_tests()
+{
+ local applet="$1"
+ local status=0
+
+ for testcase in "$tsdir/$applet"/*; do
+ # switch on basename of $testcase
+ case "${testcase##*/}" in
+ .*) continue ;; # .svn, .git etc
+ *~) continue ;; # backup files
+ "CVS") continue ;;
+ \#*) continue ;; # CVS merge residues
+ *.mine) continue ;; # svn-produced junk
+ *.r[0-9]*) continue ;; # svn-produced junk
+ esac
+ run_applet_testcase "$applet" "$testcase" || status=1
+ done
+ return $status
+}
+
+
+
+lcwd=$(pwd)
+[ x"$tsdir" != x ] || tsdir="$lcwd"
+[ x"$bindir" != x ] || bindir="${lcwd%/*}" # one directory up from $lcwd
+PATH="$bindir:$PATH"
+
+if [ x"$VERBOSE" = x ]; then
+ export VERBOSE=
+fi
+
+if [ x"$1" = x"-v" ]; then
+ export VERBOSE=1
+ shift
+fi
+
+implemented=$(
+ "$bindir/busybox" 2>&1 |
+ while read line; do
+ if [ x"$line" = x"Currently defined functions:" ]; then
+ xargs | sed 's/,//g'
+ break
+ fi
+ done
+ )
+
+applets="$implemented"
+if [ $# -ne 0 ]; then
+ applets="$@"
+fi
+
+# Populate a directory with links to all busybox applets
+
+LINKSDIR="$bindir/runtest-tempdir-links"
+rm -rf "$LINKSDIR" 2>/dev/null
+mkdir "$LINKSDIR"
+for i in $implemented; do
+ ln -s "$bindir/busybox" "$LINKSDIR/$i"
+done
+
+# Set up option flags so tests can be selective.
+export OPTIONFLAGS=:$(
+ sed -nr 's/^CONFIG_//p' "$bindir/.config" |
+ sed 's/=.*//' | xargs | sed 's/ /:/g'
+ )
+
+status=0
+for applet in $applets; do
+ # Any old-style tests for this applet?
+ if [ -d "$tsdir/$applet" ]; then
+ run_oldstyle_applet_tests "$applet" || status=1
+ fi
+
+ # Is this a new-style test?
+ if [ -f "$applet.tests" ]; then
+ if [ ! -h "$LINKSDIR/$applet" ]; then
+ # (avoiding bash'ism "${applet:0:4}")
+ if ! echo "$applet" | grep "^all_" >/dev/null; then
+ echo "SKIPPED: $applet (not built)"
+ continue
+ fi
+ fi
+# echo "Running test $tsdir/$applet.tests"
+ PATH="$LINKSDIR:$tsdir:$bindir:$PATH" \
+ "$tsdir/$applet.tests" || status=1
+ fi
+done
+
+# Leaving the dir makes it somewhat easier to run failed test by hand
+#rm -rf "$LINKSDIR"
+
+if [ $status -ne 0 ] && [ x"$VERBOSE" = x ]; then
+ echo "Failures detected, running with -v (verbose) will give more info"
+fi
+exit $status
diff --git a/testsuite/sed.tests b/testsuite/sed.tests
new file mode 100755
index 0000000..9a7f886
--- /dev/null
+++ b/testsuite/sed.tests
@@ -0,0 +1,210 @@
+#!/bin/sh
+
+# SUSv3 compliant sed tests.
+# Copyright 2005 by Rob Landley <rob@landley.net>
+# Licensed under GPL v2, see file LICENSE for details.
+
+. testing.sh
+
+# testing "description" "arguments" "result" "infile" "stdin"
+
+# Corner cases
+testing "sed no files (stdin)" 'sed ""' "hello\n" "" "hello\n"
+testing "sed explicit stdin" 'sed "" -' "hello\n" "" "hello\n"
+testing "sed handles empty lines" "sed -e 's/\$/@/'" "@\n" "" "\n"
+testing "sed stdin twice" 'sed "" - -' "hello" "" "hello"
+
+# Trailing EOF.
+# Match $, at end of each file or all files?
+
+# -e corner cases
+# without -e
+# multiple -e
+# interact with a
+# -eee arg1 arg2 arg3
+# -f corner cases
+# -e -f -e
+# -n corner cases
+# no newline at EOF?
+# -r corner cases
+# Just make sure it works.
+# -i corner cases:
+# sed -i -
+# permissions
+# -i on a symlink
+# on a directory
+# With $ last-line test
+# Continue with \
+# End of script with trailing \
+
+# command list
+testing "sed accepts blanks before command" "sed -e '1 d'" "" "" ""
+testing "sed accepts newlines in -e" "sed -e 'i\
+1
+a\
+3'" "1\n2\n3\n" "" "2\n"
+testing "sed accepts multiple -e" "sed -e 'i\' -e '1' -e 'a\' -e '3'" \
+ "1\n2\n3\n" "" "2\n"
+
+# substitutions
+testing "sed -n" "sed -n -e s/foo/bar/ -e s/bar/baz/" "" "" "foo\n"
+testing "sed s//p" "sed -e s/foo/bar/p -e s/bar/baz/p" "bar\nbaz\nbaz\n" \
+ "" "foo\n"
+testing "sed -n s//p" "sed -ne s/abc/def/p" "def\n" "" "abc\n"
+testing "sed s//g (exhaustive)" "sed -e 's/[[:space:]]*/,/g'" ",1,2,3,4,5,\n" \
+ "" "12345\n"
+testing "sed s arbitrary delimiter" "sed -e 's woo boing '" "boing\n" "" "woo\n"
+testing "sed s chains" "sed -e s/foo/bar/ -e s/bar/baz/" "baz\n" "" "foo\n"
+testing "sed s chains2" "sed -e s/foo/bar/ -e s/baz/nee/" "bar\n" "" "foo\n"
+testing "sed s [delimiter]" "sed -e 's@[@]@@'" "onetwo" "" "one@two"
+testing "sed s with \\t (GNU ext)" "sed 's/\t/ /'" "one two" "" "one\ttwo"
+
+# branch
+testing "sed b (branch)" "sed -e 'b one;p;: one'" "foo\n" "" "foo\n"
+testing "sed b (branch with no label jumps to end)" "sed -e 'b;p'" \
+ "foo\n" "" "foo\n"
+
+# test and branch
+testing "sed t (test/branch)" "sed -e 's/a/1/;t one;p;: one;p'" \
+ "1\n1\nb\nb\nb\nc\nc\nc\n" "" "a\nb\nc\n"
+testing "sed t (test/branch clears test bit)" "sed -e 's/a/b/;:loop;t loop'" \
+ "b\nb\nc\n" "" "a\nb\nc\n"
+testing "sed T (!test/branch)" "sed -e 's/a/1/;T notone;p;: notone;p'" \
+ "1\n1\n1\nb\nb\nc\nc\n" "" "a\nb\nc\n"
+
+# Normal sed end-of-script doesn't print "c" because n flushed the pattern
+# space. If n hits EOF, pattern space is empty when script ends.
+# Query: how does this interact with no newline at EOF?
+testing "sed n (flushes pattern space, terminates early)" "sed -e 'n;p'" \
+ "a\nb\nb\nc\n" "" "a\nb\nc\n"
+# N does _not_ flush pattern space, therefore c is still in there @ script end.
+testing "sed N (doesn't flush pattern space when terminating)" "sed -e 'N;p'" \
+ "a\nb\na\nb\nc\n" "" "a\nb\nc\n"
+testing "sed address match newline" 'sed "/b/N;/b\\nc/i woo"' \
+ "a\nwoo\nb\nc\nd\n" "" "a\nb\nc\nd\n"
+
+# Multiple lines in pattern space
+testing "sed N (stops at end of input) and P (prints to first newline only)" \
+ "sed -n 'N;P;p'" "a\na\nb\n" "" "a\nb\nc\n"
+
+# Hold space
+testing "sed G (append hold space to pattern space)" 'sed G' "a\n\nb\n\nc\n\n" \
+ "" "a\nb\nc\n"
+#testing "sed g/G (swap/append hold and patter space)"
+#testing "sed g (swap hold/pattern space)"
+
+testing "sed d ends script iteration" \
+ "sed -e '/ook/d;s/ook/ping/p;i woot'" "" "" "ook\n"
+testing "sed d ends script iteration (2)" \
+ "sed -e '/ook/d;a\' -e 'bang'" "woot\nbang\n" "" "ook\nwoot\n"
+
+# Multiple files, with varying newlines and NUL bytes
+testing "sed embedded NUL" "sed -e 's/woo/bang/'" "\0bang\0woo\0" "" \
+ "\0woo\0woo\0"
+testing "sed embedded NUL g" "sed -e 's/woo/bang/g'" "bang\0bang\0" "" \
+ "woo\0woo\0"
+echo -e "/woo/a he\0llo" > sed.commands
+testing "sed NUL in command" "sed -f sed.commands" "woo\nhe\0llo\n" "" "woo"
+rm sed.commands
+
+# sed has funky behavior with newlines at the end of file. Test lots of
+# corner cases with the optional newline appending behavior.
+
+testing "sed normal newlines" "sed -e 's/woo/bang/' input -" "bang\nbang\n" \
+ "woo\n" "woo\n"
+testing "sed leave off trailing newline" "sed -e 's/woo/bang/' input -" \
+ "bang\nbang" "woo\n" "woo"
+testing "sed autoinsert newline" "sed -e 's/woo/bang/' input -" "bang\nbang" \
+ "woo" "woo"
+testing "sed empty file plus cat" "sed -e 's/nohit//' input -" "one\ntwo" \
+ "" "one\ntwo"
+testing "sed cat plus empty file" "sed -e 's/nohit//' input -" "one\ntwo" \
+ "one\ntwo" ""
+testing "sed append autoinserts newline" "sed -e '/woot/a woo' -" \
+ "woot\nwoo\n" "" "woot"
+testing "sed insert doesn't autoinsert newline" "sed -e '/woot/i woo' -" \
+ "woo\nwoot" "" "woot"
+testing "sed print autoinsert newlines" "sed -e 'p' -" "one\none" "" "one"
+testing "sed print autoinsert newlines two files" "sed -e 'p' input -" \
+ "one\none\ntwo\ntwo" "one" "two"
+testing "sed noprint, no match, no newline" "sed -ne 's/woo/bang/' input" \
+ "" "no\n" ""
+testing "sed selective matches with one nl" "sed -ne 's/woo/bang/p' input -" \
+ "a bang\nc bang\n" "a woo\nb no" "c woo\nd no"
+testing "sed selective matches insert newline" \
+ "sed -ne 's/woo/bang/p' input -" "a bang\nb bang\nd bang" \
+ "a woo\nb woo" "c no\nd woo"
+testing "sed selective matches noinsert newline" \
+ "sed -ne 's/woo/bang/p' input -" "a bang\nb bang" "a woo\nb woo" \
+ "c no\nd no"
+testing "sed clusternewline" \
+ "sed -e '/one/a 111' -e '/two/i 222' -e p input -" \
+ "one\none\n111\n222\ntwo\ntwo" "one" "two"
+testing "sed subst+write" \
+ "sed -e 's/i/z/' -e 'woutputw' input -; echo -n X; cat outputw" \
+ "thzngy\nagaznXthzngy\nagazn" "thingy" "again"
+rm outputw
+testing "sed trailing NUL" \
+ "sed 's/i/z/' input -" \
+ "a\0b\0\nc" "a\0b\0" "c"
+testing "sed escaped newline in command" \
+ "sed 's/a/z\\
+z/' input" \
+ "z\nz" "a" ""
+
+# Test end-of-file matching behavior
+
+testing "sed match EOF" "sed -e '"'$p'"'" "hello\nthere\nthere" "" \
+ "hello\nthere"
+testing "sed match EOF two files" "sed -e '"'$p'"' input -" \
+ "one\ntwo\nthree\nfour\nfour" "one\ntwo" "three\nfour"
+# sed match EOF inline: gnu sed 4.1.5 outputs this:
+#00000000 6f 6e 65 0a 6f 6f 6b 0a 6f 6f 6b 0a 74 77 6f 0a |one.ook.ook.two.|
+#00000010 0a 74 68 72 65 65 0a 6f 6f 6b 0a 6f 6f 6b 0a 66 |.three.ook.ook.f|
+#00000020 6f 75 72 |our|
+# which looks buggy to me.
+$ECHO -ne "three\nfour" > input2
+testing "sed match EOF inline" \
+ "sed -e '"'$i ook'"' -i input input2 && cat input input2" \
+ "one\nook\ntwothree\nook\nfour" "one\ntwo" ""
+rm input2
+
+# Test lie-to-autoconf
+
+testing "sed lie-to-autoconf" "sed --version | grep -o 'GNU sed version '" \
+ "GNU sed version \n" "" ""
+
+# Jump to nonexistent label
+testing "sed nonexistent label" "sed -e 'b walrus' 2> /dev/null || echo yes" \
+ "yes\n" "" ""
+
+testing "sed backref from empty s uses range regex" \
+ "sed -e '/woot/s//eep \0 eep/'" "eep woot eep" "" "woot"
+
+testing "sed backref from empty s uses range regex with newline" \
+ "sed -e '/woot/s//eep \0 eep/'" "eep woot eep\n" "" "woot\n"
+
+# -i with no filename
+
+touch ./- # Detect gnu failure mode here.
+testing "sed -i with no arg [GNUFAIL]" "sed -e '' -i 2> /dev/null || echo yes" \
+ "yes\n" "" ""
+rm ./- # Clean up
+
+testing "sed s/xxx/[/" "sed -e 's/xxx/[/'" "[\n" "" "xxx\n"
+
+# Ponder this a bit more, why "woo not found" from gnu version?
+#testing "sed doesn't substitute in deleted line" \
+# "sed -e '/ook/d;s/ook//;t woo;a bang;'" "bang" "" "ook\n"
+
+# This makes both seds very unhappy. Why?
+#testing "sed -g (exhaustive)" "sed -e 's/[[:space:]]*/,/g'" ",1,2,3,4,5," \
+# "" "12345"
+
+# testing "description" "arguments" "result" "infile" "stdin"
+
+testing "sed n command must reset 'substituted' bit" \
+ "sed 's/1/x/;T;n;: next;s/3/y/;t quit;n;b next;: quit;q'" \
+ "0\nx\n2\ny\n" "" "0\n1\n2\n3\n"
+
+exit $FAILCOUNT
diff --git a/testsuite/seq.tests b/testsuite/seq.tests
new file mode 100755
index 0000000..ebb44e7
--- /dev/null
+++ b/testsuite/seq.tests
@@ -0,0 +1,36 @@
+#!/bin/sh
+
+# SUSv3 compliant seq tests.
+# Copyright 2006 by Rob Landley <rob@landley.net>
+# Licensed under GPL v2, see file LICENSE for details.
+
+# AUDIT: Full SUSv3 coverage (except internationalization).
+
+. testing.sh
+
+# testing "test name" "options" "expected result" "file input" "stdin"
+# file input will be file called "input"
+# test can create a file "actual" instead of writing to stdout
+
+# Test exit status
+
+testing "seq (exit with error)" "seq 2> /dev/null || echo yes" "yes\n" "" ""
+testing "seq (exit with error)" "seq 1 2 3 4 2> /dev/null || echo yes" \
+ "yes\n" "" ""
+testing "seq one argument" "seq 3" "1\n2\n3\n" "" ""
+testing "seq two arguments" "seq 5 7" "5\n6\n7\n" "" ""
+testing "seq two arguments reversed" "seq 7 5" "" "" ""
+testing "seq two arguments equal" "seq 3 3" "3\n" "" ""
+testing "seq two arguments equal, arbitrary negative step" "seq 1 -15 1" \
+ "1\n" "" ""
+testing "seq two arguments equal, arbitrary positive step" "seq 1 +15 1" \
+ "1\n" "" ""
+testing "seq count up by 2" "seq 4 2 8" "4\n6\n8\n" "" ""
+testing "seq count down by 2" "seq 8 -2 4" "8\n6\n4\n" "" ""
+testing "seq count wrong way #1" "seq 4 -2 8" "" "" ""
+testing "seq count wrong way #2" "seq 8 2 4" "" "" ""
+testing "seq count by .3" "seq 3 .3 4" "3\n3.3\n3.6\n3.9\n" "" ""
+testing "seq count by -.9" "seq .7 -.9 -2.2" "0.7\n-0.2\n-1.1\n-2\n" "" ""
+testing "seq count by zero" "seq 4 0 8 | head -n 10" "" "" ""
+
+exit $FAILCOUNT
diff --git a/testsuite/sort.tests b/testsuite/sort.tests
new file mode 100755
index 0000000..f700dc0
--- /dev/null
+++ b/testsuite/sort.tests
@@ -0,0 +1,119 @@
+#!/bin/bash
+
+# SUSv3 compliant sort tests.
+# Copyright 2005 by Rob Landley <rob@landley.net>
+# Licensed under GPL v2, see file LICENSE for details.
+
+. testing.sh
+
+# The basic tests. These should work even with the small busybox.
+
+testing "sort" "sort input" "a\nb\nc\n" "c\na\nb\n" ""
+testing "sort #2" "sort input" "010\n1\n3\n" "3\n1\n010\n" ""
+testing "sort stdin" "sort" "a\nb\nc\n" "" "b\na\nc\n"
+testing "sort numeric" "sort -n input" "1\n3\n010\n" "3\n1\n010\n" ""
+testing "sort reverse" "sort -r input" "wook\nwalrus\npoint\npabst\naargh\n" \
+ "point\nwook\npabst\naargh\nwalrus\n" ""
+
+# These tests require the full option set.
+
+optional FEATURE_SORT_BIG
+# Longish chunk of data re-used by the next few tests
+
+data="42 1 3 woot
+42 1 010 zoology
+egg 1 2 papyrus
+7 3 42 soup
+999 3 0 algebra
+"
+
+# Sorting with keys
+
+testing "sort one key" "sort -k4,4 input" \
+"999 3 0 algebra
+egg 1 2 papyrus
+7 3 42 soup
+42 1 3 woot
+42 1 010 zoology
+" "$data" ""
+
+testing "sort key range with numeric option" "sort -k2,3n input" \
+"42 1 010 zoology
+42 1 3 woot
+egg 1 2 papyrus
+7 3 42 soup
+999 3 0 algebra
+" "$data" ""
+
+# Busybox is definitely doing this one wrong just now. FIXME
+
+testing "sort key range with numeric option and global reverse" \
+"sort -k2,3n -r input" \
+"egg 1 2 papyrus
+42 1 3 woot
+42 1 010 zoology
+999 3 0 algebra
+7 3 42 soup
+" "$data" ""
+
+#
+
+testing "sort key range with multiple options" "sort -k2,3rn input" \
+"7 3 42 soup
+999 3 0 algebra
+42 1 010 zoology
+42 1 3 woot
+egg 1 2 papyrus
+" "$data" ""
+
+testing "sort key range with two -k options" "sort -k 2,2n -k 1,1r input" "\
+d 2
+b 2
+c 3
+" "\
+c 3
+b 2
+d 2
+" ""
+
+testing "sort with non-default leading delim 1" "sort -n -k2 -t/ input" "\
+/a/2
+/b/1
+" "\
+/a/2
+/b/1
+" ""
+
+testing "sort with non-default leading delim 2" "sort -n -k3 -t/ input" "\
+/b/1
+/a/2
+" "\
+/b/1
+/a/2
+" ""
+
+testing "sort with non-default leading delim 3" "sort -n -k3 -t/ input" "\
+//a/2
+//b/1
+" "\
+//a/2
+//b/1
+" ""
+
+testing "sort -u should consider field only when discarding" "sort -u -k2 input" "\
+a c
+" "\
+a c
+b c
+" ""
+
+testing "sort -z outputs NUL terminated lines" "sort -z input" "\
+one\0three\0two\0\
+" "\
+one\0two\0three\0\
+" ""
+
+testing "sort key doesn't strip leading blanks, disables fallback global sort" \
+"sort -n -k2 -t ' '" " a \n 1 \n 2 \n" "" " 2 \n 1 \n a \n"
+
+exit $FAILCOUNT
diff --git a/testsuite/start-stop-daemon.tests b/testsuite/start-stop-daemon.tests
new file mode 100755
index 0000000..ba77cde
--- /dev/null
+++ b/testsuite/start-stop-daemon.tests
@@ -0,0 +1,19 @@
+#!/bin/sh
+# Copyright 2008 by Denys Vlasenko
+# Licensed under GPL v2, see file LICENSE for details.
+
+. testing.sh
+
+# testing "test name" "cmd" "expected result" "file input" "stdin"
+
+testing "start-stop-daemon -x without -a" \
+ 'start-stop-daemon -S -x true 2>&1; echo $?' \
+ "0\n" \
+ "" ""
+
+testing "start-stop-daemon -a without -x" \
+ 'start-stop-daemon -S -a false 2>&1; echo $?' \
+ "1\n" \
+ "" ""
+
+exit $FAILCOUNT
diff --git a/testsuite/strings/strings-works-like-GNU b/testsuite/strings/strings-works-like-GNU
new file mode 100644
index 0000000..2d64710
--- /dev/null
+++ b/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/testsuite/sum.tests b/testsuite/sum.tests
new file mode 100755
index 0000000..e537cf6
--- /dev/null
+++ b/testsuite/sum.tests
@@ -0,0 +1,24 @@
+#!/bin/sh
+
+# unit test for sum.
+# Copyright 2007 by Bernhard Reutner-Fischer
+# Licensed under GPL v2 or later, see file LICENSE for details.
+
+# AUDIT: Unit tests for sum
+
+. testing.sh
+
+# testing "test name" "options" "expected result" "file input" "stdin"
+# file input will be file called "input"
+# test can create a file "actual" instead of writing to stdout
+
+testing "sum -r file doesn't print file's name" \
+ "sum -r $0 | grep -c $0 && echo wrongly_printed_filename || echo yes" \
+ "0\nyes\n" "" ""
+testing "sum -r file file does print both names" \
+ "sum -r $0 $0 | grep -c $0 && echo yes || echo wrongly_omitted_filename" \
+ "2\nyes\n" "" ""
+testing "sum -s file does print file's name" \
+ "sum -s $0 | grep -c $0 && echo yes || echo wrongly_omitted_filename" \
+ "1\nyes\n" "" ""
+exit $FAILCOUNT
diff --git a/testsuite/tail/tail-n-works b/testsuite/tail/tail-n-works
new file mode 100644
index 0000000..0e1319f
--- /dev/null
+++ b/testsuite/tail/tail-n-works
@@ -0,0 +1,4 @@
+$ECHO -ne "abc\ndef\n123\n" >input
+$ECHO -ne "def\n123\n" >logfile.ok
+busybox tail -n 2 input > logfile.bb
+cmp logfile.ok logfile.bb
diff --git a/testsuite/tail/tail-works b/testsuite/tail/tail-works
new file mode 100644
index 0000000..f3434d1
--- /dev/null
+++ b/testsuite/tail/tail-works
@@ -0,0 +1,4 @@
+$ECHO -ne "abc\ndef\n123\n" >input
+$ECHO -ne "def\n123\n" >logfile.ok
+busybox tail -2 input > logfile.bb
+cmp logfile.ok logfile.bb
diff --git a/testsuite/tar/tar-archives-multiple-files b/testsuite/tar/tar-archives-multiple-files
new file mode 100644
index 0000000..245d9e9
--- /dev/null
+++ b/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/testsuite/tar/tar-complains-about-missing-file b/testsuite/tar/tar-complains-about-missing-file
new file mode 100644
index 0000000..26e8cbb
--- /dev/null
+++ b/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/testsuite/tar/tar-demands-at-least-one-ctx b/testsuite/tar/tar-demands-at-least-one-ctx
new file mode 100644
index 0000000..85e7f60
--- /dev/null
+++ b/testsuite/tar/tar-demands-at-least-one-ctx
@@ -0,0 +1 @@
+! busybox tar v
diff --git a/testsuite/tar/tar-demands-at-most-one-ctx b/testsuite/tar/tar-demands-at-most-one-ctx
new file mode 100644
index 0000000..130d0e7
--- /dev/null
+++ b/testsuite/tar/tar-demands-at-most-one-ctx
@@ -0,0 +1 @@
+! busybox tar tx
diff --git a/testsuite/tar/tar-extracts-all-subdirs b/testsuite/tar/tar-extracts-all-subdirs
new file mode 100644
index 0000000..886c37c
--- /dev/null
+++ b/testsuite/tar/tar-extracts-all-subdirs
@@ -0,0 +1,12 @@
+# FEATURE: CONFIG_FEATURE_TAR_CREATE
+mkdir -p foo/{1,2,3}
+mkdir -p foo/1/{10,11}
+mkdir -p foo/1/10/{100,101,102}
+tar cf foo.tar -C foo .
+rm -rf foo/*
+busybox tar xf foo.tar -C foo ./1/10
+find foo | sort >logfile.bb
+rm -rf foo/*
+tar xf foo.tar -C foo ./1/10
+find foo | sort >logfile.gnu
+cmp logfile.gnu logfile.bb
diff --git a/testsuite/tar/tar-extracts-file b/testsuite/tar/tar-extracts-file
new file mode 100644
index 0000000..ca72f24
--- /dev/null
+++ b/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/testsuite/tar/tar-extracts-from-standard-input b/testsuite/tar/tar-extracts-from-standard-input
new file mode 100644
index 0000000..a30e9f0
--- /dev/null
+++ b/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/testsuite/tar/tar-extracts-multiple-files b/testsuite/tar/tar-extracts-multiple-files
new file mode 100644
index 0000000..7897d81
--- /dev/null
+++ b/testsuite/tar/tar-extracts-multiple-files
@@ -0,0 +1,6 @@
+touch foo bar
+tar cf foo.tar foo bar
+rm foo bar
+busybox tar -xf foo.tar
+test -f foo
+test -f bar
diff --git a/testsuite/tar/tar-extracts-to-standard-output b/testsuite/tar/tar-extracts-to-standard-output
new file mode 100644
index 0000000..ca48e36
--- /dev/null
+++ b/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/testsuite/tar/tar-handles-cz-options b/testsuite/tar/tar-handles-cz-options
new file mode 100644
index 0000000..5b55e46
--- /dev/null
+++ b/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/testsuite/tar/tar-handles-empty-include-and-non-empty-exclude-list b/testsuite/tar/tar-handles-empty-include-and-non-empty-exclude-list
new file mode 100644
index 0000000..5033642
--- /dev/null
+++ b/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/testsuite/tar/tar-handles-exclude-and-extract-lists b/testsuite/tar/tar-handles-exclude-and-extract-lists
new file mode 100644
index 0000000..2de0f0e
--- /dev/null
+++ b/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/testsuite/tar/tar-handles-multiple-X-options b/testsuite/tar/tar-handles-multiple-X-options
new file mode 100644
index 0000000..155b27e
--- /dev/null
+++ b/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/testsuite/tar/tar-handles-nested-exclude b/testsuite/tar/tar-handles-nested-exclude
new file mode 100644
index 0000000..39013a1
--- /dev/null
+++ b/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/testsuite/tar/tar_with_link_with_size b/testsuite/tar/tar_with_link_with_size
new file mode 100644
index 0000000..5b61cc7
--- /dev/null
+++ b/testsuite/tar/tar_with_link_with_size
@@ -0,0 +1,29 @@
+# This tarball contains a softlink with size field != 0.
+# If not ignored, it makes hext header to be skipped
+# and data to be read as a header.
+# GNU tar 1.15.1 has a bug here: tf won't work, but xf will.
+tar1_bz2()
+{
+ $ECHO -ne "\x42\x5a\x68\x39\x31\x41\x59\x26\x53\x59\x14\x44\xe3\xdd\x00\x00"
+ $ECHO -ne "\x9a\xfb\x90\xca\x18\x00\xc0\x40\x03\xff\x80\x08\x00\x7b\xe3\xff"
+ $ECHO -ne "\x80\x04\x00\x00\x08\x30\x00\xd6\xb3\x09\x45\x19\x0d\x0d\x41\x84"
+ $ECHO -ne "\x1a\x68\xd0\x7a\x99\x90\x4a\x0a\x6d\x4c\xa3\x20\x7a\x41\xa0\x00"
+ $ECHO -ne "\x00\x55\x25\x34\x1a\x34\xd0\x00\x64\x64\x1a\x32\x3f\x76\x3c\x1c"
+ $ECHO -ne "\xd3\x3c\xa0\x84\x9b\x88\x05\x70\x90\xbb\x18\x28\x39\x29\xb3\x30"
+ $ECHO -ne "\xa8\x0a\x21\x70\x0c\x01\x32\x3b\xbe\xde\xd7\x13\x2e\xbd\x2a\x9c"
+ $ECHO -ne "\xa8\x42\x2a\x91\x15\xe2\xa1\xcd\x24\x37\x9c\x91\xaa\xc7\x14\xdb"
+ $ECHO -ne "\x4c\x08\xaa\xaf\x12\xeb\x6c\x37\x96\xb0\xa4\x25\x0c\xb4\x4b\xc5"
+ $ECHO -ne "\x52\x70\x3b\x25\x4c\x0e\x46\x67\x51\x54\x89\x13\x13\xf0\xa8\xe9"
+ $ECHO -ne "\x68\x4e\x8c\x81\xfc\x79\xe0\xb0\xd8\x79\x34\x94\x71\xa2\x0c\xbe"
+ $ECHO -ne "\x93\x61\x82\x95\x10\x88\xd1\xa6\x69\xaa\x38\x9c\xb6\xc2\xb2\x94"
+ $ECHO -ne "\x90\xc3\x82\x29\xe8\x8c\xb8\x95\x83\x32\x40\x61\x11\x11\xd3\xaa"
+ $ECHO -ne "\x3f\x8b\xb9\x22\x9c\x28\x48\x0a\x22\x71\xee\x80"
+}
+res1="\
+lrwxrwxrwx user/group 0 2008-07-19 15:02:37 firmware-372/sources/native/bin/chroot-setup.sh -> qemu-setup.sh
+-rwxr-xr-x user/group 512 2008-07-19 15:02:37 firmware-372/sources/native/bin/qemu-setup.sh"
+
+export TZ=UTC-2
+
+t=`tar1_bz2 | bunzip2 | busybox tar tvf -`
+test x"$res1" = x"$t"
diff --git a/testsuite/tar/tar_with_prefix_fields b/testsuite/tar/tar_with_prefix_fields
new file mode 100644
index 0000000..1c7124d
--- /dev/null
+++ b/testsuite/tar/tar_with_prefix_fields
@@ -0,0 +1,261 @@
+tar1_bz2()
+{
+ $ECHO -ne "\x42\x5a\x68\x39\x31\x41\x59\x26\x53\x59\x12\xd1\x86\x30\x00\x0c"
+ $ECHO -ne "\xb8\x7f\x80\xff\x50\x08\xa0\x5e\xff\xff\xfd\x7f\xff\xff\xee\xff"
+ $ECHO -ne "\xff\xff\xfa\x00\x08\x60\x0f\xc5\x3e\xf4\xdc\x00\x00\x59\x25\xbd"
+ $ECHO -ne "\xb8\x7a\x02\xb5\x82\x78\x25\xb0\x89\x54\x10\x11\x44\x8b\x36\x36"
+ $ECHO -ne "\xc8\x97\x0d\x34\x9a\x21\xa9\x36\xa9\xed\x32\x02\x8d\xa6\x81\x8a"
+ $ECHO -ne "\x79\x13\x4d\x1a\x03\x10\x69\xa0\xd3\x40\x64\x0f\x44\x68\x3d\x41"
+ $ECHO -ne "\x2a\x7a\x20\x09\xa1\x34\x9a\x09\xa4\xc8\xf5\x4f\x46\xa6\x86\x32"
+ $ECHO -ne "\x4c\x08\x00\x00\xd0\x06\x9a\x00\xd3\xd4\x11\x49\xa7\xb5\x20\x1a"
+ $ECHO -ne "\x7a\x80\x00\x00\x00\x00\xd0\x68\x00\x00\x00\x00\x00\x49\xa8\x89"
+ $ECHO -ne "\xa9\x31\x4f\x22\xa7\xea\x9b\x61\x53\xf4\x93\xf2\xa3\x47\xa4\xd3"
+ $ECHO -ne "\x41\xea\x06\x41\xa0\x0d\x00\x00\x00\x1e\xa0\x70\x34\xd3\x4d\x06"
+ $ECHO -ne "\x86\x86\x86\x46\x80\x64\x01\xa1\xa0\x34\xd1\x90\x00\x03\x09\x88"
+ $ECHO -ne "\x0d\x04\x89\x08\x00\x82\x7a\x4c\x42\x64\xc9\x3d\x1a\x29\xe9\xa2"
+ $ECHO -ne "\x3d\x46\x9e\x46\x9a\x13\x26\x9e\x53\x10\x01\x91\xea\x68\x19\xf0"
+ $ECHO -ne "\x73\xf2\xe0\xd1\x3c\x80\x01\xb1\x48\x44\x08\x9a\xba\xf3\x9e\x87"
+ $ECHO -ne "\xec\xc4\x4b\x02\x92\x80\x75\x00\x56\x42\x88\x10\x68\xcc\x06\x22"
+ $ECHO -ne "\x7c\x2b\xa7\xc8\x21\x91\x13\xe5\x72\xc0\xe6\x0c\x03\x10\xf2\x89"
+ $ECHO -ne "\x9c\x67\x6b\xc3\xe6\xae\x98\x85\x0a\x7f\x25\x2e\x3d\x84\x5b\xeb"
+ $ECHO -ne "\xf3\xff\xb3\x52\xf7\x6e\xf6\x92\xd6\x33\x5f\x4f\xd1\x3d\xb7\xc4"
+ $ECHO -ne "\x0d\x50\x02\x49\x01\xaf\xd0\x69\xbb\xd3\xe9\x63\x0a\x68\x36\x92"
+ $ECHO -ne "\xf2\x03\x1d\xf2\xe2\x35\xbc\x73\xd4\x44\xf6\xa0\xe0\x31\xd7\x7d"
+ $ECHO -ne "\x56\x96\xcb\x52\xfc\x79\xe0\xeb\xf7\x34\xd8\xda\x18\x72\x30\x94"
+ $ECHO -ne "\x53\x45\xf5\x54\x56\x6c\x0b\x50\xa0\xbc\xbd\xcc\xd8\x21\xab\x7b"
+ $ECHO -ne "\xa8\xa4\xe4\x78\x25\x73\xbf\x4b\x30\x38\x71\xe9\x3c\x14\x5d\xa3"
+ $ECHO -ne "\x12\x04\x6b\x37\x9d\xe5\xce\xa5\xd9\xd1\xa5\x69\x09\x08\xc4\x48"
+ $ECHO -ne "\x4b\x34\x58\x81\x15\x18\x88\xac\x11\x51\x88\x35\x0d\xd3\x13\x18"
+ $ECHO -ne "\x67\x73\x20\x5c\x28\x03\x26\xcd\x6d\x20\x90\xba\xa4\x12\xb3\x08"
+ $ECHO -ne "\x27\x74\x6a\x99\xdf\xb1\x20\x3d\x85\xe7\x5f\xab\x0e\x2e\xdc\x23"
+ $ECHO -ne "\x99\xe1\xef\x34\x68\xcd\xa9\xb0\xbf\xda\xec\x81\xdd\x66\xca\x21"
+ $ECHO -ne "\x13\x47\xd7\xca\x48\xcf\xeb\x25\xbb\x79\x6d\x40\xd0\xe4\x69\x3c"
+ $ECHO -ne "\x8f\x09\x1e\x7b\xaa\x4b\x91\x39\xac\xd6\xd2\x0c\x85\x1d\xf7\x70"
+ $ECHO -ne "\x1f\x1e\x58\xbb\x22\x11\x29\x39\x14\x4d\x58\x81\x9f\xd7\x1e\x22"
+ $ECHO -ne "\x21\x91\x0a\x40\xd1\x87\x29\x99\x93\xf4\xf3\x25\x48\xbb\xb4\x24"
+ $ECHO -ne "\x2a\x1c\xa7\x28\xc1\x68\x08\x25\x00\xaa\x3d\xee\xae\xc1\xe1\x4f"
+ $ECHO -ne "\xe6\x9a\x26\x6b\xcf\xb1\x3e\xb9\x85\x04\xf4\xef\xff\x7a\x2f\x2a"
+ $ECHO -ne "\x04\x08\xe0\x4c\xb8\xbd\x8b\x81\xbf\xa2\xbe\x82\x52\x9b\x40\x63"
+ $ECHO -ne "\xe6\xf3\xb3\xe4\xe6\xe5\x94\x4a\xdd\xc3\x1b\xaf\x61\xf3\xbf\x5b"
+ $ECHO -ne "\x6d\xaa\xaa\x27\xe8\x50\x8d\x23\x97\xa4\xbd\xc3\xd2\xe6\xb5\x66"
+ $ECHO -ne "\x9a\x1a\x8e\x45\x2a\xed\x0b\x79\xb8\x89\x38\x4a\x04\x85\x0d\x1e"
+ $ECHO -ne "\x2b\x77\x51\x91\x5f\x9f\xe0\x2a\x49\x56\xd3\xa1\xde\xf6\xd7\x88"
+ $ECHO -ne "\x5a\x61\xe5\x04\x54\xdf\xa3\x92\xeb\xbf\x75\x39\xce\xfa\xf5\xde"
+ $ECHO -ne "\x30\xd7\x56\xd1\x7d\x2c\xdf\xda\x3e\x1c\xc8\xc2\x93\x61\x21\x20"
+ $ECHO -ne "\xb2\x22\x6d\xbe\x39\x52\x64\xf6\xb3\x91\x21\x86\xdb\x67\x72\x8f"
+ $ECHO -ne "\x49\xad\xe4\x93\x39\x5c\x34\x8f\x58\xdb\x58\xd3\x3c\x1e\x4c\x6c"
+ $ECHO -ne "\xbb\x70\x6f\x42\xcf\x9e\xbf\xb1\xcb\xa9\x8d\x05\xe7\xea\xea\xd7"
+ $ECHO -ne "\x3c\x67\x31\x69\x44\x33\xa4\x92\x9c\x65\xa4\x89\x5a\xae\xcf\xc9"
+ $ECHO -ne "\x55\x43\x62\x6d\xbf\x05\x3c\xd1\x0f\x01\x4a\xb5\x1d\xbb\x2c\xfb"
+ $ECHO -ne "\xa6\xb7\xb3\xb1\x1d\x66\xd3\xeb\x22\xd0\xb5\x5a\x4b\xc4\x47\x47"
+ $ECHO -ne "\x5a\x49\x85\x18\xbc\x15\x39\x3b\x92\xee\x51\x98\x33\x34\x5d\xb5"
+ $ECHO -ne "\xbb\x8b\x94\x8c\xde\x8e\x3f\x3d\x09\x4f\xba\xd3\xf6\x79\x74\x8e"
+ $ECHO -ne "\x82\x0d\x56\x85\xa2\xc7\xc6\xa6\x89\x29\x26\xa3\x53\x5e\x52\xf5"
+ $ECHO -ne "\x56\x74\x8b\x17\x82\xed\x7a\x8b\x68\x61\xa5\xc9\x7c\xde\x9f\x68"
+ $ECHO -ne "\x27\x4d\xea\x65\x68\x6f\x7d\x5e\x88\x73\x87\x6c\x92\xf2\xa9\x15"
+ $ECHO -ne "\x4e\xee\x4d\x41\xbb\x98\x5d\x8a\xaf\xcb\x11\x7b\x2a\xce\xf4\x1e"
+ $ECHO -ne "\x3a\x28\x48\x14\xfe\x7f\x09\x45\x48\xf1\x5b\xc1\xcb\xcd\x91\xba"
+ $ECHO -ne "\x3b\xe2\x7d\x57\x85\x66\x68\xec\x51\x82\x97\x88\xeb\x94\x3b\x78"
+ $ECHO -ne "\x6c\xf4\xf1\x3e\x38\x8d\x22\x16\xab\x3b\x13\xb3\x1b\x39\x94\x0e"
+ $ECHO -ne "\xa8\x26\xb7\x8d\xe9\x7d\x66\x23\x4b\x65\x07\xb7\x2b\xc9\x96\xb6"
+ $ECHO -ne "\x99\x12\x22\xbc\x90\xda\x51\xbc\xfd\x97\xa5\x7d\xbc\x12\xa6\x72"
+ $ECHO -ne "\xd3\xe3\x8c\xc7\x58\xe1\xf8\x28\xf4\x46\x49\x14\xd0\x9d\xb6\xed"
+ $ECHO -ne "\xce\x99\xc6\xbc\xed\xa3\xab\xa0\x8c\x9d\xce\x1a\x1a\xc2\xe6\x77"
+ $ECHO -ne "\xba\xae\xba\xd6\xc9\xb2\xd1\x65\x24\x7b\x0d\xd4\xf2\xac\x28\xc3"
+ $ECHO -ne "\x1c\xbe\x4a\x54\xe3\x0f\x8d\xad\xb2\x37\x9e\x1f\x81\x72\x2d\xab"
+ $ECHO -ne "\x8f\xb1\xcd\xf7\xb4\x51\x2f\x1d\xf8\xad\x77\x14\x37\xd2\x1a\x9a"
+ $ECHO -ne "\xc0\xf2\x48\xc6\x4c\x8d\xd3\x8d\xf1\xd9\x2e\x2c\xdd\x7a\x98\x3c"
+ $ECHO -ne "\x24\x76\xb9\x9d\x27\xcd\x71\x7d\x6c\xc7\x1f\x0a\x74\x8a\x6e\x54"
+ $ECHO -ne "\xec\x5a\xa1\x77\x60\x80\xef\x00\xa4\x5f\x9e\x8b\x2f\x02\x72\x9c"
+ $ECHO -ne "\x46\xd8\x79\x92\x4c\x8f\x4e\x37\xed\x0c\x58\xab\x44\xee\x1d\xd1"
+ $ECHO -ne "\xa1\xb0\xa5\x1f\xaf\xb0\x39\x01\x26\xb2\x4a\x20\x68\x4a\x18\x23"
+ $ECHO -ne "\xc3\x03\x84\x22\x18\xdb\x6d\x83\x60\xc1\x12\x09\x21\x84\x22\x48"
+ $ECHO -ne "\x7f\x1e\x17\xf5\xbe\xce\x4c\x4f\x9f\x9f\xee\xf4\xfe\xef\x9a\x34"
+ $ECHO -ne "\x91\x8f\x36\x1d\xbc\x73\xd7\xeb\xc8\x2e\x81\x25\xfa\x18\x76\x35"
+ $ECHO -ne "\x1f\x16\xdb\x20\x4b\x74\x6d\x94\x4e\xe5\x36\xed\xf5\x5d\x59\xaf"
+ $ECHO -ne "\x46\x70\xea\x03\xac\x50\xbb\x26\xab\x39\x9a\x4b\x6b\x09\x8c\x6d"
+ $ECHO -ne "\x34\xcf\xed\xaa\xf7\x56\x40\xf2\xab\x07\xca\x22\x71\x97\xc7\x35"
+ $ECHO -ne "\xe8\x06\x90\x7b\xec\xc3\x9f\xa4\xde\xd9\xdb\x43\xf1\xd5\x06\x58"
+ $ECHO -ne "\x72\x9e\x1f\x08\xb6\xc2\x05\x0d\x25\xfe\x7a\x85\xe5\x10\x12\x68"
+ $ECHO -ne "\x18\x7e\x8c\xa0\xfa\xb4\xc4\xc7\x4e\xa9\xf2\x13\xd7\xc2\x52\xb5"
+ $ECHO -ne "\xe3\x72\x37\x31\x1e\x4f\x99\xfd\xac\x97\x08\x88\x71\x88\xeb\x1a"
+ $ECHO -ne "\xf9\xa1\x10\x9c\x44\x08\x56\x4a\x77\xaa\x0f\x19\x5f\x5f\xb3\x95"
+ $ECHO -ne "\xee\x9b\x9f\x5b\xb5\xc9\x0a\xf4\x28\x16\x25\x34\x6c\x72\xda\x92"
+ $ECHO -ne "\xb4\x2c\xbd\x5e\xb1\xe8\xe5\x0f\x68\xf3\x44\x8a\xd5\xfa\x73\x5c"
+ $ECHO -ne "\x89\x2e\x99\x7d\xed\xe3\x5b\x3f\x48\x97\xeb\xb6\x76\x5c\xa5\x9d"
+ $ECHO -ne "\xef\x12\x1e\x42\x89\x52\xad\x28\x90\xe5\x2b\x88\xa0\x4f\x11\x92"
+ $ECHO -ne "\xcd\xcc\x63\x40\x1a\xc7\x10\x0c\x2f\xcd\x01\xf2\x07\x38\xac\x14"
+ $ECHO -ne "\xe5\x90\xc0\x30\x21\xe2\xe3\x72\x0e\x3e\x04\xc8\x9e\xa7\x00\xdb"
+ $ECHO -ne "\x91\xdd\x9d\x80\xa4\x69\x2a\x48\x37\x97\xa4\x26\x5d\xae\x84\x1e"
+ $ECHO -ne "\x88\xf4\x83\x04\x24\xc9\x1f\x94\x61\x25\xf9\x82\xdd\xed\x2d\x96"
+ $ECHO -ne "\xad\x06\x45\xdd\x88\xd7\x50\x40\x14\xdc\x7c\xdb\x0f\x53\x96\x27"
+ $ECHO -ne "\xcb\x67\xac\xa6\xc1\x15\x2f\xc3\xdb\x2c\xca\x94\xb3\xf3\xd1\x6a"
+ $ECHO -ne "\xba\x34\x83\xd1\xcc\x40\x3e\x76\xa1\x69\x7f\x49\x33\xdc\xa7\x3c"
+ $ECHO -ne "\x6a\x67\x15\xab\xdb\x52\xa0\xb8\xa6\x1e\xce\xe3\xaf\xf4\xa2\x62"
+ $ECHO -ne "\x35\x0f\x03\x40\x8e\x20\x12\x9c\xb6\x34\x71\x3a\x15\x5d\xe5\x34"
+ $ECHO -ne "\xa8\xd4\x05\x99\x6b\x9a\xb6\x41\x0b\x78\xc4\xd8\xd9\x7a\x65\xdc"
+ $ECHO -ne "\xdb\xe3\x42\xd5\x66\xf9\xb4\x83\x7e\xc0\xf4\x01\xc4\xcc\x3b\x0e"
+ $ECHO -ne "\x15\xdc\x15\xc2\x3e\x04\x2f\xfc\x6b\x72\xeb\xf6\xaa\x16\x20\xde"
+ $ECHO -ne "\xd3\x3a\xb1\x10\xc6\x3c\xe8\x2b\xb8\xea\xda\x19\x6e\x36\xaa\xa4"
+ $ECHO -ne "\x23\x6d\xa0\x40\xd1\x5a\x0b\x7e\xa4\xd5\x2d\xcb\xa9\x15\x35\xba"
+ $ECHO -ne "\x93\x92\x45\x41\xb0\x1a\xd1\x13\x31\xb6\x44\x98\x78\x28\x15\xe4"
+ $ECHO -ne "\xae\xba\x58\xd1\x75\x36\x34\x1a\xd8\x28\xf1\x4a\x4c\xbc\x1b\xa8"
+ $ECHO -ne "\xf7\x57\x92\xbc\xe2\xb5\xda\xb6\xa6\x1d\x83\x37\x96\x43\x20\x84"
+ $ECHO -ne "\xcb\xb6\xd9\x3f\xeb\xfa\xa0\xfe\x9a\x7d\xee\x47\x98\xc4\xe7\xc4"
+ $ECHO -ne "\xbd\xc6\xf0\x6d\xb2\x26\x10\x1e\x78\xef\xf3\x28\x3e\x35\xe6\xe4"
+ $ECHO -ne "\xe6\xf3\x0f\x26\x34\x13\x85\xd0\xcf\x55\x0f\x8b\xd7\xe9\xf4\xdf"
+ $ECHO -ne "\x70\x68\xc0\xb5\x30\x3c\xb1\x01\xe8\x28\xae\x80\x26\x01\x8b\x15"
+ $ECHO -ne "\x0f\x80\x48\x18\x4b\xe2\xed\x59\x92\x31\xcf\xd2\x8f\x42\xbf\xee"
+ $ECHO -ne "\xbd\x07\x91\x24\xc6\x66\x5e\x8c\x9a\x48\x63\xe7\xac\x8a\x1e\xc5"
+ $ECHO -ne "\x69\x16\x8d\xac\x67\xdc\x75\x75\x82\xca\x19\x28\x36\x4d\x10\xf9"
+ $ECHO -ne "\x41\xcb\x15\x05\x64\xc7\xb0\xc3\x64\xf3\x48\x71\x60\xf2\xbd\xcc"
+ $ECHO -ne "\x37\xb1\x36\xbc\xa7\x2e\x6b\x20\x11\x51\x42\xe1\x8a\x29\xac\x44"
+ $ECHO -ne "\x8f\x63\x56\x23\xd4\xd4\x07\xb4\x60\xa4\xb8\xcd\xee\x49\xa5\x42"
+ $ECHO -ne "\xcc\x52\x00\x6f\xdc\x44\x20\x57\x7d\x36\xd7\x48\x1a\x22\x2c\xd0"
+ $ECHO -ne "\x19\x43\x51\x5e\x1c\x8c\x5f\x70\xc2\x6b\xcf\xea\xd4\x97\x61\x72"
+ $ECHO -ne "\x33\xc3\x9a\xd4\x06\xf1\x8a\x9a\xfe\x21\x83\x0b\xea\xf1\xfa\x2c"
+ $ECHO -ne "\x52\x23\x2c\xb8\xc1\xe6\xc8\x9d\x9c\x5f\x8f\xf2\x4a\x86\x76\x92"
+ $ECHO -ne "\x78\x0f\x7d\x9d\x09\x38\xce\xe1\x9a\xf3\x60\xed\x65\x0b\x1a\x68"
+ $ECHO -ne "\xa6\x52\x39\x18\x1e\x45\xe3\x5d\xe0\x7d\xfb\xc6\xcc\x44\x18\x93"
+ $ECHO -ne "\xe9\x71\xa8\x18\x0d\x74\x48\x8a\x18\x0b\x61\xbf\xe1\xa9\x0e\x4c"
+ $ECHO -ne "\xad\x1b\xaf\x1a\x37\x39\x92\x4d\xcc\x96\x87\x46\x0d\x83\x06\x33"
+ $ECHO -ne "\x53\x35\xd9\x2c\x36\x98\x28\x1c\x52\xb1\x89\x55\x56\xcc\x37\x20"
+ $ECHO -ne "\x89\x84\x0e\x3d\x27\x2f\xc6\xfa\x78\x04\xe1\xd5\xc6\x90\x49\x16"
+ $ECHO -ne "\xfe\x0a\x16\x6f\x11\x54\x42\x22\xa1\x90\x2d\x19\x91\x28\x05\xf2"
+ $ECHO -ne "\x30\x6c\x14\x16\xd6\x8a\xce\xf6\xcd\x7c\x64\x76\x42\xe9\x28\xe9"
+ $ECHO -ne "\x1c\xd1\xb8\x9e\xcd\x53\xb2\x6b\x8d\x57\x57\x2a\xb8\x59\x58\x8c"
+ $ECHO -ne "\xd3\x12\x57\xa6\xe3\x48\x70\xf5\x55\x0f\x76\xb5\x27\x08\xd1\xa0"
+ $ECHO -ne "\xf8\x60\x09\xa1\xf2\x30\x43\x4a\x30\x46\xf7\x96\x19\xe9\x3a\x44"
+ $ECHO -ne "\xc0\xd8\xa8\x51\xae\x50\x92\x81\x81\xda\x10\xd3\x18\x62\x94\xd0"
+ $ECHO -ne "\x9e\x54\x0b\x22\xcc\xd0\xfe\x0c\x36\x44\x4d\x4d\x40\x5c\xa8\x35"
+ $ECHO -ne "\xb6\x53\x9c\x36\x9c\x5a\x0e\x0e\xb0\x5c\x29\x2a\x35\x66\xaa\x3a"
+ $ECHO -ne "\xcb\x23\x7b\xbb\xc8\x60\xbc\xb4\x28\xf4\x6e\xfe\x86\xfc\x16\x85"
+ $ECHO -ne "\x0c\xe0\x1d\xcf\xfd\x12\x28\xc6\x60\xd0\xe6\x2f\x76\xf0\x1a\x5b"
+ $ECHO -ne "\xfa\xa6\xc6\xea\x58\xbb\x26\x37\x84\xdd\x85\xd5\x37\x82\x76\xd9"
+ $ECHO -ne "\x14\x7a\xca\xed\x13\x72\xc3\xe1\xb9\x69\x45\xd4\xec\x44\x94\x26"
+ $ECHO -ne "\x8e\x0b\x90\xb6\x8b\x1f\x1e\x01\x96\x5a\xb9\x51\xa6\x27\xa2\x9b"
+ $ECHO -ne "\x38\xd9\x25\x32\x9b\x54\xfc\x45\xd1\xa8\x59\x35\x1a\xb0\xb2\x1a"
+ $ECHO -ne "\xc8\x88\x15\x42\x98\x50\x99\x12\x9e\xf5\x59\xb2\x5c\xc5\xa7\x34"
+ $ECHO -ne "\x35\xca\xb3\xed\xdc\xc9\x9f\x3e\x77\x8f\x6c\xde\xc8\x41\x6a\xc5"
+ $ECHO -ne "\x24\x85\x04\xa1\x2f\xe3\x47\x8c\x47\xd4\xdb\x74\x8c\xb6\x4c\xef"
+ $ECHO -ne "\xed\xad\x9f\x86\x31\xd8\xc8\x07\xc5\x11\x1c\x39\x3a\xf8\x75\x73"
+ $ECHO -ne "\xae\x78\x7d\x1d\x36\x5b\xd1\x23\x5d\x84\x17\x5d\x4b\xac\xd3\x70"
+ $ECHO -ne "\x8a\x83\x48\x48\x83\x7b\x5c\x99\x9e\x56\xbb\xfc\x0c\x4b\x04\xcf"
+ $ECHO -ne "\x83\x5d\xf8\x31\x2c\xc4\x5c\xa1\x68\x6a\x56\xe1\x7f\xbe\xd6\x59"
+ $ECHO -ne "\x6c\x55\xb0\x63\x41\xeb\x88\x69\xb6\x9b\x50\xc4\x31\xea\xb0\xd7"
+ $ECHO -ne "\xe2\xfb\x7b\xeb\xbb\x52\xc4\x97\x23\xe9\x16\x29\x18\x50\x4d\x0e"
+ $ECHO -ne "\x68\x62\xfb\x3f\xd9\x07\xb9\x89\x4d\x58\x7c\x32\x6d\x12\x3e\x9b"
+ $ECHO -ne "\x3a\x14\xee\xac\x3c\x8d\x09\x62\x30\x8e\xe0\x86\x84\xb9\xf3\x0d"
+ $ECHO -ne "\xf8\xad\x42\xa6\xbb\x7d\xd1\xf2\xf3\xc0\xe2\x32\xc4\x40\xaa\x8a"
+ $ECHO -ne "\x2a\xe9\xa9\x45\x83\x23\xf6\x90\x05\x24\x59\x22\x84\x50\x82\xc0"
+ $ECHO -ne "\x58\x41\x42\x18\x91\x3d\xd8\x80\xb1\x26\x68\xb2\xa8\xc0\x21\x14"
+ $ECHO -ne "\x18\xdf\x3a\x86\x25\x85\x56\xab\x20\x38\xcd\xdc\x98\x6e\x07\xc4"
+ $ECHO -ne "\x6b\x16\x55\xe0\x41\xe0\x41\xda\x29\x62\x8d\xba\xce\xa2\xcb\xfc"
+ $ECHO -ne "\x70\x78\x99\xf9\x16\x0b\x5a\x0c\xc5\xad\x18\xeb\xf0\xb5\xc9\x25"
+ $ECHO -ne "\x82\x16\xe0\x5d\xc1\xc4\xc6\xf0\x84\x6a\x45\x7d\xdb\x28\x46\xab"
+ $ECHO -ne "\xef\x32\xc9\x49\x50\x51\x60\x77\x1c\xfd\x58\x9c\x01\x3b\x7a\xfa"
+ $ECHO -ne "\x49\x47\x3e\x87\x1c\x39\xa6\x6a\xa4\xb7\x39\x93\xac\xac\xb0\x39"
+ $ECHO -ne "\x2f\xbc\xab\x9b\x52\x96\x24\x46\xc1\x95\xe4\x31\x89\x37\x18\xc8"
+ $ECHO -ne "\x2c\x22\x32\x2a\x8f\xb6\x58\x77\x57\x77\x2f\x09\xd0\x7c\xed\x74"
+ $ECHO -ne "\xaa\x7c\x86\x25\x45\x0c\x43\x4d\x31\xb0\x63\x40\xcf\x86\xfe\x75"
+ $ECHO -ne "\x76\xe0\xee\x99\xb5\x71\xe2\x4e\xe5\xc1\xf9\x2e\x48\xe2\xa6\x1b"
+ $ECHO -ne "\x28\xa5\xa3\xbe\xff\x37\xd1\xdd\x66\xa2\xe8\xd3\x88\x4d\x13\xd5"
+ $ECHO -ne "\x68\x51\x27\x41\xc3\x6c\x1b\x48\x67\x6a\xdf\x25\x2a\x40\xa1\x87"
+ $ECHO -ne "\x1d\x54\xb7\xe3\x91\xc2\x6b\x5b\xb9\x8c\xd5\x10\x11\x10\x16\xab"
+ $ECHO -ne "\x6b\xbe\x65\x6b\x73\xa7\x35\xa1\x09\x60\x60\xed\x96\x39\xc9\x40"
+ $ECHO -ne "\x5d\xdc\xee\x60\x49\x0c\x68\x18\x34\xb2\x6f\x2a\x95\x14\x29\x95"
+ $ECHO -ne "\x5b\x59\xd2\x1f\x63\x2a\xbe\xfd\xae\x09\x5c\xee\x11\xb5\x29\x36"
+ $ECHO -ne "\xca\xdf\x28\x8c\x65\x42\x46\x74\x0c\x39\x68\x30\xac\x2c\x2f\xd0"
+ $ECHO -ne "\x9b\xb3\x92\x19\x90\xa1\x07\xcc\xf6\xde\x64\x5f\x6f\xd7\xb6\xcc"
+ $ECHO -ne "\xe0\x70\x0f\x0b\xd2\x0e\x77\xa1\x70\xe3\x56\x90\x4b\x28\x58\xd0"
+ $ECHO -ne "\xd1\xe1\x9d\x18\x98\xba\x6b\x36\x54\xa9\x54\x09\x63\x49\x18\x55"
+ $ECHO -ne "\x60\xba\x11\xb1\x0a\x14\x45\x1f\xae\x08\x50\x09\x33\x00\xa2\xb2"
+ $ECHO -ne "\x71\x81\x75\x89\xb7\xb9\x0c\x73\xc0\x4c\x32\x89\x72\xac\xa9\xa3"
+ $ECHO -ne "\x47\x5f\x7d\x4e\x1b\x4d\xb9\xea\x84\x45\x00\x37\x3c\xb3\x7b\xf8"
+ $ECHO -ne "\xe7\x0f\xaa\x33\x1a\x9b\xc2\x0c\x35\x8a\xd4\x04\x46\x42\xcb\xab"
+ $ECHO -ne "\xaa\xc7\xe5\xc9\x20\x6e\x21\xa6\x8c\xed\x61\x86\x42\x87\x03\x25"
+ $ECHO -ne "\xde\x2c\x4a\x85\xcb\xb4\x36\xc9\xd4\x72\x60\x62\xc2\x19\xd0\x30"
+ $ECHO -ne "\x16\x6d\x58\x61\x62\x16\xe8\xd2\x0e\xd0\xf3\xdb\x53\x37\x07\x37"
+ $ECHO -ne "\x40\xc3\xe5\x5b\x9d\x16\x45\x60\x8e\xfb\x12\xc4\x5f\x9f\xdd\xe1"
+ $ECHO -ne "\x45\x5d\x45\x36\x21\xa0\xc0\xb8\x11\x98\x0f\x64\x98\x67\x1c\x11"
+ $ECHO -ne "\xa9\xa1\x65\x10\xb9\x22\x12\x91\x10\x9b\x10\x6f\x95\x2e\x34\x91"
+ $ECHO -ne "\x64\x82\xa4\x05\x02\xfc\x4a\x9f\x9c\x4d\x6c\x8d\x67\x26\x90\x63"
+ $ECHO -ne "\x04\x12\x6f\x0e\x55\x3c\x8e\xf2\x8d\xb4\x6b\x3d\xac\xcf\x84\x2e"
+ $ECHO -ne "\x60\x0f\x40\x62\x88\x3a\xcf\xbd\xea\xad\x40\x4c\x29\xe1\xb5\xb6"
+ $ECHO -ne "\x3e\x15\x86\xd5\xbe\xad\x27\xde\x2b\x32\xef\xcf\x97\x88\x8b\x17"
+ $ECHO -ne "\x80\x43\x0e\x20\x79\x3b\x36\x73\xb8\xad\x12\x0e\x87\x59\x5f\xd3"
+ $ECHO -ne "\x3c\x8c\x84\xc8\x54\x2b\x94\xc9\x2e\x36\x8b\x32\x48\xf1\xe3\x08"
+ $ECHO -ne "\xf0\x36\xc0\xb8\xc2\xa2\xa9\xe2\x52\x02\xf1\x9b\xcb\xde\xcc\xb5"
+ $ECHO -ne "\x5a\x6c\x05\x06\x31\x44\x41\x88\xa3\x05\x04\x16\x0d\x4a\x85\x20"
+ $ECHO -ne "\x79\xda\x89\x82\x1d\x5f\x5a\x11\x88\x89\x06\x05\xf5\xf4\xed\x75"
+ $ECHO -ne "\x62\x39\x37\x69\x11\x32\x3e\x8d\xe4\x60\x62\x52\xc9\xad\x82\x9a"
+ $ECHO -ne "\x9a\x2f\x06\x41\x26\xb4\x48\x70\x39\x2b\x8a\xb1\x5a\x53\xc6\x48"
+ $ECHO -ne "\x57\x17\xf5\xd8\x5a\xc6\x19\x83\x06\x0b\x9b\x04\xb8\xf5\xaf\x23"
+ $ECHO -ne "\x45\x87\x48\x50\x6d\x16\xea\xb4\x20\xb8\x49\x92\x6b\x0c\x76\x14"
+ $ECHO -ne "\x48\x53\xa1\x29\x74\xf6\xd7\x49\x44\x39\xba\xbd\x63\xa6\xf2\x81"
+ $ECHO -ne "\x8f\x5b\x5e\x46\x0a\x34\x95\x31\xc0\xdd\x60\x50\xd6\x0a\xa6\x29"
+ $ECHO -ne "\x3d\x36\x3a\xc7\xb8\xcf\x25\x5e\xf7\x82\x55\x88\xc2\x8b\x30\xd2"
+ $ECHO -ne "\x97\x90\x49\x94\xde\xe5\xaa\xeb\x42\x8c\x94\x2a\xa0\x0d\x9b\xb5"
+ $ECHO -ne "\x59\xbe\xcb\x35\xa3\x37\x54\x76\x35\x98\xcb\x1f\x13\x3f\x4a\xd1"
+ $ECHO -ne "\x45\x87\x67\xed\x66\x02\x06\x49\x1c\x59\x51\x1f\x4d\x85\x03\x46"
+ $ECHO -ne "\x65\x86\x4e\x4c\x6a\xd2\x24\x31\x5b\x6a\x3b\x19\x49\xe1\x83\x14"
+ $ECHO -ne "\xc1\xf0\x56\x61\x93\x8b\x33\x13\x54\x6f\x78\x4c\xa0\x85\xf0\xb3"
+ $ECHO -ne "\x17\xaa\xf2\x67\x02\x0c\x31\xed\x5e\x98\x02\x28\xc4\xe5\x87\xa2"
+ $ECHO -ne "\x70\xd1\xd5\x9c\xf8\xec\x19\x88\xa9\x0d\x0e\x4a\xe3\x47\x83\x6e"
+ $ECHO -ne "\xf7\x70\x3e\xa4\xa9\xc0\x4c\xfa\x2b\x3b\xd7\x6f\x96\xc3\x6d\x6d"
+ $ECHO -ne "\x71\x2a\x8d\x62\xf1\xd3\xdd\xb0\x33\xd4\x67\x19\x0d\x30\x85\x3a"
+ $ECHO -ne "\x06\x04\x85\x00\x48\x5d\x53\x35\xa0\x31\x56\x84\x82\xa5\xac\x22"
+ $ECHO -ne "\x02\x44\xaf\x6d\xc0\x61\x59\x23\x96\x72\x5a\x81\x9e\x0c\xe5\x79"
+ $ECHO -ne "\xda\xd0\x42\x5c\x89\xa5\x00\xec\x56\x41\x64\x8a\x11\x60\x79\xb1"
+ $ECHO -ne "\xed\x55\x16\x54\xe6\x51\x03\x34\x14\x60\x31\xd2\xf0\x0b\xce\xf2"
+ $ECHO -ne "\x4e\x4c\x45\x8c\xeb\x2a\x82\x3a\xa8\x52\xce\x8f\x4e\xf1\x89\xea"
+ $ECHO -ne "\x44\x91\x66\xdd\x6b\x49\xa3\x83\x0b\x19\x0e\x66\x5f\x02\x22\x58"
+ $ECHO -ne "\xe7\xc0\xa8\xce\x55\x48\xa6\x04\xf3\x03\xac\x62\xb2\xc0\xaa\xa0"
+ $ECHO -ne "\x09\xae\x5b\x96\xd0\xdd\xa9\x1f\xfb\x2d\x3d\xf5\x02\xe1\x86\x02"
+ $ECHO -ne "\x3e\xda\xd0\x5d\xba\x16\x39\xcd\x75\xa2\x47\x26\x74\x25\xa8\x5e"
+ $ECHO -ne "\xf3\x36\x0c\x37\x19\x17\x06\x66\xd0\x0b\x42\x41\x0a\xa0\xde\x93"
+ $ECHO -ne "\xd7\xb4\x9f\xfb\xc7\x4f\x65\x54\xda\xb8\x8b\x23\xde\x9c\x57\xcf"
+ $ECHO -ne "\x2d\x2a\x12\xda\xcc\xf6\x73\x83\x02\x4c\x0e\x42\x88\xda\x27\xb9"
+ $ECHO -ne "\xcb\x04\xb6\x07\x26\x78\xa1\xa1\x09\xa3\x6a\x86\xbd\x9d\xd4\xf9"
+ $ECHO -ne "\xc0\x81\xa6\x49\xa9\x72\xeb\x56\xbd\xf9\xea\x89\x4f\xae\x72\x28"
+ $ECHO -ne "\xb6\x57\x35\xbe\x94\xad\xc0\xff\x1e\xf2\x35\x24\xa0\x45\xd5\x09"
+ $ECHO -ne "\xc0\xe0\x10\xd0\x17\x90\xe2\xff\x8b\xb9\x22\x9c\x28\x48\x09\x68"
+ $ECHO -ne "\xc3\x18\x00"
+}
+
+tar2_bz2()
+{
+ $ECHO -ne "\x42\x5a\x68\x39\x31\x41\x59\x26\x53\x59\x16\x08\xfd\x60\x00\x00"
+ $ECHO -ne "\x01\xff\x80\x48\x80\x00\xa0\x40\x03\xff\xc0\x72\x00\x89\x40\xff"
+ $ECHO -ne "\xe7\xdf\xc0\x20\x00\x92\x11\x53\xf5\x13\xd3\x53\x7a\x41\xa8\xf2"
+ $ECHO -ne "\x9a\x60\x21\x9a\x40\xf4\x9b\xd2\x0d\x09\xa5\x3c\xa6\x4f\x44\xf5"
+ $ECHO -ne "\x34\x34\xd1\xb5\x01\xa0\x3d\x41\xa4\xe1\xeb\x4c\x5a\x01\x47\x3b"
+ $ECHO -ne "\xd1\x67\x1a\x4c\x3b\x21\x84\x23\x2c\x5c\xf7\xe0\xbd\x2a\xa4\xea"
+ $ECHO -ne "\xdc\xdb\x71\x80\x26\x98\x21\x0e\x76\x21\x30\xce\xe4\xad\x8c\xb5"
+ $ECHO -ne "\x68\x62\x35\xa1\xfd\x8e\x7b\x51\x70\x96\xb1\x2c\xa2\x99\x6c\xa1"
+ $ECHO -ne "\xc2\xcd\xea\xa7\x5e\x6b\x91\x4f\x73\x96\xe4\x48\x3c\xe7\x8c\x0f"
+ $ECHO -ne "\x03\x64\x5b\x7a\x43\xc1\x68\x86\x41\x83\x46\x0b\xba\xaa\x6a\x9b"
+ $ECHO -ne "\x59\x34\xf1\x1c\x08\x69\x1d\x41\xfb\x4a\x96\x1b\x14\x9e\x32\x89"
+ $ECHO -ne "\x69\x5f\x63\x9a\x22\xe4\x96\x34\xff\x12\x20\xd0\x25\x70\xdc\x5d"
+ $ECHO -ne "\xc9\x14\xe1\x42\x40\x58\x23\xf5\x80"
+}
+
+# NB: tar emits "tar: short read" on stderr because these test tars are
+# also lacking proper terminating zeroed blocks. But exitcode is 0.
+# This is intended.
+
+export TZ=UTC-1
+
+# Case 1: long name, with path in prefix field
+res1='-rw-r--r-- fm3/users 9869 2007-03-12 10:44:54 VirtualBox-1.5.6_OSE/src/libs/xpcom18a4/ipc/ipcd/extensions/transmngr/public/ipcITransactionService.idl'
+t=`tar1_bz2 | bunzip2 | busybox tar tvf -`
+test x"$res1" = x"$t"
+t=`tar1_bz2 | bunzip2 | busybox tar tv`
+test x"$res1" = x"$t"
+
+# Case 2: long dir name, with ENTIRE path in prefix field (name = "")
+res2='drwxr-xr-x fm3/users 0 2008-02-19 16:33:20 VirtualBox-1.5.6_OSE/src/VBox/Additions/linux/x11include/4.3/programs/Xserver/hw/xfree86/xf24_32bpp/'
+t=`tar2_bz2 | bunzip2 | busybox tar tvf -`
+test x"$res2" = x"$t"
+t=`tar2_bz2 | bunzip2 | busybox tar tv`
+test x"$res2" = x"$t"
diff --git a/testsuite/taskset.tests b/testsuite/taskset.tests
new file mode 100755
index 0000000..4599364
--- /dev/null
+++ b/testsuite/taskset.tests
@@ -0,0 +1,17 @@
+#!/bin/sh
+
+# Copyright 2006 Bernhard Reutner-Fischer
+# Licensed under GPL v2 or later, see file LICENSE for details.
+
+. testing.sh
+a="taskset"
+
+# testing "test name" "opts" "expected result" "file inp" "stdin"
+testing "taskset (get from pid 1)" "$a -p 1 >/dev/null;echo \$?" "0\n" "" ""
+testing "taskset (invalid pid)" "$a -p 0 >/dev/null 2>&1;echo \$?" "1\n" "" ""
+testing "taskset (set_aff, needs CAP_SYS_NICE)" \
+ "$a 0x1 $SHELL -c $a\ -p\ \$$\|grep\ \"current\ affinity\ mask:\ 1\" >/dev/null;echo \$?" \
+ "0\n" "" ""
+
+unset a
+exit $FAILCOUNT
diff --git a/testsuite/tee/tee-appends-input b/testsuite/tee/tee-appends-input
new file mode 100644
index 0000000..cff20bf
--- /dev/null
+++ b/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/testsuite/tee/tee-tees-input b/testsuite/tee/tee-tees-input
new file mode 100644
index 0000000..26e2173
--- /dev/null
+++ b/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/testsuite/test.tests b/testsuite/test.tests
new file mode 100755
index 0000000..d4be949
--- /dev/null
+++ b/testsuite/test.tests
@@ -0,0 +1,69 @@
+#!/bin/sh
+
+# Copyright 2007 by Denys Vlasenko <vda.linux@googlemail.com>
+# Licensed under GPL v2, see file LICENSE for details.
+
+. testing.sh
+
+# testing "test name" "command" "expected result" "file input" "stdin"
+# file input will be file called "input"
+# test can create a file "actual" instead of writing to stdout
+
+# Need to call 'busybox test', otherwise shell builtin is used
+
+testing "test: should be false (1)" \
+ "busybox test; echo \$?" \
+ "1\n" \
+ "" ""
+
+testing "test '': should be false (1)" \
+ "busybox test ''; echo \$?" \
+ "1\n" \
+ "" ""
+
+testing "test a: should be true (0)" \
+ "busybox test a; echo \$?" \
+ "0\n" \
+ "" ""
+
+testing "test --help: should be true (0)" \
+ "busybox test --help; echo \$?" \
+ "0\n" \
+ "" ""
+
+testing "test -f: should be true (0)" \
+ "busybox test -f; echo \$?" \
+ "0\n" \
+ "" ""
+
+testing "test ! -f: should be false (1)" \
+ "busybox test ! -f; echo \$?" \
+ "1\n" \
+ "" ""
+
+testing "test a = a: should be true (0)" \
+ "busybox test a = a; echo \$?" \
+ "0\n" \
+ "" ""
+
+testing "test -lt = -gt: should be false (1)" \
+ "busybox test -lt = -gt; echo \$?" \
+ "1\n" \
+ "" ""
+
+testing "test -f = a -o b: should be true (0)" \
+ "busybox test -f = a -o b; echo \$?" \
+ "0\n" \
+ "" ""
+
+testing "test ! a = b -a ! c = c: should be false (1)" \
+ "busybox test ! a = b -a ! c = c; echo \$?" \
+ "1\n" \
+ "" ""
+
+testing "test ! a = b -a ! c = d: should be true (0)" \
+ "busybox test ! a = b -a ! c = d; echo \$?" \
+ "0\n" \
+ "" ""
+
+exit $FAILCOUNT
diff --git a/testsuite/testing.sh b/testsuite/testing.sh
new file mode 100755
index 0000000..a57c4d6
--- /dev/null
+++ b/testsuite/testing.sh
@@ -0,0 +1,154 @@
+# Simple test harness infrastructurei for BusyBox
+#
+# Copyright 2005 by Rob Landley
+#
+# License is GPLv2, see LICENSE in the busybox tarball for full license text.
+
+# This file defines two functions, "testing" and "optional"
+# and a couple more...
+
+# The following environment variables may be set to enable optional behavior
+# in "testing":
+# VERBOSE - Print the diff -u of each failed test case.
+# DEBUG - Enable command tracing.
+# SKIP - do not perform this test (this is set by "optional")
+#
+# The "testing" function takes five arguments:
+# $1) Test description
+# $2) Command(s) to run. May have pipes, redirects, etc
+# $3) Expected result on stdout
+# $4) Data to be written to file "input"
+# $5) Data to be written to stdin
+#
+# The exit value of testing is the exit value of $2 it ran.
+#
+# The environment variable "FAILCOUNT" contains a cumulative total of the
+# number of failed tests.
+
+# The "optional" function is used to skip certain tests, ala:
+# optional CONFIG_FEATURE_THINGY
+#
+# The "optional" function checks the environment variable "OPTIONFLAGS",
+# which is either empty (in which case it always clears SKIP) or
+# else contains a colon-separated list of features (in which case the function
+# clears SKIP if the flag was found, or sets it to 1 if the flag was not found).
+
+export FAILCOUNT=0
+export SKIP=
+
+# Helper functions
+
+optional()
+{
+ option=`echo ":$OPTIONFLAGS:" | grep ":$1:"`
+ # Not set?
+ if [ -z "$1" ] || [ -z "$OPTIONFLAGS" ] || [ ${#option} -ne 0 ]
+ then
+ SKIP=
+ return
+ fi
+ SKIP=1
+}
+
+# The testing function
+
+testing()
+{
+ NAME="$1"
+ [ -n "$1" ] || NAME="$2"
+
+ if [ $# -ne 5 ]
+ then
+ echo "Test $NAME has wrong number of arguments (must be 5) ($# $*)" >&2
+ exit 1
+ fi
+
+ [ -z "$DEBUG" ] || set -x
+
+ if [ -n "$SKIP" ]
+ then
+ echo "SKIPPED: $NAME"
+ return 0
+ fi
+
+ $ECHO -ne "$3" > expected
+ $ECHO -ne "$4" > input
+ [ -z "$VERBOSE" ] || echo "echo '$5' | $2"
+ $ECHO -ne "$5" | eval "$2" > actual
+ RETVAL=$?
+
+ if cmp expected actual >/dev/null 2>/dev/null
+ then
+ echo "PASS: $NAME"
+ else
+ FAILCOUNT=$(($FAILCOUNT + 1))
+ echo "FAIL: $NAME"
+ [ -z "$VERBOSE" ] || diff -u expected actual
+ fi
+ rm -f input expected actual
+
+ [ -z "$DEBUG" ] || set +x
+
+ return $RETVAL
+}
+
+# Recursively grab an executable and all the libraries needed to run it.
+# Source paths beginning with / will be copied into destpath, otherwise
+# the file is assumed to already be there and only its library dependencies
+# are copied.
+
+mkchroot()
+{
+ [ $# -lt 2 ] && return
+
+ $ECHO -n .
+
+ dest=$1
+ shift
+ for i in "$@"
+ do
+ #bashism: [ "${i:0:1}" == "/" ] || i=$(which $i)
+ i=$(which $i) # no-op for /bin/prog
+ [ -f "$dest/$i" ] && continue
+ if [ -e "$i" ]
+ then
+ d=`echo "$i" | grep -o '.*/'` &&
+ mkdir -p "$dest/$d" &&
+ cat "$i" > "$dest/$i" &&
+ chmod +x "$dest/$i"
+ else
+ echo "Not found: $i"
+ fi
+ mkchroot "$dest" $(ldd "$i" | egrep -o '/.* ')
+ done
+}
+
+# Set up a chroot environment and run commands within it.
+# Needed commands listed on command line
+# Script fed to stdin.
+
+dochroot()
+{
+ mkdir tmpdir4chroot
+ mount -t ramfs tmpdir4chroot tmpdir4chroot
+ mkdir -p tmpdir4chroot/{etc,sys,proc,tmp,dev}
+ cp -L testing.sh tmpdir4chroot
+
+ # Copy utilities from command line arguments
+
+ $ECHO -n "Setup chroot"
+ mkchroot tmpdir4chroot $*
+ echo
+
+ mknod tmpdir4chroot/dev/tty c 5 0
+ mknod tmpdir4chroot/dev/null c 1 3
+ mknod tmpdir4chroot/dev/zero c 1 5
+
+ # Copy script from stdin
+
+ cat > tmpdir4chroot/test.sh
+ chmod +x tmpdir4chroot/test.sh
+ chroot tmpdir4chroot /test.sh
+ umount -l tmpdir4chroot
+ rmdir tmpdir4chroot
+}
diff --git a/testsuite/touch/touch-creates-file b/testsuite/touch/touch-creates-file
new file mode 100644
index 0000000..4b49354
--- /dev/null
+++ b/testsuite/touch/touch-creates-file
@@ -0,0 +1,2 @@
+busybox touch foo
+test -f foo
diff --git a/testsuite/touch/touch-does-not-create-file b/testsuite/touch/touch-does-not-create-file
new file mode 100644
index 0000000..8852592
--- /dev/null
+++ b/testsuite/touch/touch-does-not-create-file
@@ -0,0 +1,2 @@
+busybox touch -c foo
+test ! -f foo
diff --git a/testsuite/touch/touch-touches-files-after-non-existent-file b/testsuite/touch/touch-touches-files-after-non-existent-file
new file mode 100644
index 0000000..a869ec2
--- /dev/null
+++ b/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/testsuite/tr/tr-d-alnum-works b/testsuite/tr/tr-d-alnum-works
new file mode 100644
index 0000000..d440f8f
--- /dev/null
+++ b/testsuite/tr/tr-d-alnum-works
@@ -0,0 +1,4 @@
+echo testing | tr -d '[[:alnum:]]' > logfile.gnu
+echo testing | busybox tr -d '[[:alnum:]]' > logfile.bb
+
+diff -u logfile.gnu logfile.bb
diff --git a/testsuite/tr/tr-d-works b/testsuite/tr/tr-d-works
new file mode 100644
index 0000000..a86bfbd
--- /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
+
+diff -u logfile.gnu logfile.bb
diff --git a/testsuite/tr/tr-non-gnu b/testsuite/tr/tr-non-gnu
new file mode 100644
index 0000000..ffa6951
--- /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-rejects-wrong-class b/testsuite/tr/tr-rejects-wrong-class
new file mode 100644
index 0000000..9753936
--- /dev/null
+++ b/testsuite/tr/tr-rejects-wrong-class
@@ -0,0 +1,19 @@
+echo t12esting | tr -d '[[:alpha:]]' > logfile.gnu
+echo t12esting | tr -d '[:alpha:]' >> logfile.gnu
+echo t12esting | tr -d '[[:alpha:]' >> logfile.gnu
+echo t12esting | tr -d '[[:alpha:' >> logfile.gnu
+echo t12esting | tr -d '[[:alpha' >> logfile.gnu
+echo t12esting | tr -d '[:alpha:]' >> logfile.gnu
+echo t12esting | tr -d '[:alpha:' >> logfile.gnu
+echo t12esting | tr -d '[:alpha' >> logfile.gnu
+
+echo t12esting | busybox tr -d '[[:alpha:]]' > logfile.bb
+echo t12esting | busybox tr -d '[:alpha:]' >> logfile.bb
+echo t12esting | busybox tr -d '[[:alpha:]' >> logfile.bb
+echo t12esting | busybox tr -d '[[:alpha:' >> logfile.bb
+echo t12esting | busybox tr -d '[[:alpha' >> logfile.bb
+echo t12esting | busybox tr -d '[:alpha:]' >> logfile.bb
+echo t12esting | busybox tr -d '[:alpha:' >> logfile.bb
+echo t12esting | busybox tr -d '[:alpha' >> logfile.bb
+
+diff -u logfile.gnu logfile.bb
diff --git a/testsuite/tr/tr-works b/testsuite/tr/tr-works
new file mode 100644
index 0000000..2c0a9d1
--- /dev/null
+++ b/testsuite/tr/tr-works
@@ -0,0 +1,26 @@
+run_tr ()
+{
+ echo -n "echo '$1' | tr '$2' '$3': "
+ echo "$1" | $bb tr "$2" "$3"
+ echo
+}
+tr_test ()
+{
+ run_tr "cbaab" abc zyx
+ run_tr "TESTING A B C" '[A-Z]' '[a-z]'
+ run_tr "abc[]" "a[b" AXB
+ run_tr abc '[:alpha:]' A-ZA-Z
+ run_tr abc56 '[:alnum:]' A-ZA-Zxxxxxxxxxx
+ run_tr 012 '[:digit:]' abcdefghi
+ run_tr abc56 '[:lower:]' '[:upper:]'
+ run_tr " " '[:space:]' 12345
+ run_tr " " '[:blank:]' 12
+ run_tr 'a b' '[= =]' X
+ run_tr "[:" '[:' ab
+ run_tr " .,:" '[:punct:]' 12
+ run_tr " .,:" '[:cntrl:]' 12
+}
+
+bb= tr_test > logfile.gnu
+bb=busybox tr_test > logfile.bb
+diff -u logfile.gnu logfile.bb
diff --git a/testsuite/true/true-is-silent b/testsuite/true/true-is-silent
new file mode 100644
index 0000000..1d1bdb2
--- /dev/null
+++ b/testsuite/true/true-is-silent
@@ -0,0 +1 @@
+busybox true 2>&1 | cmp - /dev/null
diff --git a/testsuite/true/true-returns-success b/testsuite/true/true-returns-success
new file mode 100644
index 0000000..cdf2d55
--- /dev/null
+++ b/testsuite/true/true-returns-success
@@ -0,0 +1 @@
+busybox true
diff --git a/testsuite/umlwrapper.sh b/testsuite/umlwrapper.sh
new file mode 100755
index 0000000..e55e4db
--- /dev/null
+++ b/testsuite/umlwrapper.sh
@@ -0,0 +1,20 @@
+#!/bin/sh
+
+# Wrapper for User Mode Linux emulation environment
+
+RUNFILE="$(pwd)/${1}.testroot"
+if [ -z "$RUNFILE" ] || [ ! -x "$RUNFILE" ]
+then
+ echo "Can't run '$RUNFILE'"
+ exit 1
+fi
+
+shift
+
+if [ -z $(which linux) ]
+then
+ echo "No User Mode Linux."
+ exit 1;
+fi
+
+linux rootfstype=hostfs rw init="$RUNFILE" TESTDIR=`pwd` PATH="$PATH" $* quiet
diff --git a/testsuite/unexpand/unexpand-works-like-GNU b/testsuite/unexpand/unexpand-works-like-GNU
new file mode 100644
index 0000000..a525836
--- /dev/null
+++ b/testsuite/unexpand/unexpand-works-like-GNU
@@ -0,0 +1,52 @@
+rm -f foo bar
+echo " y" | unexpand ../../busybox > foo
+echo " y" | busybox unexpand ../../busybox > bar
+set +e
+test ! -f foo -a -f bar
+if [ $? = 0 ] ; then
+ set -e
+ diff -q foo bar
+fi
+rm -f foo bar
+echo " y" | unexpand ../../busybox > foo
+echo " y" | busybox unexpand ../../busybox > bar
+set +e
+test ! -f foo -a -f bar
+if [ $? = 0 ] ; then
+ set -e
+ diff -q foo bar
+fi
+echo " y y" | unexpand ../../busybox > foo
+echo " y y" | busybox unexpand ../../busybox > bar
+set +e
+test ! -f foo -a -f bar
+if [ $? = 0 ] ; then
+ set -e
+ diff -q foo bar
+fi
+rm -f foo bar
+echo " y y" | unexpand ../../busybox > foo
+echo " y y" | busybox unexpand ../../busybox > bar
+set +e
+test ! -f foo -a -f bar
+if [ $? = 0 ] ; then
+ set -e
+ diff -q foo bar
+fi
+echo " y y" | unexpand -a ../../busybox > foo
+echo " y y" | busybox unexpand -a ../../busybox > bar
+set +e
+test ! -f foo -a -f bar
+if [ $? = 0 ] ; then
+ set -e
+ diff -q foo bar
+fi
+rm -f foo bar
+echo " y y" | unexpand -a ../../busybox > foo
+echo " y y" | busybox unexpand -a ../../busybox > bar
+set +e
+test ! -f foo -a -f bar
+if [ $? = 0 ] ; then
+ set -e
+ diff -q foo bar
+fi
diff --git a/testsuite/uniq.tests b/testsuite/uniq.tests
new file mode 100755
index 0000000..8961d66
--- /dev/null
+++ b/testsuite/uniq.tests
@@ -0,0 +1,87 @@
+#!/bin/sh
+
+# SUSv3 compliant uniq tests.
+# Copyright 2005 by Rob Landley <rob@landley.net>
+# Licensed under GPL v2, see file LICENSE for details.
+
+# AUDIT: Full SUSv3 coverage (except internationalization).
+
+. testing.sh
+
+# testing "test name" "options" "expected result" "file input" "stdin"
+# file input will be file called "input"
+# test can create a file "actual" instead of writing to stdout
+
+# Test exit status
+
+testing "uniq (exit with error)" "uniq nonexistent 2> /dev/null || echo yes" \
+ "yes\n" "" ""
+testing "uniq (exit success)" "uniq /dev/null && echo yes" "yes\n" "" ""
+
+# Test various data sources and destinations
+
+testing "uniq (default to stdin)" "uniq" "one\ntwo\nthree\n" "" \
+ "one\ntwo\ntwo\nthree\nthree\nthree\n"
+testing "uniq - (specify stdin)" "uniq -" "one\ntwo\nthree\n" "" \
+ "one\ntwo\ntwo\nthree\nthree\nthree\n"
+testing "uniq input (specify file)" "uniq input" "one\ntwo\nthree\n" \
+ "one\ntwo\ntwo\nthree\nthree\nthree\n" ""
+
+testing "uniq input outfile (two files)" "uniq input actual > /dev/null" \
+ "one\ntwo\nthree\n" "one\ntwo\ntwo\nthree\nthree\nthree\n" ""
+testing "uniq (stdin) outfile" "uniq - actual" \
+ "one\ntwo\nthree\n" "" "one\ntwo\ntwo\nthree\nthree\nthree\n"
+# Note: SUSv3 doesn't seem to require support for "-" output, but we do anyway.
+testing "uniq input - (specify stdout)" "uniq input -" \
+ "one\ntwo\nthree\n" "one\ntwo\ntwo\nthree\nthree\nthree\n" ""
+
+
+#-f skip fields
+#-s skip chars
+#-c occurrences
+#-d dups only
+#-u
+#-w max chars
+
+# Test various command line options
+
+# Leading whitespace is a minor technical violation of the spec,
+# but since gnu does it...
+testing "uniq -c (occurrence count)" "uniq -c | sed 's/^[ \t]*//'" \
+ "1 one\n2 two\n3 three\n" "" \
+ "one\ntwo\ntwo\nthree\nthree\nthree\n"
+testing "uniq -d (dups only) " "uniq -d" "two\nthree\n" "" \
+ "one\ntwo\ntwo\nthree\nthree\nthree\n"
+
+testing "uniq -f -s (skip fields and chars)" "uniq -f2 -s 3" \
+"cc dd ee8
+aa bb cc9
+" "" \
+"cc dd ee8
+bb cc dd8
+aa bb cc9
+"
+testing "uniq -w (compare max characters)" "uniq -w 2" \
+"cc1
+" "" \
+"cc1
+cc2
+cc3
+"
+
+testing "uniq -s -w (skip fields and compare max chars)" \
+"uniq -s 2 -w 2" \
+"aaccaa
+" "" \
+"aaccaa
+aaccbb
+bbccaa
+"
+
+# -d is "Suppress the writing fo lines that are not repeated in the input."
+# -u is "Suppress the writing of lines that are repeated in the input."
+# Therefore, together this means they should produce no output.
+testing "uniq -u and -d produce no output" "uniq -d -u" "" "" \
+ "one\ntwo\ntwo\nthree\nthree\nthree\n"
+
+exit $FAILCOUNT
diff --git a/testsuite/unzip.tests b/testsuite/unzip.tests
new file mode 100755
index 0000000..975079d
--- /dev/null
+++ b/testsuite/unzip.tests
@@ -0,0 +1,38 @@
+#!/bin/sh
+
+# Tests for unzip.
+# Copyright 2006 Rob Landley <rob@landley.net>
+# Copyright 2006 Glenn McGrath
+# Licensed under GPL v2, see file LICENSE for details.
+
+. testing.sh
+
+# testing "test name" "options" "expected result" "file input" "stdin"
+# file input will be file called "input"
+# test can create a file "actual" instead of writing to stdout
+
+# Create a scratch directory
+
+mkdir temp
+cd temp
+
+# Create test file to work with.
+
+mkdir foo
+touch foo/bar
+zip foo.zip foo foo/bar > /dev/null
+rm -f foo/bar
+rmdir foo
+
+# Test that unzipping just foo doesn't create bar.
+testing "unzip (subdir only)" "unzip -q foo.zip foo/ && test -d foo && test ! -f foo/bar && echo yes" "yes\n" "" ""
+
+rmdir foo
+rm foo.zip
+
+# Clean up scratch directory.
+
+cd ..
+rm -rf temp
+
+exit $FAILCOUNT
diff --git a/testsuite/uptime/uptime-works b/testsuite/uptime/uptime-works
new file mode 100644
index 0000000..80e5787
--- /dev/null
+++ b/testsuite/uptime/uptime-works
@@ -0,0 +1,2 @@
+busybox uptime
+
diff --git a/testsuite/uuencode.tests b/testsuite/uuencode.tests
new file mode 100755
index 0000000..cb658db
--- /dev/null
+++ b/testsuite/uuencode.tests
@@ -0,0 +1,28 @@
+#!/bin/sh
+
+# unit test for uuencode to test functionality.
+# Copyright 2006 by Erik Hovland <erik@hovland.org>
+# Licensed under GPL v2, see file LICENSE for details.
+
+# AUDIT: Unit tests for uuencode
+
+. testing.sh
+
+# testing "test name" "options" "expected result" "file input" "stdin"
+# file input will be file called "input"
+# test can create a file "actual" instead of writing to stdout
+
+# Test setup of standard input
+saved_umask=$(umask)
+umask 0
+testing "uuencode sets standard input mode correctly" \
+ "uuencode foo </dev/null | head -n 1 | grep -q 666 && echo yes" "yes\n" "" ""
+umask $saved_umask
+
+testing "uuencode correct encoding" "uuencode bb_uuenc_test.out" \
+"begin 644 bb_uuenc_test.out\nM5&AE(&9A<W0@9W)E>2!F;W@@:G5M<&5D(&]V97(@=&AE(&QA>GD@8G)O=VX@\n%9&]G+@H\`\n\`\nend\n" \
+ "" "The fast grey fox jumped over the lazy brown dog.\n"
+testing "uuencode correct base64 encoding" "uuencode -m bb_uuenc_test.out" \
+"begin-base64 644 bb_uuenc_test.out\nVGhlIGZhc3QgZ3JleSBmb3gganVtcGVkIG92ZXIgdGhlIGxhenkgYnJvd24g\nZG9nLgo=\n====\n" \
+ "" "The fast grey fox jumped over the lazy brown dog.\n"
+exit $FAILCOUNT
diff --git a/testsuite/wc/wc-counts-all b/testsuite/wc/wc-counts-all
new file mode 100644
index 0000000..7083645
--- /dev/null
+++ b/testsuite/wc/wc-counts-all
@@ -0,0 +1,2 @@
+# 1 line, 4 words, 20 chars.
+test "`echo i\'m a little teapot | busybox wc | sed 's/ */ /g' | sed 's/^ //'`" = '1 4 20'
diff --git a/testsuite/wc/wc-counts-characters b/testsuite/wc/wc-counts-characters
new file mode 100644
index 0000000..7558646
--- /dev/null
+++ b/testsuite/wc/wc-counts-characters
@@ -0,0 +1 @@
+test `echo i\'m a little teapot | busybox wc -c` -eq 20
diff --git a/testsuite/wc/wc-counts-lines b/testsuite/wc/wc-counts-lines
new file mode 100644
index 0000000..5be6ed0
--- /dev/null
+++ b/testsuite/wc/wc-counts-lines
@@ -0,0 +1 @@
+test `echo i\'m a little teapot | busybox wc -l` -eq 1
diff --git a/testsuite/wc/wc-counts-words b/testsuite/wc/wc-counts-words
new file mode 100644
index 0000000..331650e
--- /dev/null
+++ b/testsuite/wc/wc-counts-words
@@ -0,0 +1 @@
+test `echo i\'m a little teapot | busybox wc -w` -eq 4
diff --git a/testsuite/wc/wc-prints-longest-line-length b/testsuite/wc/wc-prints-longest-line-length
new file mode 100644
index 0000000..78831fc
--- /dev/null
+++ b/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/testsuite/wget/wget--O-overrides--P b/testsuite/wget/wget--O-overrides--P
new file mode 100644
index 0000000..fdb5d47
--- /dev/null
+++ b/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/testsuite/wget/wget-handles-empty-path b/testsuite/wget/wget-handles-empty-path
new file mode 100644
index 0000000..5b59183
--- /dev/null
+++ b/testsuite/wget/wget-handles-empty-path
@@ -0,0 +1 @@
+busybox wget http://www.google.com
diff --git a/testsuite/wget/wget-retrieves-google-index b/testsuite/wget/wget-retrieves-google-index
new file mode 100644
index 0000000..7be9a80
--- /dev/null
+++ b/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/testsuite/wget/wget-supports--P b/testsuite/wget/wget-supports--P
new file mode 100644
index 0000000..9b4d095
--- /dev/null
+++ b/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/testsuite/which/which-uses-default-path b/testsuite/which/which-uses-default-path
new file mode 100644
index 0000000..63ceb9f
--- /dev/null
+++ b/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/testsuite/xargs.tests b/testsuite/xargs.tests
new file mode 100755
index 0000000..3652449
--- /dev/null
+++ b/testsuite/xargs.tests
@@ -0,0 +1,29 @@
+#!/bin/sh
+# Copyright 2008 by Denys Vlasenko
+# Licensed under GPL v2, see file LICENSE for details.
+
+. testing.sh
+
+# testing "test name" "command" "expected result" "file input" "stdin"
+
+testing "xargs -E _ stops on underscore" \
+ "xargs -E _" \
+ "a\n" \
+ "" "a\n_\nb\n"
+
+testing "xargs -E ''" \
+ "xargs -E ''" \
+ "a _ b\n" \
+ "" "a\n_\nb\n"
+
+testing "xargs -e without param" \
+ "xargs -e" \
+ "a _ b\n" \
+ "" "a\n_\nb\n"
+
+testing "xargs does not stop on underscore ('new' GNU behavior)" \
+ "xargs" \
+ "a _ b\n" \
+ "" "a\n_\nb\n"
+
+exit $FAILCOUNT
diff --git a/testsuite/xargs/xargs-works b/testsuite/xargs/xargs-works
new file mode 100644
index 0000000..c95869e
--- /dev/null
+++ b/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