diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2018-02-13 07:01:01 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2018-02-13 07:01:01 +0000 |
commit | 0437b6ffc0da64f949af9f8d12297dafd1973ea2 (patch) | |
tree | 475922608b5ef7331bbb6a885b229f9921f5eac9 /testsuite | |
parent | Adding upstream version 1.19. (diff) | |
download | lziprecover-0437b6ffc0da64f949af9f8d12297dafd1973ea2.tar.xz lziprecover-0437b6ffc0da64f949af9f8d12297dafd1973ea2.zip |
Adding upstream version 1.20.upstream/1.20
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'testsuite')
-rwxr-xr-x | testsuite/check.sh | 111 |
1 files changed, 104 insertions, 7 deletions
diff --git a/testsuite/check.sh b/testsuite/check.sh index 3ce8f9e..76ad361 100755 --- a/testsuite/check.sh +++ b/testsuite/check.sh @@ -1,6 +1,6 @@ #! /bin/sh # check script for Lziprecover - Data recovery tool for the lzip format -# Copyright (C) 2009-2017 Antonio Diaz Diaz. +# Copyright (C) 2009-2018 Antonio Diaz Diaz. # # This script is free software: you have unlimited permission # to copy, distribute and modify it. @@ -77,6 +77,8 @@ printf "testing lziprecover-%s..." "$2" [ $? = 2 ] || test_failed $LINENO "${LZIP}" -cdq < in [ $? = 2 ] || test_failed $LINENO +"${LZIP}" -dq -o in < "${in_lz}" +[ $? = 1 ] || test_failed $LINENO # these are for code coverage "${LZIP}" -lt "${in_lz}" 2> /dev/null [ $? = 1 ] || test_failed $LINENO @@ -111,6 +113,12 @@ printf "LZIP\001+.............................." | "${LZIP}" -t 2> /dev/null [ $? = 1 ] || test_failed $LINENO "${LZIPRECOVER}" -sq [ $? = 1 ] || test_failed $LINENO +"${LZIPRECOVER}" -q --dump-tdata +[ $? = 1 ] || test_failed $LINENO +"${LZIPRECOVER}" -q --strip-tdata +[ $? = 1 ] || test_failed $LINENO +"${LZIPRECOVER}" -q --remove-tdata +[ $? = 1 ] || test_failed $LINENO "${LZIPRECOVER}" -Aq in [ $? = 2 ] || test_failed $LINENO @@ -244,6 +252,54 @@ cmp "${inD}" copy || test_failed $LINENO printf "\ntesting bad input..." +headers='LZIp LZiP LZip LzIP LzIp LziP lZIP lZIp lZiP lzIP' +body='\001\014\000\203\377\373\377\377\300\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000$\000\000\000\000\000\000\000' +cat "${in_lz}" > in0.lz +printf "LZIP${body}" >> in0.lz +if "${LZIP}" -tq in0.lz ; then + for header in ${headers} ; do + printf "${header}${body}" > in0.lz # first member + "${LZIP}" -lq in0.lz + [ $? = 2 ] || test_failed $LINENO ${header} + "${LZIP}" -tq in0.lz + [ $? = 2 ] || test_failed $LINENO ${header} + "${LZIP}" -lq --loose-trailing in0.lz + [ $? = 2 ] || test_failed $LINENO ${header} + "${LZIP}" -tq --loose-trailing in0.lz + [ $? = 2 ] || test_failed $LINENO ${header} + cat "${in_lz}" > in0.lz + printf "${header}${body}" >> in0.lz # trailing data + "${LZIP}" -lq in0.lz + [ $? = 2 ] || test_failed $LINENO ${header} + "${LZIP}" -tq in0.lz + [ $? = 2 ] || test_failed $LINENO ${header} + "${LZIP}" -lq --loose-trailing in0.lz + [ $? = 0 ] || test_failed $LINENO ${header} + "${LZIP}" -t --loose-trailing in0.lz + [ $? = 0 ] || test_failed $LINENO ${header} + "${LZIP}" -lq --loose-trailing --trailing-error in0.lz + [ $? = 2 ] || test_failed $LINENO ${header} + "${LZIP}" -tq --loose-trailing --trailing-error in0.lz + [ $? = 2 ] || test_failed $LINENO ${header} + "${LZIPRECOVER}" -q --dump-tdata in0.lz > /dev/null + [ $? = 2 ] || test_failed $LINENO ${header} + "${LZIPRECOVER}" -q --strip-tdata in0.lz > /dev/null + [ $? = 2 ] || test_failed $LINENO ${header} + "${LZIPRECOVER}" --dump-tdata --loose-trailing in0.lz > /dev/null + [ $? = 0 ] || test_failed $LINENO ${header} + "${LZIPRECOVER}" --strip-tdata --loose-trailing in0.lz > /dev/null + [ $? = 0 ] || test_failed $LINENO ${header} + "${LZIPRECOVER}" -q --remove-tdata in0.lz + [ $? = 2 ] || test_failed $LINENO ${header} + "${LZIPRECOVER}" --remove-tdata --loose-trailing in0.lz + [ $? = 0 ] || test_failed $LINENO ${header} + cmp "${in_lz}" in0.lz || test_failed $LINENO ${header} + done +else + printf "\nwarning: skipping header test: 'printf' does not work on your system." +fi +rm -f in0.lz + cat "${in_lz}" "${in_lz}" "${in_lz}" > in3.lz || framework_failure if dd if=in3.lz of=trunc.lz bs=14752 count=1 2> /dev/null && [ -e trunc.lz ] && cmp in2.lz trunc.lz > /dev/null 2>&1 ; then @@ -251,7 +307,7 @@ if dd if=in3.lz of=trunc.lz bs=14752 count=1 2> /dev/null && dd if=in3.lz of=trunc.lz bs=$i count=1 2> /dev/null "${LZIP}" -lq trunc.lz [ $? = 2 ] || test_failed $LINENO $i - "${LZIP}" -t trunc.lz 2> /dev/null + "${LZIP}" -tq trunc.lz [ $? = 2 ] || test_failed $LINENO $i "${LZIP}" -tq < trunc.lz [ $? = 2 ] || test_failed $LINENO $i @@ -263,6 +319,7 @@ if dd if=in3.lz of=trunc.lz bs=14752 count=1 2> /dev/null && else printf "\nwarning: skipping truncation test: 'dd' does not work on your system." fi +rm -f in3.lz trunc.lz cat "${in_lz}" > ingin.lz || framework_failure printf "g" >> ingin.lz || framework_failure @@ -275,6 +332,13 @@ cmp in copy || test_failed $LINENO "${LZIP}" -t < ingin.lz || test_failed $LINENO "${LZIP}" -d < ingin.lz > copy || test_failed $LINENO cmp in copy || test_failed $LINENO +"${LZIPRECOVER}" -q --dump-tdata ingin.lz +[ $? = 2 ] || test_failed $LINENO +"${LZIPRECOVER}" -q --strip-tdata ingin.lz +[ $? = 2 ] || test_failed $LINENO +"${LZIPRECOVER}" -q --remove-tdata ingin.lz +[ $? = 2 ] || test_failed $LINENO +rm -f ingin.lz printf "\ntesting --merge..." @@ -449,13 +513,46 @@ mv copy.lz copy.tlz || framework_failure printf "\ntesting --split..." -cat "${in_lz}" "${in_lz}" "${in_lz}" > copy || framework_failure -printf "garbage" >> copy || framework_failure -"${LZIPRECOVER}" -s -o copy.lz copy || test_failed $LINENO -for i in 1 2 3 ; do - "${LZIPRECOVER}" -cd rec${i}copy.lz > copy || test_failed $LINENO $i +cat "${in_lz}" "${in_lz}" "${in_lz}" "${in_lz}" "${in_lz}" "${in_lz}" \ + "${in_lz}" "${in_lz}" "${in_lz}" > in9.lz || framework_failure +printf "garbage" >> in9.lz || framework_failure +"${LZIPRECOVER}" -s in9.lz || test_failed $LINENO +for i in 1 2 3 4 5 6 7 8 9 ; do + "${LZIP}" -cd rec${i}in9.lz > copy || test_failed $LINENO $i cmp in copy || test_failed $LINENO $i done +cat rec*in9.lz | cmp in9.lz - || test_failed $LINENO + +printf "\ntesting trailing data..." + +cat "${in_lz}" "${inD}" > int.lz || framework_failure +"${LZIPRECOVER}" --dump-tdata int.lz > copy +cmp "${inD}" copy || test_failed $LINENO +rm -f copy +"${LZIPRECOVER}" --dump-tdata int.lz -o copy +cmp "${inD}" copy || test_failed $LINENO +cat "${fox6_lz}" "${inD}" > fox6t.lz || framework_failure +cat "${inD}" "${inD}" > inD2 || framework_failure +"${LZIPRECOVER}" --dump-tdata int.lz fox6t.lz -f -o copy +cmp inD2 copy || test_failed $LINENO + +"${LZIPRECOVER}" --strip-tdata int.lz > copy +cmp "${in_lz}" copy || test_failed $LINENO +rm -f copy +"${LZIPRECOVER}" --strip-tdata int.lz -o copy +cmp "${in_lz}" copy || test_failed $LINENO +"${LZIPRECOVER}" --strip-tdata fox6t.lz -f -o copy +cmp "${fox6_lz}" copy || test_failed $LINENO +"${LZIPRECOVER}" --strip-tdata int.lz int.lz -f -o copy +cmp in2.lz copy || test_failed $LINENO + +"${LZIPRECOVER}" --remove-tdata int.lz fox6t.lz +cmp "${in_lz}" int.lz || test_failed $LINENO +cmp "${fox6_lz}" fox6t.lz || test_failed $LINENO +"${LZIPRECOVER}" --remove-tdata int.lz +cmp "${in_lz}" int.lz || test_failed $LINENO +"${LZIPRECOVER}" --remove-tdata fox6t.lz +cmp "${fox6_lz}" fox6t.lz || test_failed $LINENO echo if [ ${fail} = 0 ] ; then |