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: Michal Berger <michal.berger@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/17498
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Konrad Sztyber <konrad.sztyber@intel.com>
This commit is contained in:
Michal Berger 2023-04-12 09:42:22 +02:00 committed by David Ko
parent 5ea00c32d6
commit 0a845fec27

View File

@ -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