Commit 3dd4d639 authored by Daniel Verkamp's avatar Daniel Verkamp Committed by Jim Harris
Browse files

autotest: only look up SPDK_GPT_GUID where needed



Getting SPDK_GPT_GUID is only necessary inside the part_dev_by_gpt()
function where it is used; this shortens the log and saves some build
time.

Additionally, $rootdir is not necessarily defined by all scripts
sourcing scripts/autotest_common.sh, so this fixes several (harmless but
annoying) error messages:

  grep: /lib/bdev/gpt/gpt.h: No such file or directory

Change-Id: Iea7a46273437ee54a15097e63700487f7bcd324f
Signed-off-by: default avatarDaniel Verkamp <daniel.verkamp@intel.com>
Reviewed-on: https://review.gerrithub.io/389608


Tested-by: default avatarSPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: default avatarBen Walker <benjamin.walker@intel.com>
Reviewed-by: default avatarJim Harris <james.r.harris@intel.com>
parent f386909c
Loading
Loading
Loading
Loading
+4 −4
Original line number Diff line number Diff line
@@ -47,10 +47,6 @@ config_params='--enable-debug --enable-werror'

export UBSAN_OPTIONS='halt_on_error=1:print_stacktrace=1:abort_on_error=1'

export SPDK_GPT_GUID=`grep SPDK_GPT_PART_TYPE_GUID $rootdir/lib/bdev/gpt/gpt.h \
			| awk -F "(" '{ print $2}' | sed 's/)//g' \
			| awk -F ", " '{ print $1 "-" $2 "-" $3 "-" $4 "-" $5}' | sed 's/0x//g'`

# Override the default HUGEMEM in scripts/setup.sh
export HUGEMEM=8192

@@ -394,7 +390,11 @@ function part_dev_by_gpt () {

		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
			SPDK_GPT_GUID=`grep SPDK_GPT_PART_TYPE_GUID $rootdir/lib/bdev/gpt/gpt.h \
				| awk -F "(" '{ print $2}' | sed 's/)//g' \
				| awk -F ", " '{ print $1 "-" $2 "-" $3 "-" $4 "-" $5}' | sed 's/0x//g'`
			sgdisk -t 1:$SPDK_GPT_GUID /dev/nbd0
			sgdisk -t 2:$SPDK_GPT_GUID /dev/nbd0
		elif [ "$operation" = reset ]; then