dm-cmd-test.sh 25.1 KB
Newer Older
Helen Koike's avatar
Helen Koike committed
1 2
#!/bin/bash

3 4 5 6
# shellcheck disable=SC2154
# shellcheck disable=SC1090

set -eo pipefail
Helen Koike's avatar
Helen Koike committed
7 8 9 10 11 12 13 14

if [ "$#" -ne 1 ]; then
    echo "Illegal number of parameters"
    echo "Usage: $0 <path-to-kernel-bzimage>"
    exit 1
fi
KERNEL=$1

15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30
finish() {
	ret=$?
	if [ "$ret" != "0" ]; then
		echo ""
		echo "Script couldn't be executed."
		echo "You might need to do the following cleanups by hand:"
		echo "	sudo losetup"
		echo "	sudo losetup -d /dev/loopX"
		echo "	sudo dmsetup ls"
		echo "	sudo dmsetup remove dm-XXXXXX"
	fi

	exit $ret
}
trap "finish" INT TERM EXIT

Helen Koike's avatar
Helen Koike committed
31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49
fill_rootfs()
{
	MSG=${1-""}
	# Add busybox and init script
	if [ ! -f busybox ]; then
		wget https://busybox.net/downloads/binaries/1.21.1/busybox-x86_64 -O busybox
		chmod +x busybox
	fi
	sudo mkdir dm-mount/bin
	sudo cp busybox dm-mount/bin/busybox

	sudo bash -c 'cat > dm-mount/bin/init.sh' <<- EOF
	#!/bin/busybox sh
	busybox echo "System Booted $MSG"
	busybox poweroff -f
	EOF
	sudo chmod +x dm-mount/bin/init.sh
}

50
create_4part()
Helen Koike's avatar
Helen Koike committed
51 52 53 54
{
	# Create disk
	DISK=$1
	PREFIX=$2
Helen Koike's avatar
Helen Koike committed
55 56
	TYPE=${3-snap}
	DM_DEV=dm-${TYPE}
57
	if [ -f "$DISK" ] && [ -f "${DISK}".info ]; then
Helen Koike's avatar
Helen Koike committed
58 59 60 61 62 63
		echo "$DISK already exist, not creating it"
		return
	else
		echo "creating $DISK"
	fi

64
	dd if=/dev/zero of="$DISK" bs=256M count=4
Helen Koike's avatar
Helen Koike committed
65 66 67 68
	# Partition 1
	sudo sgdisk -n 1:0:+200M -t 1:7f01 "$DISK"
	# Partition 2
	sudo sgdisk -n 2:0:+200M -t 2:7f01 "$DISK"
Helen Koike's avatar
Helen Koike committed
69
	# Partition 3
Helen Koike's avatar
Helen Koike committed
70
	sudo sgdisk -n 3:0:+200M -t 3:7f01 "$DISK"
71 72
	# Partition 4
	sudo sgdisk -n 4:0:+200M -t 4:7f01 "$DISK"
Helen Koike's avatar
Helen Koike committed
73

74
	LOOP_DEV=$(sudo losetup -fP --show "$DISK")
Helen Koike's avatar
Helen Koike committed
75
	sectors=$(sudo blockdev --getsz "${LOOP_DEV}"p1)
76
	sudo mkfs.ext4 -L ROOT-"${TYPE}"p1 "${LOOP_DEV}"p1
Helen Koike's avatar
Helen Koike committed
77
	mkdir -p dm-mount
78
	sudo mount "${LOOP_DEV}"p1 dm-mount
Helen Koike's avatar
Helen Koike committed
79

80 81 82 83 84 85
	fill_rootfs  "${TYPE} disk $DISK p1"

	# Umount disk/dm/loopback
	sudo umount dm-mount
	rm -r dm-mount

86
	sudo mkfs.ext4 -L ROOT-"${TYPE}"p2 "${LOOP_DEV}"p2
87
	mkdir -p dm-mount
88
	sudo mount "${LOOP_DEV}"p2 dm-mount
89 90

	fill_rootfs  "${TYPE} disk $DISK p2"
Helen Koike's avatar
Helen Koike committed
91 92 93 94

	# Umount disk/dm/loopback
	sudo umount dm-mount
	rm -r dm-mount
95 96 97 98 99
	sudo losetup -d "$LOOP_DEV"

	bash -c "cat > ${DISK}.info" <<- EOF
	${PREFIX}sectors=${sectors}
	EOF
Helen Koike's avatar
Helen Koike committed
100 101
}

