summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDenys Vlasenko <vda.linux@googlemail.com>2010-05-12 13:59:32 (GMT)
committer Denys Vlasenko <vda.linux@googlemail.com>2010-05-12 13:59:32 (GMT)
commite82cf339e476126e4016e417aee3c6eb52c702c9 (patch)
treeaf480d4552cb63fcf8ee28600986e9c16c7adb6a
parenta2215b98f7d65bc613b9c8f008d79672402c6a07 (diff)
downloadbusybox-e82cf339e476126e4016e417aee3c6eb52c702c9.tar.gz
busybox-e82cf339e476126e4016e417aee3c6eb52c702c9.tar.bz2
randomtest fixes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
-rwxr-xr-xtestsuite/ash.tests2
-rw-r--r--testsuite/cut/cut-cuts-a-field2
-rw-r--r--testsuite/date/date-R-works9
-rw-r--r--testsuite/du/du-h-works6
-rw-r--r--testsuite/du/du-k-works8
-rw-r--r--testsuite/du/du-l-works10
-rw-r--r--testsuite/du/du-m-works6
-rw-r--r--testsuite/du/du-s-works4
-rw-r--r--testsuite/du/du-works4
-rw-r--r--testsuite/expand/expand-works-like-GNU8
-rw-r--r--testsuite/hostid/hostid-works10
-rw-r--r--testsuite/hostname/hostname-d-works5
-rwxr-xr-xtestsuite/rx.tests4
-rwxr-xr-xtestsuite/sed.tests4
-rwxr-xr-xtestsuite/tar.tests2
-rw-r--r--testsuite/tr/tr-works2
16 files changed, 51 insertions, 35 deletions
diff --git a/testsuite/ash.tests b/testsuite/ash.tests
index 183394a..dd626e6 100755
--- a/testsuite/ash.tests
+++ b/testsuite/ash.tests
@@ -71,7 +71,7 @@ testing "2 bytes which are not valid unicode chars followed by left arrow key" \
# not checked by the test), then read and execute the rest: "echo A | ..."
# The bug was that ash was eating the beginning of "echo A" despite the pause.
testing "Invalid unicode chars followed by a pause do not eat next chars" \
- "{ echo -ne 'echo \xff\n'; sleep 1; echo -ne 'echo A | hexdump -C >ash.output; exit; exit; exit; exit\n'; } \
+ "{ $ECHO -ne 'echo \xff\n'; sleep 1; $ECHO -ne 'echo A | hexdump -C >ash.output; exit; exit; exit; exit\n'; } \
| script -q -c 'ash' /dev/null >/dev/null; cat ash.output" \
"\
00000000 41 0a |A.|
diff --git a/testsuite/cut/cut-cuts-a-field b/testsuite/cut/cut-cuts-a-field
index 4c7f440..e200b6b 100644
--- a/testsuite/cut/cut-cuts-a-field
+++ b/testsuite/cut/cut-cuts-a-field
@@ -1 +1 @@
-test $(echo -e "f1\tf2\tf3" | busybox cut -f 2) = f2
+test $($ECHO -e "f1\tf2\tf3" | busybox cut -f 2) = f2
diff --git a/testsuite/date/date-R-works b/testsuite/date/date-R-works
index 34cd735..d056344 100644
--- a/testsuite/date/date-R-works
+++ b/testsuite/date/date-R-works
@@ -1 +1,8 @@
-test x"`date -R`" = x"`busybox date -R`"
+dt1="`date -R`"
+# Wait for the start of next second
+dt="$dt1"
+while test x"$dt" = x"$dt1"; do
+ dt="`date -R`"
+done
+
+test x"$dt" = x"`busybox date -R`"
diff --git a/testsuite/du/du-h-works b/testsuite/du/du-h-works
index a1b4b49..c18433c 100644
--- a/testsuite/du/du-h-works
+++ b/testsuite/du/du-h-works
@@ -1,6 +1,4 @@
# FEATURE: CONFIG_FEATURE_HUMAN_READABLE
-d=/bin
-du -h "$d" > logfile.gnu
-busybox du -h "$d" > logfile.bb
-cmp logfile.gnu logfile.bb
+dd if=/dev/zero of=file bs=1M count=1 2>/dev/null
+test x"`busybox du -h .`" = x"1.0M ."
diff --git a/testsuite/du/du-k-works b/testsuite/du/du-k-works
index 6c2c5d0..a522649 100644
--- a/testsuite/du/du-k-works
+++ b/testsuite/du/du-k-works
@@ -1,4 +1,4 @@
-d=/bin
-du -k "$d" > logfile.gnu
-busybox du -k "$d" > logfile.bb
-cmp logfile.gnu logfile.bb
+dd if=/dev/zero of=file1 bs=1k count=64 2>/dev/null
+dd if=/dev/zero of=file2 bs=1k count=16 2>/dev/null
+test x"`busybox du -k .`" = x"80 ." \
+ -o x"`busybox du -k .`" = x"88 ." \
diff --git a/testsuite/du/du-l-works b/testsuite/du/du-l-works
index 64dcf87..6b150e0 100644
--- a/testsuite/du/du-l-works
+++ b/testsuite/du/du-l-works
@@ -1,6 +1,8 @@
# FEATURE: CONFIG_FEATURE_DU_DEFAULT_BLOCKSIZE_1K
-d=/bin
-du -l "$d" > logfile.gnu
-busybox du -l "$d" > logfile.bb
-cmp logfile.gnu logfile.bb
+dd if=/dev/zero of=file1 bs=1k count=64 2>/dev/null
+ln file1 file1.1
+dd if=/dev/zero of=file2 bs=1k count=16 2>/dev/null
+test x"`busybox du -l .`" = x"144 ." \
+ -o x"`busybox du -l .`" = x"148 ." \
+ -o x"`busybox du -l .`" = x"152 ." \
diff --git a/testsuite/du/du-m-works b/testsuite/du/du-m-works
index 6e733c0..9fa7437 100644
--- a/testsuite/du/du-m-works
+++ b/testsuite/du/du-m-works
@@ -1,6 +1,4 @@
# FEATURE: CONFIG_FEATURE_HUMAN_READABLE
-d=/bin
-du -m "$d" > logfile.gnu
-busybox du -m "$d" > logfile.bb
-cmp logfile.gnu logfile.bb
+dd if=/dev/zero of=file bs=1M count=1 2>/dev/null
+test x"`busybox du -m .`" = x"1 ."
diff --git a/testsuite/du/du-s-works b/testsuite/du/du-s-works
index 0c870ce..534432c 100644
--- a/testsuite/du/du-s-works
+++ b/testsuite/du/du-s-works
@@ -3,4 +3,6 @@
d=/bin
du -s "$d" > logfile.gnu
busybox du -s "$d" > logfile.bb
-cmp logfile.gnu logfile.bb
+cmp logfile.gnu logfile.bb && exit 0
+diff -u logfile.gnu logfile.bb
+exit 1
diff --git a/testsuite/du/du-works b/testsuite/du/du-works
index 4db684a..e320f1d 100644
--- a/testsuite/du/du-works
+++ b/testsuite/du/du-works
@@ -3,4 +3,6 @@
d=/bin
du "$d" > logfile.gnu
busybox du "$d" > logfile.bb
-cmp logfile.gnu logfile.bb
+cmp logfile.gnu logfile.bb && exit 0
+diff -u logfile.gnu logfile.bb
+exit 1
diff --git a/testsuite/expand/expand-works-like-GNU b/testsuite/expand/expand-works-like-GNU
index 8431112..b0278d8 100644
--- a/testsuite/expand/expand-works-like-GNU
+++ b/testsuite/expand/expand-works-like-GNU
@@ -1,8 +1,8 @@
# FEATURE: CONFIG_UNEXPAND
rm -f foo bar
-echo -e "\ty" | expand -t 3 ../../busybox > foo
-echo -e "\ty" | busybox unexpand -t 3 ../../busybox > 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
@@ -10,8 +10,8 @@ if [ $? = 0 ] ; then
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
+$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
diff --git a/testsuite/hostid/hostid-works b/testsuite/hostid/hostid-works
index e85698e..bcfd717 100644
--- a/testsuite/hostid/hostid-works
+++ b/testsuite/hostid/hostid-works
@@ -1,2 +1,8 @@
-test x$(hostid) = x$(busybox hostid)
-
+h=x$(busybox hostid)
+# Is $h a sequence of hex numbers?
+x="${h//[0123456789abcdef]/x}"
+x="${x//xxx/x}"
+x="${x//xxx/x}"
+x="${x//xxx/x}"
+x="${x//xx/x}"
+test x"$x" = x"x"
diff --git a/testsuite/hostname/hostname-d-works b/testsuite/hostname/hostname-d-works
index a9aeb92..e062242 100644
--- a/testsuite/hostname/hostname-d-works
+++ b/testsuite/hostname/hostname-d-works
@@ -1,2 +1,3 @@
-test x$(hostname -d) = x$(busybox hostname -d)
-
+f=$(busybox hostname -f)
+d=$(busybox hostname -d)
+test x"${f#*.}" = x"$d"
diff --git a/testsuite/rx.tests b/testsuite/rx.tests
index c2b8814..985fcdc 100755
--- a/testsuite/rx.tests
+++ b/testsuite/rx.tests
@@ -18,9 +18,9 @@ testing "rx" \
00000000 43 06 06 |C..|\n\
00000003\n\
???????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????" \
- "" "\1\1\376\
+ "" "\01\01\0376\
???????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????\
-\x1A\x1A\x1A\x1A\x1A\x4B\xB0\4"
+\x1A\x1A\x1A\x1A\x1A\x4B\xB0\04"
rm -f rx.OUTFILE 2>/dev/null
diff --git a/testsuite/sed.tests b/testsuite/sed.tests
index 5b0750c..88b9c4e 100755
--- a/testsuite/sed.tests
+++ b/testsuite/sed.tests
@@ -110,7 +110,7 @@ testing "sed embedded NUL" "sed -e 's/woo/bang/'" "\0bang\0woo\0" "" \
testing "sed embedded NUL g" "sed -e 's/woo/bang/g'" "bang\0bang\0" "" \
"woo\0woo\0"
test x"$SKIP_KNOWN_BUGS" = x"" && {
-echo -e "/woo/a he\0llo" > sed.commands
+$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
}
@@ -153,7 +153,7 @@ testing "sed clusternewline" \
"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" \
+ "sed -e 's/i/z/' -e 'woutputw' input -; $ECHO -n X; cat outputw" \
"thzngy\nagaznXthzngy\nagazn" "thingy" "again"
rm outputw
testing "sed trailing NUL" \
diff --git a/testsuite/tar.tests b/testsuite/tar.tests
index d1d4165..f400790 100755
--- a/testsuite/tar.tests
+++ b/testsuite/tar.tests
@@ -84,7 +84,7 @@ chmod 550 input_dir
ln input_file input_dir
ln input_soft input_dir
tar cf test.tar input_*
-tar tvf test.tar | sed "s/.*[0-9] input/input/"
+tar tvf test.tar | sed "s/.*[0-9] input/input/" | sort
tar xf test.tar 2>&1
echo Ok: $?
ls -l . input_dir/* | grep input_ | sed "s/\\(^[^ ]*\\) .* input/\\1 input/"
diff --git a/testsuite/tr/tr-works b/testsuite/tr/tr-works
index 3783971..5e4a30e 100644
--- a/testsuite/tr/tr-works
+++ b/testsuite/tr/tr-works
@@ -2,7 +2,7 @@
run_tr ()
{
- echo -n "echo '$1' | tr '$2' '$3': "
+ $ECHO -n "echo '$1' | tr '$2' '$3': "
echo "$1" | $bb tr "$2" "$3"
echo
}