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:
parent
5ea00c32d6
commit
0a845fec27
@ -5,6 +5,11 @@
|
|||||||
#
|
#
|
||||||
set -xe
|
set -xe
|
||||||
|
|
||||||
|
wipe() {
|
||||||
|
wipefs --all --force "$@"
|
||||||
|
sync
|
||||||
|
}
|
||||||
|
|
||||||
cleanup() {
|
cleanup() {
|
||||||
local _devs=()
|
local _devs=()
|
||||||
|
|
||||||
@ -13,7 +18,7 @@ cleanup() {
|
|||||||
_devs=("${devs[@]/#//dev/}")
|
_devs=("${devs[@]/#//dev/}")
|
||||||
|
|
||||||
umount "${_devs[@]}" || :
|
umount "${_devs[@]}" || :
|
||||||
wipefs --all --force "${_devs[@]}" || :
|
wipe "${_devs[@]}" || :
|
||||||
}
|
}
|
||||||
|
|
||||||
MAKE="make -j$(($(nproc) * 2))"
|
MAKE="make -j$(($(nproc) * 2))"
|
||||||
@ -37,11 +42,11 @@ trap "cleanup; exit 1" SIGINT SIGTERM EXIT
|
|||||||
for fs in $fs; do
|
for fs in $fs; do
|
||||||
for dev in "${devs[@]}"; do
|
for dev in "${devs[@]}"; do
|
||||||
[[ -b /dev/$dev ]]
|
[[ -b /dev/$dev ]]
|
||||||
wipefs --all --force "/dev/$dev"
|
wipe "/dev/$dev"
|
||||||
echo "INFO: Creating partition table on $dev disk"
|
echo "INFO: Creating partition table on $dev disk"
|
||||||
parted "/dev/$dev" -s mklabel gpt mkpart SPDK_TEST 2048s 100%
|
parted "/dev/$dev" -s mklabel gpt mkpart SPDK_TEST 2048s 100%
|
||||||
sleep 1s
|
sleep 1s
|
||||||
wipefs --all --force "/dev/${dev}1"
|
wipe "/dev/${dev}1"
|
||||||
echo "INFO: Creating filesystem on /dev/${dev}1"
|
echo "INFO: Creating filesystem on /dev/${dev}1"
|
||||||
|
|
||||||
if [[ $fs == ext4 ]]; then
|
if [[ $fs == ext4 ]]; then
|
||||||
|
Loading…
Reference in New Issue
Block a user