Helen Koike's avatar
Helen Koike committed
102
create_raid()
Helen Koike's avatar
Helen Koike committed
103 104 105 106
{
	# Create disk
	DISK=$1
	PREFIX=$2
Helen Koike's avatar
Helen Koike committed
107 108
	TYPE=${3-raid4}
	DM_DEV=dm-raid
109
	if [ -f "$DISK" ] && [ -f "${DISK}".info ]; then
Helen Koike's avatar
Helen Koike committed
110 111 112 113 114 115
		echo "$DISK already exist, not creating it"
		return
	else
		echo "creating $DISK"
	fi

116
	dd if=/dev/zero of="$DISK" bs=256M count=4
Helen Koike's avatar
Helen Koike committed
117 118 119 120 121 122 123 124 125
	# 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"

126
	LOOP_DEV=$(sudo losetup -fP --show "$DISK")
Helen Koike's avatar
Helen Koike committed
127 128

	sectors=$(sudo blockdev --getsz "${LOOP_DEV}"p1)
129
	sectors=$(($(sudo blockdev --getsz "${LOOP_DEV}"p2) + "$sectors"))
Helen Koike's avatar
Helen Koike committed
130
	if [ "$TYPE" != "raid6_zr" ]; then
131
		sectors=$(($(sudo blockdev --getsz "${LOOP_DEV}"p3) + "$sectors"))
Helen Koike's avatar
Helen Koike committed
132
	fi
Helen Koike's avatar
Helen Koike committed
133

Helen Koike's avatar
Helen Koike committed
134
	table="0 $sectors raid ${TYPE} 3 64 region_size 1024 4 - ${LOOP_DEV}p1 - ${LOOP_DEV}p2 - ${LOOP_DEV}p3 - ${LOOP_DEV}p4"
Helen Koike's avatar
Helen Koike committed
135 136 137 138 139 140 141
	echo "$table"
	echo "$table" | sudo dmsetup create $DM_DEV

	echo "concise table (with loopback device)"
	sudo dmsetup table --concise /dev/mapper/$DM_DEV

	# Format
Helen Koike's avatar
Helen Koike committed
142
	sudo mkfs.ext4 -L ROOT-RAID /dev/mapper/$DM_DEV
Helen Koike's avatar
Helen Koike committed
143 144 145
	mkdir -p dm-mount
	sudo mount /dev/mapper/$DM_DEV dm-mount

Helen Koike's avatar
Helen Koike committed
146
	fill_rootfs "raid disk $DISK"
Helen Koike's avatar
Helen Koike committed
147 148 149 150 151

	# Umount disk/dm/loopback
	sudo umount dm-mount
	rm -r dm-mount
	sudo dmsetup remove $DM_DEV
152 153 154 155 156 157
	sudo losetup -d "$LOOP_DEV"

	bash -c "cat > ${DISK}.info" <<- EOF
	${PREFIX}sectors=${sectors}
	EOF

Helen Koike's avatar
Helen Koike committed
158 159
}

Helen Koike's avatar
Helen Koike committed
160 161 162 163 164 165
create_crypt()
{
	# Create disk
	DISK=$1
	PREFIX=$2
	DM_DEV=dm-crypt
166
	if [ -f "$DISK" ] && [ -f "${DISK}".info ]; then
Helen Koike's avatar
Helen Koike committed
167 168 169 170 171 172
		echo "$DISK already exist, not creating it"
		return
	else
		echo "creating $DISK"
	fi

173 174
	dd if=/dev/zero of="$DISK" bs=256M count=2
	LOOP_DEV=$(sudo losetup -fP --show "$DISK")
Helen Koike's avatar
Helen Koike committed
175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193
	sectors=$(sudo blockdev --getsz "${LOOP_DEV}")
	key=babebabebabebabebabebabebabebabebabebabebabebabebabebabebabebabe
	table="0 $sectors crypt aes-xts-plain64 $key 0 ${LOOP_DEV} 0 1 allow_discards"
	echo "$table" | sudo dmsetup create $DM_DEV

	echo "concise table (with loopback device)"
	sudo dmsetup table --concise /dev/mapper/$DM_DEV

	# Format
	sudo mkfs.ext4 -L ROOT-CRYPT /dev/mapper/$DM_DEV
	mkdir -p dm-mount
	sudo mount /dev/mapper/$DM_DEV dm-mount

	fill_rootfs  "crypt disk $DISK"

	# Umount disk/dm/loopback
	sudo umount dm-mount
	rm -r dm-mount
	sudo dmsetup remove $DM_DEV
194 195 196 197 198 199 200
	sudo losetup -d "$LOOP_DEV"

	bash -c "cat > ${DISK}.info" <<- EOF
	${PREFIX}sectors=${sectors}
	${PREFIX}key=${key}
	EOF

Helen Koike's avatar
Helen Koike committed
201 202
}

