From 24fcd9fc5c999385785d73414bfd1cf72c1b230d Mon Sep 17 00:00:00 2001 From: Ryan Moeller Date: Fri, 21 Feb 2020 19:00:23 -0500 Subject: [PATCH] ZTS: Eliminate partitioning from zpool_destroy The zpool destroy tests partition a single disk to create two pools. This can be done using two disks and no partitioning instead. And temporarily allow vol recursion for FreeBSD while in here. Reviewed-by: John Kennedy Reviewed-by: Brian Behlendorf Signed-off-by: Ryan Moeller Closes #10036 --- .../cli_root/zpool_destroy/zpool_destroy.cfg | 10 +--------- .../zpool_destroy/zpool_destroy_001_pos.ksh | 18 ++++++++---------- .../zpool_destroy/zpool_destroy_002_pos.ksh | 5 +---- 3 files changed, 10 insertions(+), 23 deletions(-) diff --git a/tests/zfs-tests/tests/functional/cli_root/zpool_destroy/zpool_destroy.cfg b/tests/zfs-tests/tests/functional/cli_root/zpool_destroy/zpool_destroy.cfg index 9349e5ff63..bf6026747f 100644 --- a/tests/zfs-tests/tests/functional/cli_root/zpool_destroy/zpool_destroy.cfg +++ b/tests/zfs-tests/tests/functional/cli_root/zpool_destroy/zpool_destroy.cfg @@ -28,18 +28,10 @@ # Copyright (c) 2012 by Delphix. All rights reserved. # -export DISK=${DISKS%% *} export DISK_ARRAY_NUM=$(echo ${DISKS} | nawk '{print NF}') export DISKSARRAY=$DISKS +echo $DISKS | read DISK0 DISK1 if is_linux; then set_device_dir - set_slice_prefix - export SLICE0=1 - export SLICE1=2 -else - export SLICE0=0 - export SLICE1=1 - fi -export SLICE_SIZE=500m diff --git a/tests/zfs-tests/tests/functional/cli_root/zpool_destroy/zpool_destroy_001_pos.ksh b/tests/zfs-tests/tests/functional/cli_root/zpool_destroy/zpool_destroy_001_pos.ksh index 041a1d00cb..3323f1db0c 100755 --- a/tests/zfs-tests/tests/functional/cli_root/zpool_destroy/zpool_destroy_001_pos.ksh +++ b/tests/zfs-tests/tests/functional/cli_root/zpool_destroy/zpool_destroy_001_pos.ksh @@ -56,26 +56,24 @@ function cleanup poolexists $pool && destroy_pool $pool done - zero_partitions $DISK + [ -n "$recursive" ] && set_tunable64 VOL_RECURSIVE $recursive } set -A datasets "$TESTPOOL" "$TESTPOOL2" -if ! is_physical_device $DISKS; then - log_unsupported "This case cannot be run on raw files." -fi - log_assert "'zpool destroy ' can destroy a specified pool." log_onexit cleanup -partition_disk $SLICE_SIZE $DISK 2 - -create_pool "$TESTPOOL" "${DISK}${SLICE_PREFIX}${SLICE0}" -create_pool "$TESTPOOL1" "${DISK}${SLICE_PREFIX}${SLICE1}" +create_pool $TESTPOOL $DISK0 +create_pool $TESTPOOL1 $DISK1 log_must zfs create -s -V $VOLSIZE $TESTPOOL1/$TESTVOL block_device_wait -create_pool "$TESTPOOL2" "${ZVOL_DEVDIR}/$TESTPOOL1/$TESTVOL" +if is_freebsd; then + typeset recursive=$(get_tunable VOL_RECURSIVE) + log_must set_tunable64 VOL_RECURSIVE 1 +fi +create_pool $TESTPOOL2 $ZVOL_DEVDIR/$TESTPOOL1/$TESTVOL typeset -i i=0 while (( i < ${#datasets[*]} )); do diff --git a/tests/zfs-tests/tests/functional/cli_root/zpool_destroy/zpool_destroy_002_pos.ksh b/tests/zfs-tests/tests/functional/cli_root/zpool_destroy/zpool_destroy_002_pos.ksh index ad9425795c..794a6c37c3 100755 --- a/tests/zfs-tests/tests/functional/cli_root/zpool_destroy/zpool_destroy_002_pos.ksh +++ b/tests/zfs-tests/tests/functional/cli_root/zpool_destroy/zpool_destroy_002_pos.ksh @@ -73,9 +73,7 @@ log_assert "'zpool destroy -f ' can forcely destroy the specified pool" log_onexit cleanup -typeset cwd="" - -create_pool "$TESTPOOL" "$DISK" +create_pool $TESTPOOL $DISK0 log_must zfs create $TESTPOOL/$TESTFS log_must mkdir -p $TESTDIR log_must zfs set mountpoint=$TESTDIR $TESTPOOL/$TESTFS @@ -90,7 +88,6 @@ while (( $i < ${#datasets[*]} )); do ((i = i + 1)) done -cwd=$PWD log_note "'zpool destroy' without '-f' will fail " \ "while pool is busy."