aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlan Somers <asomers@FreeBSD.org>2019-10-05 03:19:53 +0000
committerAlan Somers <asomers@FreeBSD.org>2019-10-05 03:19:53 +0000
commit4330d7272da0eee229572c55234807f9881fd693 (patch)
tree5076eede59b16b59e6e7a7d97b7311b3f384720c
parent7d4670b647e04e1b998d340170665697f5d60df6 (diff)
downloadsrc-4330d7272da0eee229572c55234807f9881fd693.tar.gz
src-4330d7272da0eee229572c55234807f9881fd693.zip
ZFS: fix several of the "zpool create" tests
* Remove zpool_create_013_neg. FreeBSD doesn't have an equivalent of Solaris's metadevices. GEOM would be the equivalent, but since all geoms are the same from ZFS's perspective, this test would be redundant with zpool_create_012_neg * Remove zpool_create_014_neg. FreeBSD does not support swapping to regular files. * Remove zpool_create_016_pos. This test is redundant with literally every other test that creates a disk-backed pool. * s:/etc/vfstab:/etc/fstab in zpool_create_011_neg * Delete the VTOC-related portion of zpool_create_008_pos. FreeBSD doesn't use VTOC. * Replace dumpadm with dumpon and swap with swapon in multiple tests. * In zpool_create_015_neg, don't require "zpool create -n" to fail. It's reasonable for that variant to succeed, because it doesn't actually open the zvol. * Greatly simplify zpool_create_012_neg. Make it safer, too, but not interfering with the system's regular swap devices. * Expect zpool_create_011_neg to fail (PR 241070) * Delete some redundant cleanup steps in various tests * Remove some unneeeded ATF timeout specifications. The default is fine. PR: 241070 MFC after: 2 weeks Sponsored by: Axcient
Notes
Notes: svn path=/head/; revision=353118
-rw-r--r--ObsoleteFiles.inc4
-rw-r--r--tests/sys/cddl/zfs/include/commands.txt1
-rw-r--r--tests/sys/cddl/zfs/tests/cli_root/zpool_create/Makefile3
-rw-r--r--tests/sys/cddl/zfs/tests/cli_root/zpool_create/zpool_create.kshlib34
-rw-r--r--tests/sys/cddl/zfs/tests/cli_root/zpool_create/zpool_create_008_pos.ksh78
-rw-r--r--tests/sys/cddl/zfs/tests/cli_root/zpool_create/zpool_create_011_neg.ksh16
-rw-r--r--tests/sys/cddl/zfs/tests/cli_root/zpool_create/zpool_create_012_neg.ksh24
-rw-r--r--tests/sys/cddl/zfs/tests/cli_root/zpool_create/zpool_create_013_neg.ksh116
-rw-r--r--tests/sys/cddl/zfs/tests/cli_root/zpool_create/zpool_create_014_neg.ksh103
-rw-r--r--tests/sys/cddl/zfs/tests/cli_root/zpool_create/zpool_create_015_neg.ksh21
-rw-r--r--tests/sys/cddl/zfs/tests/cli_root/zpool_create/zpool_create_016_pos.ksh100
-rwxr-xr-xtests/sys/cddl/zfs/tests/cli_root/zpool_create/zpool_create_test.sh106
12 files changed, 42 insertions, 564 deletions
diff --git a/ObsoleteFiles.inc b/ObsoleteFiles.inc
index 432ce0ab8240..853ba5e94115 100644
--- a/ObsoleteFiles.inc
+++ b/ObsoleteFiles.inc
@@ -38,6 +38,10 @@
# xargs -n1 | sort | uniq -d;
# done
+# 20191003: Remove useless ZFS tests
+OLD_FILES+=usr/tests/sys/cddl/zfs/tests/cli_root/zpool_create/zpool_create_013_neg.ksh
+OLD_FILES+=usr/tests/sys/cddl/zfs/tests/cli_root/zpool_create/zpool_create_014_neg.ksh
+OLD_FILES+=usr/tests/sys/cddl/zfs/tests/cli_root/zpool_create/zpool_create_016_pos.ksh
# 20190910: mklocale(1) and colldef(1) removed
OLD_FILES+=usr/bin/mklocale
OLD_FILES+=usr/share/man/man1/mklocale.1.gz
diff --git a/tests/sys/cddl/zfs/include/commands.txt b/tests/sys/cddl/zfs/include/commands.txt
index 8c90e6f8f420..b6c49648132d 100644
--- a/tests/sys/cddl/zfs/include/commands.txt
+++ b/tests/sys/cddl/zfs/include/commands.txt
@@ -65,6 +65,7 @@
/usr/bin/dirname
/usr/bin/du
#%%STFSUITEDIR%%/bin/dumpadm
+/sbin/dumpon
/bin/echo
/usr/bin/egrep
/usr/bin/env
diff --git a/tests/sys/cddl/zfs/tests/cli_root/zpool_create/Makefile b/tests/sys/cddl/zfs/tests/cli_root/zpool_create/Makefile
index c6d23dae2658..7e8db0132965 100644
--- a/tests/sys/cddl/zfs/tests/cli_root/zpool_create/Makefile
+++ b/tests/sys/cddl/zfs/tests/cli_root/zpool_create/Makefile
@@ -13,8 +13,6 @@ TEST_METADATA+= is_exclusive=true
${PACKAGE}FILES+= zpool_create_003_pos.ksh
${PACKAGE}FILES+= zpool_create_020_pos.ksh
${PACKAGE}FILES+= zpool_create_017_neg.ksh
-${PACKAGE}FILES+= zpool_create_013_neg.ksh
-${PACKAGE}FILES+= zpool_create_016_pos.ksh
${PACKAGE}FILES+= zpool_create_012_neg.ksh
${PACKAGE}FILES+= zpool_create_006_pos.ksh
${PACKAGE}FILES+= zpool_create_002_pos.ksh
@@ -22,7 +20,6 @@ ${PACKAGE}FILES+= zpool_create_021_pos.ksh
${PACKAGE}FILES+= zpool_create_007_neg.ksh
${PACKAGE}FILES+= setup.ksh
${PACKAGE}FILES+= cleanup.ksh
-${PACKAGE}FILES+= zpool_create_014_neg.ksh
${PACKAGE}FILES+= zpool_create_010_neg.ksh
${PACKAGE}FILES+= zpool_create_019_pos.ksh
${PACKAGE}FILES+= zpool_create_008_pos.ksh
diff --git a/tests/sys/cddl/zfs/tests/cli_root/zpool_create/zpool_create.kshlib b/tests/sys/cddl/zfs/tests/cli_root/zpool_create/zpool_create.kshlib
index 864039b2c0fc..37fd6dab977b 100644
--- a/tests/sys/cddl/zfs/tests/cli_root/zpool_create/zpool_create.kshlib
+++ b/tests/sys/cddl/zfs/tests/cli_root/zpool_create/zpool_create.kshlib
@@ -96,36 +96,22 @@ function clean_blockfile
#
# Find the storage device in /etc/vfstab
#
-function find_vfstab_dev
+function find_fstab_dev
{
- typeset vfstab="/etc/vfstab"
- typeset tmpfile="$TMPDIR/vfstab.tmp"
- typeset vfstabdev
- typeset vfstabdevs=""
+ typeset fstab="/etc/fstab"
+ typeset tmpfile="$TMPDIR/fstab.tmp"
+ typeset fstabdev
+ typeset fstabdevs=""
typeset line
- $CAT $vfstab | $GREP "^/dev" >$tmpfile
+ $CAT $fstab | $GREP "^/dev" >$tmpfile
while read -r line
do
- vfstabdev=`$ECHO "$line" | $AWK '{print $1}'`
- vfstabdev=${vfstabdev%%:}
- vfstabdevs="$vfstabdev $vfstabdevs"
+ fstabdev=`$ECHO "$line" | $AWK '{print $1}'`
+ fstabdev=${fstabdev%%:}
+ fstabdevs="$fstabdev $fstabdevs"
done <$tmpfile
$RM -f $tmpfile
- $ECHO $vfstabdevs
+ $ECHO $fstabdevs
}
-
-#
-# Save the systme current dump device configuration
-#
-function save_dump_dev
-{
-
- typeset dumpdev
- typeset fnd="Dump device"
-
- dumpdev=`$DUMPADM | $GREP "$fnd" | $CUT -f2 -d : | \
- $AWK '{print $1}'`
- $ECHO $dumpdev
-}
diff --git a/tests/sys/cddl/zfs/tests/cli_root/zpool_create/zpool_create_008_pos.ksh b/tests/sys/cddl/zfs/tests/cli_root/zpool_create/zpool_create_008_pos.ksh
index de98816e2024..ae1b62a0d668 100644
--- a/tests/sys/cddl/zfs/tests/cli_root/zpool_create/zpool_create_008_pos.ksh
+++ b/tests/sys/cddl/zfs/tests/cli_root/zpool_create/zpool_create_008_pos.ksh
@@ -57,70 +57,7 @@
verify_runnable "global"
-function cleanup
-{
- if [[ $exported_pool == true ]]; then
- if [[ $force_pool == true ]]; then
- log_must $ZPOOL create -f $TESTPOOL ${disk}p1
- else
- log_must $ZPOOL import $TESTPOOL
- fi
- fi
-
- if poolexists $TESTPOOL ; then
- destroy_pool $TESTPOOL
- fi
-
- if poolexists $TESTPOOL1 ; then
- destroy_pool $TESTPOOL1
- fi
-
- #
- # recover it back to EFI label
- #
- wipe_partition_table $disk
-}
-
-#
-# create overlap slice 0 and 1 on $disk
-#
-function create_overlap_slice
-{
- typeset format_file=$TMPDIR/format_overlap.${TESTCASE_ID}
- typeset disk=$1
-
- $ECHO "partition" >$format_file
- $ECHO "0" >> $format_file
- $ECHO "" >> $format_file
- $ECHO "" >> $format_file
- $ECHO "0" >> $format_file
- $ECHO "200m" >> $format_file
- $ECHO "1" >> $format_file
- $ECHO "" >> $format_file
- $ECHO "" >> $format_file
- $ECHO "0" >> $format_file
- $ECHO "400m" >> $format_file
- $ECHO "label" >> $format_file
- $ECHO "" >> $format_file
- $ECHO "q" >> $format_file
- $ECHO "q" >> $format_file
-
- $FORMAT -e -s -d $disk -f $format_file
- typeset -i ret=$?
- $RM -fr $format_file
-
- if (( ret != 0 )); then
- log_fail "unable to create overlap slice."
- fi
-
- return 0
-}
-
log_assert "'zpool create' have to use '-f' scenarios"
-log_onexit cleanup
-
-typeset exported_pool=false
-typeset force_pool=false
if [[ -n $DISK ]]; then
disk=$DISK
@@ -128,31 +65,16 @@ else
disk=$DISK0
fi
-# overlapped slices as vdev need -f to create pool
-
# Make the disk is EFI labeled first via pool creation
create_pool $TESTPOOL $disk
destroy_pool $TESTPOOL
-# Make the disk is VTOC labeled since only VTOC label supports overlap
-log_must labelvtoc $disk
-log_must create_overlap_slice $disk
-
-log_mustnot $ZPOOL create $TESTPOOL ${disk}p1
-log_must $ZPOOL create -f $TESTPOOL ${disk}p1
-destroy_pool $TESTPOOL
-
# exported device to be as spare vdev need -f to create pool
-
-log_must $ZPOOL create -f $TESTPOOL $disk
-destroy_pool $TESTPOOL
log_must partition_disk $SIZE $disk 6
create_pool $TESTPOOL ${disk}p1 ${disk}p2
log_must $ZPOOL export $TESTPOOL
-exported_pool=true
log_mustnot $ZPOOL create $TESTPOOL1 ${disk}p3 spare ${disk}p2
create_pool $TESTPOOL1 ${disk}p3 spare ${disk}p2
-force_pool=true
destroy_pool $TESTPOOL1
log_pass "'zpool create' have to use '-f' scenarios"
diff --git a/tests/sys/cddl/zfs/tests/cli_root/zpool_create/zpool_create_011_neg.ksh b/tests/sys/cddl/zfs/tests/cli_root/zpool_create/zpool_create_011_neg.ksh
index 214d9e74f186..afd27320cb17 100644
--- a/tests/sys/cddl/zfs/tests/cli_root/zpool_create/zpool_create_011_neg.ksh
+++ b/tests/sys/cddl/zfs/tests/cli_root/zpool_create/zpool_create_011_neg.ksh
@@ -41,7 +41,7 @@
# 'zpool create' will fail in the following cases:
# existent pool; device is part of an active pool; nested virtual devices;
# differently sized devices without -f option; device being currently
-# mounted; devices in /etc/vfstab; specified as the dedicated dump device.
+# mounted; devices in /etc/fstab; specified as the dedicated dump device.
#
# STRATEGY:
# 1. Create case scenarios
@@ -67,8 +67,8 @@ function cleanup
destroy_pool $pool
done
- if [[ -n $saved_dump_dev ]]; then
- log_must $DUMPADM -u -d $saved_dump_dev
+ if [[ -n $specified_dump_dev ]]; then
+ $DUMPON -r $specified_dump_dev
fi
}
@@ -87,11 +87,11 @@ mirror2="${disk}p4 ${disk}p5"
raidz1=$mirror1
raidz2=$mirror2
diff_size_dev="${disk}p6 ${disk}p7"
-vfstab_dev=$(find_vfstab_dev)
-specified_dump_dev=${disk}p1
-saved_dump_dev=$(save_dump_dev)
+fstab_dev=$(find_fstab_dev)
+specified_dump_dev=${disk}
lba=$(get_partition_end $disk 6)
+$GPART delete -i 7 $disk
set_partition 7 "$lba" $SIZE1 $disk
create_pool "$TESTPOOL" "$pooldev1"
@@ -112,7 +112,7 @@ set -A arg "$TESTPOOL $pooldev2" \
"$TESTPOOL1 raidz $diff_size_dev" \
"$TESTPOOL1 raidz1 $diff_size_dev" \
"$TESTPOOL1 mirror $mirror1 spare $mirror2 spare $diff_size_dev" \
- "$TESTPOOL1 $vfstab_dev" \
+ "$TESTPOOL1 $fstab_dev" \
"$TESTPOOL1 ${disk}s10" \
"$TESTPOOL1 spare $pooldev2"
@@ -130,7 +130,7 @@ log_must $ZPOOL destroy -f $TESTPOOL
log_must $ZPOOL create -f $TESTPOOL3 $disk
log_must $ZPOOL destroy -f $TESTPOOL3
-log_must $DUMPADM -d /dev/$specified_dump_dev
+log_must dumpon $specified_dump_dev
log_mustnot $ZPOOL create -f $TESTPOOL1 "$specified_dump_dev"
# Also check to see that in-use checking prevents us from creating
diff --git a/tests/sys/cddl/zfs/tests/cli_root/zpool_create/zpool_create_012_neg.ksh b/tests/sys/cddl/zfs/tests/cli_root/zpool_create/zpool_create_012_neg.ksh
index 345437ba3e26..799cf9e861e9 100644
--- a/tests/sys/cddl/zfs/tests/cli_root/zpool_create/zpool_create_012_neg.ksh
+++ b/tests/sys/cddl/zfs/tests/cli_root/zpool_create/zpool_create_012_neg.ksh
@@ -38,13 +38,12 @@
#
#
# DESCRIPTION:
-# 'zpool create' will fail with formal disk slice in swap
+# 'zpool create' will fail with disk in swap
#
#
# STRATEGY:
-# 1. Get all the disk devices in swap
-# 2. For each device, try to create a new pool with this device
-# 3. Verify the creation is failed.
+# 1. Add a disk to swap
+# 2. Try to create a pool on that disk. It should fail.
#
# TESTABILITY: explicit
#
@@ -60,21 +59,14 @@ verify_runnable "global"
function cleanup
{
- if poolexists $TESTPOOL; then
- destroy_pool $TESTPOOL
- fi
+ $SWAPOFF $DISK0
}
-typeset swap_disks=`$SWAP -l | $GREP "c[0-9].*d[0-9].*s[0-9]" | \
- $AWK '{print $1}'`
-log_assert "'zpool create' should fail with disk slice in swap."
+log_assert "'zpool create' should fail with disk in swap."
log_onexit cleanup
-for sdisk in $swap_disks; do
- for opt in "-n" "" "-f"; do
- log_mustnot $ZPOOL create $opt $TESTPOOL $sdisk
- done
-done
+log_must $SWAPON $DISK0
+log_mustnot $ZPOOL create $TESTPOOL $DISK0
-log_pass "'zpool create' passed as expected with inapplicable scenario."
+log_pass "'zpool create' cannot use a swap disk"
diff --git a/tests/sys/cddl/zfs/tests/cli_root/zpool_create/zpool_create_013_neg.ksh b/tests/sys/cddl/zfs/tests/cli_root/zpool_create/zpool_create_013_neg.ksh
deleted file mode 100644
index 730a02135120..000000000000
--- a/tests/sys/cddl/zfs/tests/cli_root/zpool_create/zpool_create_013_neg.ksh
+++ /dev/null
@@ -1,116 +0,0 @@
-#!/usr/local/bin/ksh93 -p
-#
-# CDDL HEADER START
-#
-# The contents of this file are subject to the terms of the
-# Common Development and Distribution License (the "License").
-# You may not use this file except in compliance with the License.
-#
-# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
-# or http://www.opensolaris.org/os/licensing.
-# See the License for the specific language governing permissions
-# and limitations under the License.
-#
-# When distributing Covered Code, include this CDDL HEADER in each
-# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
-# If applicable, add the following below this CDDL HEADER, with the
-# fields enclosed by brackets "[]" replaced with your own identifying
-# information: Portions Copyright [yyyy] [name of copyright owner]
-#
-# CDDL HEADER END
-#
-
-# $FreeBSD$
-
-#
-# Copyright 2008 Sun Microsystems, Inc. All rights reserved.
-# Use is subject to license terms.
-#
-#ident "@(#)zpool_create_013_neg.ksh 1.2 08/02/27 SMI"
-#
-. $STF_SUITE/include/libtest.kshlib
-
-################################################################################
-#
-# __stc_assertion_start
-#
-# ID: zpool_create_013_neg
-#
-#
-# DESCRIPTION:
-# 'zpool create' will fail with metadevice in swap
-#
-# STRATEGY:
-# 1. Create a one way strip metadevice
-# 2. Try to create a new pool with metadevice in swap
-# 3. Verify the creation is failed.
-#
-# TESTABILITY: explicit
-#
-# TEST_AUTOMATION_LEVEL: automated
-#
-# CODING_STATUS: COMPLETED (2007-04-17)
-#
-# __stc_assertion_end
-#
-################################################################################
-
-verify_runnable "global"
-
-function cleanup
-{
- # cleanup SVM
- $METASTAT $md_name > /dev/null 2>&1
- if [[ $? -eq 0 ]]; then
- $SWAP -l | $GREP /dev/md/$md_name > /dev/null 2>&1
- if [[ $? -eq 0 ]]; then
- $SWAP -d /dev/md/$md_name
- fi
- $METACLEAR $md_name
- fi
-
- $METADB | $GREP $mddb_dev > /dev/null 2>&1
- if [[ $? -eq 0 ]]; then
- $METADB -df /dev/$mddb_dev
- fi
-
- if poolexists $TESTPOOL; then
- destroy_pool $TESTPOOL
- fi
-
-}
-
-if [[ -n $DISK ]]; then
- disk=$DISK
-else
- disk=$DISK0
-fi
-
-typeset mddb_dev=${disk}p1
-typeset md_dev=${disk}p2
-typeset md_name=d0
-typeset MD_DSK=/dev/md/d0
-
-log_assert "'zpool create' should fail with metadevice in swap."
-log_onexit cleanup
-
-#
-# use metadevice in swap to create pool, which should fail.
-#
-$METADB | $GREP $mddb_dev > /dev/null 2>&1
-if [[ $? -ne 0 ]]; then
- log_must $METADB -af $mddb_dev
-fi
-
-$METASTAT $md_name > /dev/null 2>&1
-if [[ $? -eq 0 ]]; then
- $METACLEAR $md_name
-fi
-
-log_must $METAINIT $md_name 1 1 $md_dev
-log_must $SWAP -a $MD_DSK
-for opt in "-n" "" "-f"; do
- log_mustnot $ZPOOL create $opt $TESTPOOL $MD_DSK
-done
-
-log_pass "'zpool create' passed as expected with inapplicable scenario."
diff --git a/tests/sys/cddl/zfs/tests/cli_root/zpool_create/zpool_create_014_neg.ksh b/tests/sys/cddl/zfs/tests/cli_root/zpool_create/zpool_create_014_neg.ksh
deleted file mode 100644
index 12d802856836..000000000000
--- a/tests/sys/cddl/zfs/tests/cli_root/zpool_create/zpool_create_014_neg.ksh
+++ /dev/null
@@ -1,103 +0,0 @@
-#!/usr/local/bin/ksh93 -p
-#
-# CDDL HEADER START
-#
-# The contents of this file are subject to the terms of the
-# Common Development and Distribution License (the "License").
-# You may not use this file except in compliance with the License.
-#
-# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
-# or http://www.opensolaris.org/os/licensing.
-# See the License for the specific language governing permissions
-# and limitations under the License.
-#
-# When distributing Covered Code, include this CDDL HEADER in each
-# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
-# If applicable, add the following below this CDDL HEADER, with the
-# fields enclosed by brackets "[]" replaced with your own identifying
-# information: Portions Copyright [yyyy] [name of copyright owner]
-#
-# CDDL HEADER END
-#
-
-# $FreeBSD$
-
-#
-# Copyright 2009 Sun Microsystems, Inc. All rights reserved.
-# Use is subject to license terms.
-#
-#ident "@(#)zpool_create_014_neg.ksh 1.3 09/06/22 SMI"
-#
-. $STF_SUITE/include/libtest.kshlib
-
-################################################################################
-#
-# __stc_assertion_start
-#
-# ID: zpool_create_014_neg
-#
-#
-# DESCRIPTION:
-# 'zpool create' will fail with ordinary file in swap
-#
-# STRATEGY:
-# 1. Create a regular file on top of UFS-zvol filesystem
-# 2. Try to create a new pool with regular file in swap
-# 3. Verify the creation is failed.
-#
-# TESTABILITY: explicit
-#
-# TEST_AUTOMATION_LEVEL: automated
-#
-# CODING_STATUS: COMPLETED (2007-04-17)
-#
-# __stc_assertion_end
-#
-################################################################################
-
-verify_runnable "global"
-
-function cleanup
-{
- if datasetexists $vol_name; then
- $SWAP -l | $GREP $TMP_FILE > /dev/null 2>&1
- if [[ $? -eq 0 ]]; then
- log_must $SWAP -d $TMP_FILE
- fi
- $RM -f $TMP_FILE
- log_must $UMOUNT $mntp
- $ZFS destroy $vol_name
- fi
-
- if poolexists $TESTPOOL; then
- destroy_pool $TESTPOOL
- fi
-}
-
-log_assert "'zpool create' should fail with regular file in swap."
-log_onexit cleanup
-
-if [[ -n $DISK ]]; then
- disk=$DISK
-else
- disk=$DISK0
-fi
-
-typeset pool_dev=${disk}p1
-typeset vol_name=$TESTPOOL/$TESTVOL
-typeset mntp=$TMPDIR
-typeset TMP_FILE=$mntp/tmpfile.${TESTCASE_ID}
-
-create_pool $TESTPOOL $pool_dev
-log_must $ZFS create -V 100m $vol_name
-log_must $ECHO "y" | $NEWFS /dev/zvol/$vol_name > /dev/null 2>&1
-log_must $MOUNT /dev/zvol/$vol_name $mntp
-
-log_must $MKFILE 50m $TMP_FILE
-log_must $SWAP -a $TMP_FILE
-
-for opt in "-n" "" "-f"; do
- log_mustnot $ZPOOL create $opt $TESTPOOL $TMP_FILE
-done
-
-log_pass "'zpool create' passed as expected with inapplicable scenario."
diff --git a/tests/sys/cddl/zfs/tests/cli_root/zpool_create/zpool_create_015_neg.ksh b/tests/sys/cddl/zfs/tests/cli_root/zpool_create/zpool_create_015_neg.ksh
index b463b381151c..fdef2b371ce4 100644
--- a/tests/sys/cddl/zfs/tests/cli_root/zpool_create/zpool_create_015_neg.ksh
+++ b/tests/sys/cddl/zfs/tests/cli_root/zpool_create/zpool_create_015_neg.ksh
@@ -62,16 +62,7 @@ verify_runnable "global"
function cleanup
{
- # cleanup zfs pool and dataset
- if datasetexists $vol_name; then
- $SWAP -l | $GREP /dev/zvol/$vol_name > /dev/null 2>&1
- if [[ $? -eq 0 ]]; then
- $SWAP -d /dev/zvol/${vol_name}
- fi
- fi
-
- destroy_pool $TESTPOOL1
- destroy_pool $TESTPOOL
+ $SWAPOFF /dev/zvol/${vol_name}
}
if [[ -n $DISK ]]; then
@@ -80,7 +71,7 @@ else
disk=$DISK0
fi
-typeset pool_dev=${disk}p1
+typeset pool_dev=${disk}
typeset vol_name=$TESTPOOL/$TESTVOL
log_assert "'zpool create' should fail with zfs vol device in swap."
@@ -91,13 +82,9 @@ log_onexit cleanup
#
create_pool $TESTPOOL $pool_dev
log_must $ZFS create -V 100m $vol_name
-log_must $SWAP -a /dev/zvol/$vol_name
-for opt in "-n" "" "-f"; do
+log_must $SWAPON /dev/zvol/$vol_name
+for opt in "" "-f"; do
log_mustnot $ZPOOL create $opt $TESTPOOL1 /dev/zvol/${vol_name}
done
-# cleanup
-log_must $SWAP -d /dev/zvol/${vol_name}
-log_must $ZFS destroy $vol_name
-
log_pass "'zpool create' passed as expected with inapplicable scenario."
diff --git a/tests/sys/cddl/zfs/tests/cli_root/zpool_create/zpool_create_016_pos.ksh b/tests/sys/cddl/zfs/tests/cli_root/zpool_create/zpool_create_016_pos.ksh
deleted file mode 100644
index 0f96a96f4c38..000000000000
--- a/tests/sys/cddl/zfs/tests/cli_root/zpool_create/zpool_create_016_pos.ksh
+++ /dev/null
@@ -1,100 +0,0 @@
-#!/usr/local/bin/ksh93 -p
-#
-# CDDL HEADER START
-#
-# The contents of this file are subject to the terms of the
-# Common Development and Distribution License (the "License").
-# You may not use this file except in compliance with the License.
-#
-# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
-# or http://www.opensolaris.org/os/licensing.
-# See the License for the specific language governing permissions
-# and limitations under the License.
-#
-# When distributing Covered Code, include this CDDL HEADER in each
-# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
-# If applicable, add the following below this CDDL HEADER, with the
-# fields enclosed by brackets "[]" replaced with your own identifying
-# information: Portions Copyright [yyyy] [name of copyright owner]
-#
-# CDDL HEADER END
-#
-
-# $FreeBSD$
-
-#
-# Copyright 2008 Sun Microsystems, Inc. All rights reserved.
-# Use is subject to license terms.
-#
-# ident "@(#)zpool_create_016_pos.ksh 1.2 08/08/15 SMI"
-#
-. $STF_SUITE/include/libtest.kshlib
-
-################################################################################
-#
-# __stc_assertion_start
-#
-# ID: zpool_create_016_pos
-#
-#
-# DESCRIPTION:
-# 'zpool create' will success with no device in swap
-#
-#
-# STRATEGY:
-# 1. delete all devices in the swap
-# 2. create a zpool
-# 3. Verify the creation is successed.
-#
-# TESTABILITY: explicit
-#
-# TEST_AUTOMATION_LEVEL: automated
-#
-# CODING_STATUS: COMPLETED (2007-04-17)
-#
-# __stc_assertion_end
-#
-################################################################################
-
-verify_runnable "global"
-
-function cleanup
-{
- destroy_pool $TESTPOOL
-
- #recover swap devices
- FSTAB=$TMPDIR/fstab_${TESTCASE_ID}
- $RM -f $FSTAB
- for sdisk in $swap_disks; do
- $ECHO "$sdisk - - swap - no -" >> $FSTAB
- done
- if [ -e $FSTAB ]
- then
- log_must $SWAPADD $FSTAB
- fi
- $RM -f $FSTAB
- if [ $dump_device != "none" ]
- then
- log_must $DUMPADM -u -d $dump_device
- fi
-}
-
-if [[ -n $DISK ]]; then
- disk=$DISK
-else
- disk=$DISK0
-fi
-typeset pool_dev=${disk}p1
-typeset swap_disks=`$SWAP -l | $GREP -v "swapfile" | $AWK '{print $1}'`
-typeset dump_device=`$DUMPADM | $GREP "Dump device" | $AWK '{print $3}'`
-
-log_assert "'zpool create' should success with no device in swap."
-log_onexit cleanup
-
-for sdisk in $swap_disks; do
- log_must $SWAP -d $sdisk
-done
-
-log_must $ZPOOL create $TESTPOOL $pool_dev
-
-log_pass "'zpool create' passed as expected with applicable scenario."
diff --git a/tests/sys/cddl/zfs/tests/cli_root/zpool_create/zpool_create_test.sh b/tests/sys/cddl/zfs/tests/cli_root/zpool_create/zpool_create_test.sh
index 068942dc472c..67a6ae692293 100755
--- a/tests/sys/cddl/zfs/tests/cli_root/zpool_create/zpool_create_test.sh
+++ b/tests/sys/cddl/zfs/tests/cli_root/zpool_create/zpool_create_test.sh
@@ -219,7 +219,7 @@ atf_test_case zpool_create_008_pos cleanup
zpool_create_008_pos_head()
{
atf_set "descr" "'zpool create' have to use '-f' scenarios"
- atf_set "require.progs" zpool format
+ atf_set "require.progs" zpool
atf_set "timeout" 2400
}
zpool_create_008_pos_body()
@@ -300,7 +300,7 @@ atf_test_case zpool_create_011_neg cleanup
zpool_create_011_neg_head()
{
atf_set "descr" "'zpool create' should be failed with inapplicable scenarios."
- atf_set "require.progs" dumpadm zpool
+ atf_set "require.progs" zpool
atf_set "timeout" 2400
}
zpool_create_011_neg_body()
@@ -310,6 +310,7 @@ zpool_create_011_neg_body()
. $(atf_get_srcdir)/zpool_create.cfg
verify_disk_count "$DISKS" 1
+ atf_expect_fail "PR 241070 dumpon opens geom devices non-exclusively"
ksh93 $(atf_get_srcdir)/setup.ksh || atf_fail "Setup failed"
ksh93 $(atf_get_srcdir)/zpool_create_011_neg.ksh || atf_fail "Testcase failed"
}
@@ -323,12 +324,11 @@ zpool_create_011_neg_cleanup()
}
-atf_test_case zpool_create_012_neg cleanup
+atf_test_case zpool_create_012_neg
zpool_create_012_neg_head()
{
atf_set "descr" "'zpool create' should fail with disk slice in swap."
- atf_set "require.progs" zpool swap
- atf_set "timeout" 2400
+ atf_set "require.progs" zpool
}
zpool_create_012_neg_body()
{
@@ -336,69 +336,8 @@ zpool_create_012_neg_body()
. $(atf_get_srcdir)/zpool_create.kshlib
. $(atf_get_srcdir)/zpool_create.cfg
- ksh93 $(atf_get_srcdir)/setup.ksh || atf_fail "Setup failed"
- ksh93 $(atf_get_srcdir)/zpool_create_012_neg.ksh || atf_fail "Testcase failed"
-}
-zpool_create_012_neg_cleanup()
-{
- . $(atf_get_srcdir)/../../../include/default.cfg
- . $(atf_get_srcdir)/zpool_create.kshlib
- . $(atf_get_srcdir)/zpool_create.cfg
-
- ksh93 $(atf_get_srcdir)/cleanup.ksh || atf_fail "Cleanup failed"
-}
-
-
-atf_test_case zpool_create_013_neg cleanup
-zpool_create_013_neg_head()
-{
- atf_set "descr" "'zpool create' should fail with metadevice in swap."
- atf_set "require.progs" metadb metaclear metastat zpool metainit swap
- atf_set "timeout" 2400
-}
-zpool_create_013_neg_body()
-{
- . $(atf_get_srcdir)/../../../include/default.cfg
- . $(atf_get_srcdir)/zpool_create.kshlib
- . $(atf_get_srcdir)/zpool_create.cfg
-
- ksh93 $(atf_get_srcdir)/setup.ksh || atf_fail "Setup failed"
- ksh93 $(atf_get_srcdir)/zpool_create_013_neg.ksh || atf_fail "Testcase failed"
-}
-zpool_create_013_neg_cleanup()
-{
- . $(atf_get_srcdir)/../../../include/default.cfg
- . $(atf_get_srcdir)/zpool_create.kshlib
- . $(atf_get_srcdir)/zpool_create.cfg
-
- ksh93 $(atf_get_srcdir)/cleanup.ksh || atf_fail "Cleanup failed"
-}
-
-
-atf_test_case zpool_create_014_neg cleanup
-zpool_create_014_neg_head()
-{
- atf_set "descr" "'zpool create' should fail with regular file in swap."
- atf_set "require.progs" zfs swap zpool
- atf_set "timeout" 2400
-}
-zpool_create_014_neg_body()
-{
- . $(atf_get_srcdir)/../../../include/default.cfg
- . $(atf_get_srcdir)/zpool_create.kshlib
- . $(atf_get_srcdir)/zpool_create.cfg
-
verify_disk_count "$DISKS" 1
- ksh93 $(atf_get_srcdir)/setup.ksh || atf_fail "Setup failed"
- ksh93 $(atf_get_srcdir)/zpool_create_014_neg.ksh || atf_fail "Testcase failed"
-}
-zpool_create_014_neg_cleanup()
-{
- . $(atf_get_srcdir)/../../../include/default.cfg
- . $(atf_get_srcdir)/zpool_create.kshlib
- . $(atf_get_srcdir)/zpool_create.cfg
-
- ksh93 $(atf_get_srcdir)/cleanup.ksh || atf_fail "Cleanup failed"
+ ksh93 $(atf_get_srcdir)/zpool_create_012_neg.ksh || atf_fail "Testcase failed"
}
@@ -406,8 +345,7 @@ atf_test_case zpool_create_015_neg cleanup
zpool_create_015_neg_head()
{
atf_set "descr" "'zpool create' should fail with zfs vol device in swap."
- atf_set "require.progs" zfs zpool swap
- atf_set "timeout" 2400
+ atf_set "require.progs" zfs zpool
}
zpool_create_015_neg_body()
{
@@ -429,33 +367,6 @@ zpool_create_015_neg_cleanup()
}
-atf_test_case zpool_create_016_pos cleanup
-zpool_create_016_pos_head()
-{
- atf_set "descr" "'zpool create' should success with no device in swap."
- atf_set "require.progs" dumpadm swapadd zpool swap
- atf_set "timeout" 2400
-}
-zpool_create_016_pos_body()
-{
- . $(atf_get_srcdir)/../../../include/default.cfg
- . $(atf_get_srcdir)/zpool_create.kshlib
- . $(atf_get_srcdir)/zpool_create.cfg
-
- verify_disk_count "$DISKS" 1
- ksh93 $(atf_get_srcdir)/setup.ksh || atf_fail "Setup failed"
- ksh93 $(atf_get_srcdir)/zpool_create_016_pos.ksh || atf_fail "Testcase failed"
-}
-zpool_create_016_pos_cleanup()
-{
- . $(atf_get_srcdir)/../../../include/default.cfg
- . $(atf_get_srcdir)/zpool_create.kshlib
- . $(atf_get_srcdir)/zpool_create.cfg
-
- ksh93 $(atf_get_srcdir)/cleanup.ksh || atf_fail "Cleanup failed"
-}
-
-
atf_test_case zpool_create_017_neg cleanup
zpool_create_017_neg_head()
{
@@ -663,10 +574,7 @@ atf_init_test_cases()
atf_add_test_case zpool_create_010_neg
atf_add_test_case zpool_create_011_neg
atf_add_test_case zpool_create_012_neg
- atf_add_test_case zpool_create_013_neg
- atf_add_test_case zpool_create_014_neg
atf_add_test_case zpool_create_015_neg
- atf_add_test_case zpool_create_016_pos
atf_add_test_case zpool_create_017_neg
atf_add_test_case zpool_create_018_pos
atf_add_test_case zpool_create_019_pos