Helen Koike's avatar
Helen Koike committed
203 204 205 206 207 208
create_striped()
{
	# Create disk
	DISK=$1
	PREFIX=$2
	DM_DEV=dm-striped
209
	if [ -f "$DISK" ] && [ -f "${DISK}".info ]; then
Helen Koike's avatar
Helen Koike committed
210 211 212 213 214 215
		echo "$DISK already exist, not creating it"
		return
	else
		echo "creating $DISK"
	fi

216
	dd if=/dev/zero of="$DISK" bs=256M count=4
Helen Koike's avatar
Helen Koike committed
217
	# Partition 1
Helen Koike's avatar
Helen Koike committed
218
	sudo sgdisk -n 1:0:+200M -t 1:7f01 "$DISK"
Helen Koike's avatar
Helen Koike committed
219
	# Partition 2
Helen Koike's avatar
Helen Koike committed
220
	sudo sgdisk -n 2:0:+200M -t 2:7f01 "$DISK"
Helen Koike's avatar
Helen Koike committed
221
	# Partition 3
Helen Koike's avatar
Helen Koike committed
222
	sudo sgdisk -n 3:0:+200M -t 3:7f01 "$DISK"
Helen Koike's avatar
Helen Koike committed
223
	# Partition 4
Helen Koike's avatar
Helen Koike committed
224
	sudo sgdisk -n 4:0:+200M -t 4:7f01 "$DISK"
Helen Koike's avatar
Helen Koike committed
225

226
	LOOP_DEV=$(sudo losetup -fP --show "$DISK")
Helen Koike's avatar
Helen Koike committed
227 228

	sectors=$(sudo blockdev --getsz "${LOOP_DEV}"p1)
229 230 231
	sectors=$(($(sudo blockdev --getsz "${LOOP_DEV}"p2) + "$sectors"))
	sectors=$(($(sudo blockdev --getsz "${LOOP_DEV}"p3) + "$sectors"))
	sectors=$(($(sudo blockdev --getsz "${LOOP_DEV}"p4) + "$sectors"))
Helen Koike's avatar
Helen Koike committed
232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251

	PAGESIZE=$(getconf PAGESIZE)

	table="0 $sectors striped 4 $PAGESIZE ${LOOP_DEV}p1 0 ${LOOP_DEV}p2 0 ${LOOP_DEV}p3 0 ${LOOP_DEV}p4 0"
	echo "$table" | sudo dmsetup create $DM_DEV

	echo "concise table (with loopback device)"
	sudo dmsetup table --concise /dev/mapper/$DM_DEV

	# Format
	sudo mkfs.ext4 -L ROOT-STRIPED /dev/mapper/$DM_DEV
	mkdir -p dm-mount
	sudo mount /dev/mapper/$DM_DEV dm-mount

	fill_rootfs  "striped disk $DISK"

	# Umount disk/dm/loopback
	sudo umount dm-mount
	rm -r dm-mount
	sudo dmsetup remove $DM_DEV
252 253 254 255 256 257 258
	sudo losetup -d "$LOOP_DEV"

	bash -c "cat > ${DISK}.info" <<- EOF
	${PREFIX}sectors=${sectors}
	${PREFIX}PAGESIZE=${PAGESIZE}
	EOF

Helen Koike's avatar
Helen Koike committed
259 260
}

Helen Koike's avatar
Helen Koike committed
261 262 263 264 265 266
# Create a simple rootfs - target verity
create_verity()
{
	# Create disk
	DISK=$1
	PREFIX=$2
267
	if [ -f "$DISK" ] && [ -f "${DISK}".info ]; then
Helen Koike's avatar
Helen Koike committed
268 269 270 271 272 273
		echo "$DISK already exist, not creating it"
		return
	else
		echo "creating $DISK"
	fi

274
	dd if=/dev/zero of="$DISK" bs=512M count=3
Helen Koike's avatar
Helen Koike committed
275 276 277 278 279 280
	# Partition 1
	sudo sgdisk -n 1:0:+800M -t 1:7f01 "$DISK"
	# Partition 2
	sudo sgdisk -n 2:0:+500M -t 2:7f01 "$DISK"

	# Format and mount partition 1
281 282
	LOOP_DEV=$(sudo losetup -fP --show "$DISK")
	sudo mkfs.ext4 -L ROOT-VERITY "${LOOP_DEV}"p1
Helen Koike's avatar
Helen Koike committed
283
	mkdir -p dm-mount
284
	sudo mount "${LOOP_DEV}"p1 dm-mount
Helen Koike's avatar
Helen Koike committed
285 286 287 288 289 290 291 292

	fill_rootfs  "verity disk $DISK"

	# Umount partition
	sudo umount dm-mount
	rm -r dm-mount

	# Format verity
293 294 295 296 297 298 299
	tmpfile=$(mktemp)
	# shellcheck disable=SC2024
	sudo veritysetup format "${LOOP_DEV}"p1 "${LOOP_DEV}"p2 > "$tmpfile"
	sed -i -e '1d' "$tmpfile"
	sed -i -e 's/./\L&/g' "$tmpfile"
	sed -i -e 's/[[:space:]]\+/_/g' "$tmpfile"
	sed -i -e "s/:_/=/g" "$tmpfile"
Helen Koike's avatar
Helen Koike committed
300
	sectors=$(sudo blockdev --getsz "${LOOP_DEV}"p1)
301
	echo "sectors=${sectors}" >> "$tmpfile"
Helen Koike's avatar
Helen Koike committed
302 303

	# Add prefix to variables in file
304 305
	sed -i -e "s/^/$PREFIX/" "$tmpfile"
	mv "$tmpfile" "${DISK}".info
Helen Koike's avatar
Helen Koike committed
306 307

	# Umount loopback
308
	sudo losetup -d "$LOOP_DEV"
Helen Koike's avatar
Helen Koike committed
309 310
}

