ip link: add VLAN support
[oweals/busybox.git] / testsuite / bunzip2.tests
index 7875cd1aef382c5475bfa02ac73d2f04c62131ba..fcfce1a31eea1a2ec9f7d3bb336dcdbb45f4ff13 100755 (executable)
@@ -1,6 +1,8 @@
 #!/bin/sh
 # Used by both gunzip and bunzip2 tests
 
+FAILCOUNT=0
+
 if test "${0##*/}" = "gunzip.tests"; then
     unpack=gunzip
     ext=gz
@@ -461,6 +463,24 @@ $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"
 }
 
+pbzip_4m_zeros() {
+$ECHO -ne "\x42\x5a\x68\x31\x31\x41\x59\x26\x53\x59\x63\xe3\xec\xa2\x00\x06"
+$ECHO -ne "\xe4\xc1\x00\xc0\x00\x02\x00\x00\x08\x20\x00\x30\xcc\x09\xaa\x69"
+$ECHO -ne "\x94\xa1\x36\xa9\x28\x4f\x17\x72\x45\x38\x50\x90\x63\xe3\xec\xa2"
+$ECHO -ne "\x42\x5a\x68\x31\x31\x41\x59\x26\x53\x59\x63\xe3\xec\xa2\x00\x06"
+$ECHO -ne "\xe4\xc1\x00\xc0\x00\x02\x00\x00\x08\x20\x00\x30\xcc\x09\xaa\x69"
+$ECHO -ne "\x94\xa1\x36\xa9\x28\x4f\x17\x72\x45\x38\x50\x90\x63\xe3\xec\xa2"
+$ECHO -ne "\x42\x5a\x68\x31\x31\x41\x59\x26\x53\x59\x63\xe3\xec\xa2\x00\x06"
+$ECHO -ne "\xe4\xc1\x00\xc0\x00\x02\x00\x00\x08\x20\x00\x30\xcc\x09\xaa\x69"
+$ECHO -ne "\x94\xa1\x36\xa9\x28\x4f\x17\x72\x45\x38\x50\x90\x63\xe3\xec\xa2"
+$ECHO -ne "\x42\x5a\x68\x31\x31\x41\x59\x26\x53\x59\x63\xe3\xec\xa2\x00\x06"
+$ECHO -ne "\xe4\xc1\x00\xc0\x00\x02\x00\x00\x08\x20\x00\x30\xcc\x09\xaa\x69"
+$ECHO -ne "\x94\xa1\x36\xa9\x28\x4f\x17\x72\x45\x38\x50\x90\x63\xe3\xec\xa2"
+$ECHO -ne "\x42\x5a\x68\x31\x31\x41\x59\x26\x53\x59\xc9\xb5\x21\xef\x00\x04"
+$ECHO -ne "\x8d\x40\x20\xc0\x00\x01\x00\x00\x08\x20\x00\x30\xcc\x05\x29\xa6"
+$ECHO -ne "\x4a\x11\xb1\x4a\x11\xe2\xee\x48\xa7\x0a\x12\x19\x36\xa4\x3d\xe0"
+}
+
 prep() {
     rm -f t*
     hello_$ext >t1.$ext
@@ -473,6 +493,7 @@ check() {
        echo "PASS: $1"
     else
        echo "FAIL: $1"
+       FAILCOUNT=$((FAILCOUNT + 1))
     fi
 }
 
@@ -504,7 +525,7 @@ prep; >t1; check "$unpack: already exists" "${bb}$unpack t1.$ext t2.$ext; echo \
 
 # From old testsuite
 expected="HELLO\n0\n"
-prep; check "$unpack: stream unpack" "cat t1.$ext | ${bb}$unpack; echo $?"
+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"
@@ -517,8 +538,20 @@ if test "${0##*/}" = "bunzip2.tests"; then
     if test1_bz2 | ${bb}bunzip2 >/dev/null \
        && test "`test1_bz2 | ${bb}bunzip2 | md5sum`" = "61bbeee4be9c6f110a71447f584fda7b  -"
     then
-       echo "PASS: $unpack: test bz2 file"
+       echo "PASS: $unpack: test_bz2 file"
+    else
+       echo "FAIL: $unpack: test_bz2 file"
+       FAILCOUNT=$((FAILCOUNT + 1))
+    fi
+
+    if pbzip_4m_zeros | ${bb}bunzip2 >/dev/null \
+       && test "`pbzip_4m_zeros | ${bb}bunzip2 | md5sum`" = "b5cfa9d6c8febd618f91ac2843d50a1c  -"
+    then
+       echo "PASS: $unpack: pbzip_4m_zeros file"
     else
-       echo "FAIL: $unpack: test bz2 file"
+       echo "FAIL: $unpack: pbzip_4m_zeros file"
+       FAILCOUNT=$((FAILCOUNT + 1))
     fi
 fi
+
+exit $((FAILCOUNT <= 255 ? FAILCOUNT : 255))