Commit c898ef69 authored by Helen Koike's avatar Helen Koike

wip: remove those that can corrupt fs

parent 023a7283
......@@ -28,7 +28,7 @@ fill_rootfs()
sudo chmod +x dm-mount/bin/init.sh
}
create_3part()
create_4part()
{
# Create disk
DISK=$1
......@@ -42,13 +42,15 @@ create_3part()
echo "creating $DISK"
fi
dd if=/dev/zero of=$DISK bs=256M count=3
dd if=/dev/zero of=$DISK bs=256M count=4
# Partition 1
sudo sgdisk -n 1:0:+200M -t 1:7f01 "$DISK"
# Partition 2
sudo sgdisk -n 2:0:+200M -t 2:7f01 "$DISK"
# Partition 3
sudo sgdisk -n 3:0:+200M -t 3:7f01 "$DISK"
# Partition 4
sudo sgdisk -n 4:0:+200M -t 4:7f01 "$DISK"
LOOP_DEV=$(sudo losetup -fP --show $DISK)
sectors=$(sudo blockdev --getsz "${LOOP_DEV}"p1)
......@@ -56,11 +58,21 @@ create_3part()
${PREFIX}sectors=${sectors}
EOF
sudo mkfs.ext4 -L ROOT-${TYPE} ${LOOP_DEV}p1
sudo mkfs.ext4 -L ROOT-${TYPE}p1 ${LOOP_DEV}p1
mkdir -p dm-mount
sudo mount ${LOOP_DEV}p1 dm-mount
fill_rootfs "${TYPE} disk $DISK"
fill_rootfs "${TYPE} disk $DISK p1"
# Umount disk/dm/loopback
sudo umount dm-mount
rm -r dm-mount
sudo mkfs.ext4 -L ROOT-${TYPE}p2 ${LOOP_DEV}p2
mkdir -p dm-mount
sudo mount ${LOOP_DEV}p2 dm-mount
fill_rootfs "${TYPE} disk $DISK p2"
# Umount disk/dm/loopback
sudo umount dm-mount
......@@ -619,45 +631,112 @@ snap_tests()
{
launch_test \
"snap: snapshot-origin" \
"-hda ${D3P}" \
"-hda ${D4P}" \
/dev/dm-4 \
"dm-snap-orig,,4,ro,0 ${D3P_sectors} snapshot-origin 8:1"
"dm-snap-orig,,4,ro,0 ${D4P_sectors} snapshot-origin 8:1"
launch_test \
"snap: snapshot-origin" \
"-hda ${D3P}" \
/dev/dm-0 \
"dm-snap,,,ro,0 ${D3P_sectors} snapshot 8:1 8:2 P 8"
launch_test \
"snap: snapshot-merge" \
"-hda ${D3P}" \
/dev/dm-0 \
"dm-snap,,,ro,0 ${D3P_sectors} snapshot-merge 8:1 8:2 P 8"
"-hda ${D4P}" \
/dev/dm-4 \
"dm-snap-orig,,4,ro,0 ${D4P_sectors} snapshot-origin 8:2"
# launch_test \
# "snap: snapshot" \
# "-hda ${D4P}" \
# /dev/dm-0 \
# "dm-snap,,,ro,0 ${D4P_sectors} snapshot 8:2 8:1 P 8"
#
# launch_test \
# "snap: snapshot-merge" \
# "-hda ${D4P}" \
# /dev/dm-0 \
# "dm-snap,,,ro,0 ${D4P_sectors} snapshot-merge 8:1 8:2 P 8"
}
mirror_tests()
{
launch_test \
"mirror: core invert" \
"-hda ${D4P}" \
/dev/dm-4 \
"dm-mirror-core,,4,ro,0 ${D4P_sectors} mirror core 1 1024 2 /dev/sda2 0 /dev/sda1 0 1 handle_errors"
launch_test \
"mirror: core" \
"-hda ${D4P}" \
/dev/dm-4 \
"dm-mirror-core,,4,ro,0 ${D4P_sectors} mirror core 1 1024 2 /dev/sda1 0 /dev/sda2 0 1 handle_errors"
launch_test \
"mirror: core" \
"-hda ${D3P}" \
"-hda ${D4P}" \
/dev/dm-4 \
"dm-mirror-core,,4,ro,0 ${D4P_sectors} mirror core 1 1024 2 /dev/sda1 0 /dev/sda2 0 1 handle_errors"
launch_test \
"mirror: core sda3 invert" \
"-hda ${D4P}" \
/dev/dm-4 \
"dm-mirror-core,,4,ro,0 ${D3P_sectors} mirror core 1 1024 2 /dev/sda1 0 /dev/sda2 0 1 handle_errors"
"dm-mirror-core,,4,ro,0 ${D4P_sectors} mirror core 1 1024 2 /dev/sda1 0 /dev/sda3 0 1 handle_errors"
launch_test \
"mirror: core sda3" \
"-hda ${D4P}" \
/dev/dm-4 \
"dm-mirror-core,,4,ro,0 ${D4P_sectors} mirror core 1 1024 2 /dev/sda1 0 /dev/sda3 0 1 handle_errors"
launch_test \
"mirror: disk" \
"-hda ${D3P}" \
"-hda ${D4P}" \
/dev/dm-4 \
"dm-mirror-disk,,4,ro,0 ${D3P_sectors} mirror disk 2 /dev/sda3 1024 2 /dev/sda1 0 /dev/sda2 0 1 handle_errors"
"dm-mirror-disk,,4,ro,0 ${D4P_sectors} mirror disk 2 /dev/sda3 1024 2 /dev/sda1 0 /dev/sda2 0 1 handle_errors"
}
cache_tests()
{
launch_test \
"cache: with minor" \
"-hda ${D3P}" \
"-hda ${D4P}" \
/dev/dm-4 \
"dm-cache,,4,ro,0 ${D4P_sectors} cache /dev/sda3 /dev/sda2 /dev/sda1 128 0 default 0"
}
era_tests()
{
launch_test \
"era: with minor" \
"-hda ${D4P}" \
/dev/dm-4 \
"dm-era,,4,ro,0 ${D4P_sectors} era /dev/sda1 /dev/sda2 128"
launch_test \
"era: with minor" \
"-hda ${D4P}" \
/dev/dm-4 \
"dm-cache,,4,ro,0 ${D3P_sectors} cache /dev/sda3 /dev/sda2 /dev/sda1 128 0 default 0"
"dm-era,,4,ro,0 ${D4P_sectors} era /dev/sda2 /dev/sda1 128"
launch_test \
"era: with minor" \
"-hda ${D4P}" \
/dev/dm-4 \
"dm-era,,4,ro,0 ${D4P_sectors} era /dev/sda1 /dev/sda2 128"
}
delay_tests()
{
launch_test \
"delay: delay rw 500ms" \
"-hda ${D4P}" \
/dev/dm-4 \
"dm-delay,,4,ro,0 ${D4P_sectors} delay /dev/sda1 0 500"
launch_test \
"delay: delay write only 500ms" \
"-hda ${D4P}" \
/dev/dm-4 \
"dm-delay,,4,ro,0 ${D4P_sectors} delay /dev/sda1 0 0 /dev/sda1 0 500"
}
DR41=disk-raid4-1.img
......@@ -700,17 +779,19 @@ create_crypt $DC1 DC1_
# Load disk info
source ${DC1}.info
# used by snap, mirror and cache
D3P=disk-3part-1.img
create_3part $D3P D3P_ 3part
# used by snap, mirror, cache and era
D4P=disk-4part-1.img
create_4part $D4P D4P_ 4part
# Load disk info
source ${D3P}.info
verity_tests
linear_parser_tests
striped_tests
crypt_tests
raid_tests
source ${D4P}.info
#verity_tests
#linear_parser_tests
#striped_tests
#crypt_tests
#raid_tests
#era_tests
snap_tests
mirror_tests
cache_tests
#mirror_tests
#cache_tests
delay_tests
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment