
   What it is

This is the small test suite for GNU ddrescue for testing
bad block skipping algorithm. It imitates device with bad block
using 'Linux Device Mapper'.


   How to use it

1. Extract this test suit into your home directory
  (in this example it is $HOME/test_on_badblocks/ )

2. Build the latest GNU ddrescue with provided patch
   which allows to set a small value for the 'initial skip size' parameter.

  $ wget http://download.savannah.gnu.org/releases/ddrescue/ddrescue-1.17-rc3.tar.lz
  $ lzip -cd ddrescue-1.17-rc3.tar.lz | tar xf -
  $ cd ddrescue-1.17-rc3/
  $ patch -p1 < ~/test_on_badblocks/fix-minimal-skip-size.patch
  $ ./configure
  $ make

  Note: if you use other GNU ddrescue version or other path
  you have to change DD= variable in 'test-on-bad-block.sh' script also.

3. Configure udev for regular user may have access to created DM device:

  $ sudo nano /etc/udev/rules.d/70-test-purpose-bad-disk.rules

  ENV{DM_NAME}=="disk_with_bad_blocks", OWNER="root", GROUP="root", MODE="666"

  (udev automatically detects a changes in .rules files)

4. Run the test as a regular user.
  This user must have ability to execute some commands with 'sudo'.
  Note: In Ubuntu first user created during install process does.

  $ cd ~/test_on_badblocks/
  $ bash test-on-bad-blocks.sh

5. Look into /tmp/strace_lseek_offsets_in_Ki.txt
   Here is the offsets which GNU ddrescue does when tries to read this device.

