diff --git a/test/vhost/integrity/integrity_vm.sh b/test/vhost/integrity/integrity_vm.sh index 8082f6bec1..683a1851a1 100755 --- a/test/vhost/integrity/integrity_vm.sh +++ b/test/vhost/integrity/integrity_vm.sh @@ -20,12 +20,17 @@ trap "exit 1" SIGINT SIGTERM EXIT for fs in $fs; do for dev in $devs; do + i=0 parted_cmd="parted -s /dev/${dev}" echo "INFO: Creating partition table on disk using: $parted_cmd mklabel gpt" $parted_cmd mklabel gpt + while ! ($parted_cmd print | grep -q gpt); do + [[ $i -lt 100 ]] || break + i=$((i+1)) + sleep 0.1 + done $parted_cmd mkpart primary 2048s 100% - sleep 2 mkfs_cmd="mkfs.$fs" if [[ $fs == "ntfs" ]]; then @@ -33,7 +38,13 @@ for fs in $fs; do fi mkfs_cmd+=" /dev/${dev}1" echo "INFO: Creating filesystem using: $mkfs_cmd" - wipefs -a /dev/${dev}1 + i=0 + until wipefs -a /dev/${dev}1; do + [[ $i -lt 100 ]] || break + i=$((i+1)) + echo "Waiting for /dev/${dev}1" + sleep 0.1 + done $mkfs_cmd mkdir -p /mnt/${dev}dir @@ -51,6 +62,7 @@ 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) ) echo ""