Commit d2d7a0ee authored by Helen Koike's avatar Helen Koike

Add test case when dm table fail

Add a second disk. The system should boot the second disk if creating a
dm device fails
parent 9ff8a106
......@@ -308,6 +308,36 @@ create_verity()
sudo losetup -d "$LOOP_DEV"
}
# Create a simple rootfs - not device mapped
create_simple-hd()
{
# Create 1g disk
DISK=$1
PREFIX=$2
if [ -f "$DISK" ] ; then
echo "$DISK already exist, not creating it"
return
else
echo "creating $DISK"
fi
dd if=/dev/zero of="$DISK" bs=512M count=2
# Create linear device
LOOP_DEV=$(sudo losetup -fP --show "$DISK")
# Format
sudo mkfs.ext4 -L ROOT-LINEAR "$LOOP_DEV"
mkdir -p dm-mount
sudo mount "$LOOP_DEV" dm-mount
fill_rootfs "simple-hd disk $DISK"
# Umount disk/dm/loopback
sudo umount dm-mount
rm -r dm-mount
}
# Create a simple rootfs - target linear from 4 joined partitions
create_linear()
{
......@@ -598,6 +628,12 @@ verity_tests()
/dev/dm-4 \
"dm-verity,,4,ro,0 $DV1_sectors verity $DV1_hash_type 8:1 8:2 $DV1_data_block_size $DV1_hash_block_size $DV1_data_blocks 1 $DV1_hash_algorithm $DV1_root_hash $DV1_salt"
launch_test \
"verity: table fail" \
"-hda ${DV1} -hdb ${DHD1}" \
/dev/sdb \
"dm-verity,,4,ro,0 $DV1_sectors verity payload=ROOT_DEV hashtree=HASH_DEV hashstart=$DV1_sectors alg=$DV1_hash_algorithm root_hexdigest=$DV1_root_hash salt=$DV1_salt"
UUID=CRYPT-VERITY-543c115f6fb048e2bd7ecbb5960aae4d-verity-test
launch_test \
"verity: with uuid" \
......@@ -869,6 +905,9 @@ create_4part $D4P D4P_ 4part
# Load disk info
source ${D4P}.info
DHD1=disk-simple-hd-1.img
create_simple-hd $DHD1
verity_tests
linear_parser_tests
striped_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