randomtest fixes
authorDenys Vlasenko <vda.linux@googlemail.com>
Wed, 12 May 2010 13:59:32 +0000 (15:59 +0200)
committerDenys Vlasenko <vda.linux@googlemail.com>
Wed, 12 May 2010 13:59:32 +0000 (15:59 +0200)
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
16 files changed:
testsuite/ash.tests
testsuite/cut/cut-cuts-a-field
testsuite/date/date-R-works
testsuite/du/du-h-works
testsuite/du/du-k-works
testsuite/du/du-l-works
testsuite/du/du-m-works
testsuite/du/du-s-works
testsuite/du/du-works
testsuite/expand/expand-works-like-GNU
testsuite/hostid/hostid-works
testsuite/hostname/hostname-d-works
testsuite/rx.tests
testsuite/sed.tests
testsuite/tar.tests
testsuite/tr/tr-works

index 183394a2095067bdbe619fee52efbb504adba58b..dd626e6d13d0a57b4f731b016f6ebaf7cea6f525 100755 (executable)
@@ -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.|
index 4c7f440074feeb3d9b253be54cf13b645e3660e6..e200b6b78a834ced9925193f2d4fdfae289c3c92 100644 (file)
@@ -1 +1 @@
-test $(echo -e "f1\tf2\tf3" | busybox cut -f 2) = f2
+test $($ECHO -e "f1\tf2\tf3" | busybox cut -f 2) = f2
index 34cd735e54fe0728db94e66d5ab34703356b09c1..d056344561a1c3509cce7dc629cfb41ff959b88a 100644 (file)
@@ -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`"
index a1b4b4905cfed798d6dbb763f5ee42b93366f200..c18433c29669198a31251b59f636b5aa5be8edb4 100644 (file)
@@ -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     ."
index 6c2c5d073543d17de3f7acaf1b78b63ef813fd32..a52264945040321a889ed73be719373c7679e15b 100644 (file)
@@ -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       ." \
index 64dcf872668656e2c0bbed03e23308b63eef5c6a..6b150e0dd73eb667935d2f2d7b2d9ead96b6dae4 100644 (file)
@@ -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      ." \
index 6e733c0160cfc06546375e3cf43361b1c4240b45..9fa7437ace8268131443a8966e88f7572f2008df 100644 (file)
@@ -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        ."
index 0c870ceb571f319dfaee992db826f8fc3c4eb44c..534432cb0faee52096c99461d3eb49ed472f199a 100644 (file)
@@ -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
index 4db684a9b569a29f17e02866dbfe4061f199e3ee..e320f1dd088113dabce5fff615b594523dddcb34 100644 (file)
@@ -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
index 8431112759d4e55740959709d0eed6e13df4e43b..b0278d88d90702ef7bac3554d18c2a73e8e79480 100644 (file)
@@ -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
index e85698e66a9293c5ae60807f47979a08d0fc3120..bcfd717af42bb14a8a3c1e6b5749c11796af452b 100644 (file)
@@ -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"
index a9aeb92cb59048586fe06f39d32760dbfe86303d..e062242bbfb148479aef3a6ce0568f9fc14b8971 100644 (file)
@@ -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"
index c2b8814a2132138c24d62e36af4e7a31276891cf..985fcdc018191006baf299cdfe5ef595399eeb20 100755 (executable)
@@ -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
 
index 5b0750cac0cb880e12ec600a6f55021089537248..88b9c4e4b5184d6db497423a42e2708bb67c73c3 100755 (executable)
@@ -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" \
index d1d4165ca0e8aa038b9d64c5bb0399f058121de4..f4007903776d67132387ceda583b5860c983f1c8 100755 (executable)
@@ -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/"
index 3783971cef6cdaa8ddb81340be7de9e20bc5dbf0..5e4a30ee40964e38778f64ae7e9422c2aefa1697 100644 (file)
@@ -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
 }