diff options
Diffstat (limited to 'testsuite')
-rwxr-xr-x | testsuite/check.sh | 74 | ||||
-rw-r--r-- | testsuite/test_bad1.lz | bin | 11548 -> 0 bytes | |||
-rw-r--r-- | testsuite/test_bad2.lz | bin | 11548 -> 0 bytes | |||
-rw-r--r-- | testsuite/test_bad3.lz | bin | 11548 -> 0 bytes | |||
-rw-r--r-- | testsuite/test_bad4.lz | bin | 11548 -> 0 bytes | |||
-rw-r--r-- | testsuite/test_bad5.lz | bin | 11548 -> 0 bytes | |||
-rw-r--r-- | testsuite/unzcrash.cc | 38 |
7 files changed, 22 insertions, 90 deletions
diff --git a/testsuite/check.sh b/testsuite/check.sh index 82bc47d..69291e2 100755 --- a/testsuite/check.sh +++ b/testsuite/check.sh @@ -10,26 +10,22 @@ export LC_ALL objdir=`pwd` testdir=`cd "$1" ; pwd` LZIP="${objdir}"/lzip -LZIPRECOVER="${objdir}"/lziprecover framework_failure() { echo "failure in testing framework" ; exit 1 ; } if [ ! -x "${LZIP}" ] ; then echo "${LZIP}: cannot execute" exit 1 fi -if [ ! -x "${LZIPRECOVER}" ] ; then - echo "${LZIPRECOVER}: cannot execute" - exit 1 -fi if [ -d tmp ] ; then rm -rf tmp ; fi mkdir tmp -printf "testing lzip-%s..." "$2" cd "${objdir}"/tmp cat "${testdir}"/test.txt > in || framework_failure fail=0 +printf "testing lzip-%s..." "$2" + "${LZIP}" -t "${testdir}"/test_v0.lz || fail=1 printf . "${LZIP}" -cd "${testdir}"/test_v0.lz > copy || fail=1 @@ -48,7 +44,7 @@ printf . cmp in copy || fail=1 printf . -"${LZIP}" -cf "${testdir}"/test_v1.lz > out 2>/dev/null +"${LZIP}" -cfq "${testdir}"/test_v1.lz > out if [ $? != 1 ] ; then fail=1 ; printf - ; else printf . ; fi "${LZIP}" -cF "${testdir}"/test_v1.lz > out || fail=1 "${LZIP}" -cd out | "${LZIP}" -d > copy || fail=1 @@ -91,70 +87,6 @@ done cmp in anyothername.out || fail=1 printf . -# Description of test files for lziprecover: -# 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 - -printf "\ntesting lziprecover-%s..." "$2" - -"${LZIP}" -c in in in > out || fail=1 -printf "garbage" >> out || fail=1 -"${LZIPRECOVER}" -s out -o out.lz || fail=1 -for i in 1 2 3 ; do - "${LZIP}" -cd rec0000${i}out.lz > copy || fail=1 - cmp in copy || fail=1 - printf . -done - -"${LZIP}" -0kf -$i in || fail=1 -"${LZIPRECOVER}" -R in.lz || fail=1 -printf . -"${LZIPRECOVER}" -R "${testdir}"/test_v1.lz || fail=1 -printf . - -"${LZIPRECOVER}" -R -o copy.lz "${testdir}"/test_bad1.lz || fail=1 -"${LZIP}" -df copy.lz || fail=1 -cmp in copy || fail=1 -printf . - -"${LZIPRECOVER}" -m -o copy.lz "${testdir}"/test_bad1.lz "${testdir}"/test_bad2.lz || fail=1 -"${LZIP}" -df copy.lz || fail=1 -cmp in copy || fail=1 -printf . -"${LZIPRECOVER}" -m -o copy.lz "${testdir}"/test_bad2.lz "${testdir}"/test_bad1.lz || fail=1 -"${LZIP}" -df copy.lz || fail=1 -cmp in copy || fail=1 -printf . - -for i in 1 2 ; do - for j in 3 4 5 ; do - "${LZIPRECOVER}" -m -o copy.lz "${testdir}"/test_bad${i}.lz "${testdir}"/test_bad${j}.lz || fail=1 - "${LZIP}" -df copy.lz || fail=1 - cmp in copy || fail=1 - printf . - "${LZIPRECOVER}" -m -o copy.lz "${testdir}"/test_bad${j}.lz "${testdir}"/test_bad${i}.lz || fail=1 - "${LZIP}" -df copy.lz || fail=1 - cmp in copy || fail=1 - printf . - done -done - -"${LZIPRECOVER}" -m -o copy.lz "${testdir}"/test_bad3.lz "${testdir}"/test_bad4.lz "${testdir}"/test_bad5.lz || fail=1 -"${LZIP}" -df copy.lz || fail=1 -cmp in copy || fail=1 -printf . -"${LZIPRECOVER}" -m -o copy.lz "${testdir}"/test_bad4.lz "${testdir}"/test_bad5.lz "${testdir}"/test_bad3.lz || fail=1 -"${LZIP}" -df copy.lz || fail=1 -cmp in copy || fail=1 -printf . -"${LZIPRECOVER}" -m -o copy.lz "${testdir}"/test_bad5.lz "${testdir}"/test_bad3.lz "${testdir}"/test_bad4.lz || fail=1 -"${LZIP}" -df copy.lz || fail=1 -cmp in copy || fail=1 -printf . - echo if [ ${fail} = 0 ] ; then echo "tests completed successfully." diff --git a/testsuite/test_bad1.lz b/testsuite/test_bad1.lz Binary files differdeleted file mode 100644 index 0b84883..0000000 --- a/testsuite/test_bad1.lz +++ /dev/null diff --git a/testsuite/test_bad2.lz b/testsuite/test_bad2.lz Binary files differdeleted file mode 100644 index cce6a3c..0000000 --- a/testsuite/test_bad2.lz +++ /dev/null diff --git a/testsuite/test_bad3.lz b/testsuite/test_bad3.lz Binary files differdeleted file mode 100644 index a1676bb..0000000 --- a/testsuite/test_bad3.lz +++ /dev/null diff --git a/testsuite/test_bad4.lz b/testsuite/test_bad4.lz Binary files differdeleted file mode 100644 index a8f89a3..0000000 --- a/testsuite/test_bad4.lz +++ /dev/null diff --git a/testsuite/test_bad5.lz b/testsuite/test_bad5.lz Binary files differdeleted file mode 100644 index 73e0142..0000000 --- a/testsuite/test_bad5.lz +++ /dev/null diff --git a/testsuite/unzcrash.cc b/testsuite/unzcrash.cc index 5fac783..b80580f 100644 --- a/testsuite/unzcrash.cc +++ b/testsuite/unzcrash.cc @@ -58,22 +58,22 @@ int verbosity = 0; void show_help() throw() { std::printf( "%s - A test program written to test robustness to\n", Program_name ); - std::printf( "decompression of corrupted data.\n" ); - std::printf( "\nUsage: %s [options] \"lzip -tv\" filename.lz\n", invocation_name ); - std::printf( "\nThis program reads the specified file and then repeatedly decompresses\n" ); - std::printf( "it, increasing 256 times each byte of the compressed data, so as to test\n" ); - std::printf( "all possible one-byte errors. This should not cause any invalid memory\n" ); - std::printf( "accesses. If it does, please, report it as a bug.\n" ); - std::printf( "\nOptions:\n" ); - std::printf( " -h, --help display this help and exit\n" ); - std::printf( " -V, --version output version information and exit\n" ); - std::printf( " -b, --bits=<n>[,n] test <n>-bit errors instead of full byte\n" ); - std::printf( " -p, --position=<n> first byte position to test\n" ); - std::printf( " -q, --quiet suppress all messages\n" ); - std::printf( " -s, --size=<n> number of byte positions to test\n" ); - std::printf( " -v, --verbose be verbose (a 2nd -v gives more)\n" ); - std::printf( "\nReport bugs to lzip-bug@nongnu.org\n" ); - std::printf( "Lzip home page: http://www.nongnu.org/lzip/lzip.html\n" ); + std::printf( "decompression of corrupted data.\n" + "\nUsage: %s [options] \"lzip -tv\" filename.lz\n", invocation_name ); + std::printf( "\nThis program reads the specified file and then repeatedly decompresses\n" + "it, increasing 256 times each byte of the compressed data, so as to test\n" + "all possible one-byte errors. This should not cause any invalid memory\n" + "accesses. If it does, please, report it as a bug.\n" + "\nOptions:\n" + " -h, --help display this help and exit\n" + " -V, --version output version information and exit\n" + " -b, --bits=<n>[,<n>]... test <n>-bit errors instead of full byte\n" + " -p, --position=<bytes> first byte position to test\n" + " -q, --quiet suppress all messages\n" + " -s, --size=<bytes> number of byte positions to test\n" + " -v, --verbose be verbose (a 2nd -v gives more)\n" + "\nReport bugs to lzip-bug@nongnu.org\n" + "Lzip home page: http://www.nongnu.org/lzip/lzip.html\n" ); } @@ -81,9 +81,9 @@ void show_version() throw() { std::printf( "%s %s\n", Program_name, PROGVERSION ); std::printf( "Copyright (C) %s Antonio Diaz Diaz.\n", program_year ); - std::printf( "License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>\n" ); - std::printf( "This is free software: you are free to change and redistribute it.\n" ); - std::printf( "There is NO WARRANTY, to the extent permitted by law.\n" ); + std::printf( "License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>\n" + "This is free software: you are free to change and redistribute it.\n" + "There is NO WARRANTY, to the extent permitted by law.\n" ); } |