Helen Koike's avatar
Helen Koike committed
311 312 313 314 315 316 317
# Create a simple rootfs - target linear from 4 joined partitions
create_linear()
{
	# Create 1g disk
	DISK=$1
	PREFIX=$2
	DM_DEV=dm-linear
318
	if [ -f "$DISK" ] && [ -f "${DISK}".info ]; then
Helen Koike's avatar
Helen Koike committed
319 320 321 322 323 324
		echo "$DISK already exist, not creating it"
		return
	else
		echo "creating $DISK"
	fi

325
	dd if=/dev/zero of="$DISK" bs=512M count=2
Helen Koike's avatar
Helen Koike committed
326 327 328 329 330 331 332 333 334 335
	# Partition 1 - bootable
	sudo sgdisk -n 1:0:+16M -t 1:7f00 "$DISK"
	# Partition 2
	sudo sgdisk -n 2:0:+500M -t 2:7f01 "$DISK"
	# Partition 3
	sudo sgdisk -n 3:0:+100M -t 3:7f01 "$DISK"
	# Partition 4
	sudo sgdisk -n 4:0:+250M -t 4:7f01 "$DISK"

	# Create linear device
336 337 338 339 340 341 342 343
	LOOP_DEV=$(sudo losetup -fP --show "$DISK")
	S1=$(sudo blockdev --getsz "${LOOP_DEV}"p1)
	S2=$(sudo blockdev --getsz "${LOOP_DEV}"p2)
	S3=$(sudo blockdev --getsz "${LOOP_DEV}"p3)
	S4=$(sudo blockdev --getsz "${LOOP_DEV}"p4)

	tmpfile=$(mktemp)
	bash -c "cat > $tmpfile" <<- EOF
Helen Koike's avatar
Helen Koike committed
344 345 346 347
	P1_START=0
	P1_SIZE=$S1
	P2_START=$S1
	P2_SIZE=$S2
348
	P3_START=$((S1 + S2))
Helen Koike's avatar
Helen Koike committed
349
	P3_SIZE=$S3
350
	P4_START=$((S1 + S2 + S3))
Helen Koike's avatar
Helen Koike committed
351 352 353
	P4_SIZE=$S4
	EOF

354
	source "$tmpfile"
Helen Koike's avatar
Helen Koike committed
355 356

	# Add prefix to variables in file
357
	sed -i -e "s/^/$PREFIX/" "$tmpfile"
Helen Koike's avatar
Helen Koike committed
358

Helen Koike's avatar
Helen Koike committed
359
	table="$P1_START $P1_SIZE linear ${LOOP_DEV}p1 0
Helen Koike's avatar
Helen Koike committed
360 361
	$P2_START $P2_SIZE linear ${LOOP_DEV}p2 0
	$P3_START $P3_SIZE linear ${LOOP_DEV}p3 0
Helen Koike's avatar
Helen Koike committed
362 363
	$P4_START $P4_SIZE linear ${LOOP_DEV}p4 0"
	echo "$table" | sudo dmsetup create $DM_DEV
Helen Koike's avatar
Helen Koike committed
364 365 366 367 368 369 370 371 372

	echo "concise table (with loopback device)"
	sudo dmsetup table --concise /dev/mapper/$DM_DEV

	# Format
	sudo mkfs.ext4 -L ROOT-LINEAR /dev/mapper/$DM_DEV
	mkdir -p dm-mount
	sudo mount /dev/mapper/$DM_DEV dm-mount

Helen Koike's avatar
Helen Koike committed
373
	fill_rootfs  "linear disk $DISK"
Helen Koike's avatar
Helen Koike committed
374 375 376 377 378

	# Umount disk/dm/loopback
	sudo umount dm-mount
	rm -r dm-mount
	sudo dmsetup remove $DM_DEV
379 380 381
	sudo losetup -d "$LOOP_DEV"

	mv "$tmpfile" "${DISK}".info
Helen Koike's avatar
Helen Koike committed
382 383 384 385
}

