diff options
author | Daniel Baumann <mail@daniel-baumann.ch> | 2015-11-07 11:41:41 +0000 |
---|---|---|
committer | Daniel Baumann <mail@daniel-baumann.ch> | 2015-11-07 11:41:41 +0000 |
commit | 9317e4b89644635a9ce309c4626d917d886ae20b (patch) | |
tree | 768c1cbb87e5c29ddcfcf2853ff1d5ce5b511e6b /testsuite/check.sh | |
parent | Adding debian version 1.14-1. (diff) | |
download | lziprecover-9317e4b89644635a9ce309c4626d917d886ae20b.tar.xz lziprecover-9317e4b89644635a9ce309c4626d917d886ae20b.zip |
Merging upstream version 1.15~pre1.
Signed-off-by: Daniel Baumann <mail@daniel-baumann.ch>
Diffstat (limited to 'testsuite/check.sh')
-rwxr-xr-x | testsuite/check.sh | 166 |
1 files changed, 110 insertions, 56 deletions
diff --git a/testsuite/check.sh b/testsuite/check.sh index ea6e768..4ac7f59 100755 --- a/testsuite/check.sh +++ b/testsuite/check.sh @@ -23,10 +23,15 @@ mkdir tmp cd "${objdir}"/tmp in="${testdir}"/test.txt -in_lz="${testdir}"/test_v1.lz +in_lz="${testdir}"/test.txt.lz inD="${testdir}"/test921-1921.txt -fox5="${testdir}"/fox5_bad.txt -fox5_lz="${testdir}"/fox5_bad.lz +fox5_lz="${testdir}"/fox5.lz +f5b1="${testdir}"/fox5_bad1.txt +f5b1_lz="${testdir}"/fox5_bad1.lz +f5b2_lz="${testdir}"/fox5_bad2.lz +f5b3_lz="${testdir}"/fox5_bad3.lz +f5b4_lz="${testdir}"/fox5_bad4.lz +f5b5_lz="${testdir}"/fox5_bad5.lz bad1_lz="${testdir}"/test_bad1.lz bad2_lz="${testdir}"/test_bad2.lz bad3_lz="${testdir}"/test_bad3.lz @@ -35,91 +40,140 @@ bad5_lz="${testdir}"/test_bad5.lz fail=0 # Description of test files for lziprecover: -# fox5_bad.lz: byte at offset 188 changed from 0x34 to 0x33 +# fox5_bad1.lz: byte at offset 62 changed from 0x50 to 0x70 (CRC) +# byte at offset 144 changed from 0x2D to 0x2E (data_size) +# byte at offset 188 changed from 0x34 to 0x33 (mid stream) +# byte at offset 247 changed from 0x2A to 0x2B (first byte) +# byte at offset 378 changed from 0xA0 to 0x20 (EOS marker) +# fox5_bad2.lz: [ 30- 49] --> zeroed; +# fox5_bad3.lz: [100-299] --> zeroed; +# fox5_bad4.lz: [250-349] --> zeroed; +# fox5_bad5.lz: [300-399] --> zeroed; # test_bad1.lz: byte at offset 67 changed from 0xCC to 0x33 -# test_bad2.lz: [ 34- 66) --> copy of bytes [ 68- 100) -# test_bad3.lz: [ 512-1536) --> zeroed; [2560-3584) --> zeroed -# test_bad4.lz: [3072-4096) --> random data; [4608-5632) --> zeroed -# test_bad5.lz: [1024-2048) --> random data; [5120-6144) --> random data +# test_bad2.lz: [ 34- 65] --> copy of bytes [ 68- 99] +# test_bad3.lz: [ 512-1535] --> zeroed; [2560-3583] --> zeroed +# test_bad4.lz: [3072-4095] --> random data; [4608-5631] --> zeroed +# test_bad5.lz: [1024-2047] --> random data; [5120-6143] --> random data printf "testing lziprecover-%s..." "$2" "${LZIPRECOVER}" -lq -if [ $? != 1 ] ; then fail=1 ; printf - ; else printf . ; fi +if [ $? = 1 ] ; then printf . ; else fail=1 ; printf - ; fi "${LZIPRECOVER}" -mq "${bad1_lz}" -if [ $? != 1 ] ; then fail=1 ; printf - ; else printf . ; fi +if [ $? = 1 ] ; then printf . ; else fail=1 ; printf - ; fi "${LZIPRECOVER}" -Rq -if [ $? != 1 ] ; then fail=1 ; printf - ; else printf . ; fi +if [ $? = 1 ] ; then printf . ; else fail=1 ; printf - ; fi "${LZIPRECOVER}" -sq -if [ $? != 1 ] ; then fail=1 ; printf - ; else printf . ; fi +if [ $? = 1 ] ; then printf . ; else fail=1 ; printf - ; fi -"${LZIP}" -t "${testdir}"/test_v0.lz || fail=1 -printf . -"${LZIP}" -cd "${testdir}"/test_v0.lz > copy || fail=1 -cmp "${in}" copy || fail=1 -printf . - -"${LZIP}" -t "${testdir}"/test_v1.lz || fail=1 -printf . -"${LZIP}" -cd "${testdir}"/test_v1.lz > copy || fail=1 +"${LZIP}" -t "${testdir}"/test.txt.lz || fail=1 +"${LZIP}" -cd "${testdir}"/test.txt.lz > copy || fail=1 cmp "${in}" copy || fail=1 printf . "${LZIPRECOVER}" -D 921-1921 -fo copy "${in_lz}" || fail=1 cmp "${inD}" copy || fail=1 -printf . "${LZIPRECOVER}" -D 921,1000 "${in_lz}" > copy || fail=1 cmp "${inD}" copy || fail=1 printf . -"${LZIPRECOVER}" -D0 -iq -fo copy "${fox5_lz}" -if [ $? = 2 ] && cmp "${fox5}" copy ; then printf . ; else fail=1 ; printf - ; fi -"${LZIPRECOVER}" -D0 -iq "${fox5_lz}" > copy -if [ $? = 2 ] && cmp "${fox5}" copy ; then printf . ; else fail=1 ; printf - ; fi - +"${LZIPRECOVER}" -D0 -iq "${f5b1_lz}" -fo copy +if [ $? = 2 ] && cmp "${f5b1}" copy ; then printf . ; else fail=1 ; printf - ; fi +"${LZIPRECOVER}" -D0 -iq "${f5b1_lz}" > copy +if [ $? = 2 ] && cmp "${f5b1}" copy ; then printf . ; else fail=1 ; printf - ; fi + +rm -f copy.lz +"${LZIPRECOVER}" -m -o copy.lz "${fox5_lz}" "${f5b1_lz}" +if [ $? = 0 ] && [ ! -e copy.lz ] ; then printf . ; else fail=1 ; printf - ; fi +"${LZIPRECOVER}" -m -o copy.lz "${f5b1_lz}" "${fox5_lz}" +if [ $? = 0 ] && [ ! -e copy.lz ] ; then printf . ; else fail=1 ; printf - ; fi "${LZIPRECOVER}" -m -o copy.lz "${bad1_lz}" "${bad2_lz}" "${bad1_lz}" -q -if [ $? != 2 ] ; then fail=1 ; printf - ; else printf . ; fi -"${LZIPRECOVER}" -m -o copy.lz "${bad1_lz}" "${bad2_lz}" || fail=1 -"${LZIPRECOVER}" -df copy.lz || fail=1 -cmp "${in}" copy || fail=1 +if [ $? = 2 ] && [ ! -e copy.lz ] ; then printf . ; else fail=1 ; printf - ; fi +"${LZIPRECOVER}" -m -o copy.lz "${f5b1_lz}" "${f5b5_lz}" -q +if [ $? = 2 ] && [ ! -e copy.lz ] ; then printf . ; else fail=1 ; printf - ; fi +"${LZIPRECOVER}" -m -o copy.lz "${f5b3_lz}" "${f5b5_lz}" -q +if [ $? = 2 ] && [ ! -e copy.lz ] ; then printf . ; else fail=1 ; printf - ; fi +"${LZIPRECOVER}" -m -o copy.lz "${bad3_lz}" "${bad4_lz}" -q +if [ $? = 2 ] && [ ! -e copy.lz ] ; then printf . ; else fail=1 ; printf - ; fi + +for i in "${f5b1_lz}" "${f5b3_lz}" "${f5b4_lz}" "${f5b5_lz}" ; do + "${LZIPRECOVER}" -mf -o copy.lz "${f5b2_lz}" "${i}" || fail=1 + cmp "${fox5_lz}" copy.lz || fail=1 + "${LZIPRECOVER}" -mf -o copy.lz "${i}" "${f5b2_lz}" || fail=1 + cmp "${fox5_lz}" copy.lz || fail=1 + printf . +done + +for i in "${f5b3_lz}" "${f5b4_lz}" "${f5b5_lz}" ; do + "${LZIPRECOVER}" -mf -o copy.lz "${f5b1_lz}" "${f5b2_lz}" "${i}" || fail=1 + cmp "${fox5_lz}" copy.lz || fail=1 + "${LZIPRECOVER}" -mf -o copy.lz "${f5b1_lz}" "${i}" "${f5b2_lz}" || fail=1 + cmp "${fox5_lz}" copy.lz || fail=1 + "${LZIPRECOVER}" -mf -o copy.lz "${f5b2_lz}" "${f5b1_lz}" "${i}" || fail=1 + cmp "${fox5_lz}" copy.lz || fail=1 + "${LZIPRECOVER}" -mf -o copy.lz "${f5b2_lz}" "${i}" "${f5b1_lz}" || fail=1 + cmp "${fox5_lz}" copy.lz || fail=1 + "${LZIPRECOVER}" -mf -o copy.lz "${i}" "${f5b1_lz}" "${f5b2_lz}" || fail=1 + cmp "${fox5_lz}" copy.lz || fail=1 + "${LZIPRECOVER}" -mf -o copy.lz "${i}" "${f5b2_lz}" "${f5b1_lz}" || fail=1 + cmp "${fox5_lz}" copy.lz || fail=1 + printf . +done + +"${LZIPRECOVER}" -mf -o copy.lz "${f5b3_lz}" "${f5b4_lz}" "${f5b5_lz}" || fail=1 +cmp "${fox5_lz}" copy.lz || fail=1 +"${LZIPRECOVER}" -mf -o copy.lz "${f5b1_lz}" "${f5b3_lz}" "${f5b4_lz}" "${f5b5_lz}" || fail=1 +cmp "${fox5_lz}" copy.lz || fail=1 +"${LZIPRECOVER}" -mf -o copy.lz "${f5b2_lz}" "${f5b3_lz}" "${f5b4_lz}" "${f5b5_lz}" || fail=1 +cmp "${fox5_lz}" copy.lz || fail=1 +"${LZIPRECOVER}" -mf -o copy.lz "${f5b1_lz}" "${f5b2_lz}" "${f5b3_lz}" "${f5b4_lz}" "${f5b5_lz}" || fail=1 +cmp "${fox5_lz}" copy.lz || fail=1 printf . -"${LZIPRECOVER}" -m -o copy.lz "${bad2_lz}" "${bad1_lz}" || fail=1 -"${LZIPRECOVER}" -df copy.lz || fail=1 -cmp "${in}" copy || fail=1 + +"${LZIPRECOVER}" -mf -o copy.lz "${bad1_lz}" "${bad2_lz}" || fail=1 +cmp "${in_lz}" copy.lz || fail=1 +"${LZIPRECOVER}" -mf -o copy.lz "${bad2_lz}" "${bad1_lz}" || fail=1 +cmp "${in_lz}" copy.lz || fail=1 printf . for i in "${bad1_lz}" "${bad2_lz}" ; do for j in "${bad3_lz}" "${bad4_lz}" "${bad5_lz}" ; do - "${LZIPRECOVER}" -m -o copy.lz "${i}" "${j}" || fail=1 - "${LZIPRECOVER}" -df copy.lz || fail=1 - cmp "${in}" copy || fail=1 - printf . - "${LZIPRECOVER}" -m -o copy.lz "${j}" "${i}" || fail=1 - "${LZIPRECOVER}" -df copy.lz || fail=1 - cmp "${in}" copy || fail=1 + "${LZIPRECOVER}" -mf -o copy.lz "${i}" "${j}" || fail=1 + cmp "${in_lz}" copy.lz || fail=1 + "${LZIPRECOVER}" -mf -o copy.lz "${j}" "${i}" || fail=1 + cmp "${in_lz}" copy.lz || fail=1 printf . done done -"${LZIPRECOVER}" -m -o copy.lz "${bad3_lz}" "${bad4_lz}" "${bad5_lz}" || fail=1 -"${LZIPRECOVER}" -df copy.lz || fail=1 -cmp "${in}" copy || fail=1 +"${LZIPRECOVER}" -mf -o copy.lz "${bad3_lz}" "${bad4_lz}" "${bad5_lz}" || fail=1 +cmp "${in_lz}" copy.lz || fail=1 printf . -"${LZIPRECOVER}" -m -o copy.lz "${bad4_lz}" "${bad5_lz}" "${bad3_lz}" || fail=1 -"${LZIPRECOVER}" -df copy.lz || fail=1 -cmp "${in}" copy || fail=1 +"${LZIPRECOVER}" -mf -o copy.lz "${bad3_lz}" "${bad5_lz}" "${bad4_lz}" || fail=1 +cmp "${in_lz}" copy.lz || fail=1 printf . -"${LZIPRECOVER}" -m -o copy.lz "${bad5_lz}" "${bad3_lz}" "${bad4_lz}" || fail=1 -"${LZIPRECOVER}" -df copy.lz || fail=1 -cmp "${in}" copy || fail=1 +"${LZIPRECOVER}" -mf -o copy.lz "${bad4_lz}" "${bad3_lz}" "${bad5_lz}" || fail=1 +cmp "${in_lz}" copy.lz || fail=1 printf . - -"${LZIPRECOVER}" -R "${in_lz}" || fail=1 +"${LZIPRECOVER}" -mf -o copy.lz "${bad4_lz}" "${bad5_lz}" "${bad3_lz}" || fail=1 +cmp "${in_lz}" copy.lz || fail=1 +printf . +"${LZIPRECOVER}" -mf -o copy.lz "${bad5_lz}" "${bad3_lz}" "${bad4_lz}" || fail=1 +cmp "${in_lz}" copy.lz || fail=1 +printf . +"${LZIPRECOVER}" -mf -o copy.lz "${bad5_lz}" "${bad4_lz}" "${bad3_lz}" || fail=1 +cmp "${in_lz}" copy.lz || fail=1 printf . + +rm -f copy.lz +"${LZIPRECOVER}" -R -o copy.lz "${fox5_lz}" || fail=1 +if [ $? = 0 ] && [ ! -e copy.lz ] ; then printf . ; else fail=1 ; printf - ; fi "${LZIPRECOVER}" -R -o copy.lz "${bad2_lz}" -q -if [ $? != 2 ] ; then fail=1 ; printf - ; else printf . ; fi -"${LZIPRECOVER}" -R -o copy.lz "${bad1_lz}" || fail=1 -"${LZIPRECOVER}" -df copy.lz || fail=1 -cmp "${in}" copy || fail=1 +if [ $? = 2 ] && [ ! -e copy.lz ] ; then printf . ; else fail=1 ; printf - ; fi +"${LZIPRECOVER}" -Rf -o copy.lz "${f5b1_lz}" || fail=1 +cmp "${fox5_lz}" copy.lz || fail=1 +printf . +"${LZIPRECOVER}" -Rf -o copy.lz "${bad1_lz}" || fail=1 +cmp "${in_lz}" copy.lz || fail=1 printf . cat "${in_lz}" "${in_lz}" "${in_lz}" > copy || framework_failure |