test/bdev: remove partition table after GPT test

Make sure later tests don't fail due to a GPT partition table created on
an NVMe device.

Change-Id: I623e4fd0a84588a85f9d1ced6daf539d48267f50
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-on: https://review.gerrithub.io/374007
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
This commit is contained in:
Daniel Verkamp 2017-08-11 15:06:17 -07:00
parent 91f037f6c3
commit a31c600a9c
2 changed files with 19 additions and 4 deletions

View File

@ -315,11 +315,16 @@ function part_dev_by_gpt () {
conf=$1
devname=$2
rootdir=$3
operation=$4
if [ ! -e $conf ]; then
return 1
fi
if [ -z "$operation" ]; then
operation="create"
fi
cp $conf ${conf}.gpt
echo "[Gpt]" >> ${conf}.gpt
echo " Disable Yes" >> ${conf}.gpt
@ -332,10 +337,15 @@ function part_dev_by_gpt () {
waitforbdev $devname "python $rootdir/scripts/rpc.py"
if [ -e /dev/nbd0 ]; then
parted -s /dev/nbd0 mklabel gpt mkpart first '0%' '50%' mkpart second '50%' '100%'
# change the GUID to SPDK GUID value
sgdisk -t 1:$SPDK_GPT_GUID /dev/nbd0
sgdisk -t 2:$SPDK_GPT_GUID /dev/nbd0
if [ "$operation" = create ]; then
parted -s /dev/nbd0 mklabel gpt mkpart first '0%' '50%' mkpart second '50%' '100%'
# change the GUID to SPDK GUID value
sgdisk -t 1:$SPDK_GPT_GUID /dev/nbd0
sgdisk -t 2:$SPDK_GPT_GUID /dev/nbd0
elif [ "$operation" = reset ]; then
# clear the partition table
dd if=/dev/zero of=/dev/nbd0 bs=4096 count=8 oflag=direct
fi
fi
killprocess $nbd_pid
rm -f ${conf}.gpt

View File

@ -81,6 +81,11 @@ if [ $RUN_NIGHTLY -eq 1 ]; then
timing_exit reset
fi
if grep -q Nvme0 $testdir/bdev.conf; then
part_dev_by_gpt $testdir/bdev.conf Nvme0n1 $rootdir reset
fi
rm -f /tmp/aiofile
rm -f $testdir/bdev.conf
timing_exit bdev