summaryrefslogtreecommitdiffstats
path: root/tests/07testreshape5
blob: 03609886e9c181c48a7abf93e360aac32dceb82c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39

#
# test the reshape code by using test_reshape and the
# kernel md code to move data into and out of variously
# shaped md arrays.
set -x
layouts=(la ra ls rs)
for chunk in 4 8 16 32 64 128
do
  devs="$dev1"
  for disks in 2 3 4 5 6
  do
    eval devs=\"$devs \$dev$disks\"
    for nlayout in 0 1 2 3
    do
      layout=${layouts[$nlayout]}

      size=$[chunk*(disks-1)*disks]

      # test restore: make a raid5 from a file, then do a compare
      dd if=/dev/urandom of=/tmp/RandFile bs=1024 count=$size
      $dir/test_stripe restore /tmp/RandFile $disks $[chunk*1024] 5 $nlayout 0 $[size*1024] $devs
      mdadm -CR $md0 -amd -l5 -n$disks --assume-clean -c $chunk -p $layout $devs
      cmp -s -n $[size*1024] $md0 /tmp/RandFile || { echo cmp failed ; exit 2; }

      # FIXME check parity

      # test save
      dd if=/dev/urandom of=$md0 bs=1024 count=$size
      blockdev --flushbufs $md0 $devs
      > /tmp/NewRand
      $dir/test_stripe save /tmp/NewRand $disks $[chunk*1024] 5 $nlayout 0 $[size*1024] $devs
      cmp -s -n $[size*1024] $md0 /tmp/NewRand || { echo cmp failed ; exit 2; }
      mdadm -S $md0
    done
  done
done
exit 0