launch_test()
{
386 387 388 389 390
	DESC="$1"
	KVM_PARAM="$2"
	ROOT_DEV="$3"
	DM_BOOT_PARAM="$4"
	EXPECT_RESULT="${5-0}"
Helen Koike's avatar
Helen Koike committed
391 392 393
	LOG_N="${LOG_N-0}"
	N_SUCCESS="${N_SUCCESS-0}"
	N_FAIL="${N_FAIL-0}"
Helen Koike's avatar
Helen Koike committed
394 395 396

	LOG_N=$((LOG_N+1))

Helen Koike's avatar
Helen Koike committed
397
	local args="loglevel=15 nokaslr printk.synchronous=1 console=ttyS0 dm-mod.create=\"${DM_BOOT_PARAM}\" root=${ROOT_DEV} ro init=/bin/init.sh"
Helen Koike's avatar
Helen Koike committed
398 399 400 401 402 403 404 405 406 407 408

	mkdir -p logs/${LOG_N}

	echo ""
	echo "=== Test $LOG_N ($(date)):" | tee logs/${LOG_N}/info
	echo "description:: $DESC" | tee -a logs/${LOG_N}/info
	echo "kernel: $KERNEL" | tee -a logs/${LOG_N}/info
	echo "kvm_param: $KVM_PARAM" | tee -a logs/${LOG_N}/info
	echo "dm_param: $DM_BOOT_PARAM" | tee -a logs/${LOG_N}/info
	echo "root_dev: $ROOT_DEV" | tee -a logs/${LOG_N}/info

409
	cmd="timeout --foreground 15 qemu-system-x86_64 --enable-kvm ${KVM_PARAM} -smp 1 -m 2g -nographic -kernel ${KERNEL} -append '${args}' > logs/${LOG_N}/qemu 2>&1"
Helen Koike's avatar
Helen Koike committed
410
	echo "$cmd" >> logs/${LOG_N}/info
411
	eval "$cmd" && ret=$? || ret=$?
Helen Koike's avatar
Helen Koike committed
412 413
	if [ "$ret" == "${EXPECT_RESULT}" ]; then
		echo "> Result: SUCCESS ($ret)"
Helen Koike's avatar
Helen Koike committed
414
		N_SUCCESS=$((N_SUCCESS+1))
Helen Koike's avatar
Helen Koike committed
415 416
	else
		echo "> Result: FAIL ($ret)"
Helen Koike's avatar
Helen Koike committed
417
		N_FAIL=$((N_FAIL+1))
Helen Koike's avatar
Helen Koike committed
418
	fi
Helen Koike's avatar
Helen Koike committed
419 420
	echo ""
	echo "Total successes: ${N_SUCCESS}. Total failures: ${N_FAIL}"
Helen Koike's avatar
Helen Koike committed
421 422
}

Helen Koike's avatar
Helen Koike committed
423 424
linear_parser_tests()
{
425
	launch_test \
Helen Koike's avatar
Helen Koike committed
426 427 428 429 430 431
	"linear: should fail (test the test)" \
	"-hda ${DL1}" \
	/dev/dm-0 \
	"dm-linear,,0,rw,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

432
	launch_test \
Helen Koike's avatar
Helen Koike committed
433 434 435 436 437
	"linear: with minor" \
	"-hda ${DL1}" \
	/dev/dm-4 \
	"dm-linear,,4,rw,$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"

438
	launch_test \
439 440 441 442 443
	"linear: big minor 255" \
	"-hda ${DL1}" \
	/dev/dm-255 \
	"dm-linear,,255,rw,$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"

444
	launch_test \
445 446 447 448 449
	"linear: big minor 256" \
	"-hda ${DL1}" \
	/dev/dm-0 \
	"dm-linear,,256,rw,$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"

450
	launch_test \
451 452 453 454 455
	"linear: big minor 257" \
	"-hda ${DL1}" \
	/dev/dm-1 \
	"dm-linear,,257,rw,$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"

456
	launch_test \
457 458 459 460 461 462
	"linear: huge minor" \
	"-hda ${DL1}" \
	/dev/dm-123123123123123123123 \
	"dm-linear,,123123123123123123123,rw,$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

463 464
	UUID=123123123123
	launch_test \
Helen Koike's avatar
Helen Koike committed
465 466 467 468 469
	"linear: with uuid (but booting from /dev/dm-0)" \
	"-hda ${DL1}" \
	"/dev/dm-0" \
	"dm-linear,${UUID},,rw,$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"

470
	launch_test \
Helen Koike's avatar
Helen Koike committed
471 472 473 474 475
	"linear: with device path" \
	"-hda ${DL1}" \
	/dev/dm-4 \
	"dm-linear,,4,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"

476
	launch_test \
Helen Koike's avatar
Helen Koike committed
477 478 479 480 481
	"linear: No minor" \
	"-hda ${DL1}" \
	/dev/dm-0 \
	"dm-linear,,,rw,$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"

482
	launch_test \
Helen Koike's avatar
Helen Koike committed
483 484 485 486 487
	"linear: minor to 0" \
	"-hda ${DL1}" \
	/dev/dm-0 \
	"dm-linear,,0,rw,$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"

488 489 490
	args="dm-linear1,,4,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"
	args+=";dm-linear2,,5,rw,$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 \
Helen Koike's avatar
Helen Koike committed
491 492 493 494 495
	"linear: multiple disks (boot sda)" \
	"-hda ${DL1} -hdb ${DL2} " \
	/dev/dm-4 \
	"$args"

496 497 498
	args="dm-linear1,,4,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"
	args+=";dm-linear2,,5,rw,$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 \
Helen Koike's avatar
Helen Koike committed
499 500 501 502 503
	"linear: multiple disks (boot sdb)" \
	"-hda ${DL1} -hdb ${DL2} " \
	/dev/dm-5 \
	"$args"

504 505 506
	args="   dm-linear  ,  ,   100  ,  rw  ,  $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 ,   , ,ro,   $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 \
Helen Koike's avatar
Helen Koike committed
507 508 509 510 511
	"linear: spaces" \
	"-hda ${DL1} -hdb ${DL2} " \
	/dev/dm-0 \
	"$args"

512
	launch_test \
Helen Koike's avatar
Helen Koike committed
513 514 515 516 517
	"linear: name with space" \
	"-hda ${DL1}" \
	/dev/dm-4 \
	"this is a name,,4,rw,$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" \

518
	launch_test \
Helen Koike's avatar
Helen Koike committed
519 520 521 522 523 524
	"linear: bad argument: bad name" \
	"-hda ${DL1}" \
	/dev/dm-4 \
	"/dev/asdf,,4,rw,$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

525
	launch_test \
Helen Koike's avatar
Helen Koike committed
526 527 528 529 530 531
	"linear: bad argument: bad minor" \
	"-hda ${DL1}" \
	/dev/dm-4 \
	"dm-linear,,BAD,rw,$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

532
	launch_test \
Helen Koike's avatar
Helen Koike committed
533 534 535 536 537 538
	"linear: bad argument: bad read/write" \
	"-hda ${DL1}" \
	/dev/dm-4 \
	"dm-linear,,,BAD,$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

539
	launch_test \
Helen Koike's avatar
Helen Koike committed
540 541 542 543 544 545
	"linear: bad argument: missing field" \
	"-hda ${DL1}" \
	/dev/dm-4 \
	"dm-linear,,,rw" \
	124

546
	launch_test \
547 548 549 550 551 552
	"linear: bad argument: missing field in table" \
	"-hda ${DL1}" \
	/dev/dm-4 \
	"dm-linear,,BAD,rw,$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_SIZE linear 8:4 0" \
	124

553
	launch_test \
Helen Koike's avatar
Helen Koike committed
554 555 556 557 558 559
	"linear: bad argument: empty" \
	"-hda ${DL1}" \
	/dev/dm-4 \
	"" \
	124

560
	launch_test \
Helen Koike's avatar
Helen Koike committed
561 562 563 564 565 566
	"linear: bad argument: negative minor number" \
	"-hda ${DL1}" \
	/dev/dm-4 \
	"dm-linear,,-4,ro,$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

567
	launch_test \
Helen Koike's avatar
Helen Koike committed
568 569 570 571 572 573
	"linear: ending with semi-colon (empty device)" \
	"-hda ${DL1}" \
	/dev/dm-4 \
	"dm-linear,,4,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;" \
	124

574 575 576 577 578 579 580 581 582 583 584 585
	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 \
Helen Koike's avatar
Helen Koike committed
586 587 588 589 590
	"linear: bad argument: too long name" \
	"-hda ${DL1}" \
	/dev/dm-4 \
	"$name,,4,rw,$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
Helen Koike's avatar
Helen Koike committed
591 592 593 594
}

