Changeset 3621 in MondoRescue for branches/3.3/mindi-busybox/testsuite/bzcat.tests
- Timestamp:
- Dec 20, 2016, 4:07:32 PM (7 years ago)
- Location:
- branches/3.3
- Files:
-
- 1 edited
- 1 copied
Legend:
- Unmodified
- Added
- Removed
-
branches/3.3/mindi-busybox/testsuite/bzcat.tests
r3232 r3621 2 2 3 3 FAILCOUNT=0 4 5 ext=bz26 4 7 5 bb="busybox " … … 11 9 unset LANG 12 10 unset LANGUAGE 11 12 hello_Z() { 13 # Compressed "HELLO\n" 14 $ECHO -ne "\x1f\x9d\x90\x48\x8a\x30\x61\xf2\x44\x01" 15 } 13 16 14 17 hello_gz() { … … 26 29 } 27 30 28 prep() { 29 rm -f t* 30 hello_$ext >t1.$ext 31 hello_$ext >t2.$ext 32 } 31 for ext in \ 32 `test x"$CONFIG_GUNZIP" = x"y" && echo gz` \ 33 `test x"$CONFIG_BUNZIP2" = x"y" && echo bz2` \ 34 `test x"$CONFIG_UNCOMPRESS" = x"y" && echo Z` 35 do 36 prep() { 37 rm -f t1.$ext t2.$ext t_actual 38 hello_$ext >t1.$ext 39 hello_$ext >t2.$ext 40 } 33 41 34 check() {35 36 37 echo "PASS: $1"38 39 echo "FAIL: $1"40 FAILCOUNT=$((FAILCOUNT + 1))41 42 }42 check() { 43 eval $2 >t_actual 2>&1 44 if $ECHO -ne "$expected" | cmp - t_actual; then 45 echo "PASS: $1" 46 else 47 echo "FAIL: $1" 48 FAILCOUNT=$((FAILCOUNT + 1)) 49 fi 50 } 43 51 44 mkdir testdir 2>/dev/null 45 ( 46 cd testdir || { echo "cannot cd testdir!"; exit 1; } 47 48 expected="HELLO\nok\n" 49 prep; check "bzcat: dont delete src" "${bb}bzcat t2.bz2; test -f t2.bz2 && echo ok" 50 51 ) 52 rm -rf testdir 53 52 mkdir testdir 2>/dev/null 53 ( 54 cd testdir || { echo "cannot cd testdir!"; exit 1; } 55 expected="HELLO\nok\n" 56 prep 57 check "zcat: dont delete $ext src" "${bb}zcat t2.$ext; test -f t2.$ext && echo ok" 58 exit $FAILCOUNT 59 ) 60 FAILCOUNT=$? 61 rm -rf testdir 62 done 54 63 55 64 … … 60 69 61 70 # testing "test name" "command" "expected result" "file input" "stdin" 71 72 ## bzip algorithm 62 73 63 74 # "input" file is bzipped file with "a\n" data … … 80 91 "\x42\x5a\x68\x39\x17\x72\x45\x38\x50\x90\x00\x00\x00\x00" "" 81 92 93 ## compress algorithm 94 95 # "input" file is compressed (.Z) file with "a\n" data 96 test x"$CONFIG_UNCOMPRESS" = x"y" && \ 97 testing "zcat can print many files" \ 98 "$ECHO -ne '$hexdump' | zcat input input; echo \$?" \ 99 "\ 100 a 101 a 102 0 103 " "\ 104 \x1f\x9d\x90\x61\x14\x00\ 105 " "" 106 107 # "input" file is compressed (.Z) zero byte file 108 test x"$CONFIG_UNCOMPRESS" = x"y" && \ 109 testing "zcat can handle compressed zero-length (.Z) files" \ 110 "$ECHO -ne '$hexdump' | zcat input input; echo \$?" \ 111 "0\n" \ 112 "\x1f\x9d\x90\x00" "" 113 82 114 83 115
Note:
See TracChangeset
for help on using the changeset viewer.