summaryrefslogtreecommitdiffstats
path: root/testsuite
diff options
context:
space:
mode:
authorDaniel Baumann <mail@daniel-baumann.ch>2015-11-07 11:41:41 +0000
committerDaniel Baumann <mail@daniel-baumann.ch>2015-11-07 11:41:41 +0000
commit9317e4b89644635a9ce309c4626d917d886ae20b (patch)
tree768c1cbb87e5c29ddcfcf2853ff1d5ce5b511e6b /testsuite
parentAdding debian version 1.14-1. (diff)
downloadlziprecover-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')
-rwxr-xr-xtestsuite/check.sh166
-rw-r--r--testsuite/fox5.lz (renamed from testsuite/fox5_bad.lz)bin400 -> 400 bytes
-rw-r--r--testsuite/fox5_bad1.lzbin0 -> 400 bytes
-rw-r--r--testsuite/fox5_bad1.txt (renamed from testsuite/fox5_bad.txt)2
-rw-r--r--testsuite/fox5_bad2.lzbin0 -> 400 bytes
-rw-r--r--testsuite/fox5_bad3.lzbin0 -> 400 bytes
-rw-r--r--testsuite/fox5_bad4.lzbin0 -> 400 bytes
-rw-r--r--testsuite/fox5_bad5.lzbin0 -> 400 bytes
-rw-r--r--testsuite/test.txt.lzbin0 -> 11518 bytes
-rw-r--r--testsuite/test_bad1.lzbin11548 -> 11518 bytes
-rw-r--r--testsuite/test_bad2.lzbin11548 -> 11518 bytes
-rw-r--r--testsuite/test_bad3.lzbin11548 -> 11518 bytes
-rw-r--r--testsuite/test_bad4.lzbin11548 -> 11518 bytes
-rw-r--r--testsuite/test_bad5.lzbin11548 -> 11518 bytes
-rw-r--r--testsuite/test_v0.lzbin11540 -> 0 bytes
-rw-r--r--testsuite/test_v1.lzbin11548 -> 0 bytes
-rw-r--r--testsuite/unzcrash.cc10
17 files changed, 116 insertions, 62 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
diff --git a/testsuite/fox5_bad.lz b/testsuite/fox5.lz
index 8bfd314..3472f64 100644
--- a/testsuite/fox5_bad.lz
+++ b/testsuite/fox5.lz
Binary files differ
diff --git a/testsuite/fox5_bad1.lz b/testsuite/fox5_bad1.lz
new file mode 100644
index 0000000..a3b5658
--- /dev/null
+++ b/testsuite/fox5_bad1.lz
Binary files differ
diff --git a/testsuite/fox5_bad.txt b/testsuite/fox5_bad1.txt
index 813a71f..14e5367 100644
--- a/testsuite/fox5_bad.txt
+++ b/testsuite/fox5_bad1.txt
@@ -1,4 +1,4 @@
The quick brown fox jumps over the lazy dog.
The quick brown fox jumps over the lazy dog.
-The quick brown fox c††zzzzzzzzzzzzzzzzzzzzzzThe quick brown fox jumps over the lazy dog.
+The quick brown fox c††zzzzzzzzzzzzzzzzzzzzzzVhe quick brown fox jumps over the lazy dog.
The quick brown fox jumps over the lazy dog.
diff --git a/testsuite/fox5_bad2.lz b/testsuite/fox5_bad2.lz
new file mode 100644
index 0000000..9993ea7
--- /dev/null
+++ b/testsuite/fox5_bad2.lz
Binary files differ
diff --git a/testsuite/fox5_bad3.lz b/testsuite/fox5_bad3.lz
new file mode 100644
index 0000000..ef58e47
--- /dev/null
+++ b/testsuite/fox5_bad3.lz
Binary files differ
diff --git a/testsuite/fox5_bad4.lz b/testsuite/fox5_bad4.lz
new file mode 100644
index 0000000..0474bb9
--- /dev/null
+++ b/testsuite/fox5_bad4.lz
Binary files differ
diff --git a/testsuite/fox5_bad5.lz b/testsuite/fox5_bad5.lz
new file mode 100644
index 0000000..6ec2740
--- /dev/null
+++ b/testsuite/fox5_bad5.lz
Binary files differ
diff --git a/testsuite/test.txt.lz b/testsuite/test.txt.lz
new file mode 100644
index 0000000..4db881a
--- /dev/null
+++ b/testsuite/test.txt.lz
Binary files differ
diff --git a/testsuite/test_bad1.lz b/testsuite/test_bad1.lz
index 0b84883..687c8a1 100644
--- a/testsuite/test_bad1.lz
+++ b/testsuite/test_bad1.lz
Binary files differ
diff --git a/testsuite/test_bad2.lz b/testsuite/test_bad2.lz
index cce6a3c..c8ac08c 100644
--- a/testsuite/test_bad2.lz
+++ b/testsuite/test_bad2.lz
Binary files differ
diff --git a/testsuite/test_bad3.lz b/testsuite/test_bad3.lz
index a1676bb..3ed8936 100644
--- a/testsuite/test_bad3.lz
+++ b/testsuite/test_bad3.lz
Binary files differ
diff --git a/testsuite/test_bad4.lz b/testsuite/test_bad4.lz
index a8f89a3..c912871 100644
--- a/testsuite/test_bad4.lz
+++ b/testsuite/test_bad4.lz
Binary files differ
diff --git a/testsuite/test_bad5.lz b/testsuite/test_bad5.lz
index 73e0142..7c70365 100644
--- a/testsuite/test_bad5.lz
+++ b/testsuite/test_bad5.lz
Binary files differ
diff --git a/testsuite/test_v0.lz b/testsuite/test_v0.lz
deleted file mode 100644
index a09b1e8..0000000
--- a/testsuite/test_v0.lz
+++ /dev/null
Binary files differ
diff --git a/testsuite/test_v1.lz b/testsuite/test_v1.lz
deleted file mode 100644
index f1c79eb..0000000
--- a/testsuite/test_v1.lz
+++ /dev/null
Binary files differ
diff --git a/testsuite/unzcrash.cc b/testsuite/unzcrash.cc
index abf61bb..24defa6 100644
--- a/testsuite/unzcrash.cc
+++ b/testsuite/unzcrash.cc
@@ -58,11 +58,11 @@ void show_help()
" -h, --help display this help and exit\n"
" -V, --version output version information and exit\n"
" -b, --bits=<range> test N-bit errors instead of full byte\n"
- " -p, --position=<bytes> first byte position to test\n"
+ " -p, --position=<bytes> first byte position to test [default 0]\n"
" -q, --quiet suppress all messages\n"
- " -s, --size=<bytes> number of byte positions to test\n"
+ " -s, --size=<bytes> number of byte positions to test [all]\n"
" -v, --verbose be verbose (a 2nd -v gives more)\n"
- "Examples of <range>: 1 1,2,3 1-4 1,3-5,8\n"
+ "Examples of <range>: 1 1,2,3 1-4 1,3-5,8 1-3,5-8\n"
"\nReport bugs to lzip-bug@nongnu.org\n"
"Lzip home page: http://www.nongnu.org/lzip/lzip.html\n" );
}
@@ -109,8 +109,8 @@ unsigned long long getnum( const char * const ptr,
const unsigned long long llimit,
const unsigned long long ulimit )
{
- errno = 0;
char * tail;
+ errno = 0;
unsigned long long result = strtoull( ptr, &tail, 0 );
if( tail == ptr )
{
@@ -172,7 +172,7 @@ public:
bool includes( const int i ) const
{ return ( i >= 1 && i <= 8 && data[i-1] ); }
- // Recognized formats: 1 1,2,3 1-4 1,3-5,8
+ // Recognized formats: 1 1,2,3 1-4 1,3-5,8 1-3,5-8
bool parse( const char * p )
{
for( int i = 0; i < 8; ++i ) data[i] = false;