From 581ca28169eaa2c3285057876f42bab3314051ad 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 d993a8576..5ca2575fc 100644 --- a/tests/zfs-tests/include/commands.cfg +++ b/tests/zfs-tests/include/commands.cfg @@ -132,6 +132,7 @@ export SYSTEM_FILES_LINUX='attr blockdev chattr cksum + dmidecode exportfs fallocate fdisk diff --git a/tests/zfs-tests/include/libtest.shlib b/tests/zfs-tests/include/libtest.shlib index 888abdb75..7e9dd52f1 100644 --- a/tests/zfs-tests/include/libtest.shlib +++ b/tests/zfs-tests/include/libtest.shlib @@ -2301,10 +2301,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 d549896ca..8e4c8a077 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