verity_tests()
{
595
	launch_test \
Helen Koike's avatar
Helen Koike committed
596 597 598 599 600
	"verity: with minor" \
	"-hda ${DV1}" \
	/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"

601 602
	UUID=CRYPT-VERITY-543c115f6fb048e2bd7ecbb5960aae4d-verity-test
	launch_test \
Helen Koike's avatar
Helen Koike committed
603 604
	"verity: with uuid" \
	"-hda ${DV1}" \
Helen Koike's avatar
Helen Koike committed
605
	/dev/dm-4 \
Helen Koike's avatar
Helen Koike committed
606 607
	"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"
}
Helen Koike's avatar
Helen Koike committed
608 609 610

striped_tests()
{
611
	launch_test \
Helen Koike's avatar
Helen Koike committed
612 613 614 615 616
	"striped: with minor" \
	"-hda ${DS1}" \
	/dev/dm-4 \
	"dm-striped,,4,ro,0 $DS1_sectors striped 4 $DS1_PAGESIZE 8:1 0 8:2 0 8:3 0 8:4 0"

617 618
	UUID=123123123
	launch_test \
Helen Koike's avatar
Helen Koike committed
619 620 621 622 623
	"striped: with uuid" \
	"-hda ${DS1}" \
	/dev/dm-4 \
	"dm-striped,${UUID},4,ro,0 $DS1_sectors striped 4 $DS1_PAGESIZE 8:1 0 8:2 0 8:3 0 8:4 0"
}
Helen Koike's avatar
Helen Koike committed
624 625 626

crypt_tests()
{
627
	launch_test \
Helen Koike's avatar
Helen Koike committed
628 629 630 631 632
	"crypt: with minor" \
	"-hda ${DC1}" \
	/dev/dm-4 \
	"dm-crypt,,4,ro,0 $DC1_sectors crypt aes-xts-plain64 $DC1_key 0 /dev/sda 0 1 allow_discards"

633 634
	UUID=123123123
	launch_test \
Helen Koike's avatar
Helen Koike committed
635 636 637 638 639
	"crypt: with uuid" \
	"-hda ${DC1}" \
	/dev/dm-4 \
	"dm-crypt,${UUID},4,ro,0 $DC1_sectors crypt aes-xts-plain64 $DC1_key 0 /dev/sda 0 1 allow_discards"

640
	launch_test \
Helen Koike's avatar
Helen Koike committed
641 642 643 644 645 646 647
	"crypt: wrong key" \
	"-hda ${DC1}" \
	/dev/dm-4 \
	"dm-crypt,,4,ro,0 $DC1_sectors crypt aes-xts-plain64 123123123123 0 /dev/sda 0 1 allow_discards" \
	124
}

