Commit cf32b199 authored by Helen Koike's avatar Helen Koike

add shim tests for chrome

parent 9ff8a106
......@@ -388,13 +388,20 @@ launch_test()
ROOT_DEV="$3"
DM_BOOT_PARAM="$4"
EXPECT_RESULT="${5-0}"
CHROME_TEST="${6-0}"
LOG_N="${LOG_N-0}"
N_SUCCESS="${N_SUCCESS-0}"
N_FAIL="${N_FAIL-0}"
LOG_N=$((LOG_N+1))
local args="loglevel=15 nokaslr printk.synchronous=1 console=ttyS0 dm-mod.create=\"${DM_BOOT_PARAM}\" root=${ROOT_DEV} ro init=/bin/init.sh"
if [ "$CHROME_TEST" == "0" ]; then
arg_dm="dm-mod.create"
else
arg_dm="dm"
fi
local args="loglevel=15 nokaslr printk.synchronous=1 console=ttyS0 ${arg_dm}=\"${DM_BOOT_PARAM}\" root=${ROOT_DEV} ro init=/bin/init.sh"
mkdir -p logs/${LOG_N}
......@@ -590,6 +597,153 @@ linear_parser_tests()
124
}
linear_parser_tests_chrome()
{
launch_test \
"linear: should fail (test the test)" \
"-hda ${DL1}" \
/dev/dm-0 \
"dm-linear none ro 4,0 0 linear 8:1 0,0 0 linear 8:2 0,0 0 linear 8:3 0,0 0 linear 8:4 0" \
124 \
1
launch_test \
"linear: with minor" \
"-hda ${DL1}" \
/dev/dm-0 \
"dm-linear none rw 4,$DL1_P1_START $DL1_P1_SIZE linear 8:1 0,$DL1_P2_START $DL1_P2_SIZE linear 8:2 0,$DL1_P3_START $DL1_P3_SIZE linear 8:3 0,$DL1_P4_START $DL1_P4_SIZE linear 8:4 0" \
0 \
1
UUID=123123123123
launch_test \
"linear: with uuid (but booting from /dev/dm-0)" \
"-hda ${DL1}" \
"/dev/dm-0" \
"dm-linear ${UUID} rw 4,$DL1_P1_START $DL1_P1_SIZE linear 8:1 0,$DL1_P2_START $DL1_P2_SIZE linear 8:2 0,$DL1_P3_START $DL1_P3_SIZE linear 8:3 0,$DL1_P4_START $DL1_P4_SIZE linear 8:4 0" \
0 \
1
launch_test \
"linear: with device path" \
"-hda ${DL1}" \
/dev/dm-0 \
"dm-linear none rw 4,$DL1_P1_START $DL1_P1_SIZE linear /dev/sda1 0,$DL1_P2_START $DL1_P2_SIZE linear /dev/sda2 0,$DL1_P3_START $DL1_P3_SIZE linear /dev/sda3 0,$DL1_P4_START $DL1_P4_SIZE linear /dev/sda4 0" \
0 \
1
args="2 dm-linear1 none rw 4,$DL1_P1_START $DL1_P1_SIZE linear /dev/sda1 0,$DL1_P2_START $DL1_P2_SIZE linear /dev/sda2 0,$DL1_P3_START $DL1_P3_SIZE linear /dev/sda3 0,$DL1_P4_START $DL1_P4_SIZE linear /dev/sda4 0"
args+=",dm-linear2 none rw 4,$DL2_P1_START $DL2_P1_SIZE linear /dev/sdb1 0,$DL2_P2_START $DL2_P2_SIZE linear /dev/sdb2 0,$DL2_P3_START $DL2_P3_SIZE linear /dev/sdb3 0,$DL2_P4_START $DL2_P4_SIZE linear /dev/sdb4 0"
launch_test \
"linear: multiple disks (boot sda)" \
"-hda ${DL1} -hdb ${DL2} " \
/dev/dm-0 \
"$args" \
0 \
1
args="2 dm-linear1 none rw 4,$DL1_P1_START $DL1_P1_SIZE linear /dev/sda1 0,$DL1_P2_START $DL1_P2_SIZE linear /dev/sda2 0,$DL1_P3_START $DL1_P3_SIZE linear /dev/sda3 0,$DL1_P4_START $DL1_P4_SIZE linear /dev/sda4 0"
args+=",dm-linear2 none rw 4,$DL2_P1_START $DL2_P1_SIZE linear /dev/sdb1 0,$DL2_P2_START $DL2_P2_SIZE linear /dev/sdb2 0,$DL2_P3_START $DL2_P3_SIZE linear /dev/sdb3 0,$DL2_P4_START $DL2_P4_SIZE linear /dev/sdb4 0"
launch_test \
"linear: multiple disks (boot sdb)" \
"-hda ${DL1} -hdb ${DL2} " \
/dev/dm-1 \
"$args" \
0 \
1
args=" dm-linear none rw 4 , $DL1_P1_START $DL1_P1_SIZE linear 8:1 0 , $DL1_P2_START $DL1_P2_SIZE linear 8:2 0 , $DL1_P3_START $DL1_P3_SIZE linear 8:3 0 , $DL1_P4_START $DL1_P4_SIZE linear 8:4 0 "
args+=" , dm-linear2 none ro 4 , $DL2_P1_START $DL2_P1_SIZE linear /dev/sdb1 0,$DL2_P2_START $DL2_P2_SIZE linear /dev/sdb2 0,$DL2_P3_START $DL2_P3_SIZE linear /dev/sdb3 0,$DL2_P4_START $DL2_P4_SIZE linear /dev/sdb4 0 "
launch_test \
"linear: spaces" \
"-hda ${DL1} -hdb ${DL2} " \
/dev/dm-0 \
"$args" \
0 \
1
launch_test \
"linear: name with space" \
"-hda ${DL1}" \
/dev/dm-0 \
"this is a name none rw 4,$DL1_P1_START $DL1_P1_SIZE linear 8:1 0,$DL1_P2_START $DL1_P2_SIZE linear 8:2 0,$DL1_P3_START $DL1_P3_SIZE linear 8:3 0,$DL1_P4_START $DL1_P4_SIZE linear 8:4 0" \
124 \
1
launch_test \
"linear: bad argument: bad name" \
"-hda ${DL1}" \
/dev/dm-0 \
"/dev/asdf none rw 4,$DL1_P1_START $DL1_P1_SIZE linear 8:1 0,$DL1_P2_START $DL1_P2_SIZE linear 8:2 0,$DL1_P3_START $DL1_P3_SIZE linear 8:3 0,$DL1_P4_START $DL1_P4_SIZE linear 8:4 0" \
124 \
1
launch_test \
"linear: bad argument: bad read/write" \
"-hda ${DL1}" \
/dev/dm-0 \
"dm-linear none BAD 4,$DL1_P1_START $DL1_P1_SIZE linear 8:1 0,$DL1_P2_START $DL1_P2_SIZE linear 8:2 0,$DL1_P3_START $DL1_P3_SIZE linear 8:3 0,$DL1_P4_START $DL1_P4_SIZE linear 8:4 0" \
124 \
1
launch_test \
"linear: bad argument: missing field" \
"-hda ${DL1}" \
/dev/dm-0 \
"dm-linear none rw 0" \
124 \
0 \
1
launch_test \
"linear: bad argument: empty targets" \
"-hda ${DL1}" \
/dev/dm-0 \
"dm-linear none rw 0," \
124 \
0 \
1
launch_test \
"linear: bad argument: empty" \
"-hda ${DL1}" \
/dev/dm-0 \
"" \
124 \
0 \
1
launch_test \
"linear: ending with colon (empty device)" \
"-hda ${DL1}" \
/dev/dm-0 \
"dm-linear none rw 4,$DL1_P1_START $DL1_P1_SIZE linear /dev/sda1 0,$DL1_P2_START $DL1_P2_SIZE linear /dev/sda2 0,$DL1_P3_START $DL1_P3_SIZE linear /dev/sda3 0,$DL1_P4_START $DL1_P4_SIZE linear /dev/sda4 0," \
124 \
0 \
1
name="this is a really loooooooooooong name for a deviceeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee - reaaaaaaaaaly loooooooooooooooooooooooooong nnnnnnnnnnnnnnnnnnnname"
name+=" this is a really loooooooooooong name for a deviceeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee - reaaaaaaaaaly loooooooooooooooooooooooooong nnnnnnnnnnnnnnnnnnnname"
name+=" this is a really loooooooooooong name for a deviceeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee - reaaaaaaaaaly loooooooooooooooooooooooooong nnnnnnnnnnnnnnnnnnnname"
name+=" this is a really loooooooooooong name for a deviceeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee - reaaaaaaaaaly loooooooooooooooooooooooooong nnnnnnnnnnnnnnnnnnnname"
name+=" this is a really loooooooooooong name for a deviceeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee - reaaaaaaaaaly loooooooooooooooooooooooooong nnnnnnnnnnnnnnnnnnnname"
name+=" this is a really loooooooooooong name for a deviceeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee - reaaaaaaaaaly loooooooooooooooooooooooooong nnnnnnnnnnnnnnnnnnnname"
name+=" this is a really loooooooooooong name for a deviceeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee - reaaaaaaaaaly loooooooooooooooooooooooooong nnnnnnnnnnnnnnnnnnnname"
name+=" this is a really loooooooooooong name for a deviceeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee - reaaaaaaaaaly loooooooooooooooooooooooooong nnnnnnnnnnnnnnnnnnnname"
name+=" this is a really loooooooooooong name for a deviceeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee - reaaaaaaaaaly loooooooooooooooooooooooooong nnnnnnnnnnnnnnnnnnnname"
name+=" this is a really loooooooooooong name for a deviceeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee - reaaaaaaaaaly loooooooooooooooooooooooooong nnnnnnnnnnnnnnnnnnnname"
name+=" this is a really loooooooooooong name for a deviceeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee - reaaaaaaaaaly loooooooooooooooooooooooooong nnnnnnnnnnnnnnnnnnnname"
launch_test \
"linear: bad argument: too long name" \
"-hda ${DL1}" \
/dev/dm-0 \
"$name none rw 4,$DL1_P1_START $DL1_P1_SIZE linear 8:1 0,$DL1_P2_START $DL1_P2_SIZE linear 8:2 0,$DL1_P3_START $DL1_P3_SIZE linear 8:3 0,$DL1_P4_START $DL1_P4_SIZE linear 8:4 0" \
124 \
0 \
1
}
verity_tests()
{
launch_test \
......@@ -606,6 +760,26 @@ verity_tests()
"dm-verity,${UUID},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"
}
verity_tests_chrome()
{
launch_test \
"verity: with minor" \
"-hda ${DV1}" \
/dev/dm-0 \
"1 dm-verity none ro 1,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" \
0 \
1
UUID=CRYPT-VERITY-543c115f6fb048e2bd7ecbb5960aae4d-verity-test
launch_test \
"verity: with uuid" \
"-hda ${DV1}" \
/dev/dm-0 \
"dm-verity ${UUID} 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" \
0 \
1
}
striped_tests()
{
launch_test \
......@@ -622,6 +796,26 @@ striped_tests()
"dm-striped,${UUID},4,ro,0 $DS1_sectors striped 4 $DS1_PAGESIZE 8:1 0 8:2 0 8:3 0 8:4 0"
}
striped_tests_chrome()
{
launch_test \
"striped: no uuid" \
"-hda ${DS1}" \
/dev/dm-0 \
"dm-striped none ro,0 $DS1_sectors striped 4 $DS1_PAGESIZE 8:1 0 8:2 0 8:3 0 8:4 0" \
0 \
1
UUID=123123123
launch_test \
"striped: with uuid" \
"-hda ${DS1}" \
/dev/dm-0 \
"dm-striped ${UUID} ro,0 $DS1_sectors striped 4 $DS1_PAGESIZE 8:1 0 8:2 0 8:3 0 8:4 0" \
0 \
1
}
crypt_tests()
{
launch_test \
......@@ -645,6 +839,35 @@ crypt_tests()
124
}
crypt_tests_chrome()
{
launch_test \
"crypt: without uuid" \
"-hda ${DC1}" \
/dev/dm-0 \
"dm-crypt none ro,0 $DC1_sectors crypt aes-xts-plain64 $DC1_key 0 /dev/sda 0 1 allow_discards" \
0 \
1
UUID=123123123
launch_test \
"crypt: with uuid" \
"-hda ${DC1}" \
/dev/dm-0 \
"dm-crypt ${UUID} ro,0 $DC1_sectors crypt aes-xts-plain64 $DC1_key 0 /dev/sda 0 1 allow_discards" \
0 \
1
launch_test \
"crypt: wrong key" \
"-hda ${DC1}" \
/dev/dm-0 \
"dm-crypt none ,ro,0 $DC1_sectors crypt aes-xts-plain64 123123123123 0 /dev/sda 0 1 allow_discards" \
124 \
0 \
1
}
raid_tests()
{
# raid is not supported, should fail
......@@ -700,6 +923,44 @@ snap_tests()
124
}
snap_tests_chrome()
{
launch_test \
"snap: snapshot-origin" \
"-hda ${D4P}" \
/dev/dm-0 \
"dm-snap-orig none ro,0 ${D4P_sectors} snapshot-origin 8:1" \
0 \
1
launch_test \
"snap: snapshot-origin" \
"-hda ${D4P}" \
/dev/dm-0 \
"dm-snap-orig none ro,0 ${D4P_sectors} snapshot-origin 8:2" \
0 \
1
# snapshot and snapshot-merge is not supported, should fail
launch_test \
"snap: snapshot" \
"-hda ${D4P}" \
/dev/dm-0 \
"dm-snap none ro,0 ${D4P_sectors} snapshot 8:2 8:1 P 8" \
124 \
0 \
1
launch_test \
"snap: snapshot-merge" \
"-hda ${D4P}" \
/dev/dm-0 \
"dm-snap none ro,0 ${D4P_sectors} snapshot-merge 8:1 8:2 P 8" \
124 \
0 \
1
}
mirror_tests()
{
# mirror is not supported, should fail
......@@ -776,6 +1037,25 @@ delay_tests()
"dm-delay,,4,ro,0 ${D4P_sectors} delay /dev/sda1 0 0 /dev/sda1 0 500"
}
delay_tests_chrome()
{
launch_test \
"delay: delay rw 500ms" \
"-hda ${D4P}" \
/dev/dm-0 \
"dm-delay none ro,0 ${D4P_sectors} delay /dev/sda1 0 500" \
0 \
1
launch_test \
"delay: delay write only 500ms" \
"-hda ${D4P}" \
/dev/dm-0 \
"dm-delay none ro,0 ${D4P_sectors} delay /dev/sda1 0 0 /dev/sda1 0 500" \
0 \
1
}
misc_tests()
{
args="dm-linear1,,1,rw,$DL1_P1_START $DL1_P1_SIZE linear /dev/sda1 0,$DL1_P2_START $DL1_P2_SIZE linear /dev/sda2 0,$DL1_P3_START $DL1_P3_SIZE linear /dev/sda3 0,$DL1_P4_START $DL1_P4_SIZE linear /dev/sda4 0"
......@@ -823,6 +1103,65 @@ misc_tests()
"$args"
}
misc_tests_chrome()
{
args="6 dm-linear1 none rw 4,$DL1_P1_START $DL1_P1_SIZE linear /dev/sda1 0,$DL1_P2_START $DL1_P2_SIZE linear /dev/sda2 0,$DL1_P3_START $DL1_P3_SIZE linear /dev/sda3 0,$DL1_P4_START $DL1_P4_SIZE linear /dev/sda4 0"
args+=",dm-linear2 none rw 4,$DL2_P1_START $DL2_P1_SIZE linear /dev/sdb1 0,$DL2_P2_START $DL2_P2_SIZE linear /dev/sdb2 0,$DL2_P3_START $DL2_P3_SIZE linear /dev/sdb3 0,$DL2_P4_START $DL2_P4_SIZE linear /dev/sdb4 0"
args+=",dm-verity none ro 1,0 $DV1_sectors verity $DV1_hash_type /dev/sdc1 /dev/sdc2 $DV1_data_block_size $DV1_hash_block_size $DV1_data_blocks 1 $DV1_hash_algorithm $DV1_root_hash $DV1_salt"
args+=",dm-striped none rw,0 $DS1_sectors striped 4 $DS1_PAGESIZE /dev/sdd1 0 /dev/sdd2 0 /dev/sdd3 0 /dev/sdd4 0"
args+=",dm-crypt none ro,0 $DC1_sectors crypt aes-xts-plain64 $DC1_key 0 /dev/vda 0 1 allow_discards"
args+=",dm-snap-orig none ro,0 ${D4P_sectors} snapshot-origin /dev/vdb1"
disks="-hda ${DL1} -hdb ${DL2} -hdc ${DV1} -hdd ${DS1} -drive file=${DC1},if=virtio -drive file=${D4P},if=virtio"
launch_test \
"misc: multi devices: boot 0" \
"$disks" \
/dev/dm-0 \
"$args" \
0 \
1
launch_test \
"misc: multi devices: boot 1" \
"$disks" \
/dev/dm-1 \
"$args" \
0 \
1
launch_test \
"misc: multi devices: boot 2" \
"$disks" \
/dev/dm-2 \
"$args" \
0 \
1
launch_test \
"misc: multi devices: boot 3" \
"$disks" \
/dev/dm-3 \
"$args" \
0 \
1
launch_test \
"misc: multi devices: boot 4" \
"$disks" \
/dev/dm-4 \
"$args" \
0 \
1
launch_test \
"misc: multi devices: boot 5" \
"$disks" \
/dev/dm-5 \
"$args" \
0 \
1
}
DR41=disk-raid4-1.img
create_raid $DR41 DR41_ raid4
# Load disk info
......@@ -870,13 +1209,20 @@ create_4part $D4P D4P_ 4part
source ${D4P}.info
verity_tests
verity_tests_chrome
linear_parser_tests
linear_parser_tests_chrome
striped_tests
striped_tests_chrome
crypt_tests
crypt_tests_chrome
raid_tests
era_tests
snap_tests
snap_tests_chrome
mirror_tests
cache_tests
delay_tests
delay_tests_chrome
misc_tests
misc_tests_chrome
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