1#! /bin/sh 2# check script for Lziprecover - Data recovery tool for the lzip format 3# Copyright (C) 2009-2021 Antonio Diaz Diaz. 4# 5# This script is free software: you have unlimited permission 6# to copy, distribute, and modify it. 7 8LC_ALL=C 9export LC_ALL 10objdir=`pwd` 11testdir=`cd "$1" ; pwd` 12LZIP="${objdir}"/lziprecover 13LZIPRECOVER="${LZIP}" 14framework_failure() { echo "failure in testing framework" ; exit 1 ; } 15 16if [ ! -f "${LZIP}" ] || [ ! -x "${LZIP}" ] ; then 17 echo "${LZIP}: cannot execute" 18 exit 1 19fi 20 21[ -e "${LZIP}" ] 2> /dev/null || 22 { 23 echo "$0: a POSIX shell is required to run the tests" 24 echo "Try bash -c \"$0 $1 $2\"" 25 exit 1 26 } 27 28if [ -d tmp ] ; then rm -rf tmp ; fi 29mkdir tmp 30cd "${objdir}"/tmp || framework_failure 31 32cat "${testdir}"/test.txt > in || framework_failure 33in_lz="${testdir}"/test.txt.lz 34in_lzma="${testdir}"/test.txt.lzma 35in_em="${testdir}"/test_em.txt.lz 36inD="${testdir}"/test21723.txt 37bad1_lz="${testdir}"/test_bad1.lz 38bad2_lz="${testdir}"/test_bad2.lz 39bad3_lz="${testdir}"/test_bad3.lz 40bad4_lz="${testdir}"/test_bad4.lz 41bad5_lz="${testdir}"/test_bad5.lz 42fox_lz="${testdir}"/fox.lz 43fox6_lz="${testdir}"/fox6.lz 44f6b1="${testdir}"/fox6_bad1.txt 45f6b1_lz="${testdir}"/fox6_bad1.lz 46f6b2_lz="${testdir}"/fox6_bad2.lz 47f6b3_lz="${testdir}"/fox6_bad3.lz 48f6b4_lz="${testdir}"/fox6_bad4.lz 49f6b5_lz="${testdir}"/fox6_bad5.lz 50f6b6_lz="${testdir}"/fox6_bad6.lz 51f6s1_lz="${testdir}"/fox6_sc1.lz 52f6s2_lz="${testdir}"/fox6_sc2.lz 53f6s3_lz="${testdir}"/fox6_sc3.lz 54f6s4_lz="${testdir}"/fox6_sc4.lz 55f6s5_lz="${testdir}"/fox6_sc5.lz 56f6s6_lz="${testdir}"/fox6_sc6.lz 57num_lz="${testdir}"/numbers.lz 58nbt_lz="${testdir}"/numbersbt.lz 59fail=0 60test_failed() { fail=1 ; printf " $1" ; [ -z "$2" ] || printf "($2)" ; } 61 62# Description of test files for lziprecover: 63# single-member files with one or more errors 64# test_bad1.lz: byte at offset 66 changed from 0xA6 to 0x26 65# test_bad2.lz: [ 34- 65] --> copy of bytes [ 68- 99] 66# test_bad3.lz: [ 512-1535] --> zeroed [2560-3583] --> zeroed 67# test_bad4.lz: [3072-4095] --> random errors [4608-5631] --> zeroed 68# test_bad5.lz: [1024-2047] --> random errors [5120-6143] --> random data 69# test_bad6.lz: [ 512-1023] --> zeroed (reference test.txt [ 891- 2137]) 70# test_bad7.lz: [6656-7167] --> zeroed (reference test.txt [20428-32231]) 71# test_bad8.lz: [ 66- 73] --> zeroed (reference test.txt [ 89- 110]) 72# test_bad9.lz: [6491-6498] --> zeroed (reference test.txt [17977-18120]) 73# 74# 6-member files with one or more errors 75# fox6_bad1.lz: byte at offset 5 changed from 0x0C to 0x00 (DS) 76# byte at offset 142 changed from 0x50 to 0x70 (CRC) 77# byte at offset 224 changed from 0x2D to 0x2E (data_size) 78# byte at offset 268 changed from 0x34 to 0x33 (mid stream) 79# byte at offset 327 changed from 0x2A to 0x2B (byte 7) 80# byte at offset 458 changed from 0xA0 to 0x20 (EOS marker) 81# fox6_bad2.lz: [110-129] --> zeroed (member 2) 82# fox6_bad3.lz: [180-379] --> zeroed (members 3-5) 83# fox6_bad4.lz: [330-429] --> zeroed (members 5,6) 84# fox6_bad5.lz: [380-479] --> zeroed (members 5,6) 85# fox6_bad6.lz: [430-439] --> zeroed (member 6) 86# 87# 6-member files "shortcircuited" by a corrupt or fake trailer 88# fox6_sc1.lz: (corrupt but consistent last trailer) 89# last CRC != 0 ; dsize = 4 * msize ; msize = 480 (file size) 90# fox6_sc2.lz: (appended fake but consistent trailer) 91# fake CRC != 0 ; dsize = 4 * msize ; msize = 500 (file size) 92# fox6_sc3.lz: fake CRC = 0 93# fox6_sc4.lz: fake dsize = 0 94# fox6_sc5.lz: fake dsize = 411 (< 8 * ( fake msize - 36 ) / 9) 95# fox6_sc6.lz: fake dsize = 3360660 (>= 7090 * ( fake msize - 26 )) 96# 97# 9-member files "one_" "two_" "three_" "four_" "five_" "six_" "seven_" 98# "eight_" "nine_" 99# numbers.lz : good file containing the 9 members shown above 100# numbersbt.lz: "gap" after "three_", "damaged" after "six_", "trailing data" 101 102printf "testing lziprecover-%s..." "$2" 103 104"${LZIP}" -lq in 105[ $? = 2 ] || test_failed $LINENO 106"${LZIP}" -tq in 107[ $? = 2 ] || test_failed $LINENO 108"${LZIP}" -tq < in 109[ $? = 2 ] || test_failed $LINENO 110"${LZIP}" -cdq in 111[ $? = 2 ] || test_failed $LINENO 112"${LZIP}" -cdq < in 113[ $? = 2 ] || test_failed $LINENO 114"${LZIP}" -dq -o in < "${in_lz}" 115[ $? = 1 ] || test_failed $LINENO 116"${LZIP}" -dq -o in "${in_lz}" 117[ $? = 1 ] || test_failed $LINENO 118"${LZIP}" -dq -o out nx_file.lz 119[ $? = 1 ] || test_failed $LINENO 120[ ! -e out ] || test_failed $LINENO 121# these are for code coverage 122"${LZIP}" -lt "${in_lz}" 2> /dev/null 123[ $? = 1 ] || test_failed $LINENO 124"${LZIP}" -cdl "${in_lz}" > out 2> /dev/null 125[ $? = 1 ] || test_failed $LINENO 126"${LZIP}" -cdt "${in_lz}" > out 2> /dev/null 127[ $? = 1 ] || test_failed $LINENO 128"${LZIP}" -t -- nx_file.lz 2> /dev/null 129[ $? = 1 ] || test_failed $LINENO 130"${LZIP}" -t "" < /dev/null 2> /dev/null 131[ $? = 1 ] || test_failed $LINENO 132"${LZIP}" --help > /dev/null || test_failed $LINENO 133"${LZIP}" -n1 -V > /dev/null || test_failed $LINENO 134"${LZIP}" -m 2> /dev/null 135[ $? = 1 ] || test_failed $LINENO 136"${LZIP}" -z 2> /dev/null 137[ $? = 1 ] || test_failed $LINENO 138"${LZIP}" --bad_option 2> /dev/null 139[ $? = 1 ] || test_failed $LINENO 140"${LZIP}" --t 2> /dev/null 141[ $? = 1 ] || test_failed $LINENO 142"${LZIP}" --test=2 2> /dev/null 143[ $? = 1 ] || test_failed $LINENO 144"${LZIP}" --output= 2> /dev/null 145[ $? = 1 ] || test_failed $LINENO 146"${LZIP}" --output 2> /dev/null 147[ $? = 1 ] || test_failed $LINENO 148printf "LZIP\001-.............................." | "${LZIP}" -t 2> /dev/null 149printf "LZIP\002-.............................." | "${LZIP}" -t 2> /dev/null 150printf "LZIP\001+.............................." | "${LZIP}" -t 2> /dev/null 151 152"${LZIPRECOVER}" -eq "${testdir}"/test_bad6.lz 153[ $? = 1 ] || test_failed $LINENO 154"${LZIPRECOVER}" -mq "${bad1_lz}" 155[ $? = 1 ] || test_failed $LINENO 156"${LZIPRECOVER}" -Rq 157[ $? = 1 ] || test_failed $LINENO 158"${LZIPRECOVER}" -sq 159[ $? = 1 ] || test_failed $LINENO 160"${LZIPRECOVER}" -t --remove=damaged "${in_lz}" 2> /dev/null 161[ $? = 1 ] || test_failed $LINENO 162"${LZIPRECOVER}" --strip=damaged -t "${in_lz}" 2> /dev/null 163[ $? = 1 ] || test_failed $LINENO 164"${LZIPRECOVER}" --remove=tdata -t "${in_lz}" 2> /dev/null 165[ $? = 1 ] || test_failed $LINENO 166"${LZIPRECOVER}" -t --strip=tdata "${in_lz}" 2> /dev/null 167[ $? = 1 ] || test_failed $LINENO 168"${LZIPRECOVER}" -q --dump=tdata --strip=damaged "${in_lz}" 169[ $? = 1 ] || test_failed $LINENO 170"${LZIPRECOVER}" --remove=tdata --strip=damaged "${in_lz}" 2> /dev/null 171[ $? = 1 ] || test_failed $LINENO 172"${LZIPRECOVER}" -q --dump=damaged 173[ $? = 1 ] || test_failed $LINENO 174"${LZIPRECOVER}" -q --dump=damaged in > /dev/null 175[ $? = 2 ] || test_failed $LINENO 176"${LZIPRECOVER}" -q --dump=damagedd "${in_lz}" > /dev/null 177[ $? = 1 ] || test_failed $LINENO 178"${LZIPRECOVER}" -q --strip=damaged 179[ $? = 1 ] || test_failed $LINENO 180"${LZIPRECOVER}" -q --strip=damaged in > /dev/null 181[ $? = 2 ] || test_failed $LINENO 182"${LZIPRECOVER}" -q --strip=damagedd "${in_lz}" > /dev/null 183[ $? = 1 ] || test_failed $LINENO 184"${LZIPRECOVER}" -q --remove=damaged 185[ $? = 1 ] || test_failed $LINENO 186"${LZIPRECOVER}" -q --remove=damaged in 187[ $? = 2 ] || test_failed $LINENO 188"${LZIPRECOVER}" -q --remove=damagedd "${in_lz}" 189[ $? = 1 ] || test_failed $LINENO 190"${LZIPRECOVER}" -q --dump=tdata 191[ $? = 1 ] || test_failed $LINENO 192"${LZIPRECOVER}" -q --dump=tdata in > /dev/null 193[ $? = 2 ] || test_failed $LINENO 194"${LZIPRECOVER}" -q --dump=tdataa "${in_lz}" > /dev/null 195[ $? = 1 ] || test_failed $LINENO 196"${LZIPRECOVER}" -q --strip=tdata 197[ $? = 1 ] || test_failed $LINENO 198"${LZIPRECOVER}" -q --strip=tdata in > /dev/null 199[ $? = 2 ] || test_failed $LINENO 200"${LZIPRECOVER}" -q --strip=tdataa "${in_lz}" > /dev/null 201[ $? = 1 ] || test_failed $LINENO 202"${LZIPRECOVER}" -q --remove=tdata 203[ $? = 1 ] || test_failed $LINENO 204"${LZIPRECOVER}" -q --remove=tdata in 205[ $? = 2 ] || test_failed $LINENO 206"${LZIPRECOVER}" -q --remove=tdataa "${in_lz}" 207[ $? = 1 ] || test_failed $LINENO 208 209"${LZIPRECOVER}" -Aq in 210[ $? = 2 ] || test_failed $LINENO 211"${LZIPRECOVER}" -Aq < in > copy.lz # /dev/null returns 1 on OS/2 212[ $? = 2 ] || test_failed $LINENO 213"${LZIPRECOVER}" -Aq < "${in_lz}" > copy.lz 214[ $? = 2 ] || test_failed $LINENO 215"${LZIPRECOVER}" -Aq "${in_lz}" 216[ $? = 1 ] || test_failed $LINENO 217"${LZIPRECOVER}" -Akq "${in_lzma}" 218[ $? = 1 ] || test_failed $LINENO 219rm -f copy.lz || framework_failure 220"${LZIPRECOVER}" -A "${in_lzma}" -o copy.lz || test_failed $LINENO 221cmp "${in_lz}" copy.lz || test_failed $LINENO 222"${LZIPRECOVER}" -Ac "${in_lzma}" > copy.lz || test_failed $LINENO 223cmp "${in_lz}" copy.lz || test_failed $LINENO 224rm -f copy.lz || framework_failure 225"${LZIPRECOVER}" -A -o copy.lz < "${in_lzma}" || test_failed $LINENO 226cmp "${in_lz}" copy.lz || test_failed $LINENO 227"${LZIPRECOVER}" -A < "${in_lzma}" > copy.lz || test_failed $LINENO 228cmp "${in_lz}" copy.lz || test_failed $LINENO 229rm -f copy.lz || framework_failure 230cat "${in_lzma}" > copy.lzma || framework_failure 231"${LZIPRECOVER}" -Ak copy.lzma || test_failed $LINENO 232cmp "${in_lz}" copy.lz || test_failed $LINENO 233printf "to be overwritten" > copy.lz || framework_failure 234"${LZIPRECOVER}" -Af copy.lzma || test_failed $LINENO 235cmp "${in_lz}" copy.lz || test_failed $LINENO 236rm -f copy.lz || framework_failure 237cat "${in_lzma}" > copy.tlz || framework_failure 238"${LZIPRECOVER}" -Ak copy.tlz || test_failed $LINENO 239cmp "${in_lz}" copy.tar.lz || test_failed $LINENO 240printf "to be overwritten" > copy.tar.lz || framework_failure 241"${LZIPRECOVER}" -Af copy.tlz || test_failed $LINENO 242cmp "${in_lz}" copy.tar.lz || test_failed $LINENO 243rm -f copy.tar.lz || framework_failure 244cat in in > in2 || framework_failure 245"${LZIPRECOVER}" -A -o out2.lz - "${in_lzma}" - < "${in_lzma}" || 246 test_failed $LINENO 247"${LZIP}" -cd out2.lz > copy2 || test_failed $LINENO 248cmp in2 copy2 || test_failed $LINENO 249rm -f out2.lz copy2 || framework_failure 250 251printf "\ntesting decompression..." 252 253for i in "${in_lz}" "${in_em}" ; do 254 "${LZIP}" -lq "$i" || test_failed $LINENO "$i" 255 "${LZIP}" -t "$i" || test_failed $LINENO "$i" 256 "${LZIP}" -d "$i" -o copy || test_failed $LINENO "$i" 257 cmp in copy || test_failed $LINENO "$i" 258 "${LZIP}" -cd "$i" > copy || test_failed $LINENO "$i" 259 cmp in copy || test_failed $LINENO "$i" 260 "${LZIP}" -d "$i" -o - > copy || test_failed $LINENO "$i" 261 cmp in copy || test_failed $LINENO "$i" 262 "${LZIP}" -d < "$i" > copy || test_failed $LINENO "$i" 263 cmp in copy || test_failed $LINENO "$i" 264 rm -f copy || framework_failure 265done 266 267lines=$("${LZIP}" -tvv "${in_em}" 2>&1 | wc -l) || test_failed $LINENO 268[ "${lines}" -eq 8 ] || test_failed $LINENO "${lines}" 269 270lines=$("${LZIP}" -lvv "${in_em}" | wc -l) || test_failed $LINENO 271[ "${lines}" -eq 11 ] || test_failed $LINENO "${lines}" 272 273cat "${in_lz}" > copy.lz || framework_failure 274"${LZIP}" -dk copy.lz || test_failed $LINENO 275cmp in copy || test_failed $LINENO 276printf "to be overwritten" > copy || framework_failure 277"${LZIP}" -d copy.lz 2> /dev/null 278[ $? = 1 ] || test_failed $LINENO 279"${LZIP}" -df copy.lz || test_failed $LINENO 280[ ! -e copy.lz ] || test_failed $LINENO 281cmp in copy || test_failed $LINENO 282 283printf "to be overwritten" > copy || framework_failure 284"${LZIP}" -df -o copy < "${in_lz}" || test_failed $LINENO 285cmp in copy || test_failed $LINENO 286rm -f out copy || framework_failure 287"${LZIP}" -d -o ./- "${in_lz}" || test_failed $LINENO 288cmp in ./- || test_failed $LINENO 289rm -f ./- || framework_failure 290"${LZIP}" -d -o ./- < "${in_lz}" || test_failed $LINENO 291cmp in ./- || test_failed $LINENO 292rm -f ./- || framework_failure 293 294cat "${in_lz}" > anyothername || framework_failure 295"${LZIP}" -dv - anyothername - < "${in_lz}" > copy 2> /dev/null || 296 test_failed $LINENO 297cmp in copy || test_failed $LINENO 298cmp in anyothername.out || test_failed $LINENO 299rm -f copy anyothername.out || framework_failure 300 301"${LZIP}" -lq in "${in_lz}" 302[ $? = 2 ] || test_failed $LINENO 303"${LZIP}" -lq nx_file.lz "${in_lz}" 304[ $? = 1 ] || test_failed $LINENO 305"${LZIP}" -tq in "${in_lz}" 306[ $? = 2 ] || test_failed $LINENO 307"${LZIP}" -tq nx_file.lz "${in_lz}" 308[ $? = 1 ] || test_failed $LINENO 309"${LZIP}" -cdq in "${in_lz}" > copy 310[ $? = 2 ] || test_failed $LINENO 311cat copy in | cmp in - || test_failed $LINENO 312"${LZIP}" -cdq nx_file.lz "${in_lz}" > copy 313[ $? = 1 ] || test_failed $LINENO 314cmp in copy || test_failed $LINENO 315rm -f copy || framework_failure 316cat "${in_lz}" > copy.lz || framework_failure 317for i in 1 2 3 4 5 6 7 ; do 318 printf "g" >> copy.lz || framework_failure 319 "${LZIP}" -alvv copy.lz "${in_lz}" > /dev/null 2>&1 320 [ $? = 2 ] || test_failed $LINENO $i 321 "${LZIP}" -atvvvv copy.lz "${in_lz}" 2> /dev/null 322 [ $? = 2 ] || test_failed $LINENO $i 323done 324"${LZIP}" -dq in copy.lz 325[ $? = 2 ] || test_failed $LINENO 326[ -e copy.lz ] || test_failed $LINENO 327[ ! -e copy ] || test_failed $LINENO 328[ ! -e in.out ] || test_failed $LINENO 329"${LZIP}" -dq nx_file.lz copy.lz 330[ $? = 1 ] || test_failed $LINENO 331[ ! -e copy.lz ] || test_failed $LINENO 332[ ! -e nx_file ] || test_failed $LINENO 333cmp in copy || test_failed $LINENO 334 335"${LZIP}" -lq "${in_lz}" "${in_lz}" || test_failed $LINENO 336"${LZIP}" -t "${in_lz}" "${in_lz}" || test_failed $LINENO 337"${LZIP}" -cd "${in_lz}" "${in_lz}" -o out > copy2 || test_failed $LINENO 338[ ! -e out ] || test_failed $LINENO # override -o 339cmp in2 copy2 || test_failed $LINENO 340rm -f copy2 || framework_failure 341"${LZIP}" -d "${in_lz}" "${in_lz}" -o copy2 || test_failed $LINENO 342cmp in2 copy2 || test_failed $LINENO 343rm -f copy2 || framework_failure 344 345cat "${in_lz}" "${in_lz}" > copy2.lz || framework_failure 346printf "\ngarbage" >> copy2.lz || framework_failure 347"${LZIP}" -tvvvv copy2.lz 2> /dev/null || test_failed $LINENO 348"${LZIPRECOVER}" -aD0 -q copy2.lz 349[ $? = 2 ] || test_failed $LINENO 350"${LZIP}" -alq copy2.lz 351[ $? = 2 ] || test_failed $LINENO 352"${LZIP}" -atq copy2.lz 353[ $? = 2 ] || test_failed $LINENO 354"${LZIP}" -atq < copy2.lz 355[ $? = 2 ] || test_failed $LINENO 356"${LZIP}" -adkq copy2.lz 357[ $? = 2 ] || test_failed $LINENO 358[ ! -e copy2 ] || test_failed $LINENO 359"${LZIP}" -adkq -o copy2 < copy2.lz 360[ $? = 2 ] || test_failed $LINENO 361[ ! -e copy2 ] || test_failed $LINENO 362printf "to be overwritten" > copy2 || framework_failure 363"${LZIP}" -df copy2.lz || test_failed $LINENO 364cmp in2 copy2 || test_failed $LINENO 365rm -f copy2 || framework_failure 366 367"${LZIPRECOVER}" -D ,18000 "${in_lz}" > copy || test_failed $LINENO 368"${LZIPRECOVER}" -D 18000 "${in_lz}" >> copy || test_failed $LINENO 369cmp in copy || test_failed $LINENO 370"${LZIPRECOVER}" -D 21723-22120 -fo copy "${in_lz}" || test_failed $LINENO 371cmp "${inD}" copy || test_failed $LINENO 372"${LZIPRECOVER}" -D 21723,397 "${in_lz}" > copy || test_failed $LINENO 373cmp "${inD}" copy || test_failed $LINENO 374 375printf "\ntesting bad input..." 376 377headers='LZIp LZiP LZip LzIP LzIp LziP lZIP lZIp lZiP lzIP' 378body='\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' 379cat "${in_lz}" > int.lz 380printf "LZIP${body}" >> int.lz 381if "${LZIP}" -tq int.lz ; then 382 for header in ${headers} ; do 383 printf "${header}${body}" > int.lz # first member 384 "${LZIP}" -lq int.lz 385 [ $? = 2 ] || test_failed $LINENO ${header} 386 "${LZIP}" -tq int.lz 387 [ $? = 2 ] || test_failed $LINENO ${header} 388 "${LZIP}" -tq < int.lz 389 [ $? = 2 ] || test_failed $LINENO ${header} 390 "${LZIP}" -cdq int.lz > /dev/null 391 [ $? = 2 ] || test_failed $LINENO ${header} 392 "${LZIP}" -lq --loose-trailing int.lz 393 [ $? = 2 ] || test_failed $LINENO ${header} 394 "${LZIP}" -tq --loose-trailing int.lz 395 [ $? = 2 ] || test_failed $LINENO ${header} 396 "${LZIP}" -tq --loose-trailing < int.lz 397 [ $? = 2 ] || test_failed $LINENO ${header} 398 "${LZIP}" -cdq --loose-trailing int.lz > /dev/null 399 [ $? = 2 ] || test_failed $LINENO ${header} 400 cat "${in_lz}" > int.lz 401 printf "${header}${body}" >> int.lz # trailing data 402 "${LZIP}" -lq int.lz 403 [ $? = 2 ] || test_failed $LINENO ${header} 404 "${LZIP}" -tq int.lz 405 [ $? = 2 ] || test_failed $LINENO ${header} 406 "${LZIP}" -tq < int.lz 407 [ $? = 2 ] || test_failed $LINENO ${header} 408 "${LZIP}" -cdq int.lz > /dev/null 409 [ $? = 2 ] || test_failed $LINENO ${header} 410 "${LZIP}" -lq --loose-trailing int.lz || 411 test_failed $LINENO ${header} 412 "${LZIP}" -t --loose-trailing int.lz || 413 test_failed $LINENO ${header} 414 "${LZIP}" -t --loose-trailing < int.lz || 415 test_failed $LINENO ${header} 416 "${LZIP}" -cd --loose-trailing int.lz > /dev/null || 417 test_failed $LINENO ${header} 418 "${LZIP}" -lq --loose-trailing --trailing-error int.lz 419 [ $? = 2 ] || test_failed $LINENO ${header} 420 "${LZIP}" -tq --loose-trailing --trailing-error int.lz 421 [ $? = 2 ] || test_failed $LINENO ${header} 422 "${LZIP}" -tq --loose-trailing --trailing-error < int.lz 423 [ $? = 2 ] || test_failed $LINENO ${header} 424 "${LZIP}" -cdq --loose-trailing --trailing-error int.lz > /dev/null 425 [ $? = 2 ] || test_failed $LINENO ${header} 426 "${LZIPRECOVER}" -q --dump=tdata int.lz > /dev/null 427 [ $? = 2 ] || test_failed $LINENO ${header} 428 "${LZIPRECOVER}" -q --strip=tdata int.lz > /dev/null 429 [ $? = 2 ] || test_failed $LINENO ${header} 430 "${LZIPRECOVER}" --dump=tdata --loose-trailing int.lz > \ 431 /dev/null || test_failed $LINENO ${header} 432 "${LZIPRECOVER}" --strip=tdata --loose-trailing int.lz > \ 433 /dev/null || test_failed $LINENO ${header} 434 "${LZIPRECOVER}" -q --remove=tdata int.lz 435 [ $? = 2 ] || test_failed $LINENO ${header} 436 "${LZIPRECOVER}" --remove=tdata --loose-trailing int.lz || 437 test_failed $LINENO ${header} 438 cmp "${in_lz}" int.lz || test_failed $LINENO ${header} 439 done 440else 441 printf "\nwarning: skipping header test: 'printf' does not work on your system." 442fi 443rm -f int.lz || framework_failure 444 445for i in fox_v2.lz fox_s11.lz fox_de20.lz \ 446 fox_bcrc.lz fox_crc0.lz fox_das46.lz fox_mes81.lz ; do 447 "${LZIP}" -tq "${testdir}"/$i 448 [ $? = 2 ] || test_failed $LINENO $i 449done 450 451"${LZIP}" -cd "${fox_lz}" > fox || test_failed $LINENO 452for i in fox_bcrc.lz fox_crc0.lz fox_das46.lz fox_mes81.lz ; do 453 "${LZIP}" -cdq "${testdir}"/$i > out 454 [ $? = 2 ] || test_failed $LINENO $i 455 cmp fox out || test_failed $LINENO $i 456 "${LZIPRECOVER}" -tq -i "${testdir}"/$i || test_failed $LINENO $i 457 "${LZIPRECOVER}" -cdq -i "${testdir}"/$i > out || test_failed $LINENO $i 458 cmp fox out || test_failed $LINENO $i 459done 460rm -f fox out || framework_failure 461 462cat "${in_lz}" "${in_lz}" > in2.lz || framework_failure 463cat "${in_lz}" "${in_lz}" "${in_lz}" > in3.lz || framework_failure 464if dd if=in3.lz of=trunc.lz bs=14752 count=1 2> /dev/null && 465 [ -e trunc.lz ] && cmp in2.lz trunc.lz > /dev/null 2>&1 ; then 466 for i in 6 20 14734 14753 14754 14755 14756 14757 14758 ; do 467 dd if=in3.lz of=trunc.lz bs=$i count=1 2> /dev/null 468 "${LZIP}" -lq trunc.lz 469 [ $? = 2 ] || test_failed $LINENO $i 470 "${LZIP}" -tq trunc.lz 471 [ $? = 2 ] || test_failed $LINENO $i 472 "${LZIP}" -tq < trunc.lz 473 [ $? = 2 ] || test_failed $LINENO $i 474 "${LZIP}" -cdq trunc.lz > out 475 [ $? = 2 ] || test_failed $LINENO $i 476 "${LZIP}" -dq < trunc.lz > out 477 [ $? = 2 ] || test_failed $LINENO $i 478 done 479else 480 printf "\nwarning: skipping truncation test: 'dd' does not work on your system." 481fi 482rm -f in3.lz trunc.lz out || framework_failure 483 484for i in "${f6s1_lz}" "${f6s2_lz}" ; do 485 lines=`"${LZIP}" -lvv "$i" | wc -l || test_failed $LINENO "$i"` 486 [ "${lines}" -eq 2 ] || test_failed $LINENO "$i ${lines}" 487done 488for i in "${f6s3_lz}" "${f6s4_lz}" "${f6s5_lz}" "${f6s6_lz}" ; do 489 lines=`"${LZIP}" -lvv "$i" | wc -l || test_failed $LINENO "$i"` 490 [ "${lines}" -eq 9 ] || test_failed $LINENO "$i ${lines}" 491done 492 493cat "${in_lz}" > ingin.lz || framework_failure 494printf "g" >> ingin.lz || framework_failure 495cat "${in_lz}" >> ingin.lz || framework_failure 496"${LZIP}" -lq ingin.lz 497[ $? = 2 ] || test_failed $LINENO 498"${LZIP}" -atq ingin.lz 499[ $? = 2 ] || test_failed $LINENO 500"${LZIP}" -atq < ingin.lz 501[ $? = 2 ] || test_failed $LINENO 502"${LZIP}" -acdq ingin.lz > out 503[ $? = 2 ] || test_failed $LINENO 504"${LZIP}" -adq < ingin.lz > out 505[ $? = 2 ] || test_failed $LINENO 506"${LZIPRECOVER}" -lq -i ingin.lz || test_failed $LINENO 507"${LZIP}" -t ingin.lz || test_failed $LINENO 508"${LZIP}" -t < ingin.lz || test_failed $LINENO 509"${LZIP}" -cd ingin.lz > copy || test_failed $LINENO 510cmp in copy || test_failed $LINENO 511"${LZIP}" -d < ingin.lz > copy || test_failed $LINENO 512cmp in copy || test_failed $LINENO 513"${LZIPRECOVER}" -cd -i ingin.lz > copy2 || test_failed $LINENO 514cmp in2 copy2 || test_failed $LINENO 515 516"${LZIPRECOVER}" -D0 -q "${f6b1_lz}" -fo copy 517[ $? = 2 ] || test_failed $LINENO 518cmp -s "${f6b1}" copy && test_failed $LINENO 519"${LZIPRECOVER}" -D0 -q "${f6b1_lz}" > copy 520[ $? = 2 ] || test_failed $LINENO 521cmp -s "${f6b1}" copy && test_failed $LINENO 522"${LZIPRECOVER}" -D0 -iq "${f6b1_lz}" -fo copy || test_failed $LINENO 523cmp "${f6b1}" copy || test_failed $LINENO 524"${LZIPRECOVER}" -D0 -iq "${f6b1_lz}" > copy || test_failed $LINENO 525cmp "${f6b1}" copy || test_failed $LINENO 526 527touch empty || framework_failure 528"${LZIPRECOVER}" -D0 -q ingin.lz > copy 529[ $? = 2 ] || test_failed $LINENO 530cmp empty copy || test_failed $LINENO 531"${LZIPRECOVER}" -D0 -i ingin.lz > copy2 || test_failed $LINENO 532cmp in2 copy2 || test_failed $LINENO 533printf "LZIP\001+" > in2t.lz || framework_failure # gap size < 36 bytes 534cat "${in_lz}" in "${in_lz}" >> in2t.lz || framework_failure 535printf "LZIP\001-" >> in2t.lz || framework_failure # truncated member 536"${LZIPRECOVER}" -D0 -iq in2t.lz > copy2 || test_failed $LINENO 537cmp in2 copy2 || test_failed $LINENO 538"${LZIPRECOVER}" -cd -iq in2t.lz > copy2 || test_failed $LINENO 539cmp in2 copy2 || test_failed $LINENO 540"${LZIPRECOVER}" -t -iq in2t.lz || test_failed $LINENO 541rm -f in2 in2t.lz copy copy2 || framework_failure 542 543printf "\ntesting --merge..." 544 545rm -f copy.lz || framework_failure 546"${LZIPRECOVER}" -m -o copy.lz "${fox6_lz}" "${f6b1_lz}" || test_failed $LINENO 547[ ! -e copy.lz ] || test_failed $LINENO 548"${LZIPRECOVER}" -m -o copy.lz "${f6b1_lz}" "${fox6_lz}" || test_failed $LINENO 549[ ! -e copy.lz ] || test_failed $LINENO 550"${LZIPRECOVER}" -m -o copy.lz "${bad1_lz}" "${bad2_lz}" "${bad1_lz}" -q 551[ $? = 2 ] || test_failed $LINENO 552[ ! -e copy.lz ] || test_failed $LINENO 553"${LZIPRECOVER}" -m -o copy.lz "${bad1_lz}" "${bad2_lz}" "${bad2_lz}" -q 554[ $? = 2 ] || test_failed $LINENO 555[ ! -e copy.lz ] || test_failed $LINENO 556cat "${bad2_lz}" > bad2.lz || framework_failure 557"${LZIPRECOVER}" -m -o copy.lz "${bad1_lz}" "${bad2_lz}" bad2.lz -q 558[ $? = 2 ] || test_failed $LINENO 559[ ! -e copy.lz ] || test_failed $LINENO 560rm -f bad2.lz || framework_failure 561"${LZIPRECOVER}" -m -o copy.lz "${f6b1_lz}" "${f6b5_lz}" -q 562[ $? = 2 ] || test_failed $LINENO 563[ ! -e copy.lz ] || test_failed $LINENO 564"${LZIPRECOVER}" -m -o copy.lz "${f6b3_lz}" "${f6b5_lz}" -q 565[ $? = 2 ] || test_failed $LINENO 566[ ! -e copy.lz ] || test_failed $LINENO 567"${LZIPRECOVER}" -m -o copy.lz "${bad3_lz}" "${bad4_lz}" -q 568[ $? = 2 ] || test_failed $LINENO 569[ ! -e copy.lz ] || test_failed $LINENO 570 571"${LZIPRECOVER}" -mf -o copy.lz "${f6b1_lz}" "${f6b4_lz}" || test_failed $LINENO 572cmp "${fox6_lz}" copy.lz || test_failed $LINENO 573"${LZIPRECOVER}" -mf -o copy.lz "${f6b4_lz}" "${f6b1_lz}" || test_failed $LINENO 574cmp "${fox6_lz}" copy.lz || test_failed $LINENO 575 576for i in "${f6b1_lz}" "${f6b3_lz}" "${f6b4_lz}" "${f6b5_lz}" "${f6b6_lz}" ; do 577 "${LZIPRECOVER}" -mf -o copy.lz "${f6b2_lz}" "$i" || 578 test_failed $LINENO "$i" 579 cmp "${fox6_lz}" copy.lz || test_failed $LINENO "$i" 580 "${LZIPRECOVER}" -mf -o copy.lz "$i" "${f6b2_lz}" || 581 test_failed $LINENO "$i" 582 cmp "${fox6_lz}" copy.lz || test_failed $LINENO "$i" 583done 584 585for i in "${f6b3_lz}" "${f6b4_lz}" "${f6b5_lz}" "${f6b6_lz}" ; do 586 "${LZIPRECOVER}" -mf -o copy.lz "${f6b1_lz}" "${f6b2_lz}" "$i" || 587 test_failed $LINENO "$i" 588 cmp "${fox6_lz}" copy.lz || test_failed $LINENO "$i" 589 "${LZIPRECOVER}" -mf -o copy.lz "${f6b1_lz}" "$i" "${f6b2_lz}" || 590 test_failed $LINENO "$i" 591 cmp "${fox6_lz}" copy.lz || test_failed $LINENO "$i" 592 "${LZIPRECOVER}" -mf -o copy.lz "${f6b2_lz}" "${f6b1_lz}" "$i" || 593 test_failed $LINENO "$i" 594 cmp "${fox6_lz}" copy.lz || test_failed $LINENO "$i" 595 "${LZIPRECOVER}" -mf -o copy.lz "${f6b2_lz}" "$i" "${f6b1_lz}" || 596 test_failed $LINENO "$i" 597 cmp "${fox6_lz}" copy.lz || test_failed $LINENO "$i" 598 "${LZIPRECOVER}" -mf -o copy.lz "$i" "${f6b1_lz}" "${f6b2_lz}" || 599 test_failed $LINENO "$i" 600 cmp "${fox6_lz}" copy.lz || test_failed $LINENO "$i" 601 "${LZIPRECOVER}" -mf -o copy.lz "$i" "${f6b2_lz}" "${f6b1_lz}" || 602 test_failed $LINENO "$i" 603 cmp "${fox6_lz}" copy.lz || test_failed $LINENO "$i" 604done 605 606"${LZIPRECOVER}" -mf -o copy.lz "${f6b3_lz}" "${f6b4_lz}" "${f6b5_lz}" || 607 test_failed $LINENO 608cmp "${fox6_lz}" copy.lz || test_failed $LINENO 609"${LZIPRECOVER}" -mf -o copy.lz "${f6b1_lz}" "${f6b3_lz}" "${f6b4_lz}" \ 610"${f6b5_lz}" || test_failed $LINENO 611cmp "${fox6_lz}" copy.lz || test_failed $LINENO 612"${LZIPRECOVER}" -mf -o copy.lz "${f6b2_lz}" "${f6b3_lz}" "${f6b4_lz}" \ 613"${f6b5_lz}" || test_failed $LINENO 614cmp "${fox6_lz}" copy.lz || test_failed $LINENO 615"${LZIPRECOVER}" -mf -o copy.lz "${f6b1_lz}" "${f6b2_lz}" "${f6b3_lz}" \ 616"${f6b4_lz}" "${f6b5_lz}" || test_failed $LINENO 617cmp "${fox6_lz}" copy.lz || test_failed $LINENO 618 619"${LZIPRECOVER}" -mf -o copy.lz "${bad1_lz}" "${bad2_lz}" || test_failed $LINENO 620cmp "${in_lz}" copy.lz || test_failed $LINENO 621"${LZIPRECOVER}" -mf -o copy.lz "${bad2_lz}" "${bad1_lz}" || test_failed $LINENO 622cmp "${in_lz}" copy.lz || test_failed $LINENO 623 624cat "${bad1_lz}" "${in_lz}" "${bad1_lz}" "${bad1_lz}" > bad11.lz || framework_failure 625cat "${bad1_lz}" "${in_lz}" "${bad2_lz}" "${in_lz}" > bad12.lz || framework_failure 626cat "${bad2_lz}" "${in_lz}" "${bad2_lz}" "${bad2_lz}" > bad22.lz || framework_failure 627cat "${in_lz}" "${in_lz}" "${in_lz}" "${in_lz}" > copy4.lz || framework_failure 628"${LZIPRECOVER}" -mf -o out4.lz bad11.lz bad12.lz bad22.lz || test_failed $LINENO 629cmp out4.lz copy4.lz || test_failed $LINENO 630"${LZIPRECOVER}" -mf -o out4.lz bad11.lz bad22.lz bad12.lz || test_failed $LINENO 631cmp out4.lz copy4.lz || test_failed $LINENO 632"${LZIPRECOVER}" -mf -o out4.lz bad12.lz bad11.lz bad22.lz || test_failed $LINENO 633cmp out4.lz copy4.lz || test_failed $LINENO 634"${LZIPRECOVER}" -mf -o out4.lz bad12.lz bad22.lz bad11.lz || test_failed $LINENO 635cmp out4.lz copy4.lz || test_failed $LINENO 636"${LZIPRECOVER}" -mf -o out4.lz bad22.lz bad11.lz bad12.lz || test_failed $LINENO 637cmp out4.lz copy4.lz || test_failed $LINENO 638"${LZIPRECOVER}" -mf -o out4.lz bad22.lz bad12.lz bad11.lz || test_failed $LINENO 639cmp out4.lz copy4.lz || test_failed $LINENO 640rm -f bad11.lz bad12.lz bad22.lz || framework_failure 641 642for i in "${bad1_lz}" "${bad2_lz}" ; do 643 for j in "${bad3_lz}" "${bad4_lz}" "${bad5_lz}" ; do 644 "${LZIPRECOVER}" -mf -o copy.lz "$i" "$j" || 645 test_failed $LINENO "$i $j" 646 cmp "${in_lz}" copy.lz || test_failed $LINENO "$i $j" 647 "${LZIPRECOVER}" -mf -o copy.lz "$j" "$i" || 648 test_failed $LINENO "$i $j" 649 cmp "${in_lz}" copy.lz || test_failed $LINENO "$i $j" 650 done 651done 652 653"${LZIPRECOVER}" -mf -o copy.lz "${bad3_lz}" "${bad4_lz}" "${bad5_lz}" || 654 test_failed $LINENO 655cmp "${in_lz}" copy.lz || test_failed $LINENO 656"${LZIPRECOVER}" -mf -o copy.lz "${bad3_lz}" "${bad5_lz}" "${bad4_lz}" || 657 test_failed $LINENO 658cmp "${in_lz}" copy.lz || test_failed $LINENO 659"${LZIPRECOVER}" -mf -o copy.lz "${bad4_lz}" "${bad3_lz}" "${bad5_lz}" || 660 test_failed $LINENO 661cmp "${in_lz}" copy.lz || test_failed $LINENO 662"${LZIPRECOVER}" -mf -o copy.lz "${bad4_lz}" "${bad5_lz}" "${bad3_lz}" || 663 test_failed $LINENO 664cmp "${in_lz}" copy.lz || test_failed $LINENO 665"${LZIPRECOVER}" -mf -o copy.lz "${bad5_lz}" "${bad3_lz}" "${bad4_lz}" || 666 test_failed $LINENO 667cmp "${in_lz}" copy.lz || test_failed $LINENO 668"${LZIPRECOVER}" -mf -o copy.lz "${bad5_lz}" "${bad4_lz}" "${bad3_lz}" || 669 test_failed $LINENO 670cmp "${in_lz}" copy.lz || test_failed $LINENO 671 672cat "${bad3_lz}" "${bad4_lz}" "${bad5_lz}" "${in_lz}" > bad345.lz || framework_failure 673cat "${bad4_lz}" "${bad5_lz}" "${bad3_lz}" "${in_lz}" > bad453.lz || framework_failure 674cat "${bad5_lz}" "${bad3_lz}" "${bad4_lz}" "${in_lz}" > bad534.lz || framework_failure 675cat "${in_lz}" "${in_lz}" "${in_lz}" "${in_lz}" > copy4.lz || framework_failure 676"${LZIPRECOVER}" -mf -o out4.lz bad345.lz bad453.lz bad534.lz || 677 test_failed $LINENO 678cmp out4.lz copy4.lz || test_failed $LINENO 679"${LZIPRECOVER}" -mf -o out4.lz bad345.lz bad534.lz bad453.lz || 680 test_failed $LINENO 681cmp out4.lz copy4.lz || test_failed $LINENO 682"${LZIPRECOVER}" -mf -o out4.lz bad453.lz bad345.lz bad534.lz || 683 test_failed $LINENO 684cmp out4.lz copy4.lz || test_failed $LINENO 685"${LZIPRECOVER}" -mf -o out4.lz bad453.lz bad534.lz bad345.lz || 686 test_failed $LINENO 687cmp out4.lz copy4.lz || test_failed $LINENO 688"${LZIPRECOVER}" -mf -o out4.lz bad534.lz bad345.lz bad453.lz || 689 test_failed $LINENO 690cmp out4.lz copy4.lz || test_failed $LINENO 691"${LZIPRECOVER}" -mf -o out4.lz bad534.lz bad453.lz bad345.lz || 692 test_failed $LINENO 693cmp out4.lz copy4.lz || test_failed $LINENO 694rm -f bad345.lz bad453.lz bad534.lz out4.lz copy4.lz || framework_failure 695 696printf "\ntesting --repair..." 697 698rm -f copy.lz || framework_failure 699"${LZIPRECOVER}" -R -o copy.lz "${fox6_lz}" || test_failed $LINENO 700[ ! -e copy.lz ] || test_failed $LINENO 701"${LZIPRECOVER}" -R -o copy.lz "${bad2_lz}" -q 702[ $? = 2 ] || test_failed $LINENO 703[ ! -e copy.lz ] || test_failed $LINENO 704"${LZIPRECOVER}" -R -o copy.lz "${bad3_lz}" -q 705[ $? = 2 ] || test_failed $LINENO 706[ ! -e copy.lz ] || test_failed $LINENO 707"${LZIPRECOVER}" -R -o copy.lz "${bad4_lz}" -q 708[ $? = 2 ] || test_failed $LINENO 709[ ! -e copy.lz ] || test_failed $LINENO 710"${LZIPRECOVER}" -Rf -o copy.lz "${f6b1_lz}" || test_failed $LINENO 711cmp "${fox6_lz}" copy.lz || test_failed $LINENO 712"${LZIPRECOVER}" -Rf -o copy.lz "${bad1_lz}" || test_failed $LINENO 713cmp "${in_lz}" copy.lz || test_failed $LINENO 714 715cat "${f6b1_lz}" > copy.tar.lz || framework_failure 716"${LZIPRECOVER}" -R copy.tar.lz || test_failed $LINENO 717[ -e copy_fixed.tar.lz ] || test_failed $LINENO 718mv copy.tar.lz copy.lz || framework_failure 719"${LZIPRECOVER}" -R copy.lz || test_failed $LINENO 720[ -e copy_fixed.lz ] || test_failed $LINENO 721mv copy.lz copy.tlz || framework_failure 722"${LZIPRECOVER}" -R copy.tlz || test_failed $LINENO 723[ -e copy_fixed.tlz ] || test_failed $LINENO 724rm -f copy_fixed.tlz copy_fixed.lz copy_fixed.tar.lz copy.tlz || 725 framework_failure 726 727printf "\ntesting --reproduce..." 728 729if [ -z "${LZIP_NAME}" ] ; then LZIP_NAME=lzip ; fi 730if /bin/sh -c "${LZIP_NAME} -s18KiB" < in > out 2> /dev/null && 731 cmp "${in_lz}" out > /dev/null 2>&1 ; then 732 rm -f out || framework_failure 733 "${LZIPRECOVER}" --reproduce --lzip-name="${LZIP_NAME}" -o out \ 734 --reference-file=foo "${in_lz}" || test_failed $LINENO "${LZIP_NAME}" 735 [ ! -e out ] || test_failed $LINENO 736 737 for i in 6 7 8 9 ; do 738 for f in "${testdir}"/test_bad${i}.txt "${testdir}"/test.txt ; do 739 rm -f out || framework_failure 740 "${LZIPRECOVER}" -q --reproduce --lzip-name="${LZIP_NAME}" \ 741 --reference-file="$f" "${testdir}"/test_bad${i}.lz -o out || 742 test_failed $LINENO "${LZIP_NAME} $i $f" 743 cmp "${in_lz}" out || test_failed $LINENO "${LZIP_NAME} $i $f" 744 rm -f out || framework_failure 745 "${LZIPRECOVER}" -q --reproduce --lzip-name="${LZIP_NAME}" \ 746 --reference-file="$f" "${testdir}"/test_bad${i}.lz -o out \ 747 --lzip-level=6 || test_failed $LINENO "${LZIP_NAME} $i $f level=6" 748 cmp "${in_lz}" out || test_failed $LINENO "${LZIP_NAME} $i $f level=6" 749 rm -f out || framework_failure 750 "${LZIPRECOVER}" -q --reproduce --lzip-name="${LZIP_NAME}" \ 751 --reference-file="$f" "${testdir}"/test_bad${i}.lz -o out \ 752 --lzip-level=m36 || test_failed $LINENO "${LZIP_NAME} $i $f level=m36" 753 cmp "${in_lz}" out || test_failed $LINENO "${LZIP_NAME} $i $f level=m36" 754 done 755 done 756 757 cat "${in_lz}" "${in_lz}" "${in_lz}" "${in_lz}" > in4.lz || framework_failure 758 # multimember reproduction using test_bad[6789].txt as reference 759 cat "${testdir}"/test_bad6.lz "${testdir}"/test_bad7.lz \ 760 "${testdir}"/test_bad8.lz "${testdir}"/test_bad9.lz > mm_bad.lz || 761 framework_failure 762 rm -f out || framework_failure 763 for i in 6 7 8 9 ; do # reproduce one member each time 764 "${LZIPRECOVER}" -q --reproduce --lzip-name="${LZIP_NAME}" \ 765 --reference-file="${testdir}"/test_bad${i}.txt mm_bad.lz -o out || 766 test_failed $LINENO "${LZIP_NAME} $i" 767 mv -f out mm_bad.lz 768 done 769 cmp in4.lz mm_bad.lz || test_failed $LINENO "${LZIP_NAME}" 770 771 # multimember reproduction using test.txt as reference 772 cat "${testdir}"/test_bad6.lz "${testdir}"/test_bad7.lz \ 773 "${testdir}"/test_bad8.lz "${testdir}"/test_bad9.lz > mm_bad.lz || 774 framework_failure 775 rm -f out || framework_failure 776 for i in 6 7 8 9 ; do # reproduce one member each time 777 "${LZIPRECOVER}" -q --reproduce --lzip-name="${LZIP_NAME}" \ 778 --reference-file="${testdir}"/test.txt mm_bad.lz -o out || 779 test_failed $LINENO "${LZIP_NAME} $i" 780 mv -f out mm_bad.lz 781 done 782 cmp in4.lz mm_bad.lz || test_failed $LINENO "${LZIP_NAME}" 783 rm -f in4.lz mm_bad.lz || framework_failure 784 785 "${LZIPRECOVER}" -q --debug-reproduce=13-7356 --lzip-name="${LZIP_NAME}" \ 786 --reference-file="${testdir}"/test.txt "${testdir}"/test.txt.lz || 787 test_failed $LINENO "${LZIP_NAME}" 788 789 "${LZIPRECOVER}" -q --debug-reproduce=512,5120,512 --lzip-name="${LZIP_NAME}" \ 790 --reference-file="${testdir}"/test.txt "${testdir}"/test.txt.lz || 791 test_failed $LINENO "${LZIP_NAME}" 792else 793 printf "\nwarning: skipping --reproduce test: ${LZIP_NAME} not found or not the right version." 794 printf "\nTry 'make LZIP_NAME=<name_of_lzip_executable> check'." 795fi 796 797printf "\ntesting --split..." 798 799cat "${in_lz}" "${in_lz}" "${in_lz}" "${in_lz}" "${in_lz}" "${in_lz}" \ 800 "${in_lz}" "${in_lz}" "${in_lz}" > in9.lz || framework_failure 801"${LZIPRECOVER}" -s in9.lz || test_failed $LINENO 802for i in 1 2 3 4 5 6 7 8 9 ; do 803 cmp "${in_lz}" rec${i}in9.lz || test_failed $LINENO $i 804 "${LZIP}" -cd rec${i}in9.lz > copy || test_failed $LINENO $i 805 cmp in copy || test_failed $LINENO $i 806done 807cat rec*in9.lz | cmp in9.lz - || test_failed $LINENO 808rm -f rec*in9.lz || framework_failure 809 810cat in9.lz > in9t.lz || framework_failure 811printf "garbage" >> in9t.lz || framework_failure 812"${LZIPRECOVER}" -s in9t.lz || test_failed $LINENO 813for i in 01 02 03 04 05 06 07 08 09 ; do 814 cmp "${in_lz}" rec${i}in9t.lz || test_failed $LINENO $i 815 "${LZIP}" -cd rec${i}in9t.lz > copy || test_failed $LINENO $i 816 cmp in copy || test_failed $LINENO $i 817done 818[ -e rec10in9t.lz ] || test_failed $LINENO 819[ ! -e rec11in9t.lz ] || test_failed $LINENO 820cat rec*in9t.lz | cmp in9t.lz - || test_failed $LINENO 821rm -f rec*in9t.lz in9t.lz || framework_failure 822 823printf "LZIP\001+" > in9t.lz || framework_failure # gap size < 36 bytes 824cat "${in_lz}" "${in_lz}" "${in_lz}" in "${in_lz}" "${in_lz}" "${in_lz}" \ 825 "${in_lz}" "${in_lz}" "${in_lz}" in >> in9t.lz || framework_failure 826"${LZIPRECOVER}" -s in9t.lz || test_failed $LINENO 827for i in 02 03 04 06 07 08 09 10 11 ; do 828 cmp "${in_lz}" rec${i}in9t.lz || test_failed $LINENO $i 829 "${LZIP}" -cd rec${i}in9t.lz > copy || test_failed $LINENO $i 830 cmp in copy || test_failed $LINENO $i 831done 832cmp in rec05in9t.lz || test_failed $LINENO 833cmp in rec12in9t.lz || test_failed $LINENO 834[ -e rec01in9t.lz ] || test_failed $LINENO 835[ ! -e rec13in9t.lz ] || test_failed $LINENO 836cat rec*in9t.lz | cmp in9t.lz - || test_failed $LINENO 837rm -f rec*in9t.lz in9t.lz || framework_failure 838 839cat "${in_lz}" "${in_lz}" "${in_lz}" "${in_lz}" "${in_lz}" "${in_lz}" \ 840 "${in_lz}" "${in_lz}" in "${in_lz}" > in9t.lz || framework_failure 841printf "LZIP\001-" >> in9t.lz || framework_failure # truncated member 842"${LZIPRECOVER}" -s in9t.lz || test_failed $LINENO 843for i in 01 02 03 04 05 06 07 08 10 ; do 844 cmp "${in_lz}" rec${i}in9t.lz || test_failed $LINENO $i 845 "${LZIP}" -cd rec${i}in9t.lz > copy || test_failed $LINENO $i 846 cmp in copy || test_failed $LINENO $i 847done 848cmp in rec09in9t.lz || test_failed $LINENO 849[ -e rec11in9t.lz ] || test_failed $LINENO 850[ ! -e rec12in9t.lz ] || test_failed $LINENO 851cat rec*in9t.lz | cmp in9t.lz - || test_failed $LINENO 852rm -f rec*in9t.lz in9t.lz || framework_failure 853 854cat "${in_lz}" "${in_lz}" "${in_lz}" in "${in_lz}" > in9t.lz || framework_failure 855printf "LZIP\001-" >> in9t.lz || framework_failure # truncated member 856cat "${in_lz}" "${in_lz}" "${in_lz}" "${in_lz}" "${in_lz}" >> in9t.lz || 857 framework_failure 858"${LZIPRECOVER}" -s in9t.lz || test_failed $LINENO 859for i in 01 02 03 05 07 08 09 10 11 ; do 860 cmp "${in_lz}" rec${i}in9t.lz || test_failed $LINENO $i 861 "${LZIP}" -cd rec${i}in9t.lz > copy || test_failed $LINENO $i 862 cmp in copy || test_failed $LINENO $i 863done 864cmp in rec04in9t.lz || test_failed $LINENO 865[ -e rec06in9t.lz ] || test_failed $LINENO 866[ ! -e rec12in9t.lz ] || test_failed $LINENO 867cat rec*in9t.lz | cmp in9t.lz - || test_failed $LINENO 868rm -f rec*in9t.lz in9t.lz || framework_failure 869 870"${LZIPRECOVER}" -s "${f6b1_lz}" -o f6.lz || test_failed $LINENO 871for i in 1 2 3 4 5 6 ; do 872 [ -e rec${i}f6.lz ] || test_failed $LINENO 873done 874[ ! -e rec7f6.lz ] || test_failed $LINENO 875cat rec*f6.lz | cmp "${f6b1_lz}" - || test_failed $LINENO 876rm -f rec*f6.lz || framework_failure 877 878"${LZIPRECOVER}" -s "${f6b2_lz}" -o f6.lz || test_failed $LINENO 879for i in 1 3 4 5 6 ; do 880 cmp "${fox_lz}" rec${i}f6.lz || test_failed $LINENO 881done 882[ -e rec2f6.lz ] || test_failed $LINENO 883[ ! -e rec7f6.lz ] || test_failed $LINENO 884cat rec*f6.lz | cmp "${f6b2_lz}" - || test_failed $LINENO 885rm -f rec*f6.lz || framework_failure 886 887"${LZIPRECOVER}" -s "${f6b3_lz}" -o f6.lz || test_failed $LINENO 888for i in 1 2 4 ; do 889 cmp "${fox_lz}" rec${i}f6.lz || test_failed $LINENO 890done 891[ -e rec3f6.lz ] || test_failed $LINENO 892[ ! -e rec5f6.lz ] || test_failed $LINENO 893cat rec*f6.lz | cmp "${f6b3_lz}" - || test_failed $LINENO 894rm -f rec*f6.lz || framework_failure 895 896for i in "${f6b4_lz}" "${f6b5_lz}" ; do 897 "${LZIPRECOVER}" -s "$i" -o f6.lz || test_failed $LINENO 898 for j in 1 2 3 4 ; do 899 cmp "${fox_lz}" rec${j}f6.lz || test_failed $LINENO 900 done 901 [ -e rec5f6.lz ] || test_failed $LINENO 902 [ ! -e rec6f6.lz ] || test_failed $LINENO 903 cat rec*f6.lz | cmp "$i" - || test_failed $LINENO 904 rm -f rec*f6.lz || framework_failure 905done 906 907"${LZIPRECOVER}" -s "${f6b6_lz}" -o f6.lz || test_failed $LINENO 908for i in 1 2 3 4 5 ; do 909 cmp "${fox_lz}" rec${i}f6.lz || test_failed $LINENO 910done 911[ -e rec6f6.lz ] || test_failed $LINENO 912[ ! -e rec7f6.lz ] || test_failed $LINENO 913cat rec*f6.lz | cmp "${f6b6_lz}" - || test_failed $LINENO 914rm -f rec*f6.lz || framework_failure 915 916"${LZIPRECOVER}" -s "${f6s1_lz}" -o f6.lz || test_failed $LINENO 917for i in 1 2 3 4 5 ; do 918 cmp "${fox_lz}" rec${i}f6.lz || test_failed $LINENO 919done 920[ -e rec6f6.lz ] || test_failed $LINENO 921[ ! -e rec7f6.lz ] || test_failed $LINENO 922cat rec*f6.lz | cmp "${f6s1_lz}" - || test_failed $LINENO 923rm -f rec*f6.lz || framework_failure 924for i in "${f6s2_lz}" "${f6s3_lz}" "${f6s4_lz}" "${f6s5_lz}" "${f6s6_lz}" ; do 925 "${LZIPRECOVER}" -s "$i" -o f6.lz || test_failed $LINENO "$i" 926 for j in 1 2 3 4 5 6 ; do 927 cmp "${fox_lz}" rec${j}f6.lz || test_failed $LINENO "$i $j" 928 done 929 [ -e rec7f6.lz ] || test_failed $LINENO "$i" 930 [ ! -e rec8f6.lz ] || test_failed $LINENO "$i" 931 cat rec*f6.lz | cmp "$i" - || test_failed $LINENO "$i" 932 rm -f rec*f6.lz || framework_failure 933done 934 935"${LZIPRECOVER}" -s ingin.lz || test_failed $LINENO 936cmp "${in_lz}" rec1ingin.lz || test_failed $LINENO 937cmp "${in_lz}" rec3ingin.lz || test_failed $LINENO 938printf "g" | cmp rec2ingin.lz - || test_failed $LINENO 939[ ! -e rec4ingin.lz ] || test_failed $LINENO 940cat rec*ingin.lz | cmp ingin.lz - || test_failed $LINENO 941rm -f rec*ingin.lz || framework_failure 942 943printf "\ntesting --*=damaged..." 944 945cat "${in_lz}" > in.lz || framework_failure 946cat "${in_lz}" in > int.lz || framework_failure 947"${LZIPRECOVER}" --dump=damaged in.lz > copy || test_failed $LINENO 948cmp empty copy || test_failed $LINENO 949"${LZIPRECOVER}" --dump=damage int.lz > copy || test_failed $LINENO 950cmp empty copy || test_failed $LINENO 951"${LZIPRECOVER}" --strip=damag in.lz > copy || test_failed $LINENO 952cmp in.lz copy || test_failed $LINENO 953"${LZIPRECOVER}" --strip=dama int.lz > copy || test_failed $LINENO 954cmp int.lz copy || test_failed $LINENO 955# strip trailing data from all but the last file 956"${LZIPRECOVER}" --strip=dam int.lz int.lz > copy || test_failed $LINENO 957cat "${in_lz}" "${in_lz}" in | cmp copy - || test_failed $LINENO 958"${LZIPRECOVER}" --remove=da in.lz || test_failed $LINENO 959cmp "${in_lz}" in.lz || test_failed $LINENO 960"${LZIPRECOVER}" --remove=d int.lz || test_failed $LINENO 961cat "${in_lz}" in | cmp int.lz - || test_failed $LINENO 962rm -f in.lz int.lz || framework_failure 963 964cat in9.lz in > in9t.lz || framework_failure 965"${LZIPRECOVER}" --dump=damaged in9.lz > copy || test_failed $LINENO 966cmp empty copy || test_failed $LINENO 967"${LZIPRECOVER}" --dump=damaged in9t.lz > copy || test_failed $LINENO 968cmp empty copy || test_failed $LINENO 969"${LZIPRECOVER}" --strip=damaged in9.lz > copy || test_failed $LINENO 970cmp in9.lz copy || test_failed $LINENO 971"${LZIPRECOVER}" --strip=damaged in9t.lz > copy || test_failed $LINENO 972cmp in9t.lz copy || test_failed $LINENO 973"${LZIPRECOVER}" --remove=damaged in9t.lz || test_failed $LINENO 974cat in9.lz in | cmp in9t.lz - || test_failed $LINENO 975cat in9.lz > in9t.lz || framework_failure 976"${LZIPRECOVER}" --remove=damaged in9t.lz || test_failed $LINENO 977cmp in9.lz in9t.lz || test_failed $LINENO 978rm -f in9t.lz || framework_failure 979 980printf "LZIP\001+" > in9t.lz || framework_failure # gap size < 36 bytes 981cat "${in_lz}" "${in_lz}" "${in_lz}" in "${in_lz}" "${in_lz}" "${in_lz}" \ 982 "${in_lz}" "${in_lz}" "${in_lz}" >> in9t.lz || framework_failure 983printf "LZIP\001-" >> in9t.lz || framework_failure # truncated member 984printf "LZIP\001+" > gaps || framework_failure 985cat in >> gaps || framework_failure 986printf "LZIP\001-" >> gaps || framework_failure 987"${LZIPRECOVER}" --dump=damaged in9t.lz > copy || test_failed $LINENO 988cmp gaps copy || test_failed $LINENO 989"${LZIPRECOVER}" --strip=damaged in9t.lz > copy || test_failed $LINENO 990cmp in9.lz copy || test_failed $LINENO 991"${LZIPRECOVER}" --remove=damaged in9t.lz || test_failed $LINENO 992cmp in9.lz in9t.lz || test_failed $LINENO 993rm -f in9.lz in9t.lz gaps || framework_failure 994 995"${LZIPRECOVER}" --dump=damaged "${f6b1_lz}" > copy || test_failed $LINENO 996cmp "${f6b1_lz}" copy || test_failed $LINENO 997cat "${f6b1_lz}" in > f6bt.lz || framework_failure 998"${LZIPRECOVER}" --dump=damaged f6bt.lz > copy || test_failed $LINENO 999cmp "${f6b1_lz}" copy || test_failed $LINENO 1000"${LZIPRECOVER}" -q --strip=damaged "${f6b1_lz}" > copy || test_failed $LINENO 1001cmp empty copy || test_failed $LINENO 1002"${LZIPRECOVER}" -q --strip=damaged f6bt.lz > copy || test_failed $LINENO 1003cmp empty copy || test_failed $LINENO 1004cat "${f6b1_lz}" > f6b.lz || framework_failure 1005"${LZIPRECOVER}" -q --remove=damaged f6b.lz 1006[ $? = 2 ] || test_failed $LINENO 1007cmp "${f6b1_lz}" f6b.lz || test_failed $LINENO 1008"${LZIPRECOVER}" -q --remove=damaged f6bt.lz 1009[ $? = 2 ] || test_failed $LINENO 1010cat "${f6b1_lz}" in | cmp f6bt.lz - || test_failed $LINENO 1011rm -f f6b.lz f6bt.lz || framework_failure 1012 1013"${LZIPRECOVER}" --dump=damaged "${f6b2_lz}" > copy || test_failed $LINENO 1014cat "${fox_lz}" copy "${fox_lz}" "${fox_lz}" "${fox_lz}" \ 1015 "${fox_lz}" | cmp "${f6b2_lz}" - || test_failed $LINENO 1016cat "${f6b2_lz}" in > f6bt.lz || framework_failure 1017"${LZIPRECOVER}" --dump=damaged f6bt.lz > copy || test_failed $LINENO 1018cat "${fox_lz}" copy "${fox_lz}" "${fox_lz}" "${fox_lz}" \ 1019 "${fox_lz}" | cmp "${f6b2_lz}" - || test_failed $LINENO 1020cat "${fox_lz}" "${fox_lz}" "${fox_lz}" "${fox_lz}" "${fox_lz}" > fox5.lz 1021"${LZIPRECOVER}" --strip=damaged "${f6b2_lz}" > copy || test_failed $LINENO 1022cmp fox5.lz copy || test_failed $LINENO 1023"${LZIPRECOVER}" --strip=damaged f6bt.lz > copy || test_failed $LINENO 1024cat fox5.lz in | cmp copy - || test_failed $LINENO 1025cat "${f6b2_lz}" > f6b.lz || framework_failure 1026"${LZIPRECOVER}" --remove=damaged f6b.lz || test_failed $LINENO 1027cmp fox5.lz f6b.lz || test_failed $LINENO 1028"${LZIPRECOVER}" --remove=damaged f6bt.lz || test_failed $LINENO 1029cat fox5.lz in | cmp f6bt.lz - || test_failed $LINENO 1030rm -f f6b.lz f6bt.lz || framework_failure 1031 1032"${LZIPRECOVER}" --dump=damaged "${f6b3_lz}" > copy || test_failed $LINENO 1033cat "${fox_lz}" "${fox_lz}" copy "${fox_lz}" | cmp "${f6b3_lz}" - || 1034 test_failed $LINENO 1035cat "${f6b3_lz}" in > f6bt.lz || framework_failure 1036"${LZIPRECOVER}" --dump=damaged f6bt.lz > copy || test_failed $LINENO 1037cat "${fox_lz}" "${fox_lz}" copy "${fox_lz}" | cmp "${f6b3_lz}" - || 1038 test_failed $LINENO 1039cat "${fox_lz}" "${fox_lz}" "${fox_lz}" > fox3.lz 1040"${LZIPRECOVER}" --strip=damaged "${f6b3_lz}" > copy || test_failed $LINENO 1041cmp fox3.lz copy || test_failed $LINENO 1042"${LZIPRECOVER}" --strip=damaged f6bt.lz > copy || test_failed $LINENO 1043cat fox3.lz in | cmp copy - || test_failed $LINENO 1044cat "${f6b3_lz}" > f6b.lz || framework_failure 1045"${LZIPRECOVER}" --remove=damaged f6b.lz || test_failed $LINENO 1046cmp fox3.lz f6b.lz || test_failed $LINENO 1047"${LZIPRECOVER}" --remove=damaged f6bt.lz || test_failed $LINENO 1048cat fox3.lz in | cmp f6bt.lz - || test_failed $LINENO 1049rm -f f6b.lz f6bt.lz fox3.lz || framework_failure 1050 1051cat "${fox_lz}" "${fox_lz}" "${fox_lz}" "${fox_lz}" > fox4.lz 1052for i in "${f6b4_lz}" "${f6b5_lz}" ; do 1053 "${LZIPRECOVER}" --dump=damaged "$i" > copy || test_failed $LINENO "$i" 1054 cat fox4.lz copy | cmp "$i" - || test_failed $LINENO "$i" 1055 cat "$i" in > f6bt.lz || framework_failure 1056 "${LZIPRECOVER}" --dump=damaged f6bt.lz > copy || 1057 test_failed $LINENO "$i" 1058 cat fox4.lz copy | cmp f6bt.lz - || test_failed $LINENO "$i" 1059 "${LZIPRECOVER}" --strip=damaged "$i" > copy || test_failed $LINENO "$i" 1060 cmp fox4.lz copy || test_failed $LINENO "$i" 1061 "${LZIPRECOVER}" --strip=damaged f6bt.lz > copy || 1062 test_failed $LINENO "$i" 1063 cmp fox4.lz copy || test_failed $LINENO "$i" 1064 cat "$i" > f6b.lz || framework_failure 1065 "${LZIPRECOVER}" --remove=damaged f6b.lz || test_failed $LINENO "$i" 1066 cmp fox4.lz f6b.lz || test_failed $LINENO "$i" 1067 "${LZIPRECOVER}" --remove=damaged f6bt.lz || test_failed $LINENO "$i" 1068 cmp fox4.lz f6bt.lz || test_failed $LINENO "$i" 1069done 1070rm -f f6b.lz f6bt.lz fox4.lz || framework_failure 1071 1072"${LZIPRECOVER}" --dump=damaged "${f6b6_lz}" > copy || test_failed $LINENO 1073cat fox5.lz copy | cmp "${f6b6_lz}" - || test_failed $LINENO 1074cat "${f6b6_lz}" in > f6bt.lz || framework_failure 1075"${LZIPRECOVER}" --dump=damaged f6bt.lz > copy || test_failed $LINENO 1076cat fox5.lz copy | cmp "${f6b6_lz}" - || test_failed $LINENO 1077"${LZIPRECOVER}" --strip=damaged "${f6b6_lz}" > copy || test_failed $LINENO 1078cmp fox5.lz copy || test_failed $LINENO 1079"${LZIPRECOVER}" --strip=damaged f6bt.lz > copy || test_failed $LINENO 1080cat fox5.lz in | cmp copy - || test_failed $LINENO 1081cat "${f6b6_lz}" > f6b.lz || framework_failure 1082"${LZIPRECOVER}" --remove=damaged f6b.lz || test_failed $LINENO 1083cmp fox5.lz f6b.lz || test_failed $LINENO 1084"${LZIPRECOVER}" --remove=damaged f6bt.lz || test_failed $LINENO 1085cat fox5.lz in | cmp f6bt.lz - || test_failed $LINENO 1086rm -f f6b.lz f6bt.lz || framework_failure 1087 1088for i in "${f6s1_lz}" "${f6s2_lz}" ; do 1089 "${LZIPRECOVER}" --dump=damaged "$i" > copy || test_failed $LINENO "$i" 1090 cmp "$i" copy || test_failed $LINENO "$i" 1091 cat "$i" in > f6bt.lz || framework_failure 1092 "${LZIPRECOVER}" --dump=damaged f6bt.lz > copy || 1093 test_failed $LINENO "$i" 1094 cmp "$i" copy || test_failed $LINENO "$i" 1095 "${LZIPRECOVER}" -q --strip=damaged "$i" > copy || 1096 test_failed $LINENO "$i" 1097 cmp empty copy || test_failed $LINENO "$i" 1098 "${LZIPRECOVER}" -q --strip=damaged f6bt.lz > copy || 1099 test_failed $LINENO "$i" 1100 cmp empty copy || test_failed $LINENO "$i" 1101 cat "$i" > f6b.lz || framework_failure 1102 "${LZIPRECOVER}" -q --remove=damaged f6b.lz 1103 [ $? = 2 ] || test_failed $LINENO "$i" 1104 cmp "$i" f6b.lz || test_failed $LINENO "$i" 1105 "${LZIPRECOVER}" -q --remove=damaged f6bt.lz 1106 [ $? = 2 ] || test_failed $LINENO "$i" 1107 cat "$i" in | cmp f6bt.lz - || test_failed $LINENO "$i" 1108done 1109rm -f f6b.lz f6bt.lz || framework_failure 1110 1111for i in "${f6s3_lz}" "${f6s4_lz}" "${f6s5_lz}" "${f6s6_lz}" ; do 1112 "${LZIPRECOVER}" --dump=damaged "$i" > copy || test_failed $LINENO "$i" 1113 cmp empty copy || test_failed $LINENO "$i" 1114 cat "$i" in > f6bt.lz || framework_failure 1115 "${LZIPRECOVER}" --dump=damaged f6bt.lz > copy || 1116 test_failed $LINENO "$i" 1117 cmp empty copy || test_failed $LINENO "$i" 1118 "${LZIPRECOVER}" --strip=damaged "$i" > copy || test_failed $LINENO "$i" 1119 cmp "$i" copy || test_failed $LINENO "$i" 1120 "${LZIPRECOVER}" --strip=damaged f6bt.lz > copy || 1121 test_failed $LINENO "$i" 1122 cat "$i" in | cmp copy - || test_failed $LINENO "$i" 1123 cat "$i" > f6b.lz || framework_failure 1124 "${LZIPRECOVER}" --remove=damaged f6b.lz || test_failed $LINENO "$i" 1125 cmp "$i" f6b.lz || test_failed $LINENO "$i" 1126 "${LZIPRECOVER}" --remove=damaged f6bt.lz || test_failed $LINENO "$i" 1127 cat "$i" in | cmp f6bt.lz - || test_failed $LINENO "$i" 1128done 1129rm -f f6b.lz f6bt.lz || framework_failure 1130 1131cat ingin.lz "${inD}" > ingint.lz || framework_failure 1132"${LZIPRECOVER}" --dump=damaged ingin.lz > copy || test_failed $LINENO 1133printf "g" | cmp copy - || test_failed $LINENO 1134"${LZIPRECOVER}" --dump=damaged ingint.lz > copy || test_failed $LINENO 1135printf "g" | cmp copy - || test_failed $LINENO 1136"${LZIPRECOVER}" --strip=damaged ingin.lz > copy || test_failed $LINENO 1137cmp in2.lz copy || test_failed $LINENO 1138"${LZIPRECOVER}" --strip=damaged ingint.lz > copy || test_failed $LINENO 1139cat "${in_lz}" "${in_lz}" "${inD}" | cmp copy - || test_failed $LINENO 1140cat ingin.lz > ingin2.lz || framework_failure 1141"${LZIPRECOVER}" --remove=damaged ingin2.lz || test_failed $LINENO 1142cmp in2.lz ingin2.lz || test_failed $LINENO 1143"${LZIPRECOVER}" --remove=damaged ingint.lz || test_failed $LINENO 1144cat "${in_lz}" "${in_lz}" "${inD}" | cmp ingint.lz - || test_failed $LINENO 1145rm -f ingin2.lz ingint.lz || framework_failure 1146 1147# concatenate output from several files 1148"${LZIPRECOVER}" --dump=damaged "${f6b2_lz}" > copy || test_failed $LINENO 1149"${LZIPRECOVER}" --dump=damaged "${bad2_lz}" "${f6b2_lz}" > copy2 || 1150 test_failed $LINENO 1151cat "${bad2_lz}" copy | cmp copy2 - || test_failed $LINENO 1152cat "${bad2_lz}" in > bad2t.lz || framework_failure 1153cat "${f6b2_lz}" in > f6bt.lz || framework_failure 1154"${LZIPRECOVER}" --dump=damaged bad2t.lz "${f6b2_lz}" "${bad2_lz}" \ 1155f6bt.lz > copy4 || test_failed $LINENO 1156cat "${bad2_lz}" copy "${bad2_lz}" copy | cmp copy4 - || test_failed $LINENO 1157"${LZIPRECOVER}" --dump=damaged "${f6b2_lz}" bad2t.lz f6bt.lz \ 1158"${bad2_lz}" > copy4 || test_failed $LINENO 1159cat copy "${bad2_lz}" copy "${bad2_lz}" | cmp copy4 - || test_failed $LINENO 1160# 1161"${LZIPRECOVER}" -q --strip=damaged "${bad2_lz}" "${f6b2_lz}" > copy || 1162 test_failed $LINENO 1163cmp fox5.lz copy || test_failed $LINENO 1164"${LZIPRECOVER}" -q --strip=damaged bad2t.lz "${f6b2_lz}" > copy || 1165 test_failed $LINENO 1166cmp fox5.lz copy || test_failed $LINENO 1167"${LZIPRECOVER}" -q --strip=damaged "${f6b2_lz}" bad2t.lz f6bt.lz > copy || 1168 test_failed $LINENO 1169cat fox5.lz fox5.lz in | cmp copy - || test_failed $LINENO 1170"${LZIPRECOVER}" -q --strip=damaged "${f6b2_lz}" f6bt.lz bad2t.lz > copy || 1171 test_failed $LINENO 1172cat fox5.lz fox5.lz | cmp copy - || test_failed $LINENO 1173"${LZIPRECOVER}" -q --strip=damaged f6bt.lz bad2t.lz > copy || 1174 test_failed $LINENO 1175cmp fox5.lz copy || test_failed $LINENO 1176"${LZIPRECOVER}" -q --strip=damaged f6bt.lz "${in_lz}" > copy || 1177 test_failed $LINENO 1178cat fox5.lz "${in_lz}" | cmp copy - || test_failed $LINENO 1179"${LZIPRECOVER}" --strip=damaged --strip=tdata f6bt.lz "${in_lz}" > copy || 1180 test_failed $LINENO 1181cat fox5.lz "${in_lz}" | cmp copy - || test_failed $LINENO 1182# 1183cat "${f6b2_lz}" > f6b.lz || framework_failure 1184"${LZIPRECOVER}" -q --remove=damaged f6b.lz bad2t.lz f6bt.lz 1185[ $? = 2 ] || test_failed $LINENO 1186cat "${bad2_lz}" in | cmp bad2t.lz - || test_failed $LINENO 1187cmp fox5.lz f6b.lz || test_failed $LINENO 1188cat fox5.lz in | cmp f6bt.lz - || test_failed $LINENO 1189cat "${bad2_lz}" in > bad2t.lz || framework_failure 1190cat "${fox6_lz}" "${inD}" > fox6t.lz || framework_failure 1191cat "${f6b1_lz}" in > f6abt.lz || framework_failure 1192cat "${f6b2_lz}" > f6b.lz || framework_failure 1193cat "${f6b2_lz}" in > f6bt.lz || framework_failure 1194"${LZIPRECOVER}" -q --remove=d:t fox6t.lz f6abt.lz f6b.lz bad2t.lz f6bt.lz 1195[ $? = 2 ] || test_failed $LINENO 1196cat "${bad2_lz}" in | cmp bad2t.lz - || test_failed $LINENO 1197cat "${f6b1_lz}" in | cmp f6abt.lz - || test_failed $LINENO 1198cmp "${fox6_lz}" fox6t.lz || test_failed $LINENO 1199cmp fox5.lz f6b.lz || test_failed $LINENO 1200cmp fox5.lz f6bt.lz || test_failed $LINENO 1201rm -f fox6t.lz f6b.lz f6bt.lz bad2t.lz fox5.lz copy2 copy4 || framework_failure 1202 1203printf "\ntesting trailing data..." 1204 1205cat "${in_lz}" "${inD}" > int.lz || framework_failure 1206"${LZIPRECOVER}" --dump=tdata int.lz > copy || test_failed $LINENO 1207cmp "${inD}" copy || test_failed $LINENO 1208rm -f copy || framework_failure 1209"${LZIPRECOVER}" --dump=tdat int.lz -o copy || test_failed $LINENO 1210cmp "${inD}" copy || test_failed $LINENO 1211cat "${fox6_lz}" "${inD}" > fox6t.lz || framework_failure 1212cat "${inD}" "${inD}" > inD2 || framework_failure 1213"${LZIPRECOVER}" --dump=tda int.lz fox6t.lz -f -o copy || test_failed $LINENO 1214cmp inD2 copy || test_failed $LINENO 1215rm -f inD2 || framework_failure 1216cat ingin.lz "${inD}" > ingint.lz || framework_failure 1217"${LZIPRECOVER}" -q --dump=td ingint.lz > /dev/null 1218[ $? = 2 ] || test_failed $LINENO 1219"${LZIPRECOVER}" -i --dump=t ingint.lz > copy || test_failed $LINENO 1220cmp "${inD}" copy || test_failed $LINENO 1221 1222"${LZIPRECOVER}" --strip=tdata int.lz > copy || test_failed $LINENO 1223cmp "${in_lz}" copy || test_failed $LINENO 1224rm -f copy || framework_failure 1225"${LZIPRECOVER}" --strip=tdata int.lz -o copy || test_failed $LINENO 1226cmp "${in_lz}" copy || test_failed $LINENO 1227"${LZIPRECOVER}" --strip=tdata fox6t.lz -f -o copy || test_failed $LINENO 1228cmp "${fox6_lz}" copy || test_failed $LINENO 1229"${LZIPRECOVER}" --strip=tdata int.lz int.lz -f -o copy || test_failed $LINENO 1230cmp in2.lz copy || test_failed $LINENO 1231rm -f in2.lz || framework_failure 1232"${LZIPRECOVER}" --strip=tdata int.lz fox6t.lz > copy || test_failed $LINENO 1233cat "${in_lz}" "${fox6_lz}" | cmp copy - || test_failed $LINENO 1234"${LZIPRECOVER}" -q --strip=tdata ingint.lz > /dev/null 1235[ $? = 2 ] || test_failed $LINENO 1236"${LZIPRECOVER}" -i --strip=tdata ingint.lz > copy || test_failed $LINENO 1237cmp ingin.lz copy || test_failed $LINENO 1238 1239"${LZIPRECOVER}" --remove=tdata int.lz fox6t.lz || test_failed $LINENO 1240cmp "${in_lz}" int.lz || test_failed $LINENO 1241cmp "${fox6_lz}" fox6t.lz || test_failed $LINENO 1242"${LZIPRECOVER}" --remove=tdata int.lz || test_failed $LINENO 1243cmp "${in_lz}" int.lz || test_failed $LINENO 1244"${LZIPRECOVER}" --remove=tdata fox6t.lz || test_failed $LINENO 1245cmp "${fox6_lz}" fox6t.lz || test_failed $LINENO 1246"${LZIPRECOVER}" -q --remove=tdata ingint.lz 1247[ $? = 2 ] || test_failed $LINENO 1248cmp -s ingin.lz ingint.lz && test_failed $LINENO 1249"${LZIPRECOVER}" -i --remove=tdata ingint.lz || test_failed $LINENO 1250cmp ingin.lz ingint.lz || test_failed $LINENO 1251rm -f int.lz fox6t.lz ingint.lz ingin.lz || framework_failure 1252 1253for i in "${f6s3_lz}" "${f6s4_lz}" "${f6s5_lz}" "${f6s6_lz}" ; do 1254 "${LZIPRECOVER}" --strip=tdata "$i" > copy || test_failed $LINENO "$i" 1255 "${LZIPRECOVER}" --dump=tdata "$i" > tdata || test_failed $LINENO "$i" 1256 cmp "${fox6_lz}" copy || test_failed $LINENO "$i" 1257 cat copy tdata | cmp "$i" - || test_failed $LINENO "$i" 1258 cat "$i" "${inD}" > f6t.lz || framework_failure 1259 "${LZIPRECOVER}" --strip=tdata f6t.lz > copy || test_failed $LINENO "$i" 1260 "${LZIPRECOVER}" --dump=tdata f6t.lz > tdata || test_failed $LINENO "$i" 1261 cmp "${fox6_lz}" copy || test_failed $LINENO "$i" 1262 cat copy tdata | cmp f6t.lz - || test_failed $LINENO "$i" 1263 "${LZIPRECOVER}" --remove=tdata f6t.lz || test_failed $LINENO "$i" 1264 cmp "${fox6_lz}" f6t.lz || test_failed $LINENO "$i" 1265 rm -f copy tdata f6t.lz || framework_failure 1266done 1267 1268printf "\ntesting --dump/remove/strip..." 1269 1270"${LZIPRECOVER}" -s "${num_lz}" -o num.lz || test_failed $LINENO 1271[ -e rec9num.lz ] || test_failed $LINENO 1272[ ! -e rec10num.lz ] || test_failed $LINENO 1273cat rec*num.lz | cmp "${num_lz}" - || test_failed $LINENO 1274for i in 1 2 3 4 5 6 7 8 9 ; do 1275 "${LZIPRECOVER}" --dump=$i "${num_lz}" | cmp rec${i}num.lz - || 1276 test_failed $LINENO $i 1277 "${LZIPRECOVER}" --strip=^$i "${num_lz}" | cmp rec${i}num.lz - || 1278 test_failed $LINENO $i 1279 cat "${num_lz}" > num.lz || framework_failure 1280 "${LZIPRECOVER}" --remove=^$i num.lz || test_failed $LINENO $i 1281 cmp rec${i}num.lz num.lz || test_failed $LINENO $i 1282done 1283"${LZIPRECOVER}" -q --dump=1 in "${num_lz}" > out 1284[ $? = 2 ] || test_failed $LINENO 1285cmp rec1num.lz out || test_failed $LINENO 1286"${LZIPRECOVER}" -q --strip=^1 in "${num_lz}" > out 1287[ $? = 2 ] || test_failed $LINENO 1288cmp rec1num.lz out || test_failed $LINENO 1289 1290"${LZIPRECOVER}" --dump=r1 "${num_lz}" | cmp rec9num.lz - || 1291 test_failed $LINENO 1292"${LZIPRECOVER}" --dump=d:r3 "${num_lz}" | cmp rec7num.lz - || 1293 test_failed $LINENO 1294"${LZIPRECOVER}" --dump=r5:d "${num_lz}" | cmp rec5num.lz - || 1295 test_failed $LINENO 1296"${LZIPRECOVER}" --dump=t:r9 "${num_lz}" | cmp rec1num.lz - || 1297 test_failed $LINENO 1298"${LZIPRECOVER}" --strip=r^1:t "${num_lz}" | cmp rec9num.lz - || 1299 test_failed $LINENO 1300"${LZIPRECOVER}" --strip=d:r^3:t "${num_lz}" | cmp rec7num.lz - || 1301 test_failed $LINENO 1302"${LZIPRECOVER}" --strip=r^5:d:t "${num_lz}" | cmp rec5num.lz - || 1303 test_failed $LINENO 1304"${LZIPRECOVER}" --strip=d:t:r^9 "${num_lz}" | cmp rec1num.lz - || 1305 test_failed $LINENO 1306 1307"${LZIPRECOVER}" --dump=1,5 "${num_lz}" > out || test_failed $LINENO 1308cat rec1num.lz rec5num.lz | cmp out - || test_failed $LINENO 1309"${LZIPRECOVER}" --dump=3,6 "${num_lz}" > out || test_failed $LINENO 1310cat rec3num.lz rec6num.lz | cmp out - || test_failed $LINENO 1311"${LZIPRECOVER}" --dump=2-4 "${num_lz}" > out || test_failed $LINENO 1312cat rec2num.lz rec3num.lz rec4num.lz | cmp out - || test_failed $LINENO 1313"${LZIPRECOVER}" --dump=4,6,8 "${num_lz}" > out || test_failed $LINENO 1314cat rec4num.lz rec6num.lz rec8num.lz | cmp out - || test_failed $LINENO 1315"${LZIPRECOVER}" --strip=^1,5 "${num_lz}" > out || test_failed $LINENO 1316cat rec1num.lz rec5num.lz | cmp out - || test_failed $LINENO 1317"${LZIPRECOVER}" --strip=^3,6 "${num_lz}" > out || test_failed $LINENO 1318cat rec3num.lz rec6num.lz | cmp out - || test_failed $LINENO 1319"${LZIPRECOVER}" --strip=^2-4 "${num_lz}" > out || test_failed $LINENO 1320cat rec2num.lz rec3num.lz rec4num.lz | cmp out - || test_failed $LINENO 1321"${LZIPRECOVER}" --strip=^4,6,8 "${num_lz}" > out || test_failed $LINENO 1322cat rec4num.lz rec6num.lz rec8num.lz | cmp out - || test_failed $LINENO 1323 1324# create a subset tarlz archive 1325"${LZIPRECOVER}" --dump=1-2:r1:t "${num_lz}" > out || test_failed $LINENO 1326cat rec1num.lz rec2num.lz rec9num.lz | cmp out - || test_failed $LINENO 1327"${LZIPRECOVER}" --dump=4-5:r1:t "${num_lz}" > out || test_failed $LINENO 1328cat rec4num.lz rec5num.lz rec9num.lz | cmp out - || test_failed $LINENO 1329"${LZIPRECOVER}" --dump=7-8:r1:t "${num_lz}" > out || test_failed $LINENO 1330cat rec7num.lz rec8num.lz rec9num.lz | cmp out - || test_failed $LINENO 1331 1332"${LZIPRECOVER}" --dump=1-9 "${num_lz}" | cmp "${num_lz}" - || 1333 test_failed $LINENO 1334"${LZIPRECOVER}" --dump=r1-9 "${num_lz}" | cmp "${num_lz}" - || 1335 test_failed $LINENO 1336"${LZIPRECOVER}" --dump=1-1000 "${num_lz}" | cmp "${num_lz}" - || 1337 test_failed $LINENO 1338"${LZIPRECOVER}" --dump=r1-1000 "${num_lz}" | cmp "${num_lz}" - || 1339 test_failed $LINENO 1340"${LZIPRECOVER}" --dump=1-4:r1-4:5 "${num_lz}" | cmp "${num_lz}" - || 1341 test_failed $LINENO 1342"${LZIPRECOVER}" --dump=^10 "${num_lz}" | cmp "${num_lz}" - || 1343 test_failed $LINENO 1344"${LZIPRECOVER}" --strip=^1-9 "${num_lz}" | cmp "${num_lz}" - || 1345 test_failed $LINENO 1346"${LZIPRECOVER}" --strip=r^1-9 "${num_lz}" | cmp "${num_lz}" - || 1347 test_failed $LINENO 1348"${LZIPRECOVER}" --strip=^1-1000 "${num_lz}" | cmp "${num_lz}" - || 1349 test_failed $LINENO 1350"${LZIPRECOVER}" --strip=r^1-1000 "${num_lz}" | cmp "${num_lz}" - || 1351 test_failed $LINENO 1352"${LZIPRECOVER}" --strip=^1-4:r^1-4:^5 "${num_lz}" | cmp "${num_lz}" - || 1353 test_failed $LINENO 1354"${LZIPRECOVER}" --strip=10 "${num_lz}" | cmp "${num_lz}" - || 1355 test_failed $LINENO 1356 1357"${LZIPRECOVER}" -i --dump=r1 "${nbt_lz}" | cmp rec9num.lz - || 1358 test_failed $LINENO 1359"${LZIPRECOVER}" -i --dump=r3 "${nbt_lz}" | cmp rec7num.lz - || 1360 test_failed $LINENO 1361"${LZIPRECOVER}" -i --dump=r7 "${nbt_lz}" | cmp rec4num.lz - || 1362 test_failed $LINENO 1363"${LZIPRECOVER}" -i --strip=r^1:t "${nbt_lz}" | cmp rec9num.lz - || 1364 test_failed $LINENO 1365"${LZIPRECOVER}" -i --strip=r^3:t "${nbt_lz}" | cmp rec7num.lz - || 1366 test_failed $LINENO 1367"${LZIPRECOVER}" -i --strip=r^7:t "${nbt_lz}" | cmp rec4num.lz - || 1368 test_failed $LINENO 1369 1370"${LZIPRECOVER}" -i --dump=4 -f -o out "${nbt_lz}" || test_failed $LINENO 1371printf "gap" | cmp out - || test_failed $LINENO 1372"${LZIPRECOVER}" -i --dump=8 "${nbt_lz}" > out || test_failed $LINENO 1373printf "damaged" | cmp out - || test_failed $LINENO 1374"${LZIPRECOVER}" -i --dump=tdata "${nbt_lz}" > out || test_failed $LINENO 1375printf "trailing data" | cmp out - || test_failed $LINENO 1376"${LZIPRECOVER}" -i --dump=4:t "${nbt_lz}" > out || test_failed $LINENO 1377printf "gaptrailing data" | cmp out - || test_failed $LINENO 1378"${LZIPRECOVER}" -i --dump=4,8:t "${nbt_lz}" > out || test_failed $LINENO 1379printf "gapdamagedtrailing data" | cmp out - || test_failed $LINENO 1380"${LZIPRECOVER}" -i --dump=4,8 "${nbt_lz}" > out || test_failed $LINENO 1381printf "gapdamaged" | cmp out - || test_failed $LINENO 1382"${LZIPRECOVER}" -i --dump=damaged "${nbt_lz}" > out || test_failed $LINENO 1383printf "gapdamaged" | cmp out - || test_failed $LINENO 1384"${LZIPRECOVER}" -i --dump=d:t "${nbt_lz}" > out || test_failed $LINENO 1385printf "gapdamagedtrailing data" | cmp out - || test_failed $LINENO 1386"${LZIPRECOVER}" -i --strip=^4:t -f -o out "${nbt_lz}" || test_failed $LINENO 1387printf "gap" | cmp out - || test_failed $LINENO 1388"${LZIPRECOVER}" -i --strip=^8:t "${nbt_lz}" > out || test_failed $LINENO 1389printf "damaged" | cmp out - || test_failed $LINENO 1390"${LZIPRECOVER}" -i --strip=1-11 "${nbt_lz}" > out || test_failed $LINENO 1391cmp empty out || test_failed $LINENO 1392"${LZIPRECOVER}" -i --strip=^4 "${nbt_lz}" > out || test_failed $LINENO 1393printf "gaptrailing data" | cmp out - || test_failed $LINENO 1394"${LZIPRECOVER}" -i --strip=^4,8 "${nbt_lz}" > out || test_failed $LINENO 1395printf "gapdamagedtrailing data" | cmp out - || test_failed $LINENO 1396"${LZIPRECOVER}" -i --strip=^4,8:t "${nbt_lz}" > out || test_failed $LINENO 1397printf "gapdamaged" | cmp out - || test_failed $LINENO 1398"${LZIPRECOVER}" -i --strip=r^4,8:t "${nbt_lz}" > out || test_failed $LINENO 1399printf "gapdamaged" | cmp out - || test_failed $LINENO 1400"${LZIPRECOVER}" -i --strip=r^4,8 "${nbt_lz}" > out || test_failed $LINENO 1401printf "gapdamagedtrailing data" | cmp out - || test_failed $LINENO 1402 1403cat "${num_lz}" > num.lz || framework_failure 1404"${LZIPRECOVER}" --remove=1-3,5,7,9 num.lz || test_failed $LINENO 1405cat rec4num.lz rec6num.lz rec8num.lz | cmp num.lz - || test_failed $LINENO 1406cat "${num_lz}" > num.lz || framework_failure 1407"${LZIPRECOVER}" --remove=^4,6,8 num.lz || test_failed $LINENO 1408cat rec4num.lz rec6num.lz rec8num.lz | cmp num.lz - || test_failed $LINENO 1409cat "${num_lz}" > num.lz || framework_failure 1410"${LZIPRECOVER}" --remove=r1,3,5,7-9 num.lz || test_failed $LINENO 1411cat rec4num.lz rec6num.lz rec8num.lz | cmp num.lz - || test_failed $LINENO 1412cat "${num_lz}" > num.lz || framework_failure 1413"${LZIPRECOVER}" --remove=r^2,4,6 num.lz || test_failed $LINENO 1414cat rec4num.lz rec6num.lz rec8num.lz | cmp num.lz - || test_failed $LINENO 1415 1416cat "${nbt_lz}" > nbt.lz || framework_failure 1417"${LZIPRECOVER}" -i --remove=4,8:tdata nbt.lz || test_failed $LINENO 1418cmp "${num_lz}" nbt.lz || test_failed $LINENO 1419cat "${nbt_lz}" > nbt.lz || framework_failure 1420"${LZIPRECOVER}" -i --remove=r4,8:tdata nbt.lz || test_failed $LINENO 1421cmp "${num_lz}" nbt.lz || test_failed $LINENO 1422cat "${nbt_lz}" > nbt.lz || framework_failure 1423"${LZIPRECOVER}" --remove=damaged:tdata nbt.lz || test_failed $LINENO 1424cmp "${num_lz}" nbt.lz || test_failed $LINENO 1425rm -f rec*num.lz nbt.lz empty || framework_failure 1426 1427for i in 1 2 3 4 5 6 7 8 9 10 ; do 1428 "${LZIPRECOVER}" -i --strip=1-$i "${nbt_lz}" > out || 1429 test_failed $LINENO $i 1430 cat "${nbt_lz}" > nbt.lz || framework_failure 1431 "${LZIPRECOVER}" -i --remove=1-$i nbt.lz || test_failed $LINENO $i 1432 cmp nbt.lz out || test_failed $LINENO $i 1433done 1434rm -f nbt.lz out || framework_failure 1435 1436echo 1437if [ ${fail} = 0 ] ; then 1438 echo "tests completed successfully." 1439 cd "${objdir}" && rm -r tmp 1440else 1441 echo "tests failed." 1442fi 1443exit ${fail} 1444