diff --git a/tests/sys/cddl/zfs/tests/cli_root/zpool_import/cleanup.ksh b/tests/sys/cddl/zfs/tests/cli_root/zpool_import/cleanup.ksh index c7da5449150d..59249d5a6378 100644 --- a/tests/sys/cddl/zfs/tests/cli_root/zpool_import/cleanup.ksh +++ b/tests/sys/cddl/zfs/tests/cli_root/zpool_import/cleanup.ksh @@ -39,24 +39,9 @@ for pool in "$TESTPOOL" "$TESTPOOL1"; do destroy_pool "$pool" done -ismounted $DEVICE_DIR ufs -(( $? == 0 )) && log_must $UMOUNT -f $DEVICE_DIR - for dir in "$TESTDIR" "$TESTDIR1" "$DEVICE_DIR" ; do [[ -d $dir ]] && \ log_must $RM -rf $dir done -# recreate and destroy a zpool over the disks to restore the partitions to -# normal -case $DISK_COUNT in -0|1) - log_note "No disk devices to restore" - ;; -*) - log_must cleanup_devices $ZFS_DISK1 - log_must cleanup_devices $ZFS_DISK2 - ;; -esac - log_pass diff --git a/tests/sys/cddl/zfs/tests/cli_root/zpool_import/setup.ksh b/tests/sys/cddl/zfs/tests/cli_root/zpool_import/setup.ksh index d179e99dfdcc..eebbbec0c38b 100644 --- a/tests/sys/cddl/zfs/tests/cli_root/zpool_import/setup.ksh +++ b/tests/sys/cddl/zfs/tests/cli_root/zpool_import/setup.ksh @@ -33,18 +33,7 @@ verify_runnable "global" -DISK=${DISKS%% *} - -for dev in $ZFS_DISK1 $ZFS_DISK2 ; do - log_must cleanup_devices $dev -done - -typeset -i i=0 -if [[ $DISK_COUNT -lt 2 ]]; then - partition_disk $PART_SIZE $ZFS_DISK1 $GROUP_NUM -fi - -create_pool "$TESTPOOL" "$ZFSSIDE_DISK1" +create_pool "$TESTPOOL" "$DISK0" if [[ -d $TESTDIR ]]; then $RM -rf $TESTDIR || log_unresolved Could not remove $TESTDIR @@ -54,22 +43,9 @@ fi log_must $ZFS create $TESTPOOL/$TESTFS log_must $ZFS set mountpoint=$TESTDIR $TESTPOOL/$TESTFS -# Limit the filesystem size to 32GiB; this should be sufficient. -(( MAXSECTS = 32 * 1024 * 1024 )) -NUMSECTS=`diskinfo ${ZFSSIDE_DISK2} | awk '{print $4}'` -if [[ $NUMSECTS -gt $MAXSECTS ]]; then - NUMSECTS=$MAXSECTS -fi - -$ECHO "y" | $NEWFS -s $NUMSECTS $ZFSSIDE_DISK2 >/dev/null 2>&1 -(( $? != 0 )) && - log_untested "Unable to setup a UFS file system" - [[ ! -d $DEVICE_DIR ]] && \ log_must $MKDIR -p $DEVICE_DIR -log_must $MOUNT $ZFSSIDE_DISK2 $DEVICE_DIR - i=0 while (( i < $MAX_NUM )); do log_must create_vdevs ${DEVICE_DIR}/${DEVICE_FILE}$i diff --git a/tests/sys/cddl/zfs/tests/cli_root/zpool_import/zpool_import.cfg b/tests/sys/cddl/zfs/tests/cli_root/zpool_import/zpool_import.cfg index 2847fdf840f5..5ba9a6c8ac85 100644 --- a/tests/sys/cddl/zfs/tests/cli_root/zpool_import/zpool_import.cfg +++ b/tests/sys/cddl/zfs/tests/cli_root/zpool_import/zpool_import.cfg @@ -32,43 +32,17 @@ . $STF_SUITE/tests/cli_root/cli.cfg . $STF_SUITE/include/libtest.kshlib -set -A disk_array $(find_disks $DISKS) -case "${#disk_array[*]}" in -0) - # - # on stf_configure, disk_freelist returns empty. - # - DISK_COUNT=0 - ;; -1) - # We need to repartition the single disk to two slices. - DISK_COUNT=1 - ZFS_DISK1=${disk_array[0]} - ZFSSIDE_DISK1=${ZFS_DISK1}p1 - ZFS_DISK2=${disk_array[0]} - ZFSSIDE_DISK2=${ZFS_DISK2}p2 - ;; -*) - # We don't need to repartition anything - DISK_COUNT=2 - ZFS_DISK1=${disk_array[0]} - ZFSSIDE_DISK1=${ZFS_DISK1} - ZFS_DISK2=${disk_array[1]} - ZFSSIDE_DISK2=${ZFS_DISK2} - ;; -esac - -export DISK_COUNT ZFS_DISK1 ZFSSIDE_DISK1 ZFS_DISK2 ZFSSIDE_DISK2 +set_disks export FS_SIZE=2gb export FILE_SIZE=64m export PART_SIZE=128m export MAX_NUM=5 export GROUP_NUM=3 -export DEVICE_DIR=${TMPDIR}/dev${TESTCASE_ID} -export BACKUP_DEVICE_DIR=/bakdev${TESTCASE_ID} +export DEVICE_DIR=$(pwd)/dev +export BACKUP_DEVICE_DIR=$(pwd)/bakdev export DEVICE_FILE=disk -export DEVICE_ARCHIVE=${TMPDIR}/archive${TESTCASE_ID}.tar +export DEVICE_ARCHIVE=$(pwd)/archive${TESTCASE_ID}.tar # MYTESTFILE can be any file that exists and we have r access to export MYTESTFILE=$STF_SUITE/include/default.cfg diff --git a/tests/sys/cddl/zfs/tests/cli_root/zpool_import/zpool_import_all_001_pos.ksh b/tests/sys/cddl/zfs/tests/cli_root/zpool_import/zpool_import_all_001_pos.ksh index e1f4421c7397..1f3707ee1886 100644 --- a/tests/sys/cddl/zfs/tests/cli_root/zpool_import/zpool_import_all_001_pos.ksh +++ b/tests/sys/cddl/zfs/tests/cli_root/zpool_import/zpool_import_all_001_pos.ksh @@ -183,9 +183,9 @@ while (( number <= $GROUP_NUM )); do continue fi fi - set_partition $number "" $PART_SIZE ${ZFS_DISK2} + set_partition $number "" $PART_SIZE ${DISK1} - setup_single_disk "${ZFS_DISK2}p${number}" \ + setup_single_disk "${DISK1}p${number}" \ "${TESTPOOL}-$number" \ "$TESTFS" \ "$TESTDIR.$number" diff --git a/tests/sys/cddl/zfs/tests/cli_root/zpool_import/zpool_import_test.sh b/tests/sys/cddl/zfs/tests/cli_root/zpool_import/zpool_import_test.sh index 76e6728ee642..296a2222200c 100755 --- a/tests/sys/cddl/zfs/tests/cli_root/zpool_import/zpool_import_test.sh +++ b/tests/sys/cddl/zfs/tests/cli_root/zpool_import/zpool_import_test.sh @@ -38,7 +38,7 @@ zpool_import_002_pos_body() . $(atf_get_srcdir)/../../../include/default.cfg . $(atf_get_srcdir)/zpool_import.cfg - verify_disk_count "$DISKS" 2 + verify_disk_count "$DISKS" 1 ksh93 $(atf_get_srcdir)/setup.ksh || atf_fail "Setup failed" ksh93 $(atf_get_srcdir)/zpool_import_002_pos.ksh || atf_fail "Testcase failed" } @@ -63,7 +63,7 @@ zpool_import_003_pos_body() . $(atf_get_srcdir)/../../../include/default.cfg . $(atf_get_srcdir)/zpool_import.cfg - verify_disk_count "$DISKS" 2 + verify_disk_count "$DISKS" 1 ksh93 $(atf_get_srcdir)/setup.ksh || atf_fail "Setup failed" ksh93 $(atf_get_srcdir)/zpool_import_003_pos.ksh || atf_fail "Testcase failed" } @@ -88,7 +88,7 @@ zpool_import_004_pos_body() . $(atf_get_srcdir)/../../../include/default.cfg . $(atf_get_srcdir)/zpool_import.cfg - verify_disk_count "$DISKS" 2 + verify_disk_count "$DISKS" 1 ksh93 $(atf_get_srcdir)/setup.ksh || atf_fail "Setup failed" ksh93 $(atf_get_srcdir)/zpool_import_004_pos.ksh || atf_fail "Testcase failed" } @@ -113,7 +113,7 @@ zpool_import_005_pos_body() . $(atf_get_srcdir)/../../../include/default.cfg . $(atf_get_srcdir)/zpool_import.cfg - verify_disk_count "$DISKS" 2 + verify_disk_count "$DISKS" 1 ksh93 $(atf_get_srcdir)/setup.ksh || atf_fail "Setup failed" ksh93 $(atf_get_srcdir)/zpool_import_005_pos.ksh || atf_fail "Testcase failed" } @@ -138,7 +138,7 @@ zpool_import_006_pos_body() . $(atf_get_srcdir)/../../../include/default.cfg . $(atf_get_srcdir)/zpool_import.cfg - verify_disk_count "$DISKS" 2 + verify_disk_count "$DISKS" 1 ksh93 $(atf_get_srcdir)/setup.ksh || atf_fail "Setup failed" ksh93 $(atf_get_srcdir)/zpool_import_006_pos.ksh || atf_fail "Testcase failed" } @@ -163,7 +163,7 @@ zpool_import_007_pos_body() . $(atf_get_srcdir)/../../../include/default.cfg . $(atf_get_srcdir)/zpool_import.cfg - verify_disk_count "$DISKS" 2 + verify_disk_count "$DISKS" 1 ksh93 $(atf_get_srcdir)/setup.ksh || atf_fail "Setup failed" ksh93 $(atf_get_srcdir)/zpool_import_007_pos.ksh || atf_fail "Testcase failed" } @@ -188,7 +188,7 @@ zpool_import_008_pos_body() . $(atf_get_srcdir)/../../../include/default.cfg . $(atf_get_srcdir)/zpool_import.cfg - verify_disk_count "$DISKS" 2 + verify_disk_count "$DISKS" 1 ksh93 $(atf_get_srcdir)/setup.ksh || atf_fail "Setup failed" ksh93 $(atf_get_srcdir)/zpool_import_008_pos.ksh || atf_fail "Testcase failed" } @@ -213,7 +213,7 @@ zpool_import_009_neg_body() . $(atf_get_srcdir)/../../../include/default.cfg . $(atf_get_srcdir)/zpool_import.cfg - verify_disk_count "$DISKS" 2 + verify_disk_count "$DISKS" 1 ksh93 $(atf_get_srcdir)/setup.ksh || atf_fail "Setup failed" ksh93 $(atf_get_srcdir)/zpool_import_009_neg.ksh || atf_fail "Testcase failed" } @@ -238,7 +238,7 @@ zpool_import_010_pos_body() . $(atf_get_srcdir)/../../../include/default.cfg . $(atf_get_srcdir)/zpool_import.cfg - verify_disk_count "$DISKS" 2 + verify_disk_count "$DISKS" 1 ksh93 $(atf_get_srcdir)/setup.ksh || atf_fail "Setup failed" ksh93 $(atf_get_srcdir)/zpool_import_010_pos.ksh || atf_fail "Testcase failed" } @@ -263,7 +263,7 @@ zpool_import_011_neg_body() . $(atf_get_srcdir)/../../../include/default.cfg . $(atf_get_srcdir)/zpool_import.cfg - verify_disk_count "$DISKS" 2 + verify_disk_count "$DISKS" 1 ksh93 $(atf_get_srcdir)/setup.ksh || atf_fail "Setup failed" ksh93 $(atf_get_srcdir)/zpool_import_011_neg.ksh || atf_fail "Testcase failed" } @@ -288,7 +288,7 @@ zpool_import_012_pos_body() . $(atf_get_srcdir)/../../../include/default.cfg . $(atf_get_srcdir)/zpool_import.cfg - verify_disk_count "$DISKS" 2 + verify_disk_count "$DISKS" 1 ksh93 $(atf_get_srcdir)/setup.ksh || atf_fail "Setup failed" ksh93 $(atf_get_srcdir)/zpool_import_012_pos.ksh || atf_fail "Testcase failed" } @@ -377,7 +377,7 @@ zpool_import_missing_001_pos_body() . $(atf_get_srcdir)/../../../include/default.cfg . $(atf_get_srcdir)/zpool_import.cfg - verify_disk_count "$DISKS" 2 + verify_disk_count "$DISKS" 1 ksh93 $(atf_get_srcdir)/setup.ksh || atf_fail "Setup failed" ksh93 $(atf_get_srcdir)/zpool_import_missing_001_pos.ksh || atf_fail "Testcase failed" } @@ -402,7 +402,7 @@ zpool_import_missing_002_pos_body() . $(atf_get_srcdir)/../../../include/default.cfg . $(atf_get_srcdir)/zpool_import.cfg - verify_disk_count "$DISKS" 2 + verify_disk_count "$DISKS" 1 ksh93 $(atf_get_srcdir)/setup.ksh || atf_fail "Setup failed" ksh93 $(atf_get_srcdir)/zpool_import_missing_002_pos.ksh || atf_fail "Testcase failed" } @@ -427,7 +427,7 @@ zpool_import_missing_003_pos_body() . $(atf_get_srcdir)/../../../include/default.cfg . $(atf_get_srcdir)/zpool_import.cfg - verify_disk_count "$DISKS" 2 + verify_disk_count "$DISKS" 1 ksh93 $(atf_get_srcdir)/setup.ksh || atf_fail "Setup failed" ksh93 $(atf_get_srcdir)/zpool_import_missing_003_pos.ksh || atf_fail "Testcase failed" } @@ -482,7 +482,7 @@ zpool_import_rename_001_pos_body() . $(atf_get_srcdir)/../../../include/default.cfg . $(atf_get_srcdir)/zpool_import.cfg - verify_disk_count "$DISKS" 2 + verify_disk_count "$DISKS" 1 ksh93 $(atf_get_srcdir)/setup.ksh || atf_fail "Setup failed" ksh93 $(atf_get_srcdir)/zpool_import_rename_001_pos.ksh || atf_fail "Testcase failed" }