From 3dd4d63940aa02b5f0af76ecd9711fc35632f763 Mon Sep 17 00:00:00 2001 From: Daniel Verkamp Date: Wed, 29 Nov 2017 09:18:30 -0700 Subject: [PATCH] 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: Daniel Verkamp Reviewed-on: https://review.gerrithub.io/389608 Tested-by: SPDK Automated Test System Reviewed-by: Ben Walker Reviewed-by: Jim Harris --- scripts/autotest_common.sh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/scripts/autotest_common.sh b/scripts/autotest_common.sh index 2ea3451b0..6f8fed01b 100755 --- a/scripts/autotest_common.sh +++ b/scripts/autotest_common.sh @@ -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