Helen Koike's avatar
Helen Koike committed
648 649
raid_tests()
{
650 651
	# raid is not supported, should fail
	launch_test \
Helen Koike's avatar
Helen Koike committed
652 653 654
	"raid4: with minor" \
	"-hda ${DR41}" \
	/dev/dm-4 \
655 656
	"dm-raid,,4,ro,0 $DR41_sectors raid raid4 3 64 region_size 1024 4 - 8:1 - 8:2 - 8:3 - 8:4" \
	124
Helen Koike's avatar
Helen Koike committed
657

658
	launch_test \
Helen Koike's avatar
Helen Koike committed
659 660 661
	"raid5: no minor" \
	"-hda ${DR51}" \
	/dev/dm-0 \
662 663
	"dm-raid,,,ro,0 $DR51_sectors raid raid5_ls 3 64 region_size 1024 4 - 8:1 - 8:2 - 8:3 - 8:4" \
	124
Helen Koike's avatar
Helen Koike committed
664

665
	launch_test \
Helen Koike's avatar
Helen Koike committed
666 667 668
	"raid6: no minor" \
	"-hda ${DR61}" \
	/dev/dm-0 \
669 670
	"dm-raid,,,ro,0 $DR61_sectors raid raid6_zr 3 64 region_size 1024 4 - 8:1 - 8:2 - 8:3 - 8:4" \
	124
Helen Koike's avatar
Helen Koike committed
671 672
}

Helen Koike's avatar
Helen Koike committed
673 674
snap_tests()
{
675
	launch_test \
Helen Koike's avatar
Helen Koike committed
676
	"snap: snapshot-origin" \
677
	"-hda ${D4P}" \
Helen Koike's avatar
Helen Koike committed
678
	/dev/dm-4 \
679
	"dm-snap-orig,,4,ro,0 ${D4P_sectors} snapshot-origin 8:1"
Helen Koike's avatar
Helen Koike committed
680

681
	launch_test \
Helen Koike's avatar
Helen Koike committed
682
	"snap: snapshot-origin" \
683 684 685 686
	"-hda ${D4P}" \
	/dev/dm-4 \
	"dm-snap-orig,,4,ro,0 ${D4P_sectors} snapshot-origin 8:2"

687 688
	# snapshot and snapshot-merge is not supported, should fail
	launch_test \
689
	"snap: snapshot" \
690
	"-hda ${D4P}" \
691 692 693
	/dev/dm-0 \
	"dm-snap,,,ro,0 ${D4P_sectors} snapshot 8:2 8:1 P 8" \
	124
694

695
	launch_test \
696
	"snap: snapshot-merge" \
697
	"-hda ${D4P}" \
698 699 700 701
	/dev/dm-0 \
	"dm-snap,,,ro,0 ${D4P_sectors} snapshot-merge 8:1 8:2 P 8" \
	124
}
702

703 704
mirror_tests()
{
705 706
	# mirror is not supported, should fail
	launch_test \
Helen Koike's avatar
Helen Koike committed
707
	"mirror: core" \
708 709
	"-hda ${D4P}" \
	/dev/dm-4 \
710 711
	"dm-mirror-core,,4,ro,0 ${D4P_sectors} mirror core 1 1024 2 /dev/sda1 0 /dev/sda2 0 1 handle_errors" \
	124
712

713
	launch_test \
714 715 716
	"mirror: core sda3" \
	"-hda ${D4P}" \
	/dev/dm-4 \
717 718
	"dm-mirror-core,,4,ro,0 ${D4P_sectors} mirror core 1 1024 2 /dev/sda1 0 /dev/sda3 0 1 handle_errors" \
	124
719

720
	launch_test \
Helen Koike's avatar
Helen Koike committed
721
	"mirror: disk" \
722
	"-hda ${D4P}" \
Helen Koike's avatar
Helen Koike committed
723
	/dev/dm-4 \
724 725
	"dm-mirror-disk,,4,ro,0 ${D4P_sectors} mirror disk 2 /dev/sda3 1024 2 /dev/sda1 0 /dev/sda2 0 1 handle_errors" \
	124
Helen Koike's avatar
Helen Koike committed
726 727 728 729
}

cache_tests()
{
730 731
	# cache is not supported, should fail
	launch_test \
Helen Koike's avatar
Helen Koike committed
732
	"cache: with minor" \
733 734
	"-hda ${D4P}" \
	/dev/dm-4 \
735 736
	"dm-cache,,4,ro,0 ${D4P_sectors} cache /dev/sda3 /dev/sda2 /dev/sda1 128 0 default 0" \
	124
737 738 739 740
}

