From 82be30978059f59a2e56f6c0f2caf67c47ac741b Mon Sep 17 00:00:00 2001 From: Brian Behlendorf Date: Mon, 6 Jan 2020 11:14:19 -0800 Subject: [PATCH] ZTS: Cleanup partition tables The cleanup_devices function should remove any partitions created on the device and force the partition table to be reread. This is needed to ensure that blkid has an up to date version of what devices and partitions are used by zfs. The cleanup_devices call was removed from inuse_008_pos.ksh since it operated on partitions instead of devices and was not needed. Lastly ddidecode may be called by parted and was therefore added to the constrained path. Reviewed-by: Tony Hutter Signed-off-by: Brian Behlendorf Closes #9806 --- tests/zfs-tests/include/commands.cfg | 1 + tests/zfs-tests/include/libtest.shlib | 7 ++++--- tests/zfs-tests/tests/functional/inuse/inuse_008_pos.ksh | 1 - 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/tests/zfs-tests/include/commands.cfg b/tests/zfs-tests/include/commands.cfg index 0d75de9a23..4d98e7c11a 100644 --- a/tests/zfs-tests/include/commands.cfg +++ b/tests/zfs-tests/include/commands.cfg @@ -33,6 +33,7 @@ export SYSTEM_FILES='arp diff dirname dmesg + dmidecode du echo egrep diff --git a/tests/zfs-tests/include/libtest.shlib b/tests/zfs-tests/include/libtest.shlib index b439b44f58..cd593b6f25 100644 --- a/tests/zfs-tests/include/libtest.shlib +++ b/tests/zfs-tests/include/libtest.shlib @@ -2202,10 +2202,11 @@ function cleanup_devices #vdevs { typeset pool="foopool$$" - if poolexists $pool ; then - destroy_pool $pool - fi + for vdev in $@; do + zero_partitions $vdev + done + poolexists $pool && destroy_pool $pool create_pool $pool $@ destroy_pool $pool diff --git a/tests/zfs-tests/tests/functional/inuse/inuse_008_pos.ksh b/tests/zfs-tests/tests/functional/inuse/inuse_008_pos.ksh index 1f5510ae5e..a08beb8b25 100755 --- a/tests/zfs-tests/tests/functional/inuse/inuse_008_pos.ksh +++ b/tests/zfs-tests/tests/functional/inuse/inuse_008_pos.ksh @@ -107,7 +107,6 @@ while (( i < ${#vdevs[*]} )); do create_pool $TESTPOOL1 ${vdevs[i]} $vslices spare $sslices log_must zpool export $TESTPOOL1 verify_assertion "$rawtargets" - cleanup_devices $vslices $sslices (( i = i + 1 )) done