diff --git a/scripts/common.sh b/scripts/common.sh index 7d867996a..3bfad54b1 100644 --- a/scripts/common.sh +++ b/scripts/common.sh @@ -345,6 +345,17 @@ block_in_use() { return 0 } +get_spdk_gpt() { + local spdk_guid + + [[ -e $rootdir/module/bdev/gpt/gpt.h ]] || return 1 + + IFS="()" read -r _ spdk_guid _ < <(grep SPDK_GPT_PART_TYPE_GUID "$rootdir/module/bdev/gpt/gpt.h") + spdk_guid=${spdk_guid//, /-} spdk_guid=${spdk_guid//0x/} + + echo "$spdk_guid" +} + if [[ -e "$CONFIG_WPDK_DIR/bin/wpdk_common.sh" ]]; then # Adjust uname to report the operating system as WSL, Msys or Cygwin # and the kernel name as Windows. Define kill() to invoke the SIGTERM diff --git a/test/bdev/blockdev.sh b/test/bdev/blockdev.sh index b26b7bd92..e874a02e5 100755 --- a/test/bdev/blockdev.sh +++ b/test/bdev/blockdev.sh @@ -79,9 +79,7 @@ function setup_gpt_conf() { # Create gpt partition table parted -s "$gpt_nvme" mklabel gpt mkpart first '0%' '50%' mkpart second '50%' '100%' # change the GUID to SPDK GUID value - # FIXME: Hardcode this in some common place, this value should not be changed much - IFS="()" read -r _ SPDK_GPT_GUID _ < <(grep SPDK_GPT_PART_TYPE_GUID module/bdev/gpt/gpt.h) - SPDK_GPT_GUID=${SPDK_GPT_GUID//, /-} SPDK_GPT_GUID=${SPDK_GPT_GUID//0x/} + SPDK_GPT_GUID=$(get_spdk_gpt) sgdisk -t "1:$SPDK_GPT_GUID" "$gpt_nvme" sgdisk -t "2:$SPDK_GPT_GUID" "$gpt_nvme" "$rootdir/scripts/setup.sh"