era_tests()
{
741 742
	# era is not supported, should fail
	launch_test \
743 744 745
	"era: with minor" \
	"-hda ${D4P}" \
	/dev/dm-4 \
746 747
	"dm-era,,4,ro,0 ${D4P_sectors} era /dev/sda1 /dev/sda2 128" \
	124
748

749
	launch_test \
750 751
	"era: with minor" \
	"-hda ${D4P}" \
Helen Koike's avatar
Helen Koike committed
752
	/dev/dm-4 \
753 754
	"dm-era,,4,ro,0 ${D4P_sectors} era /dev/sda2 /dev/sda1 128" \
	124
755

756
	launch_test \
757 758 759
	"era: with minor" \
	"-hda ${D4P}" \
	/dev/dm-4 \
760 761
	"dm-era,,4,ro,0 ${D4P_sectors} era /dev/sda1 /dev/sda2 128" \
	124
762 763 764 765
}

delay_tests()
{
766
	launch_test \
767 768 769 770 771
	"delay: delay rw 500ms" \
	"-hda ${D4P}" \
	/dev/dm-4 \
	"dm-delay,,4,ro,0 ${D4P_sectors} delay /dev/sda1 0 500"

772
	launch_test \
773 774 775 776
	"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"
Helen Koike's avatar
Helen Koike committed
777 778
}

Helen Koike's avatar
Helen Koike committed
779 780
misc_tests()
{
781 782 783 784 785 786 787 788 789
	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"
	args+=";dm-linear2,,2,rw,$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,,3,ro,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,,4,rw,0 $DS1_sectors striped 4 $DS1_PAGESIZE /dev/sdd1 0 /dev/sdd2 0 /dev/sdd3 0 /dev/sdd4 0"
	args+=";dm-crypt,,5,ro,0 $DC1_sectors crypt aes-xts-plain64 $DC1_key 0 /dev/vda 0 1 allow_discards"
	args+=";dm-snap-orig,,6,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 \
Helen Koike's avatar
Helen Koike committed
790 791 792 793 794
	"misc: multi devices: boot 1" \
	"$disks" \
	/dev/dm-1 \
	"$args"

795
	launch_test \
Helen Koike's avatar
Helen Koike committed
796 797 798 799 800
	"misc: multi devices: boot 2" \
	"$disks" \
	/dev/dm-2 \
	"$args"

801
	launch_test \
Helen Koike's avatar
Helen Koike committed
802 803 804 805 806
	"misc: multi devices: boot 3" \
	"$disks" \
	/dev/dm-3 \
	"$args"

807
	launch_test \
Helen Koike's avatar
Helen Koike committed
808 809 810 811 812
	"misc: multi devices: boot 4" \
	"$disks" \
	/dev/dm-4 \
	"$args"

813
	launch_test \
Helen Koike's avatar
Helen Koike committed
814 815 816 817 818
	"misc: multi devices: boot 5" \
	"$disks" \
	/dev/dm-5 \
	"$args"

819
	launch_test \
Helen Koike's avatar
Helen Koike committed
820 821 822 823 824 825
	"misc: multi devices: boot 6" \
	"$disks" \
	/dev/dm-6 \
	"$args"
}

Helen Koike's avatar
Helen Koike committed
826
DR41=disk-raid4-1.img
Helen Koike's avatar
Helen Koike committed
827
create_raid $DR41 DR41_ raid4
Helen Koike's avatar
Helen Koike committed
828 829 830
# Load disk info
source ${DR41}.info

Helen Koike's avatar
Helen Koike committed
831 832 833 834 835 836 837 838 839 840
DR51=disk-raid5-1.img
create_raid $DR51 DR51_ raid5_ls
# Load disk info
source ${DR51}.info

DR61=disk-raid6-1.img
create_raid $DR61 DR61_ raid6_zr
# Load disk info
source ${DR61}.info

Helen Koike's avatar
Helen Koike committed
841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865
DS1=disk-striped-1.img
create_striped $DS1 DS1_
# Load disk info
source ${DS1}.info

DL1=disk-linear-1.img
create_linear $DL1 DL1_
# Load disk info
source ${DL1}.info

DL2=disk-linear-2.img
create_linear $DL2 DL2_
# Load disk info
source ${DL2}.info

DV1=disk-verity-1.img
create_verity $DV1 DV1_
# Load disk info
source ${DV1}.info

DC1=disk-crypt-1.img
create_crypt $DC1 DC1_
# Load disk info
source ${DC1}.info

866 867 868
# used by snap, mirror, cache and era
D4P=disk-4part-1.img
create_4part $D4P D4P_ 4part
Helen Koike's avatar
Helen Koike committed
869
# Load disk info
870 871
source ${D4P}.info

872 873 874 875 876 877
verity_tests
linear_parser_tests
striped_tests
crypt_tests
raid_tests
era_tests
Helen Koike's avatar
Helen Koike committed
878
snap_tests
879 880
mirror_tests
cache_tests
881
delay_tests
Helen Koike's avatar
Helen Koike committed
882
misc_tests