#! /bin/sh

. dm_tools.sh

# the location of the hashdd program, and a couple of random seeds
s1=89
s2=90
dev=foo

# The tables we're going to be using for this test
table_linear1="0 1024000 linear /dev/hda3 8"
table_linear2="0 1024000 linear /dev/hdc 16"
table_mirror="0 1024000 mirror core 1 1024 2 /dev/hda3 8 /dev/hdc 16"
#table_log="0 102400 linear /dev/hda3 1024008"
#table_mirror="0 1024000 mirror disk 2 /dev/mapper/log 1024 2 /dev/hda3 8 /dev/hdc 16"

# just in case the device already exists
remove_quietly $dev

# stamp a different pattern across the 2 volumes that make up the mirrorset
create $dev $table_linear1
stamp $dev $s1

reload $dev $table_linear2
stamp $dev $s2

#create log $table_log
#dd if=/dev/zero of=/dev/mapper/log

# sync the mirror
reload $dev $table_mirror
stamp $dev $s1
#dmsetup wait $dev

# check the second volume matches the first
reload $dev $table_linear2
verify $dev $s1

# write a new pattern across the mirror
stamp $dev $s2
verify $dev $s2

# done
remove $dev
