Commit a31c600a authored by Daniel Verkamp's avatar Daniel Verkamp
Browse files

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: default avatarDaniel Verkamp <daniel.verkamp@intel.com>
Reviewed-on: https://review.gerrithub.io/374007


Tested-by: default avatarSPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: default avatarJim Harris <james.r.harris@intel.com>
parent 91f037f6
Loading
Loading
Loading
Loading
+14 −4
Original line number Diff line number Diff line
@@ -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
			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
+5 −0
Original line number Diff line number Diff line
@@ -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