Commit c6eda941 authored by Michal Berger's avatar Michal Berger Committed by Jim Harris
Browse files

test/vhost: Make sure block devices are cleaned up after the test



Signed-off-by: default avatarMichal Berger <michalx.berger@intel.com>
Change-Id: Icdfa78572e5cbf1ed14e559b450e7d9ba98c585b
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7321


Tested-by: default avatarSPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: default avatarTomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-by: default avatarJim Harris <james.r.harris@intel.com>
Community-CI: Mellanox Build Bot
parent c5cba2c1
Loading
Loading
Loading
Loading
+13 −3
Original line number Diff line number Diff line
#!/usr/bin/env bash
set -xe

err_wipe() {
	[[ -n $devs ]] || return 0
	local _devs

	_devs=($devs) _devs=("${devs[@]/#//dev/}")

	umount "${_devs[@]}" || :
	wipefs --all "${_devs[@]}" || :
}

MAKE="make -j$(($(nproc) * 2))"

if [[ $1 == "spdk_vhost_scsi" ]]; then
@@ -19,7 +29,7 @@ fi

fs=$2

trap "exit 1" SIGINT SIGTERM EXIT
trap "err_wipe; exit 1" SIGINT SIGTERM EXIT

for fs in $fs; do
	for dev in $devs; do
@@ -65,9 +75,9 @@ for fs in $fs; do
	for dev in $devs; do
		umount /mnt/${dev}dir
		rm -rf /mnt/${dev}dir
		parted -s /dev/${dev} rm 1

		stats=($(cat /sys/block/$dev/stat))
		wipefs --all "/dev/$dev"

		echo ""
		echo "$dev stats"
		printf "READ  IO cnt: % 8u merges: % 8u sectors: % 8u ticks: % 8u\n" \
+2 −1
Original line number Diff line number Diff line
@@ -39,4 +39,5 @@ umount "$test_folder_name"
rm -rf "${testdir:?}/${test_folder_name:?}"

echo "INFO: Deleting partition"
echo -e "d\n1\nw" | fdisk /dev/$disk_name
# Zap the entire drive to make sure the partition table is removed as well
wipefs --all "/dev/$disk_name"