1#!/usr/bin/env bash 2 3. common.bash 4 5ISOSIZE=21000 6REDUNDANCY="-n normal" 7 8MASTERISO=$ISODIR/rs01-master.iso 9MASTERECC=$ISODIR/rs01-master.ecc 10TMPISO=$ISODIR/rs01-tmp.iso 11TMPECC=$ISODIR/rs01-tmp.ecc 12SIMISO=$ISODIR/rs01-sim.iso 13 14CODEC_PREFIX=RS01 15 16# Create master image and ecc file 17 18if ! file_exists $MASTERISO; then 19 echo "$NEWVER --debug -i$MASTERISO --random-image $ISOSIZE" >>$LOGFILE 20 $NEWVER --debug -i$MASTERISO --random-image $ISOSIZE >>$LOGFILE 2>&1 21 echo -e "$FILE_MSG" 22 FILE_MSG="" 23fi 24 25if ! file_exists $MASTERECC; then 26 echo "$NEWVER --debug --set-version $SETVERSION -i$MASTERISO -e$MASTERECC -c $REDUNDANCY" >>$LOGFILE 27 $NEWVER --debug --set-version $SETVERSION -i$MASTERISO -e$MASTERECC -c $REDUNDANCY >>$LOGFILE 2>&1 28 echo -e "$FILE_MSG" 29 FILE_MSG="" 30fi 31 32ISO_PLUS56=$ISODIR/rs01-plus56_bytes.iso 33ECC_PLUS56=$ISODIR/rs01-plus56_bytes.ecc 34if ! file_exists $ISO_PLUS56; then 35 cp $MASTERISO $ISO_PLUS56 36 dd if=/dev/zero of=/tmp/padding count=1 bs=56 >>$LOGFILE 2>&1 37 cat /tmp/padding >>$ISO_PLUS56 38 rm -f /tmp/padding 39 echo -e "$FILE_MSG" 40 FILE_MSG="" 41fi 42 43if ! file_exists $ECC_PLUS56; then 44 $NEWVER --debug --set-version $SETVERSION -i$ISO_PLUS56 -e$ECC_PLUS56 -c $REDUNDANCY >>$LOGFILE 2>&1 45 echo -e "$FILE_MSG" 46 FILE_MSG="" 47fi 48 49### Verification tests 50 51echo "# Verify tests" 52 53# Test good files 54if try "good image" good; then 55 56 run_regtest good "-t" $MASTERISO $MASTERECC 57fi 58 59# Test good files 60if try "good image, quick test" good_quick; then 61 run_regtest good_quick "-tq" $MASTERISO $MASTERECC 62fi 63 64# Test with neither image nor ecc file 65if try "missing files" no_files; then 66 run_regtest no_files "-t" $ISODIR/no.iso $ISODIR/no.ecc 67fi 68 69# Test with missing image, ecc file 70if try "missing image" no_image; then 71 run_regtest no_image "-t" $ISODIR/no.iso $MASTERECC 72fi 73 74# Test with good image, no ecc file 75if try "missing ecc" no_ecc; then 76 run_regtest no_ecc "-t" $MASTERISO $ISODIR/no.ecc 77fi 78 79# Test with missing sectors, no ecc file 80if try "defective image, no ecc" defective_image_no_ecc; then 81 cp $MASTERISO $TMPISO 82 $NEWVER -i$TMPISO --debug --erase 1000-1049 >>$LOGFILE 2>&1 83 $NEWVER -i$TMPISO --debug --erase 11230 >>$LOGFILE 2>&1 84 $NEWVER -i$TMPISO --debug --erase 12450-12457 >>$LOGFILE 2>&1 85 $NEWVER -i$TMPISO --debug --byteset 13444,0,154 >>$LOGFILE 2>&1 86 87 run_regtest defective_image_no_ecc "-t" $TMPISO $ISODIR/no.ecc 88fi 89 90# Test with good image and ecc file, both not multiple of 2048 91if try "image with 56 extra bytes" plus56_bytes; then 92 run_regtest plus56_bytes "-t" $ISO_PLUS56 $ECC_PLUS56 93fi 94 95# Test with good image not multiple of 2048, no ecc file 96if try "image with 56 extra bytes, no ecc" image_plus56_bytes; then 97 run_regtest image_plus56_bytes "-t" $ISO_PLUS56 $ISODIR/no.ecc 98fi 99 100# Test with no image, ecc for image not multiple of 2048 101if try "only ecc for image with 56 extra bytes" ecc_plus56_bytes; then 102 run_regtest ecc_plus56_bytes "-t" $ISODIR/no.iso $ECC_PLUS56 103fi 104 105# Test with normal image, ecc for image not multiple of 2048 106if try "normal image, ecc file plus 56 bytes" normal_image_ecc_plus56b; then 107 run_regtest normal_image_ecc_plus56b "-t" $MASTERISO $ECC_PLUS56 108fi 109 110# Test with image not multiple of 2048, normal ecc file 111if try "image not multiple of 2048, normal ecc file" image_plus56b_normal_ecc; then 112 run_regtest image_plus56b_normal_ecc "-t" $ISO_PLUS56 $MASTERECC 113fi 114 115# Test with image a few bytes shorter than ecc 116if try "image a few bytes shorter then ecc" image_few_bytes_shorter; then 117 118 cp $MASTERISO $TMPISO 119 dd if=/dev/zero of=/tmp/padding count=1 bs=55 >>$LOGFILE 2>&1 120 cat /tmp/padding >>$TMPISO 121 rm -f /tmp/padding 122 123 run_regtest image_few_bytes_shorter "-t" $TMPISO $ECC_PLUS56 124fi 125 126# Test with image a few bytes longer than ecc 127if try "image a few bytes longer then ecc" image_few_bytes_longer; then 128 cp $MASTERISO $TMPISO 129 dd if=/dev/zero of=/tmp/padding count=1 bs=57 >>$LOGFILE 2>&1 130 cat /tmp/padding >>$TMPISO 131 rm -f /tmp/padding 132 133 run_regtest image_few_bytes_longer "-t" $TMPISO $ECC_PLUS56 134fi 135 136# Image is a few bytes shorter (original multiple of 2048) 137if try "image a few bytes truncated" truncated_by_bytes; then 138 dd if=$MASTERISO of=$TMPISO count=1 bs=$((2048*ISOSIZE-7)) >>$LOGFILE 2>&1 139 140 run_regtest truncated_by_bytes "-t" $TMPISO $MASTERECC 141fi 142 143# Image is truncated by 5 sectors 144if try "truncated image" truncated; then 145 cp $MASTERISO $TMPISO 146 NEWSIZE=$((ISOSIZE-5)) 147 $NEWVER -i$TMPISO --debug --truncate=$NEWSIZE >>$LOGFILE 2>&1 148 149 run_regtest truncated "-t" $TMPISO $MASTERECC 150fi 151 152# Image contains 1 extra sector 153if try "image with one extra sector" plus1; then 154 cp $MASTERISO $TMPISO 155 dd if=/dev/zero of=/tmp/padding count=1 bs=2048 >>$LOGFILE 2>&1 156 cat /tmp/padding >>$TMPISO 157 rm -f /tmp/padding 158 159 run_regtest plus1 "-t" $TMPISO $MASTERECC 160fi 161 162# Image contains 17 extra sectors 163if try "image with 17 extra sectors" plus17; then 164 cp $MASTERISO $TMPISO 165 dd if=/dev/zero of=/tmp/padding count=17 bs=2048 >>$LOGFILE 2>&1 166 cat /tmp/padding >>$TMPISO 167 rm -f /tmp/padding 168 169 run_regtest plus17 "-t" $TMPISO $MASTERECC 170fi 171 172# Image contains 2 rows of missing sectors, a single one 173# and a CRC error 174if try "image with missing sectors and crc errors" defective_with_ecc; then 175 cp $MASTERISO $TMPISO 176 $NEWVER -i$TMPISO --debug --erase 1000-1049 >>$LOGFILE 2>&1 177 $NEWVER -i$TMPISO --debug --erase 11230 >>$LOGFILE 2>&1 178 $NEWVER -i$TMPISO --debug --erase 12450-12457 >>$LOGFILE 2>&1 179 $NEWVER -i$TMPISO --debug --byteset 13444,0,154 >>$LOGFILE 2>&1 180 181 run_regtest defective_with_ecc "-t" $TMPISO $MASTERECC 182fi 183 184# Image contains just missing blocks 185if try "image with missing sectors" missing_sectors_with_ecc; then 186 187 cp $MASTERISO $TMPISO 188 $NEWVER -i$TMPISO --debug --erase 1000-1049 >>$LOGFILE 2>&1 189 $NEWVER -i$TMPISO --debug --erase 11230 >>$LOGFILE 2>&1 190 $NEWVER -i$TMPISO --debug --erase 12450-12457 >>$LOGFILE 2>&1 191 192 run_regtest missing_sectors_with_ecc "-t" $TMPISO $MASTERECC 193fi 194 195# Image contains just CRC errors 196if try "image with crc errors" crc_errors_with_ecc; then 197 cp $MASTERISO $TMPISO 198 $NEWVER -i$TMPISO --debug --byteset 13444,0,154 >>$LOGFILE 2>&1 199 200 run_regtest crc_errors_with_ecc "-t" $TMPISO $MASTERECC 201fi 202 203# CRC error in fingerprint sector 204if try "crc in fingerprint sector" crc_in_fingerprint; then 205 cp $MASTERISO $TMPISO 206 $NEWVER -i$TMPISO --debug --byteset 16,201,55 >>$LOGFILE 2>&1 207 208 run_regtest crc_in_fingerprint "-t" $TMPISO $MASTERECC 209fi 210 211# fingerprint sector unreadable 212if try "missing fingerprint sector" missing_fingerprint; then 213 cp $MASTERISO $TMPISO 214 $NEWVER -i$TMPISO --debug --erase 16 >>$LOGFILE 2>&1 215 216 run_regtest missing_fingerprint "-t" $TMPISO $MASTERECC 217fi 218 219# Ecc header is missing 220if try "Ecc header is missing" missing_ecc_header; then 221 cp $MASTERECC $TMPECC 222 $NEWVER --debug -i $TMPECC --erase 0 >>$LOGFILE 2>&1 223 224 run_regtest missing_ecc_header "-t" $MASTERISO $TMPECC 225fi 226 227# Ecc header has checksum error 228 229if try "checksum error in Ecc header" ecc_header_crc_error; then 230 cp $MASTERECC $TMPECC 231 $NEWVER --debug -i $TMPECC --byteset 0,22,107 >>$LOGFILE 2>&1 232 233 run_regtest ecc_header_crc_error "-t" $MASTERISO $TMPECC 234fi 235 236# Test image containing several uncorrectable dead sector markers 237# (sector displacement) 238 239if try "image with uncorrectable dead sector markers" uncorrectable_dsm_in_image; then 240 241 cp $MASTERISO $TMPISO 242 $NEWVER --debug -i$TMPISO --erase 3030 >>$LOGFILE 2>&1 243 $NEWVER --debug -i$TMPISO --byteset 3030,353,49 >>$LOGFILE 2>&1 // displaced from sector 3130 244 $NEWVER --debug -i$TMPISO --erase 4400 >>$LOGFILE 2>&1 245 $NEWVER --debug -i$TMPISO --byteset 4400,353,53 >>$LOGFILE 2>&1 // displaced from sector 4500 246 $NEWVER --debug -i$TMPISO --erase 4411 >>$LOGFILE 2>&1 247 $NEWVER --debug -i$TMPISO --byteset 4411,353,53 >>$LOGFILE 2>&1 // displaced from sector 4511 248 249 run_regtest uncorrectable_dsm_in_image "-t" $TMPISO $MASTERECC 250fi 251 252# Test image containing several uncorrectable dead sector markers, verbose output 253 254if try "image with uncorrectable dead sector markers, verbose output" uncorrectable_dsm_in_image_verbose; then 255 256 cp $MASTERISO $TMPISO 257 $NEWVER --debug -i$TMPISO --erase 3030 >>$LOGFILE 2>&1 258 $NEWVER --debug -i$TMPISO --byteset 3030,353,49 >>$LOGFILE 2>&1 // displaced from sector 3130 259 $NEWVER --debug -i$TMPISO --erase 4400 >>$LOGFILE 2>&1 260 $NEWVER --debug -i$TMPISO --byteset 4400,353,53 >>$LOGFILE 2>&1 // displaced from sector 4500 261 $NEWVER --debug -i$TMPISO --erase 4411 >>$LOGFILE 2>&1 262 $NEWVER --debug -i$TMPISO --byteset 4411,353,53 >>$LOGFILE 2>&1 // displaced from sector 4511 263 264 run_regtest uncorrectable_dsm_in_image_verbose "-t -v" $TMPISO $MASTERECC 265fi 266 267# Testimage containing several uncorrectable dead sector markers 268# (non matching fingerprint) 269 270if try "image with uncorrectable dead sector markers (2)" uncorrectable_dsm_in_image2; then 271 272 cp $MASTERISO $TMPISO 273 $NEWVER --debug -i$TMPISO --erase 3030 >>$LOGFILE 2>&1 274 $NEWVER --debug -i$TMPISO --byteset 3030,416,55 >>$LOGFILE 2>&1 // wrong fingerprint 275 $NEWVER --debug -i$TMPISO --byteset 3030,556,32 >>$LOGFILE 2>&1 // changed label 276 $NEWVER --debug -i$TMPISO --byteset 3030,557,50 >>$LOGFILE 2>&1 // changed label 277 $NEWVER --debug -i$TMPISO --erase 4400 >>$LOGFILE 2>&1 278 $NEWVER --debug -i$TMPISO --byteset 4400,416,53 >>$LOGFILE 2>&1 // wrong fingerprint 279 $NEWVER --debug -i$TMPISO --byteset 4400,556,32 >>$LOGFILE 2>&1 // changed label 280 $NEWVER --debug -i$TMPISO --byteset 4400,557,50 >>$LOGFILE 2>&1 // changed label 281 $NEWVER --debug -i$TMPISO --erase 4411 >>$LOGFILE 2>&1 282 $NEWVER --debug -i$TMPISO --byteset 4411,416,53 >>$LOGFILE 2>&1 // wrong fingerprint 283 $NEWVER --debug -i$TMPISO --byteset 4411,556,32 >>$LOGFILE 2>&1 // changed label 284 $NEWVER --debug -i$TMPISO --byteset 4411,557,50 >>$LOGFILE 2>&1 // changed label 285 286 run_regtest uncorrectable_dsm_in_image2 "-t" $TMPISO $MASTERECC 287fi 288 289# Test image containing several uncorrectable dead sector markers, verbose 290# (non matching fingerprint) 291 292if try "image with uncorrectable dead sector markers (2), verbose output" uncorrectable_dsm_in_image2_verbose; then 293 294 cp $MASTERISO $TMPISO 295 $NEWVER --debug -i$TMPISO --erase 3030 >>$LOGFILE 2>&1 296 $NEWVER --debug -i$TMPISO --byteset 3030,416,55 >>$LOGFILE 2>&1 // wrong fingerprint 297 $NEWVER --debug -i$TMPISO --byteset 3030,556,32 >>$LOGFILE 2>&1 // changed label 298 $NEWVER --debug -i$TMPISO --byteset 3030,557,50 >>$LOGFILE 2>&1 // changed label 299 $NEWVER --debug -i$TMPISO --erase 4400 >>$LOGFILE 2>&1 300 $NEWVER --debug -i$TMPISO --byteset 4400,416,53 >>$LOGFILE 2>&1 // wrong fingerprint 301 $NEWVER --debug -i$TMPISO --byteset 4400,556,32 >>$LOGFILE 2>&1 // changed label 302 $NEWVER --debug -i$TMPISO --byteset 4400,557,50 >>$LOGFILE 2>&1 // changed label 303 $NEWVER --debug -i$TMPISO --erase 4411 >>$LOGFILE 2>&1 304 $NEWVER --debug -i$TMPISO --byteset 4411,416,53 >>$LOGFILE 2>&1 // wrong fingerprint 305 $NEWVER --debug -i$TMPISO --byteset 4411,556,32 >>$LOGFILE 2>&1 // changed label 306 $NEWVER --debug -i$TMPISO --byteset 4411,557,50 >>$LOGFILE 2>&1 // changed label 307 308 run_regtest uncorrectable_dsm_in_image2_verbose "-t -v" $TMPISO $MASTERECC 309fi 310 311### Creation tests 312 313echo "# Creation tests" 314 315# Create ecc file 316if try "ecc file creation" ecc_create; then 317 318 extra_args="--debug --set-version $SETVERSION" 319 run_regtest ecc_create "-c $REDUNDANCY" $MASTERISO $TMPECC 320fi 321 322# Create with missing image 323if try "ecc creating with missing image" ecc_missing_image; then 324 NO_FILE=$ISODIR/none.iso 325 326 run_regtest ecc_missing_image "-c $REDUNDANCY" $NO_FILE $TMPECC 327fi 328 329# Create with no read permission on image 330if try "ecc creating with no read permission" ecc_no_read_perm; then 331 cp $MASTERISO $TMPISO 332 chmod 000 $TMPISO 333 334 run_regtest ecc_no_read_perm "-c $REDUNDANCY" $TMPISO $TMPECC 335 rm -f $TMPISO 336fi 337 338# Create with no write permission on ecc file 339# Should not do any harm at all: Ecc file will 340# be recreated with write permissions 341if try "ecc creating with no write permission" ecc_no_write_perm; then 342 touch $TMPECC 343 chmod 400 $TMPECC 344 345 extra_args="--debug --set-version $SETVERSION" 346 run_regtest ecc_no_write_perm "-c $REDUNDANCY" $MASTERISO $TMPECC 347fi 348 349# Create with image size not being a multiple of 2048 350 351if try "ecc file creation with image not multiple of 2048" ecc_create_plus56; then 352 353 extra_args="--debug --set-version $SETVERSION" 354 run_regtest ecc_create_plus56 "-c $REDUNDANCY" $ISO_PLUS56 $TMPECC 355fi 356 357# Create test image with unreadable sectors 358if try "ecc creating with unreadable sectors" ecc_missing_sectors; then 359 cp $MASTERISO $TMPISO 360 $NEWVER -i$TMPISO --debug --erase 1000-1049 >>$LOGFILE 2>&1 361 $NEWVER -i$TMPISO --debug --erase 11230 >>$LOGFILE 2>&1 362 $NEWVER -i$TMPISO --debug --erase 12450-12457 >>$LOGFILE 2>&1 363 364 run_regtest ecc_missing_sectors "-c $REDUNDANCY" $TMPISO $TMPECC 365fi 366 367# Read image and create ecc in the same program call. 368# Tests whether CRC and ECC information is handed over correctly. 369# NOTE: cache handling is currently disabled and will be fixed in 0.79.6! 370 371if try "read image and create ecc in one call" ecc_create_after_read; then 372 cp $MASTERISO $SIMISO 373 374 rm -f $TMPISO $TMPECC 375 replace_config read-and-create 1 376 extra_args="--debug --set-version $SETVERSION --sim-cd=$SIMISO --fixed-speed-values" 377 run_regtest ecc_create_after_read "-r -c $REDUNDANCY --spinup-delay=0" $TMPISO $TMPECC 378fi 379 380# Read image with ecc file and create new (other) ecc in the same program call. 381# Tests whether CRC and ECC information is handed over correctly. 382# NOTE: cache handling is currently disabled and will be fixed in 0.79.6! 383 384if try "read image with ecc (RS01) and create new ecc" ecc_recreate_after_read_rs01; then 385 cp $MASTERISO $SIMISO 386 387 $NEWVER --debug --set-version $SETVERSION -i$SIMISO -e$TMPECC -c -n 8 >>$LOGFILE 2>&1 388 389 rm -f $TMPISO 390 extra_args="--debug --set-version $SETVERSION --sim-cd=$SIMISO --fixed-speed-values" 391 run_regtest ecc_recreate_after_read_rs01 "-r -c $REDUNDANCY --spinup-delay=0" $TMPISO $TMPECC 392fi 393 394# Read image with ecc file and create new (other) ecc in the same program call. 395# Tests whether CRC and ECC information is handed over correctly. 396# Note: RS02 information will not be removed from the image. This ist intentional behaviour. 397# NOTE: cache handling is currently disabled and will be fixed in 0.79.6! 398 399if try "read image with ecc (RS02) and create additional ecc file" ecc_recreate_after_read_rs02; then 400 cp $MASTERISO $SIMISO 401 402 $NEWVER --debug --set-version $SETVERSION -i$SIMISO -c -mRS02 -n$((ISOSIZE+6000)) >>$LOGFILE 2>&1 403 404 rm -f $TMPISO $TMPECC 405 extra_args="--debug --set-version $SETVERSION --sim-cd=$SIMISO --fixed-speed-values" 406 run_regtest ecc_recreate_after_read_rs02 "-r -c $REDUNDANCY --spinup-delay=0" $TMPISO $TMPECC 407fi 408 409# Read image with ecc file and create new (other) ecc in the same program call. 410# Tests whether CRC and ECC information is handed over correctly. 411# Note: RS03 information will not be removed from the image. This ist intentional behaviour. 412# NOTE: cache handling is currently disabled and will be fixed in 0.79.6! 413 414if try "read image with ecc (RS03i) and create additional ecc file" ecc_recreate_after_read_rs03i; then 415 cp $MASTERISO $SIMISO 416 417 $NEWVER --debug --set-version $SETVERSION -i$SIMISO -c -mRS03 -n$((ISOSIZE+6000)) >>$LOGFILE 2>&1 418 419 rm -f $TMPISO $TMPECC 420 extra_args="--debug --set-version $SETVERSION --sim-cd=$SIMISO --fixed-speed-values" 421 run_regtest ecc_recreate_after_read_rs03i "-r -c $REDUNDANCY --spinup-delay=0" $TMPISO $TMPECC 422fi 423 424# Read image with ecc file and create new (other) ecc in the same program call. 425# Tests whether CRC and ECC information is handed over correctly. 426# NOTE: cache handling is currently disabled and will be fixed in 0.79.6! 427 428if try "read image with ecc (RS03f) and create new ecc" ecc_recreate_after_read_rs03f; then 429 cp $MASTERISO $SIMISO 430 431 $NEWVER --debug --set-version $SETVERSION -i$SIMISO -e$TMPECC -c -n 8 -mRS03 -o file >>$LOGFILE 2>&1 432 433 rm -f $TMPISO 434 extra_args="--debug --set-version $SETVERSION --sim-cd=$SIMISO --fixed-speed-values" 435 run_regtest ecc_recreate_after_read_rs03f "-r -c $REDUNDANCY --spinup-delay=0" $TMPISO $TMPECC 436fi 437 438# Complete image in a reading pass, then create an ecc file for it. 439# Cached checksums must be discarded before creating the ecc. 440 441if try "create ecc after completing partial image" ecc_create_after_partial_read; then 442 cp $MASTERISO $SIMISO 443 cp $MASTERISO $TMPISO 444 445 $NEWVER --debug -i$TMPISO --erase 1000-1500 >>$LOGFILE 2>&1 446 447 rm -f $TMPECC 448 extra_args="--debug --set-version $SETVERSION --sim-cd=$SIMISO --fixed-speed-values" 449 run_regtest ecc_create_after_partial_read "-r -c $REDUNDANCY --spinup-delay=0" $TMPISO $TMPECC 450fi 451 452### Fixing tests 453 454echo "# Repair tests" 455 456# Fix good image 457 458if try "fixing good image" fix_good; then 459 460 cp $MASTERISO $TMPISO 461 run_regtest fix_good "-f" $TMPISO $MASTERECC 462fi 463 464# Fix image without read permission 465 466if try "fixing image without read permission" fix_no_read_perm; then 467 468 cp $MASTERISO $TMPISO 469 chmod 000 $TMPISO 470 471 run_regtest fix_no_read_perm "-f" $TMPISO $MASTERECC 472 rm -f $TMPISO 473fi 474 475# Fix image without read permission for ecc 476 477if try "fixing image without read permission for ecc" fix_no_read_perm_ecc; then 478 479 cp $MASTERISO $TMPISO 480 cp $MASTERECC $TMPECC 481 chmod 000 $TMPECC 482 483 run_regtest fix_no_read_perm_ecc "-f" $TMPISO $TMPECC 484 rm -f $TMPECC 485fi 486 487# Fix good image not multiple of 2048 488 489if try "fixing good image not multiple of 2048" fix_good_plus56; then 490 cp $ISO_PLUS56 $TMPISO 491 492 run_regtest fix_plus56_bytes "-f" $TMPISO $ECC_PLUS56 493fi 494 495# Fix image without write permission 496 497if try "fixing image without write permission" fix_no_write_perm; then 498 499 cp $MASTERISO $TMPISO 500 chmod 400 $TMPISO 501 502 run_regtest fix_no_write_perm "-f" $TMPISO $MASTERECC 503 rm -f $TMPISO 504fi 505 506# Fix image with missing sectors 507 508if try "fixing image with missing sectors" fix_missing_sectors; then 509 cp $MASTERISO $TMPISO 510 $NEWVER -i$TMPISO --debug --erase 0 >>$LOGFILE 2>&1 511 $NEWVER -i$TMPISO --debug --erase 190 >>$LOGFILE 2>&1 512 $NEWVER -i$TMPISO --debug --erase 192 >>$LOGFILE 2>&1 513 $NEWVER -i$TMPISO --debug --erase 590-649 >>$LOGFILE 2>&1 514 $NEWVER -i$TMPISO --debug --erase 2000-2139 >>$LOGFILE 2>&1 515 $NEWVER -i$TMPISO --debug --erase 2141-2176 >>$LOGFILE 2>&1 516 $NEWVER -i$TMPISO --debug --erase $((ISOSIZE-1)) >>$LOGFILE 2>&1 517 518 run_regtest fix_missing_sectors "-f" $TMPISO $MASTERECC 519 520fi 521 522# Fix image with CRC errors 523 524if try "fixing image with crc errors" fix_crc_errors; then 525 cp $MASTERISO $TMPISO 526 $NEWVER -i$TMPISO --debug --byteset 0,1,1 >>$LOGFILE 2>&1 527 $NEWVER -i$TMPISO --debug --byteset 190,200,143 >>$LOGFILE 2>&1 528 $NEWVER -i$TMPISO --debug --byteset 1200,100,1 >>$LOGFILE 2>&1 529 $NEWVER -i$TMPISO --debug --byteset 1201,100,1 >>$LOGFILE 2>&1 530 $NEWVER -i$TMPISO --debug --byteset $((ISOSIZE-1)),500,91 >>$LOGFILE 2>&1 531 532 run_regtest fix_crc_errors "-f" $TMPISO $MASTERECC 533fi 534 535# Fix image with additional sectors (TAO case) 536 537if try "fixing image with one additional sector" fix_additional_sector; then 538 cp $MASTERISO $TMPISO 539 dd if=/dev/zero of=/tmp/padding count=1 bs=2048 >>$LOGFILE 2>&1 540 cat /tmp/padding >>$TMPISO 541 rm -f /tmp/padding 542 543 run_regtest fix_additional_sector "-f" $TMPISO $MASTERECC 544fi 545 546# Fix image with additional sectors (general case) 547 548if try "fixing image with 17 additional sectors" fix_plus17; then 549 cp $MASTERISO $TMPISO 550 dd if=/dev/zero of=/tmp/padding count=17 bs=2048 >>$LOGFILE 2>&1 551 cat /tmp/padding >>$TMPISO 552 rm -f /tmp/padding 553 554 run_regtest fix_plus17 "-f" $TMPISO $MASTERECC 555fi 556 557# Fix image with additional sectors (general case), with --truncate 558 559if try "fixing image with 17 additional sectors with --truncate" fix_plus17_truncate; then 560 cp $MASTERISO $TMPISO 561 dd if=/dev/zero of=/tmp/padding count=17 bs=2048 >>$LOGFILE 2>&1 562 cat /tmp/padding >>$TMPISO 563 rm -f /tmp/padding 564 565 run_regtest fix_plus17_truncate "-f --truncate" $TMPISO $MASTERECC 566fi 567 568# Fix image+56bytes 569 570if try "fixing image with CRC error in 56 additional bytes" fix_plus56; then 571 cp $ISO_PLUS56 $TMPISO 572 $NEWVER -i$TMPISO --debug --byteset 21000,28,90 >>$LOGFILE 2>&1 573 run_regtest fix_plus56 "-f" $TMPISO $ECC_PLUS56 574fi 575 576# Fix image+56bytes+more bytes 577 578if try "fixing image with CRC error in 56 additional bytes + few bytes more" fix_plus56_plus17; then 579 cp $ISO_PLUS56 $TMPISO 580 echo "0123456789abcdef" >>$TMPISO 581 $NEWVER -i$TMPISO --debug --byteset 21000,55,90 >>$LOGFILE 2>&1 582 583 run_regtest fix_plus56_plus17 "-f --truncate" $TMPISO $ECC_PLUS56 584fi 585 586# Fix image+56bytes+1 sector 587 588if try "fixing image with CRC error in 56 additional bytes + one sector more" fix_plus56_plus1s; then 589 cp $ISO_PLUS56 $TMPISO 590 dd if=/dev/zero of=/tmp/padding count=1 bs=2048 >>$LOGFILE 2>&1 591 cat /tmp/padding >>$TMPISO 592 $NEWVER -i$TMPISO --debug --byteset 21000,55,90 >>$LOGFILE 2>&1 593 594 run_regtest fix_plus56_plus1s "-f --truncate" $TMPISO $ECC_PLUS56 595fi 596 597# Fix image+56bytes+2 sectors 598 599if try "fixing image with CRC error in 56 additional bytes + two sectors more" fix_plus56_plus2s; then 600 cp $ISO_PLUS56 $TMPISO 601 dd if=/dev/zero of=/tmp/padding count=1 bs=4096 >>$LOGFILE 2>&1 602 cat /tmp/padding >>$TMPISO 603 $NEWVER -i$TMPISO --debug --byteset 21000,55,90 >>$LOGFILE 2>&1 604 605 run_regtest fix_plus56_plus2s "-f --truncate" $TMPISO $ECC_PLUS56 606fi 607 608# Fix image+56bytes+more sectors 609 610if try "fixing image with CRC error in 56 additional bytes + more sectors" fix_plus56_plus17500; then 611 cp $ISO_PLUS56 $TMPISO 612 dd if=/dev/zero of=/tmp/padding count=1 bs=17500 >>$LOGFILE 2>&1 613 cat /tmp/padding >>$TMPISO 614 $NEWVER -i$TMPISO --debug --byteset 21000,55,90 >>$LOGFILE 2>&1 615 616 run_regtest fix_plus56_plus17500 "-f --truncate" $TMPISO $ECC_PLUS56 617fi 618 619# Fix truncated image 620 621if try "fixing truncated image" fix_truncated; then 622 cp $MASTERISO $TMPISO 623 $NEWVER -i$TMPISO --debug --truncate=20731 >>$LOGFILE 2>&1 624 run_regtest fix_truncated "-f" $TMPISO $MASTERECC 625fi 626 627# Fix truncated image not a multiple of 2048 628 629if try "fixing truncated image not a multiple of 2048" fix_plus56_truncated; then 630 cp $ISO_PLUS56 $TMPISO 631 $NEWVER -i$TMPISO --debug --truncate=20972 >>$LOGFILE 2>&1 632 run_regtest fix_plus56_truncated "-f" $TMPISO $ECC_PLUS56 633fi 634 635# Fix truncated image not a multiple of 2048 and a few bytes shorter 636 637if try "fixing image not a multiple of 2048 missing a few bytes" fix_plus56_little_truncated; then 638 cp $MASTERISO $TMPISO 639 dd if=/dev/zero of=/tmp/padding count=1 bs=50 >>$LOGFILE 2>&1 640 cat /tmp/padding >>$TMPISO 641 rm -f /tmp/padding 642 643 run_regtest fix_plus56_little_truncated "-f" $TMPISO $ECC_PLUS56 644fi 645 646### Scanning tests 647 648echo "# Scanning tests" 649 650# Scan image without error correction data available 651 652if try "scanning image, no ecc data" scan_no_ecc; then 653 654 extra_args="--debug -d sim-cd --sim-cd=$MASTERISO --fixed-speed-values" 655 run_regtest scan_no_ecc "--spinup-delay=0 -s" $ISODIR/no.iso $ISODIR/no.ecc 656fi 657 658# Scan image from non-existant device 659# not applicable to GUI mode since drives are discovered differently there 660 661if try "scanning image, device not existant" scan_no_device; then 662 663 extra_args="--debug -d /dev/sdz --sim-cd=$MASTERISO --fixed-speed-values" 664 run_regtest scan_no_device "--spinup-delay=0 -s" $ISODIR/no.iso $ISODIR/no.ecc 665fi 666 667# Scan image from device with insufficient permissions 668# not applicable to GUI mode since drives are discovered differently there 669 670if try "scanning image, device access denied" scan_no_device_access; then 671 672 touch $ISODIR/sdz 673 chmod 000 $ISODIR/sdz 674 675 run_regtest scan_no_device_access "--debug --sim-cd=$MASTERISO --fixed-speed-values --spinup-delay=0 -d $ISODIR/sdz -s" $ISODIR/no.iso $ISODIR/no.ecc 676 rm -f $ISODIR/sdz 677fi 678 679# Scan image from defective media without error correction data available 680# Will report more missing sectors than the original due to the 16 sector skip default 681 682if try "scanning image, defective media, no ecc data" scan_defective_no_ecc; then 683 684 cp $MASTERISO $SIMISO 685 $NEWVER --debug -i$SIMISO --erase 100-200 >>$LOGFILE 2>&1 686 $NEWVER --debug -i$SIMISO --erase 766 >>$LOGFILE 2>&1 687 $NEWVER --debug -i$SIMISO --erase 2410 >>$LOGFILE 2>&1 688 689 extra_args="--debug --sim-cd=$SIMISO --fixed-speed-values" 690 run_regtest scan_defective_no_ecc "--spinup-delay=0 -s" $ISODIR/no.iso $ISODIR/no.ecc 691fi 692 693# Scan image from above test again, this time with a 1 sector skip size 694# Will report an exact error count of the (damaged) original 695 696if try "scanning image, defective media, no ecc data, reading w/ 1 sec step" scan_defective_no_ecc_again; then 697 698 cp $MASTERISO $SIMISO 699 $NEWVER --debug -i$SIMISO --erase 100-200 >>$LOGFILE 2>&1 700 $NEWVER --debug -i$SIMISO --erase 766 >>$LOGFILE 2>&1 701 $NEWVER --debug -i$SIMISO --erase 2410 >>$LOGFILE 2>&1 702 703 replace_config jump 0 704 extra_args="--debug --sim-cd=$SIMISO --fixed-speed-values" 705 run_regtest scan_defective_no_ecc_again "--spinup-delay=0 -j 1 -s" $ISODIR/no.iso $ISODIR/no.ecc 706fi 707 708# Scan image from defective media without error correction data available 709# using a large sector skip of 256 710 711if try "scanning image, defective media, large sector skip" scan_defective_large_skip; then 712 713 cp $MASTERISO $SIMISO 714 $NEWVER --debug -i$SIMISO --erase 1600-1615 >>$LOGFILE 2>&1 715 $NEWVER --debug -i$SIMISO --erase 6400-10000 >>$LOGFILE 2>&1 716 717 replace_config jump 256 718 extra_args="--debug --sim-cd=$SIMISO --fixed-speed-values" 719 run_regtest scan_defective_large_skip "--spinup-delay=0 -s -j 256" $ISODIR/no.iso $ISODIR/no.ecc 720fi 721 722# Scan a new image, but only for a partial range. 723# range 10000-15000 must be entered manually in the GUI; 724# there is no way for pre-configuring it 725 726if try "scanning new image with given range, no ecc data" scan_new_with_range_no_ecc; then 727 728 cp $MASTERISO $SIMISO 729 730 extra_args="--debug --sim-cd=$SIMISO --fixed-speed-values" 731 run_regtest scan_new_with_range_no_ecc "--spinup-delay=0 -s10000-15000" $ISODIR/no.iso $ISODIR/no.ecc 732fi 733 734# Scan a new image, but only for an invalid range. 735# Makes no sense in GUI mode (invalid value can not be entered) 736 737if try "scanning new image with invalid range, no ecc data" scan_new_with_invalid_range_no_ecc; then 738 739 cp $MASTERISO $SIMISO 740 741 run_regtest scan_new_with_invalid_range_no_ecc "--debug --sim-cd=$SIMISO --fixed-speed-values --spinup-delay=0 -s10000-55000" $ISODIR/no.iso $ISODIR/no.ecc 742fi 743 744# Scan image with error correction data available 745 746if try "scanning image, ecc data" scan_with_ecc; then 747 748 extra_args="--debug --sim-cd=$MASTERISO --fixed-speed-values" 749 run_regtest scan_with_ecc "--spinup-delay=0 -s" $ISODIR/no.iso $MASTERECC 750fi 751 752# Scan image with non existing error correction file given 753# Please note that this fact will be silently ignored; e.g. the image 754# will be scanned as if no ecc file was given at all. 755 756if try "scanning image, ecc file does not exist" scan_with_non_existing_ecc; then 757 758 extra_args="--debug --sim-cd=$MASTERISO --fixed-speed-values" 759 run_regtest scan_with_non_existing_ecc "--spinup-delay=0 -s" $ISODIR/no.iso $ISODIR/no_ecc 760fi 761 762# Scan image with non accessible error correction file given 763# Please note that this fact will be silently ignored; e.g. the image 764# will be scanned as if no ecc file was given at all. 765 766if try "scanning image, no permission to access ecc file" scan_with_no_permission_for_ecc; then 767 cp $MASTERECC $TMPECC 768 chmod 000 $TMPECC 769 770 extra_args="--debug --sim-cd=$MASTERISO --fixed-speed-values" 771 run_regtest scan_with_no_permission_for_ecc "--spinup-delay=0 -s" $ISODIR/no.iso $TMPECC 772 rm -f $TMPECC 773fi 774 775# Scan image with error correction data available 776# and CRC errors 777 778if try "scanning image, crc errors, ecc data" scan_crc_errors_with_ecc; then 779 780 cp $MASTERISO $SIMISO 781 $NEWVER --debug -i$SIMISO --byteset 0,100,255 >>$LOGFILE 2>&1 782 $NEWVER --debug -i$SIMISO --byteset 1,180,200 >>$LOGFILE 2>&1 783 $NEWVER --debug -i$SIMISO --byteset 7910,23,98 >>$LOGFILE 2>&1 784 $NEWVER --debug -i$SIMISO --byteset 20999,55,123 >>$LOGFILE 2>&1 785 786 extra_args="--debug --sim-cd=$SIMISO --fixed-speed-values" 787 run_regtest scan_crc_errors_with_ecc "--spinup-delay=0 -s" $ISODIR/no.iso $MASTERECC 788fi 789 790# Scan image with error correction data available 791# which is a few sectors shorter than expected. 792 793if try "scanning image, less sectors than expected, ecc data" scan_shorter_with_ecc; then 794 795 cp $MASTERISO $SIMISO 796 $NEWVER --debug -i$SIMISO --truncate=$((ISOSIZE-44)) >>$LOGFILE 2>&1 797 798 replace_config ignore-iso-size 1 799 extra_args="--debug --sim-cd=$SIMISO --fixed-speed-values" 800 run_regtest scan_shorter_with_ecc "--ignore-iso-size --spinup-delay=0 -s" $ISODIR/no.iso $MASTERECC 801fi 802 803# Scan image with error correction data available 804# which is a few sectors longer than expected. 805 806if try "scanning image, more sectors than expected, ecc data" scan_longer_with_ecc; then 807 808 cp $MASTERISO $SIMISO 809 for i in $(seq 22); do cat fixed-random-sequence >>$SIMISO; done 810 811 replace_config ignore-iso-size 1 812 extra_args="--debug --sim-cd=$SIMISO --fixed-speed-values" 813 run_regtest scan_longer_with_ecc "--ignore-iso-size --spinup-delay=0 -s" $ISODIR/no.iso $MASTERECC 814fi 815 816# Scan image with error correction data available 817# simulating the multisession case with two additional defective sectors trailing the medium 818 819if try "scanning image, tao tail case, ecc data" scan_tao_tail_with_ecc; then 820 821 cp $MASTERISO $SIMISO 822 cat fixed-random-sequence >>$SIMISO 823 $NEWVER --debug -i$SIMISO --erase 21000-21001 >>$LOGFILE 2>&1 824 825 replace_config ignore-iso-size 1 826 extra_args="--debug --sim-cd=$SIMISO --fixed-speed-values" 827 run_regtest scan_tao_tail_with_ecc "--ignore-iso-size --spinup-delay=0 -s" $ISODIR/no.iso $MASTERECC 828fi 829 830# Scan image with error correction data available 831# with two defective sectors at the end and the --dao option 832 833if try "scanning image, tao tail case and --dao, ecc data" scan_no_tao_tail_with_ecc; then 834 835 cp $MASTERISO $SIMISO 836 $NEWVER --debug -i$SIMISO --erase 20998-20999 >>$LOGFILE 2>&1 837 838 replace_config dao 1 839 extra_args="--debug --sim-cd=$SIMISO --fixed-speed-values" 840 run_regtest scan_no_tao_tail_with_ecc "--dao --spinup-delay=0 -s" $ISODIR/no.iso $MASTERECC 841fi 842 843# Scan image with error correction data available 844# and more than two defective sectors at the end 845 846if try "scanning image, more than 2 sectors missing at end, ecc data" scan_more_missing_at_end_with_ecc; then 847 848 cp $MASTERISO $SIMISO 849 $NEWVER --debug -i$SIMISO --erase 20954-20999 >>$LOGFILE 2>&1 850 851 extra_args="--debug --sim-cd=$SIMISO --fixed-speed-values" 852 run_regtest scan_more_missing_at_end_with_ecc "--spinup-delay=0 -s" $ISODIR/no.iso $MASTERECC 853fi 854 855# Scan an augmented image for which an ecc file is also available. 856# In that case, the ecc file gets precedence over the embedded ecc. 857# To make sure the RS01 data is used we introduce a CRC error in the RS02 858# ecc area - this can only be detected by the "outer" RS01 CRC. 859 860if try "scanning image with RS02 data and a RS01 ecc file" scan_with_double_ecc; then 861 862 cp $MASTERISO $SIMISO 863 $NEWVER --debug --set-version $SETVERSION -i$SIMISO -mRS02 -n$((ISOSIZE+5000)) -c >>$LOGFILE 2>&1 864 $NEWVER --debug --set-version $SETVERSION -i$SIMISO -e $TMPECC -c $REDUNDANCY >>$LOGFILE 2>&1 865 $NEWVER --debug -i$SIMISO --byteset 25910,100,200 >>$LOGFILE 2>&1 866 867 extra_args="--debug --sim-cd=$SIMISO --fixed-speed-values" 868 run_regtest scan_with_double_ecc "--spinup-delay=0 -s" $ISODIR/no.iso $TMPECC 869fi 870 871# Scan an image for which ecc information is available, 872# but requiring a newer dvdisaster version. 873 874if try "scanning image ecc file requiring a newer dvdisaster version" scan_with_incompatible_ecc; then 875 876 cp $MASTERISO $SIMISO 877 $NEWVER --debug --set-version $SETVERSION -i$SIMISO -e $TMPECC -c $REDUNDANCY >>$LOGFILE 2>&1 878 $NEWVER --debug -i$TMPECC --byteset 0,88,220 >>$LOGFILE 2>&1 879 $NEWVER --debug -i$TMPECC --byteset 0,89,65 >>$LOGFILE 2>&1 880 $NEWVER --debug -i$TMPECC --byteset 0,90,15 >>$LOGFILE 2>&1 881 882 extra_args="--debug --sim-cd=$SIMISO --fixed-speed-values" 883 run_regtest scan_with_incompatible_ecc "--spinup-delay=0 -s" $ISODIR/no.iso $TMPECC 884fi 885 886# Scan an image with a simulated hardware failure and 887# --ignore-fatal-sense not set. 888 889if try "scanning image with simulated hardware failure" scan_with_hardware_failure; then 890 891 cp $MASTERISO $SIMISO 892 $NEWVER --debug -i$SIMISO --erase "5000:hardware failure" >>$LOGFILE 2>&1 893 894 extra_args="--debug --sim-cd=$SIMISO --fixed-speed-values" 895 run_regtest scan_with_hardware_failure "--spinup-delay=0 -s" $ISODIR/no.iso $ISODIR/no.ecc 896fi 897 898# Scan an image with a simulated hardware failure and 899# --ignore-fatal-sense being set. 900 901if try "scanning image, ignoring simulated hardware failure" scan_with_ignored_hardware_failure; then 902 903 cp $MASTERISO $SIMISO 904 $NEWVER --debug -i$SIMISO --erase "5000:hardware failure" >>$LOGFILE 2>&1 905 906 replace_config ignore-fatal-sense 1 907 extra_args="--debug --sim-cd=$SIMISO --fixed-speed-values" 908 run_regtest scan_with_ignored_hardware_failure "--spinup-delay=0 -s --ignore-fatal-sense" $ISODIR/no.iso $ISODIR/no.ecc 909fi 910 911# Scan medium containing dead sector markers 912 913if try "scanning medium containing dead sector markers" scan_medium_with_dsm; then 914 915 cp $MASTERISO $SIMISO 916 $NEWVER --debug -i$SIMISO --erase "4999:pass as dead sector marker" >>$LOGFILE 2>&1 917 918 extra_args="--debug --sim-cd=$SIMISO --fixed-speed-values" 919 run_regtest scan_medium_with_dsm "--spinup-delay=0 -s" $ISODIR/no.iso $ISODIR/no.ecc 920fi 921 922### Reading tests (linear) 923 924echo "# Reading tests (linear)" 925 926# Read image without error correction data available 927 928if try "reading image, no ecc data" read_no_ecc; then 929 930 rm -f $TMPISO 931 extra_args="--debug --sim-cd=$MASTERISO --fixed-speed-values" 932 run_regtest read_no_ecc "--spinup-delay=0 -r" $TMPISO $ISODIR/no.ecc 933fi 934 935# Read into existing and complete image file 936 937if try "reading good image in good file" read_no_ecc_good_file; then 938 cp $MASTERISO $SIMISO 939 cp $MASTERISO $TMPISO 940 941 extra_args="--debug --sim-cd=$SIMISO --fixed-speed-values" 942 run_regtest read_no_ecc_good_file "--spinup-delay=0 -r" $TMPISO 943fi 944 945# Read image from non-existant device 946# Makes no sense in GUI mode. 947 948if try "reading image, device not existant" read_no_device; then 949 950 rm -f $TMPISO 951 run_regtest read_no_device "--debug --sim-cd=$MASTERISO --fixed-speed-values --spinup-delay=0 -d /dev/sdz -r" $TMPISO $ISODIR/no.ecc 952fi 953 954# Read image from device with insufficient permissions 955# not applicable to GUI mode since drives are discovered differently there 956 957if try "reading image, device access denied" read_no_device_access; then 958 959 touch $ISODIR/sdz 960 chmod 000 $ISODIR/sdz 961 962 rm -f $TMPISO 963 run_regtest read_no_device_access "--debug --sim-cd=$MASTERISO --fixed-speed-values --spinup-delay=0 -d $ISODIR/sdz -r" $TMPISO $ISODIR/no.ecc 964 rm -f $ISODIR/sdz 965fi 966 967# Read image from defective media without error correction data available 968# Will have more missing sectors than the original due to the 16 sector skip default 969 970if try "reading image, defective media, no ecc data" read_defective_no_ecc; then 971 972 cp $MASTERISO $SIMISO 973 $NEWVER --debug -i$SIMISO --erase 100-200 >>$LOGFILE 2>&1 974 $NEWVER --debug -i$SIMISO --erase 766 >>$LOGFILE 2>&1 975 $NEWVER --debug -i$SIMISO --erase 2410 >>$LOGFILE 2>&1 976 977 rm -f $TMPISO 978 extra_args="--debug --sim-cd=$SIMISO --fixed-speed-values" 979 run_regtest read_defective_no_ecc "--spinup-delay=0 -r" $TMPISO $ISODIR/no.ecc 980fi 981 982# Read image from above test again, this time with a 1 sector skip size 983# Will provide an exact copy of the (damaged) original 984 985if try "reading image, defective media, no ecc data, completing w/ 1 sec step" read_defective_no_ecc_again; then 986 987 cp $MASTERISO $SIMISO 988 $NEWVER --debug -i$SIMISO --erase 100-200 >>$LOGFILE 2>&1 989 $NEWVER --debug -i$SIMISO --erase 766 >>$LOGFILE 2>&1 990 $NEWVER --debug -i$SIMISO --erase 2410 >>$LOGFILE 2>&1 991 992 cp $MASTERISO $TMPISO 993 $NEWVER --debug -i$TMPISO --erase 96-207 >>$LOGFILE 2>&1 994 $NEWVER --debug -i$TMPISO --erase 752-767 >>$LOGFILE 2>&1 995 $NEWVER --debug -i$TMPISO --erase 2400-2415 >>$LOGFILE 2>&1 996 997 replace_config jump 0 998 extra_args="--debug --sim-cd=$SIMISO --fixed-speed-values" 999 run_regtest read_defective_no_ecc_again "--spinup-delay=0 -j 1 -r" $TMPISO $ISODIR/no.ecc 1000fi 1001 1002# Read image from defective media without error correction data available 1003# using a large sector skip of 256 1004 1005if try "reading image, defective media, large sector skip" read_defective_large_skip; then 1006 1007 cp $MASTERISO $SIMISO 1008 $NEWVER --debug -i$SIMISO --erase 1600-1615 >>$LOGFILE 2>&1 1009 $NEWVER --debug -i$SIMISO --erase 6400-10000 >>$LOGFILE 2>&1 1010 1011 rm -f $TMPISO 1012 replace_config jump 256 1013 extra_args="--debug --sim-cd=$SIMISO --fixed-speed-values" 1014 run_regtest read_defective_large_skip "--spinup-delay=0 -r -j 256" $TMPISO $ISODIR/no.ecc 1015fi 1016 1017# Complete a truncated image 1018 1019if try "completing truncated image with no ecc data available" read_truncated_no_ecc; then 1020 1021 cp $MASTERISO $TMPISO 1022 $NEWVER --debug -i$TMPISO --truncate=$((ISOSIZE-560)) >>$LOGFILE 2>&1 1023 1024 extra_args="--debug --sim-cd=$SIMISO --fixed-speed-values" 1025 run_regtest read_truncated_no_ecc "--spinup-delay=0 -r" $TMPISO $ISODIR/no.ecc 1026fi 1027 1028# Complete a truncated image from simulated defective media 1029 1030if try "completing truncated image, defective media, no ecc data" read_truncated_no_ecc_again; then 1031 1032 cp $MASTERISO $SIMISO 1033 $NEWVER --debug -i$SIMISO --erase 20800-20875 >>$LOGFILE 2>&1 1034 1035 cp $MASTERISO $TMPISO 1036 $NEWVER --debug -i$TMPISO --truncate=$((ISOSIZE-560)) >>$LOGFILE 2>&1 1037 1038 replace_config jump 0 1039 extra_args="--debug --sim-cd=$SIMISO --fixed-speed-values" 1040 run_regtest read_truncated_no_ecc_again "--spinup-delay=0 -j 1 -r" $TMPISO $ISODIR/no.ecc 1041fi 1042 1043# Complete a truncated image from simulated defective media 1044 1045if try "completing truncated image, defective media, multipass, no ecc data" read_multipass_no_ecc_again; then 1046 1047 cp $MASTERISO $SIMISO 1048 $NEWVER --debug -i$SIMISO --erase 20800-20875 >>$LOGFILE 2>&1 1049 $NEWVER --debug -i$SIMISO --erase 3000-3045 >>$LOGFILE 2>&1 1050 1051 cp $MASTERISO $TMPISO 1052 $NEWVER --debug -i$TMPISO --truncate=$((ISOSIZE-560)) >>$LOGFILE 2>&1 1053 $NEWVER --debug -i$TMPISO --erase 2980-3120 >>$LOGFILE 2>&1 1054 1055 replace_config jump 0 1056 replace_config read-medium 3 1057 extra_args="--debug --sim-cd=$SIMISO --fixed-speed-values" 1058 run_regtest read_multipass_no_ecc_again "--read-medium=3 --spinup-delay=0 -j 1 -r" $TMPISO $ISODIR/no.ecc 1059fi 1060 1061# Complete a partially read image, but continue with gap between the last 1062# read and the next sector. 1063 1064if try "completing truncated image with reading gap, no ecc data" read_with_gap_no_ecc; then 1065 1066 cp $MASTERISO $SIMISO 1067 cp $MASTERISO $TMPISO 1068 $NEWVER --debug -i$TMPISO --truncate=10000 >>$LOGFILE 2>&1 1069 1070 extra_args="--debug --sim-cd=$SIMISO --fixed-speed-values" 1071 run_regtest read_with_gap_no_ecc "--spinup-delay=0 -r15000-end" $TMPISO $ISODIR/no.ecc 1072fi 1073 1074# Read a new image, but only for a partial range. 1075 1076if try "reading new image with given range, no ecc data" read_new_with_range_no_ecc; then 1077 1078 cp $MASTERISO $SIMISO 1079 rm -f $TMPISO 1080 1081 extra_args="--debug --sim-cd=$SIMISO --fixed-speed-values" 1082 run_regtest read_new_with_range_no_ecc "--spinup-delay=0 -r10000-15000" $TMPISO $ISODIR/no.ecc 1083fi 1084 1085# Read a new image, but only for an invalid range. 1086# not possible in GUI mode 1087 1088if try "reading new image with invalid range, no ecc data" read_new_with_invalid_range_no_ecc; then 1089 1090 cp $MASTERISO $SIMISO 1091 rm -f $TMPISO 1092 1093 run_regtest read_new_with_invalid_range_no_ecc "--debug --sim-cd=$SIMISO --fixed-speed-values --spinup-delay=0 -r10000-55000" $TMPISO $ISODIR/no.ecc 1094fi 1095 1096# Read a new image, containing two missing sectors 1097# but not at the end, so no tao tail case 1098 1099if try "reading new image with two missing sectors, no ecc data" read_two_missing_secs_no_ecc; then 1100 1101 cp $MASTERISO $SIMISO 1102 $NEWVER --debug -i$SIMISO --erase 8020 >>$LOGFILE 2>&1 1103 $NEWVER --debug -i$SIMISO --erase $((ISOSIZE-1)) >>$LOGFILE 2>&1 1104 1105 rm -f $TMPISO 1106 1107 replace_config jump 0 1108 extra_args="--debug --sim-cd=$SIMISO --fixed-speed-values" 1109 run_regtest read_two_missing_secs_no_ecc "--spinup-delay=0 -r -j 1" $TMPISO $ISODIR/no.ecc 1110fi 1111 1112# Read image with error correction data available 1113 1114if try "reading image, ecc data" read_with_ecc; then 1115 1116 rm -f $TMPISO 1117 extra_args="--debug --sim-cd=$MASTERISO --fixed-speed-values" 1118 run_regtest read_with_ecc "--spinup-delay=0 -r" $TMPISO $MASTERECC 1119fi 1120 1121# Read with ecc into existing and complete image file 1122 1123if try "reading image, ecc data, good file" read_with_ecc_good_file; then 1124 cp $MASTERISO $SIMISO 1125 cp $MASTERISO $TMPISO 1126 1127 extra_args="--debug --sim-cd=$SIMISO --fixed-speed-values" 1128 run_regtest read_with_ecc_good_file "--spinup-delay=0 -r" $TMPISO $MASTERECC 1129fi 1130 1131# Read image with non existing error correction file given 1132# Please note that this fact will be silently ignored; e.g. the image 1133# will be read as if no ecc file was given at all. 1134 1135if try "reading image, ecc file does not exist" read_with_non_existing_ecc; then 1136 1137 rm -f $TMPISO 1138 extra_args="--debug --sim-cd=$MASTERISO --fixed-speed-values" 1139 run_regtest read_with_non_existing_ecc "--spinup-delay=0 -r" $TMPISO $ISODIR/no_ecc 1140fi 1141 1142# Read image with non accessible error correction file given 1143# Please note that this fact will be silently ignored; e.g. the image 1144# will be read as if no ecc file was given at all. 1145 1146if try "reading image, no permission to access ecc file" read_with_no_permission_for_ecc; then 1147 cp $MASTERECC $TMPECC 1148 chmod 000 $TMPECC 1149 1150 rm -f $TMPISO 1151 extra_args="--debug --sim-cd=$MASTERISO --fixed-speed-values" 1152 run_regtest read_with_no_permission_for_ecc "--spinup-delay=0 -r" $TMPISO $TMPECC 1153 rm -f $TMPECC 1154fi 1155 1156# Read image with error correction data available 1157# and CRC errors 1158 1159if try "reading image, crc errors, ecc data" read_crc_errors_with_ecc; then 1160 1161 cp $MASTERISO $SIMISO 1162 $NEWVER --debug -i$SIMISO --byteset 0,100,255 >>$LOGFILE 2>&1 1163 $NEWVER --debug -i$SIMISO --byteset 1,180,200 >>$LOGFILE 2>&1 1164 $NEWVER --debug -i$SIMISO --byteset 7910,23,98 >>$LOGFILE 2>&1 1165 $NEWVER --debug -i$SIMISO --byteset 20999,55,123 >>$LOGFILE 2>&1 1166 1167 rm -f $TMPISO 1168 extra_args="--debug --sim-cd=$SIMISO --fixed-speed-values" 1169 run_regtest read_crc_errors_with_ecc "--spinup-delay=0 -r" $TMPISO $MASTERECC 1170fi 1171 1172# Read image with error correction data available 1173# which is a few sectors shorter than expected. 1174 1175if try "reading image, less sectors than expected, ecc data" read_shorter_with_ecc; then 1176 1177 cp $MASTERISO $SIMISO 1178 $NEWVER --debug -i$SIMISO --truncate=$((ISOSIZE-44)) >>$LOGFILE 2>&1 1179 1180 rm -f $TMPISO 1181 replace_config ignore-iso-size 1 1182 extra_args="--debug --sim-cd=$SIMISO --fixed-speed-values" 1183 run_regtest read_shorter_with_ecc "--ignore-iso-size --spinup-delay=0 -r" $TMPISO $MASTERECC 1184fi 1185 1186# Read image with error correction data available 1187# from a medium which is a few sectors longer than expected. 1188 1189if try "reading image, more sectors than expected, ecc data" read_longer_with_ecc; then 1190 1191 cp $MASTERISO $SIMISO 1192 for i in $(seq 22); do cat fixed-random-sequence >>$SIMISO; done 1193 1194 rm -f $TMPISO 1195 replace_config ignore-iso-size 1 1196 extra_args="--debug --sim-cd=$SIMISO --fixed-speed-values" 1197 run_regtest read_longer_with_ecc "--ignore-iso-size --spinup-delay=0 -r" $TMPISO $MASTERECC 1198fi 1199 1200# Read image with error correction data available 1201# simulating the multisession case with two additional defective sectors trailing the medium 1202 1203if try "reading image, tao tail case, ecc data" read_tao_tail_with_ecc; then 1204 1205 cp $MASTERISO $SIMISO 1206 cat fixed-random-sequence >>$SIMISO 1207 $NEWVER --debug -i$SIMISO --erase 21000-21001 >>$LOGFILE 2>&1 1208 1209 rm -f $TMPISO 1210 replace_config ignore-iso-size 1 1211 extra_args="--debug --sim-cd=$SIMISO --fixed-speed-values" 1212 run_regtest read_tao_tail_with_ecc "--ignore-iso-size --spinup-delay=0 -r" $TMPISO $MASTERECC 1213fi 1214 1215# Read image with error correction data available 1216# with two defective sectors at the end and the --dao option 1217 1218if try "reading image, tao tail case and --dao, ecc data" read_no_tao_tail_with_ecc; then 1219 1220 cp $MASTERISO $SIMISO 1221 $NEWVER --debug -i$SIMISO --erase 20998-20999 >>$LOGFILE 2>&1 1222 1223 rm -f $TMPISO 1224 replace_config dao 1 1225 extra_args="--debug --sim-cd=$SIMISO --fixed-speed-values" 1226 run_regtest read_no_tao_tail_with_ecc "--dao --spinup-delay=0 -r" $TMPISO $MASTERECC 1227fi 1228 1229# Read image with error correction data available 1230# and more than two defective sectors at the end 1231 1232if try "reading image, more than 2 sectors missing at end, ecc data" read_more_missing_at_end_with_ecc; then 1233 1234 cp $MASTERISO $SIMISO 1235 $NEWVER --debug -i$SIMISO --erase 20954-20999 >>$LOGFILE 2>&1 1236 1237 rm -f $TMPISO 1238 extra_args="--debug --sim-cd=$SIMISO --fixed-speed-values" 1239 run_regtest read_more_missing_at_end_with_ecc "--spinup-delay=0 -r" $TMPISO $MASTERECC 1240fi 1241 1242# Re-read image with error correction data available 1243# and wrong fingerprint in existing image 1244 1245if try "re-reading image, wrong fingerprint, ecc data" read_wrong_fp_with_ecc; then 1246 1247 cp $MASTERISO $SIMISO 1248 1249 dd if=$MASTERISO of=$TMPISO bs=2048 count=800 >>$LOGFILE 2>&1 1250 $NEWVER --debug -i$TMPISO --byteset 16,100,200 >>$LOGFILE 2>&1 1251 1252 extra_args="--debug --sim-cd=$SIMISO --fixed-speed-values" 1253 run_regtest read_wrong_fp_with_ecc "--spinup-delay=0 -r" $TMPISO $MASTERECC 1254fi 1255 1256# Read an augmented image for which an ecc file is also available. 1257# In that case, the ecc file gets precedence over the embedded ecc. 1258# To make sure the RS01 data is used we introduce a CRC error in the RS02 1259# ecc area - this can only be detected by the "outer" RS01 CRC. 1260 1261if try "reading image with RS02 data and a RS01 ecc file" read_with_double_ecc; then 1262 1263 cp $MASTERISO $SIMISO 1264 $NEWVER --debug --set-version $SETVERSION -i$SIMISO -mRS02 -n$((ISOSIZE+5000)) -c >>$LOGFILE 2>&1 1265 $NEWVER --debug --set-version $SETVERSION -i$SIMISO -e $TMPECC -c $REDUNDANCY >>$LOGFILE 2>&1 1266 $NEWVER --debug -i$SIMISO --byteset 25910,100,200 >>$LOGFILE 2>&1 1267 1268 rm -f $TMPISO 1269 extra_args="--debug --sim-cd=$SIMISO --fixed-speed-values" 1270 run_regtest read_with_double_ecc "--spinup-delay=0 -r" $TMPISO $TMPECC 1271fi 1272 1273# Read an image for which ecc information is available, 1274# but requiring a newer dvdisaster version. 1275 1276if try "reading image ecc file requiring a newer dvdisaster version" read_with_incompatible_ecc; then 1277 1278 cp $MASTERISO $SIMISO 1279 $NEWVER --debug --set-version $SETVERSION -i$SIMISO -e $TMPECC -c $REDUNDANCY >>$LOGFILE 2>&1 1280 $NEWVER --debug -i$TMPECC --byteset 0,88,220 >>$LOGFILE 2>&1 1281 $NEWVER --debug -i$TMPECC --byteset 0,89,65 >>$LOGFILE 2>&1 1282 $NEWVER --debug -i$TMPECC --byteset 0,90,15 >>$LOGFILE 2>&1 1283 1284 rm -f $TMPISO 1285 extra_args="--debug --sim-cd=$SIMISO --fixed-speed-values" 1286 run_regtest read_with_incompatible_ecc "--spinup-delay=0 -r" $TMPISO $TMPECC 1287fi 1288 1289# Read an image with a simulated hardware failure and 1290# --ignore-fatal-sense not set. 1291 1292if try "reading image with simulated hardware failure" read_with_hardware_failure; then 1293 1294 cp $MASTERISO $SIMISO 1295 $NEWVER --debug -i$SIMISO --erase "5000:hardware failure" >>$LOGFILE 2>&1 1296 1297 rm -f $TMPISO 1298 extra_args="--debug --sim-cd=$SIMISO --fixed-speed-values" 1299 run_regtest read_with_hardware_failure "--spinup-delay=0 -r" $TMPISO $ISODIR/no.ecc 1300fi 1301 1302# Read an image with a simulated hardware failure and 1303# --ignore-fatal-sense being set. 1304 1305if try "reading image, ignoring simulated hardware failure" read_with_ignored_hardware_failure; then 1306 1307 cp $MASTERISO $SIMISO 1308 $NEWVER --debug -i$SIMISO --erase "5000:hardware failure" >>$LOGFILE 2>&1 1309 1310 rm -f $TMPISO 1311 replace_config ignore-fatal-sense 1 1312 extra_args="--debug --sim-cd=$SIMISO --fixed-speed-values" 1313 run_regtest read_with_ignored_hardware_failure "--spinup-delay=0 -r --ignore-fatal-sense" $TMPISO $ISODIR/no.ecc 1314fi 1315 1316# Read medium in several passes; some sectors become readable in the third pass. 1317 1318if try "reading medium in 3 passes; 3rd pass recovers some" read_multipass_partial_success; then 1319 1320 cp $MASTERISO $SIMISO 1321 $NEWVER --debug -i$SIMISO --erase 15800-16199 >>$LOGFILE 2>&1 1322 $NEWVER --debug -i$SIMISO --erase "15900-16099:readable in pass 3" >>$LOGFILE 2>&1 1323 1324 rm -f $TMPISO 1325 replace_config read-medium 3 1326 extra_args="--debug --sim-cd=$SIMISO --fixed-speed-values" 1327 run_regtest read_multipass_partial_success "--read-medium=3 --spinup-delay=0 -r" $TMPISO $ISODIR/no.ecc 1328fi 1329 1330# Do a second sucessful read attempt at an incomplete image; 1331# see whether correct results are reported when ecc data is present 1332# since CRC caching is a bit complicated in this case. 1333 1334if try "re-reading medium with ecc, successfull" read_second_pass_with_ecc_success; then 1335 1336 cp $MASTERISO $SIMISO 1337 cp $MASTERISO $TMPISO 1338 $NEWVER --debug -i$TMPISO --erase 15800-16199 >>$LOGFILE 2>&1 1339 1340 extra_args="--debug --sim-cd=$SIMISO --fixed-speed-values" 1341 run_regtest read_second_pass_with_ecc_success "--spinup-delay=0 -r" $TMPISO $MASTERECC 1342fi 1343 1344# Do a second read attempt at an incomplete image; 1345# see whether CRC errors are still discovered since CRC caching is a bit 1346# complicated in this case. 1347 1348if try "re-reading medium with CRC error" read_second_pass_with_crc_error; then 1349 1350 cp $MASTERISO $SIMISO 1351 $NEWVER --debug -i$SIMISO --byteset 15830,8,3 >>$LOGFILE 2>&1 1352 cp $MASTERISO $TMPISO 1353 $NEWVER --debug -i$TMPISO --erase 15800-16199 >>$LOGFILE 2>&1 1354 1355 extra_args="--debug --sim-cd=$SIMISO --fixed-speed-values" 1356 run_regtest read_second_pass_with_crc_error "--spinup-delay=0 -r" $TMPISO $MASTERECC 1357fi 1358 1359# Read medium containing several dead sector markers 1360 1361if try "reading medium containing dead sector markers" read_medium_with_dsm; then 1362 1363 cp $MASTERISO $SIMISO 1364 $NEWVER --debug -i$SIMISO --erase "4999:pass as dead sector marker" >>$LOGFILE 2>&1 1365 $NEWVER --debug -i$SIMISO --erase "5005:pass as dead sector marker" >>$LOGFILE 2>&1 1366 $NEWVER --debug -i$SIMISO --erase "5007:pass as dead sector marker" >>$LOGFILE 2>&1 1367 1368 rm -f $TMPISO 1369 extra_args="--debug --sim-cd=$SIMISO --fixed-speed-values" 1370 run_regtest read_medium_with_dsm "--spinup-delay=0 -r" $TMPISO $ISODIR/no.ecc 1371fi 1372 1373# Read medium containing several dead sector markers, verbose output 1374# not applicable in GUI mode 1375 1376if try "reading medium containing dead sector markers, verbose output" read_medium_with_dsm_verbose; then 1377 1378 cp $MASTERISO $SIMISO 1379 $NEWVER --debug -i$SIMISO --erase "4999:pass as dead sector marker" >>$LOGFILE 2>&1 1380 $NEWVER --debug -i$SIMISO --erase "5005:pass as dead sector marker" >>$LOGFILE 2>&1 1381 $NEWVER --debug -i$SIMISO --erase "5007:pass as dead sector marker" >>$LOGFILE 2>&1 1382 1383 rm -f $TMPISO 1384 extra_args="--debug --sim-cd=$SIMISO --fixed-speed-values" 1385 run_regtest read_medium_with_dsm_verbose "--spinup-delay=0 -r -v" $TMPISO $ISODIR/no.ecc 1386fi 1387 1388# Complete medium for image containing several uncorrectable dead sector markers 1389# (sector displacement) 1390 1391if try "completing image with uncorrectable dead sector markers" read_medium_with_dsm_in_image; then 1392 1393 cp $MASTERISO $SIMISO 1394 cp $MASTERISO $TMPISO 1395 $NEWVER --debug -i$TMPISO --erase 3030 >>$LOGFILE 2>&1 1396 $NEWVER --debug -i$TMPISO --byteset 3030,353,49 >>$LOGFILE 2>&1 // displaced from sector 3130 1397 $NEWVER --debug -i$TMPISO --erase 4400 >>$LOGFILE 2>&1 1398 $NEWVER --debug -i$TMPISO --byteset 4400,353,53 >>$LOGFILE 2>&1 // displaced from sector 4500 1399 $NEWVER --debug -i$TMPISO --erase 4411 >>$LOGFILE 2>&1 1400 $NEWVER --debug -i$TMPISO --byteset 4411,353,53 >>$LOGFILE 2>&1 // displaced from sector 4511 1401 1402 extra_args="--debug --sim-cd=$SIMISO --fixed-speed-values" 1403 run_regtest read_medium_with_dsm_in_image "--spinup-delay=0 -r" $TMPISO $ISODIR/no.ecc 1404fi 1405 1406# Complete medium for image containing several uncorrectable dead sector markers, verbose output 1407 1408if try "completing image with uncorrectable dead sector markers, verbose output" read_medium_with_dsm_in_image_verbose; then 1409 1410 cp $MASTERISO $SIMISO 1411 cp $MASTERISO $TMPISO 1412 $NEWVER --debug -i$TMPISO --erase 3030 >>$LOGFILE 2>&1 1413 $NEWVER --debug -i$TMPISO --byteset 3030,353,49 >>$LOGFILE 2>&1 // displaced from sector 3130 1414 $NEWVER --debug -i$TMPISO --erase 4400 >>$LOGFILE 2>&1 1415 $NEWVER --debug -i$TMPISO --byteset 4400,353,53 >>$LOGFILE 2>&1 // displaced from sector 4500 1416 $NEWVER --debug -i$TMPISO --erase 4411 >>$LOGFILE 2>&1 1417 $NEWVER --debug -i$TMPISO --byteset 4411,353,53 >>$LOGFILE 2>&1 // displaced from sector 4511 1418 1419 extra_args="--debug --sim-cd=$SIMISO --fixed-speed-values" 1420 run_regtest read_medium_with_dsm_in_image_verbose "--spinup-delay=0 -r -v" $TMPISO $ISODIR/no.ecc 1421fi 1422 1423# Complete medium for image containing several uncorrectable dead sector markers 1424# (non matching fingerprint) 1425 1426if try "completing image with uncorrectable dead sector markers (2)" read_medium_with_dsm_in_image2; then 1427 1428 cp $MASTERISO $SIMISO 1429 cp $MASTERISO $TMPISO 1430 $NEWVER --debug -i$TMPISO --erase 3030 >>$LOGFILE 2>&1 1431 $NEWVER --debug -i$TMPISO --byteset 3030,416,55 >>$LOGFILE 2>&1 // wrong fingerprint 1432 $NEWVER --debug -i$TMPISO --byteset 3030,556,32 >>$LOGFILE 2>&1 // changed label 1433 $NEWVER --debug -i$TMPISO --byteset 3030,557,50 >>$LOGFILE 2>&1 // changed label 1434 $NEWVER --debug -i$TMPISO --erase 4400 >>$LOGFILE 2>&1 1435 $NEWVER --debug -i$TMPISO --byteset 4400,416,53 >>$LOGFILE 2>&1 // wrong fingerprint 1436 $NEWVER --debug -i$TMPISO --byteset 3030,556,32 >>$LOGFILE 2>&1 // changed label 1437 $NEWVER --debug -i$TMPISO --byteset 4400,557,50 >>$LOGFILE 2>&1 // changed label 1438 $NEWVER --debug -i$TMPISO --erase 4411 >>$LOGFILE 2>&1 1439 $NEWVER --debug -i$TMPISO --byteset 4411,416,53 >>$LOGFILE 2>&1 // wrong fingerprint 1440 $NEWVER --debug -i$TMPISO --byteset 3030,556,32 >>$LOGFILE 2>&1 // changed label 1441 $NEWVER --debug -i$TMPISO --byteset 4411,557,50 >>$LOGFILE 2>&1 // changed label 1442 1443 extra_args="--debug --sim-cd=$SIMISO --fixed-speed-values" 1444 run_regtest read_medium_with_dsm_in_image2 "--spinup-delay=0 -r " $TMPISO $ISODIR/no.ecc 1445fi 1446 1447# Complete medium for image containing several uncorrectable dead sector markers, verbose 1448# (non matching fingerprint) 1449 1450if try "completing image with uncorrectable dead sector markers (2), verbose output" read_medium_with_dsm_in_image2_verbose; then 1451 1452 cp $MASTERISO $SIMISO 1453 cp $MASTERISO $TMPISO 1454 $NEWVER --debug -i$TMPISO --erase 3030 >>$LOGFILE 2>&1 1455 $NEWVER --debug -i$TMPISO --byteset 3030,416,55 >>$LOGFILE 2>&1 // wrong fingerprint 1456 $NEWVER --debug -i$TMPISO --byteset 3030,556,32 >>$LOGFILE 2>&1 // changed label 1457 $NEWVER --debug -i$TMPISO --byteset 3030,557,50 >>$LOGFILE 2>&1 // changed label 1458 $NEWVER --debug -i$TMPISO --erase 4400 >>$LOGFILE 2>&1 1459 $NEWVER --debug -i$TMPISO --byteset 4400,416,53 >>$LOGFILE 2>&1 // wrong fingerprint 1460 $NEWVER --debug -i$TMPISO --byteset 3030,556,32 >>$LOGFILE 2>&1 // changed label 1461 $NEWVER --debug -i$TMPISO --byteset 4400,557,50 >>$LOGFILE 2>&1 // changed label 1462 $NEWVER --debug -i$TMPISO --erase 4411 >>$LOGFILE 2>&1 1463 $NEWVER --debug -i$TMPISO --byteset 4411,416,53 >>$LOGFILE 2>&1 // wrong fingerprint 1464 $NEWVER --debug -i$TMPISO --byteset 3030,556,32 >>$LOGFILE 2>&1 // changed label 1465 $NEWVER --debug -i$TMPISO --byteset 4411,557,50 >>$LOGFILE 2>&1 // changed label 1466 1467 extra_args="--debug --sim-cd=$SIMISO --fixed-speed-values" 1468 run_regtest read_medium_with_dsm_in_image2_verbose "--spinup-delay=0 -r -v" $TMPISO $ISODIR/no.ecc 1469fi 1470 1471# Mechanismus um C2-Errors zu testen? 1472 1473### Reading tests (adaptive) 1474 1475echo "# Reading tests (adaptive)" 1476 1477echo "Currently not enabled!" 1478exit 0 1479 1480# Read good image with error correction data available 1481 1482if try "reading good image" adaptive_good; then 1483 1484 rm -f $TMPISO 1485 run_regtest adaptive_good "--debug --sim-cd=$MASTERISO --fixed-speed-values --spinup-delay=0 -r --adaptive-read" $TMPISO $MASTERECC 1486fi 1487 1488# Read image without error correction data available 1489 1490if try "reading image, no ecc data" adaptive_no_ecc; then 1491 1492 rm -f $TMPISO 1493 run_regtest adaptive_no_ecc "--debug --sim-cd=$MASTERISO --fixed-speed-values --spinup-delay=0 -r --adaptive-read" $TMPISO $ISODIR/no.ecc 1494fi 1495 1496# Read image from non-existant device 1497 1498if try "reading image, device not existant" adaptive_no_device; then 1499 1500 rm -f $TMPISO 1501 run_regtest adaptive_no_device "--debug --sim-cd=$MASTERISO --fixed-speed-values --spinup-delay=0 -d /dev/sdz -r --adaptive-read" $TMPISO $ISODIR/no.ecc 1502fi 1503 1504# Read image from device with insufficient permissions 1505 1506if try "reading image, device access denied" adaptive_no_device_access; then 1507 1508 touch $ISODIR/sdz 1509 chmod 000 $ISODIR/sdz 1510 1511 rm -f $TMPISO 1512 run_regtest adaptive_no_device_access "--debug --sim-cd=$MASTERISO --fixed-speed-values --spinup-delay=0 -d $ISODIR/sdz -r --adaptive-read" $TMPISO $ISODIR/no.ecc 1513 rm -f $ISODIR/sdz 1514fi 1515 1516# Read image from defective media without error correction data available 1517# Will have more missing sectors than the original due to the divide and conquer 1518# cut-off between intervals: e.g the following sectors will be missing: 1519# 100- 202; 766-786; 2410-2428 1520# Please do also note that the termination criterion is somehow misleading 1521# as it applies to any intervals resulting from a split. 1522# If we are supposed to terminate when no intervals >= n=16 sectors are 1523# available, we are actually terminating when the first interval with 1524# less than 32 sectors is being split (so we are effectively terminating below 2n). 1525# The example run terminates as soon as the following intervals are left over: 1526# 20 [ 101.. 120] 1527# 20 [ 142.. 161] 1528# 20 [ 183.. 202] 1529# 20 [ 767.. 786] 1530# 19 [ 122.. 140] 1531# 19 [ 163.. 181] 1532# 18 [ 2411.. 2428] 1533# 1534# Having said that, the results from the following run have been manually 1535# checked to match what the programmer intended ;-) 1536 1537if try "reading image, defective media, no ecc data" adaptive_defective_no_ecc; then 1538 1539 cp $MASTERISO $SIMISO 1540 $NEWVER --debug -i$SIMISO --erase 100-200 >>$LOGFILE 2>&1 1541 $NEWVER --debug -i$SIMISO --erase 766 >>$LOGFILE 2>&1 1542 $NEWVER --debug -i$SIMISO --erase 2410 >>$LOGFILE 2>&1 1543 1544 rm -f $TMPISO 1545 run_regtest adaptive_defective_no_ecc "--debug --sim-cd=$SIMISO --fixed-speed-values --spinup-delay=0 -r --adaptive-read -v" $TMPISO $ISODIR/no.ecc 1546fi 1547 1548# Read image from defective media without error correction data available 1549# using a large sector skip of 256 1550 1551if try "reading image, defective media, large sector skip" adaptive_defective_large_skip; then 1552 1553 cp $MASTERISO $SIMISO 1554 $NEWVER --debug -i$SIMISO --erase 1600-1615 >>$LOGFILE 2>&1 1555 $NEWVER --debug -i$SIMISO --erase 6400-10000 >>$LOGFILE 2>&1 1556 1557 rm -f $TMPISO 1558 run_regtest adaptive_defective_large_skip "--debug --sim-cd=$SIMISO --fixed-speed-values --spinup-delay=0 -r -j 256 --adaptive-read -v" $TMPISO $ISODIR/no.ecc 1559fi 1560 1561# Complete a truncated image 1562 1563if try "completing truncated image with no ecc data available" adaptive_truncated_no_ecc; then 1564 1565 cp $MASTERISO $TMPISO 1566 $NEWVER --debug -i$TMPISO --truncate=$((ISOSIZE-560)) >>$LOGFILE 2>&1 1567 1568 run_regtest adaptive_truncated_no_ecc "--debug --sim-cd=$MASTERISO --fixed-speed-values --spinup-delay=0 -r --adaptive-read" $TMPISO $ISODIR/no.ecc 1569fi 1570 1571# Complete a truncated image from simulated defective media 1572# Leaves 100 unread sectors. 1573 1574if try "completing truncated image, defective media, no ecc data" adaptive_truncated_no_ecc_again; then 1575 1576 cp $MASTERISO $SIMISO 1577 $NEWVER --debug -i$SIMISO --erase 20800-20875 >>$LOGFILE 2>&1 1578 1579 cp $MASTERISO $TMPISO 1580 $NEWVER --debug -i$TMPISO --truncate=$((ISOSIZE-560)) >>$LOGFILE 2>&1 1581 1582 run_regtest adaptive_truncated_no_ecc_again "--debug --sim-cd=$SIMISO --fixed-speed-values --spinup-delay=0 -r -v --adaptive-read" $TMPISO $ISODIR/no.ecc 1583fi 1584 1585# Complete a partially read image, but continue with gap between the last 1586# read and the next sector. 1587# (not a recommended setup for adaptive reading, but technically allowed) 1588 1589if try "completing truncated image with reading gap, no ecc data" adaptive_with_gap_no_ecc; then 1590 1591 cp $MASTERISO $SIMISO 1592 cp $MASTERISO $TMPISO 1593 $NEWVER --debug -i$TMPISO --truncate=10000 >>$LOGFILE 2>&1 1594 1595 run_regtest adaptive_with_gap_no_ecc "--debug --sim-cd=$SIMISO --fixed-speed-values --spinup-delay=0 -r15000-end --adaptive-read" $TMPISO $ISODIR/no.ecc 1596fi 1597 1598# Complete a partially read image, but continue with gap between the last 1599# read and the next sector. 1600# (not a recommended setup for adaptive reading, but technically allowed) 1601# specified area ends before actual medium size 1602 1603if try "completing truncated image with reading gap, no ecc data(2)" adaptive_with_gap_no_ecc2; then 1604 1605 cp $MASTERISO $SIMISO 1606 cp $MASTERISO $TMPISO 1607 $NEWVER --debug -i$TMPISO --truncate=10000 >>$LOGFILE 2>&1 1608 1609 run_regtest adaptive_with_gap_no_ecc2 "--debug --sim-cd=$SIMISO --fixed-speed-values --spinup-delay=0 -r15000-19999 --adaptive-read" $TMPISO $ISODIR/no.ecc 1610fi 1611 1612# Complete a partially read image, but continue with gap between the last 1613# read and the next sector. 1614# (not a recommended setup for adaptive reading, but technically allowed) 1615# specified area overlaps already read part 1616 1617if try "completing truncated image with reading gap, no ecc data(3)" adaptive_with_gap_no_ecc3; then 1618 1619 cp $MASTERISO $SIMISO 1620 cp $MASTERISO $TMPISO 1621 $NEWVER --debug -i$TMPISO --truncate=10000 >>$LOGFILE 2>&1 1622 1623 run_regtest adaptive_with_gap_no_ecc3 "--debug --sim-cd=$SIMISO --fixed-speed-values --spinup-delay=0 -r9000-15000 --adaptive-read" $TMPISO $ISODIR/no.ecc 1624fi 1625 1626# Read a new image, but only for a partial range. 1627 1628if try "reading new image with given range, no ecc data" adaptive_new_with_range_no_ecc; then 1629 1630 cp $MASTERISO $SIMISO 1631 rm -f $TMPISO 1632 1633 run_regtest adaptive_new_with_range_no_ecc "--debug --sim-cd=$SIMISO --fixed-speed-values --spinup-delay=0 -r10000-15000 --adaptive-read" $TMPISO $ISODIR/no.ecc 1634fi 1635 1636# Read a new image, but only for an invalid range. 1637 1638if try "reading new image with invalid range, no ecc data" adaptive_new_with_invalid_range_no_ecc; then 1639 1640 cp $MASTERISO $SIMISO 1641 rm -f $TMPISO 1642 1643 run_regtest adaptive_new_with_invalid_range_no_ecc "--debug --sim-cd=$SIMISO --fixed-speed-values --spinup-delay=0 -r10000-55000 --adaptive-read" $TMPISO $ISODIR/no.ecc 1644fi 1645 1646# Read image with non accessible error correction file given 1647# Please note that this fact will be silently ignored; e.g. the image 1648# will be read as if no ecc file was given at all. 1649 1650if try "reading image, no permission to access ecc file" adaptive_with_no_permission_for_ecc; then 1651 cp $MASTERECC $TMPECC 1652 chmod 000 $TMPECC 1653 1654 rm -f $TMPISO 1655 run_regtest adaptive_with_no_permission_for_ecc "--debug --sim-cd=$MASTERISO --fixed-speed-values --spinup-delay=0 -r --adaptive-read" $TMPISO $TMPECC 1656 rm -f $TMPECC 1657fi 1658 1659# Read image with error correction data available 1660# and CRC errors 1661# Adaptive reading will create a new interval on CRC errors, 1662# but mark them as erasure as expected. The resulting image 1663# is successfully corrected with 32 erasures/block. 1664 1665if try "reading image, crc errors, ecc data" adaptive_crc_errors_with_ecc; then 1666 1667 cp $MASTERISO $SIMISO 1668 $NEWVER --debug -i$SIMISO --byteset 0,100,255 >>$LOGFILE 2>&1 1669 $NEWVER --debug -i$SIMISO --byteset 1,180,200 >>$LOGFILE 2>&1 1670 $NEWVER --debug -i$SIMISO --byteset 7910,23,98 >>$LOGFILE 2>&1 1671 $NEWVER --debug -i$SIMISO --byteset 20999,55,123 >>$LOGFILE 2>&1 1672 1673 rm -f $TMPISO 1674 run_regtest adaptive_crc_errors_with_ecc "--debug --sim-cd=$SIMISO --fixed-speed-values --spinup-delay=0 -r --adaptive-read" $TMPISO $MASTERECC 1675fi 1676 1677# Read image with error correction data available. 1678# The image is a few sectors shorter than expected. 1679 1680if try "reading image, less sectors than expected, ecc data" adaptive_shorter_with_ecc; then 1681 1682 cp $MASTERISO $SIMISO 1683 $NEWVER --debug -i$SIMISO --truncate=$((ISOSIZE-44)) >>$LOGFILE 2>&1 1684 1685 rm -f $TMPISO 1686 run_regtest adaptive_shorter_with_ecc "--debug --ignore-iso-size --sim-cd=$SIMISO --fixed-speed-values --spinup-delay=0 -r --adaptive-read" $TMPISO $MASTERECC 1687fi 1688 1689# Read image with error correction data available 1690# from a medium which is a few sectors longer than expected. 1691 1692if try "reading image, more sectors than expected, ecc data" adaptive_longer_with_ecc; then 1693 1694 cp $MASTERISO $SIMISO 1695 for i in $(seq 22); do cat fixed-random-sequence >>$SIMISO; done 1696 1697 rm -f $TMPISO 1698 run_regtest adaptive_longer_with_ecc "--debug --ignore-iso-size --sim-cd=$SIMISO --fixed-speed-values --spinup-delay=0 -r --adaptive-read" $TMPISO $MASTERECC 1699fi 1700 1701# Read image with error correction data available 1702# simulating the multisession case with two additional defective sectors trailing the medium 1703# Both this case and the next one do not really make sense for the adaptive 1704# reading case as the right behaviour is simply caused by using the respective 1705# values from the ecc data. 1706 1707if try "reading image, tao tail case, ecc data" adaptive_tao_tail_with_ecc; then 1708 1709 cp $MASTERISO $SIMISO 1710 cat fixed-random-sequence >>$SIMISO 1711 $NEWVER --debug -i$SIMISO --erase 21000-21001 >>$LOGFILE 2>&1 1712 1713 rm -f $TMPISO 1714 run_regtest adaptive_tao_tail_with_ecc "--debug --ignore-iso-size --sim-cd=$SIMISO --fixed-speed-values --spinup-delay=0 -r --adaptive-read" $TMPISO $MASTERECC 1715fi 1716 1717# Read image with error correction data available 1718# with two defective sectors at the end and the --dao option 1719 1720if try "reading image, tao tail case and --dao, ecc data" adaptive_no_tao_tail_with_ecc; then 1721 1722 cp $MASTERISO $SIMISO 1723 $NEWVER --debug -i$SIMISO --erase 20998-20999 >>$LOGFILE 2>&1 1724 1725 rm -f $TMPISO 1726 run_regtest adaptive_no_tao_tail_with_ecc "--debug --dao --sim-cd=$SIMISO --fixed-speed-values --spinup-delay=0 -r --adaptive-read" $TMPISO $MASTERECC 1727fi 1728 1729# Re-read image with error correction data available 1730# and wrong fingerprint in existing image 1731 1732if try "re-reading image, wrong fingerprint, ecc data" adaptive_wrong_fp_with_ecc; then 1733 1734 cp $MASTERISO $SIMISO 1735 1736 dd if=$MASTERISO of=$TMPISO bs=2048 count=800 >>$LOGFILE 2>&1 1737 $NEWVER --debug -i$TMPISO --byteset 16,100,200 >>$LOGFILE 2>&1 1738 1739 run_regtest adapive_wrong_fp_with_ecc "--debug --sim-cd=$SIMISO --fixed-speed-values --spinup-delay=0 -r --adaptive-read" $TMPISO $MASTERECC 1740fi 1741 1742# Read an augmented image for which an ecc file is also available. 1743# In that case, the ecc file gets precedence over the embedded ecc. 1744 1745if try "reading image with RS02 data and a RS01 ecc file" adaptive_with_double_ecc; then 1746 1747 cp $MASTERISO $SIMISO 1748 $NEWVER --debug --set-version $SETVERSION -i$SIMISO -mRS02 -n$((ISOSIZE+5000)) -c >>$LOGFILE 2>&1 1749 $NEWVER --debug --set-version $SETVERSION -i$SIMISO -e $TMPECC -c $REDUNDANCY >>$LOGFILE 2>&1 1750 1751 rm -f $TMPISO 1752 run_regtest adaptive_with_double_ecc "--debug --sim-cd=$SIMISO --fixed-speed-values --spinup-delay=0 -r --adaptive-read" $TMPISO $TMPECC 1753fi 1754 1755# Read an image for which ecc information is available, 1756# but requiring a newer dvdisaster version. 1757 1758if try "reading image w/ ecc file requiring a newer dvdisaster version" adaptive_with_incompatible_ecc; then 1759 1760 cp $MASTERISO $SIMISO 1761 $NEWVER --debug --set-version $SETVERSION -i$SIMISO -e $TMPECC -c $REDUNDANCY >>$LOGFILE 2>&1 1762 $NEWVER --debug -i$TMPECC --byteset 0,88,220 >>$LOGFILE 2>&1 1763 $NEWVER --debug -i$TMPECC --byteset 0,89,65 >>$LOGFILE 2>&1 1764 $NEWVER --debug -i$TMPECC --byteset 0,90,15 >>$LOGFILE 2>&1 1765 1766 rm -f $TMPISO 1767 run_regtest adaptive_with_incompatible_ecc "--debug --sim-cd=$SIMISO --fixed-speed-values --spinup-delay=0 -r --adaptive-read" $TMPISO $TMPECC 1768fi 1769 1770# Read an image with a simulated hardware failure and 1771# --ignore-fatal-sense not set. 1772 1773if try "reading image with simulated hardware failure" adaptive_with_hardware_failure; then 1774 1775 cp $MASTERISO $SIMISO 1776 $NEWVER --debug -i$SIMISO --erase "5000:hardware failure" >>$LOGFILE 2>&1 1777 1778 rm -f $TMPISO 1779 run_regtest adaptive_with_hardware_failure "--debug --sim-cd=$SIMISO --fixed-speed-values --spinup-delay=0 -r --adaptive-read" $TMPISO $ISODIR/no.iso 1780fi 1781 1782# Read an image with a simulated hardware failure and 1783# --ignore-fatal-sense being set. 1784 1785if try "reading image, ignoring simulated hardware failure" adaptive_with_ignored_hardware_failure; then 1786 1787 cp $MASTERISO $SIMISO 1788 $NEWVER --debug -i$SIMISO --erase "5000:hardware failure" >>$LOGFILE 2>&1 1789 1790 rm -f $TMPISO 1791 run_regtest adaptive_with_ignored_hardware_failure "--debug --sim-cd=$SIMISO --fixed-speed-values --spinup-delay=0 -r --adaptive-read --ignore-fatal-sense" $TMPISO $ISODIR/no.iso 1792fi 1793 1794# Read medium containing several dead sector markers 1795 1796if try "reading medium containing dead sector markers" adaptive_medium_with_dsm; then 1797 1798 cp $MASTERISO $SIMISO 1799 $NEWVER --debug -i$SIMISO --erase "4999:pass as dead sector marker" >>$LOGFILE 2>&1 1800 1801 rm -f $TMPISO 1802 run_regtest adaptive_medium_with_dsm "--debug --sim-cd=$SIMISO --fixed-speed-values --spinup-delay=0 -r --adaptive-read" $TMPISO $ISODIR/no.ecc 1803fi 1804