Commit 962671f7 authored by Michal Berger's avatar Michal Berger Committed by Konrad Sztyber
Browse files

test/vhost: Create wrapper around wipefs



Call sync each time, as an extra step, to make sure all the writes on the underlying device completed. This is needed, as on occasion parted (called right after wipefs) fails to create pt complaining that the target device (and its partitions) are still in use.

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


Tested-by: default avatarSPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: default avatarJim Harris <james.r.harris@intel.com>
Reviewed-by: default avatarKonrad Sztyber <konrad.sztyber@intel.com>
parent 9ab5c8b6
Loading
Loading
Loading
Loading
+8 −3
Original line number Diff line number Diff line
@@ -5,6 +5,11 @@
#
set -xe

wipe() {
	wipefs --all --force "$@"
	sync
}

cleanup() {
	local _devs=()

@@ -13,7 +18,7 @@ cleanup() {
	_devs=("${devs[@]/#//dev/}")

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

MAKE="make -j$(($(nproc) * 2))"
@@ -37,11 +42,11 @@ trap "cleanup; exit 1" SIGINT SIGTERM EXIT
for fs in $fs; do
	for dev in "${devs[@]}"; do
		[[ -b /dev/$dev ]]
		wipefs --all --force "/dev/$dev"
		wipe "/dev/$dev"
		echo "INFO: Creating partition table on $dev disk"
		parted "/dev/$dev" -s mklabel gpt mkpart SPDK_TEST 2048s 100%
		sleep 1s
		wipefs --all --force "/dev/${dev}1"
		wipe "/dev/${dev}1"
		echo "INFO: Creating filesystem on /dev/${dev}1"

		if [[ $fs == ext4 ]]; then