summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--config/user-commands.m42
-rw-r--r--tests/zfs-tests/include/commands.cfg.in2
-rw-r--r--tests/zfs-tests/include/default.cfg.in6
-rw-r--r--tests/zfs-tests/include/libtest.shlib175
-rw-r--r--tests/zfs-tests/tests/functional/cache/cache.cfg5
-rwxr-xr-xtests/zfs-tests/tests/functional/cache/setup.ksh2
-rwxr-xr-xtests/zfs-tests/tests/functional/clean_mirror/cleanup.ksh6
-rw-r--r--tests/zfs-tests/tests/functional/clean_mirror/default.cfg43
-rwxr-xr-xtests/zfs-tests/tests/functional/clean_mirror/setup.ksh2
-rwxr-xr-xtests/zfs-tests/tests/functional/cli_root/zpool_add/cleanup.ksh5
-rwxr-xr-xtests/zfs-tests/tests/functional/cli_root/zpool_add/setup.ksh5
-rw-r--r--tests/zfs-tests/tests/functional/cli_root/zpool_add/zpool_add.cfg4
-rwxr-xr-xtests/zfs-tests/tests/functional/cli_root/zpool_create/setup.ksh7
-rw-r--r--tests/zfs-tests/tests/functional/cli_root/zpool_create/zpool_create.cfg8
-rwxr-xr-xtests/zfs-tests/tests/functional/cli_root/zpool_create/zpool_create_003_pos.ksh7
-rwxr-xr-xtests/zfs-tests/tests/functional/cli_root/zpool_create/zpool_create_006_pos.ksh1
-rwxr-xr-xtests/zfs-tests/tests/functional/cli_root/zpool_create/zpool_create_021_pos.ksh1
-rwxr-xr-xtests/zfs-tests/tests/functional/cli_root/zpool_create/zpool_create_022_pos.ksh1
-rwxr-xr-xtests/zfs-tests/tests/functional/cli_root/zpool_create/zpool_create_features_001_pos.ksh1
-rwxr-xr-xtests/zfs-tests/tests/functional/cli_root/zpool_create/zpool_create_features_002_pos.ksh1
-rwxr-xr-xtests/zfs-tests/tests/functional/cli_root/zpool_create/zpool_create_features_003_pos.ksh1
-rwxr-xr-xtests/zfs-tests/tests/functional/cli_root/zpool_create/zpool_create_features_004_neg.ksh1
-rw-r--r--tests/zfs-tests/tests/functional/cli_root/zpool_destroy/zpool_destroy.cfg3
-rw-r--r--tests/zfs-tests/tests/functional/cli_root/zpool_export/Makefile.am1
-rwxr-xr-xtests/zfs-tests/tests/functional/cli_root/zpool_export/setup.ksh1
-rw-r--r--tests/zfs-tests/tests/functional/cli_root/zpool_export/zpool_export.cfg59
-rwxr-xr-xtests/zfs-tests/tests/functional/cli_root/zpool_export/zpool_export_001_pos.ksh1
-rwxr-xr-xtests/zfs-tests/tests/functional/cli_root/zpool_import/cleanup.ksh4
-rwxr-xr-xtests/zfs-tests/tests/functional/cli_root/zpool_import/setup.ksh30
-rw-r--r--tests/zfs-tests/tests/functional/cli_root/zpool_import/zpool_import.cfg44
-rwxr-xr-xtests/zfs-tests/tests/functional/cli_root/zpool_remove/cleanup.ksh6
-rw-r--r--tests/zfs-tests/tests/functional/cli_root/zpool_remove/zpool_remove.cfg5
-rw-r--r--tests/zfs-tests/tests/functional/cli_root/zpool_scrub/zpool_scrub.cfg2
-rw-r--r--tests/zfs-tests/tests/functional/grow_pool/grow_pool.cfg3
-rw-r--r--tests/zfs-tests/tests/functional/grow_replicas/grow_replicas.cfg3
-rw-r--r--tests/zfs-tests/tests/functional/inuse/inuse.cfg3
-rwxr-xr-xtests/zfs-tests/tests/functional/migration/cleanup.ksh5
-rw-r--r--tests/zfs-tests/tests/functional/migration/migration.cfg44
-rwxr-xr-xtests/zfs-tests/tests/functional/migration/setup.ksh2
-rw-r--r--tests/zfs-tests/tests/functional/mmap/Makefile.am1
-rw-r--r--tests/zfs-tests/tests/functional/mmap/mmap.cfg59
-rwxr-xr-xtests/zfs-tests/tests/functional/mmap/mmap_read_001_pos.ksh1
-rw-r--r--tests/zfs-tests/tests/functional/mv_files/mv_files.cfg3
-rwxr-xr-xtests/zfs-tests/tests/functional/no_space/cleanup.ksh5
-rw-r--r--tests/zfs-tests/tests/functional/no_space/enospc.cfg4
-rwxr-xr-xtests/zfs-tests/tests/functional/no_space/setup.ksh9
-rw-r--r--tests/zfs-tests/tests/functional/online_offline/online_offline.cfg4
-rw-r--r--tests/zfs-tests/tests/functional/rsend/rsend.cfg2
-rwxr-xr-xtests/zfs-tests/tests/functional/scrub_mirror/cleanup.ksh5
-rw-r--r--tests/zfs-tests/tests/functional/scrub_mirror/default.cfg45
-rw-r--r--tests/zfs-tests/tests/functional/sparse/sparse.cfg6
-rw-r--r--tests/zfs-tests/tests/functional/truncate/truncate.cfg7
-rw-r--r--tests/zfs-tests/tests/functional/write_dirs/Makefile.am1
-rwxr-xr-xtests/zfs-tests/tests/functional/write_dirs/cleanup.ksh1
-rwxr-xr-xtests/zfs-tests/tests/functional/write_dirs/setup.ksh20
-rw-r--r--tests/zfs-tests/tests/functional/write_dirs/write_dirs.cfg48
-rwxr-xr-xtests/zfs-tests/tests/functional/write_dirs/write_dirs_001_pos.ksh1
-rwxr-xr-xtests/zfs-tests/tests/functional/write_dirs/write_dirs_002_pos.ksh1
-rw-r--r--tests/zfs-tests/tests/functional/zvol/zvol_ENOSPC/Makefile.am1
-rwxr-xr-xtests/zfs-tests/tests/functional/zvol/zvol_ENOSPC/setup.ksh6
-rw-r--r--tests/zfs-tests/tests/functional/zvol/zvol_ENOSPC/zvol_ENOSPC.cfg49
-rw-r--r--tests/zfs-tests/tests/functional/zvol/zvol_cli/Makefile.am1
-rwxr-xr-xtests/zfs-tests/tests/functional/zvol/zvol_cli/setup.ksh6
-rw-r--r--tests/zfs-tests/tests/functional/zvol/zvol_cli/zvol_cli.cfg46
64 files changed, 776 insertions, 58 deletions
diff --git a/config/user-commands.m4 b/config/user-commands.m4
index bda2b8652..112e4c18c 100644
--- a/config/user-commands.m4
+++ b/config/user-commands.m4
@@ -99,9 +99,11 @@ AC_DEFUN([ZFS_AC_CONFIG_USER_COMMANDS_LINUX], [
AC_PATH_TOOL(COMPRESS, gzip, "")
AC_PATH_TOOL(FORMAT, parted, "")
AC_PATH_TOOL(LOCKFS, lsof, "")
+ AC_PATH_TOOL(LSBLK, lsblk, "")
AC_PATH_TOOL(MODUNLOAD, rmmod, "")
AC_PATH_TOOL(NEWFS, mke2fs, "")
AC_PATH_TOOL(PFEXEC, sudo, "")
+ AC_PATH_TOOL(READLINK, readlink, "")
AC_PATH_TOOL(SHARE, exportfs, "")
AC_PATH_TOOL(SWAP, swapon, "")
AC_PATH_TOOL(SWAPADD, swapon, "")
diff --git a/tests/zfs-tests/include/commands.cfg.in b/tests/zfs-tests/include/commands.cfg.in
index bea8df629..10d8ffd8a 100644
--- a/tests/zfs-tests/include/commands.cfg.in
+++ b/tests/zfs-tests/include/commands.cfg.in
@@ -52,6 +52,7 @@ export LOCKFS="@LOCKFS@"
export LOFIADM="@LOFIADM@"
export LOGNAME="@LOGNAME@"
export LS="@LS@"
+export LSBLK="@LSBLK@"
export MD5SUM="@MD5SUM@"
export MKDIR="@MKDIR@"
export MKNOD="@MKNOD@"
@@ -75,6 +76,7 @@ export PRTVTOC="@PRTVTOC@"
export PS="@PS@"
export PSRINFO="@PSRINFO@"
export PYTHON="@PYTHON@"
+export READLINK="@READLINK@"
export REBOOT="@REBOOT@"
export RM="@RM@"
export RMDIR="@RMDIR@"
diff --git a/tests/zfs-tests/include/default.cfg.in b/tests/zfs-tests/include/default.cfg.in
index 13317ea87..ec2eb90f0 100644
--- a/tests/zfs-tests/include/default.cfg.in
+++ b/tests/zfs-tests/include/default.cfg.in
@@ -171,6 +171,8 @@ for i in $ZFS_ALL_VERSIONS; do
eval 'export ZFS_VERSION_$i="v${i}-fs"'
done
+export MAX_PARTITIONS=8
+
if is_linux; then
unpack_opts="--sparse -xf"
pack_opts="--sparse -cf"
@@ -180,8 +182,8 @@ if is_linux; then
ZVOL_DEVDIR="/dev/zvol"
ZVOL_RDEVDIR="/dev/zvol"
- DEV_DSKDIR="/dev"
DEV_RDSKDIR="/dev"
+ DEV_MPATHDIR="/dev/mapper"
NEWFS_DEFAULT_FS="ext2"
else
@@ -199,4 +201,4 @@ else
NEWFS_DEFAULT_FS="ufs"
fi
export unpack_opts pack_opts verbose unpack_preserve pack_preserve \
- ZVOL_DEVDIR ZVOL_RDEVDIR NEWFS_DEFAULT_FS DEV_DSKDIR DEV_RDSKDIR
+ ZVOL_DEVDIR ZVOL_RDEVDIR NEWFS_DEFAULT_FS DEV_RDSKDIR DEV_MPATHDIR
diff --git a/tests/zfs-tests/include/libtest.shlib b/tests/zfs-tests/include/libtest.shlib
index a9236a3bc..0c9ddd1cf 100644
--- a/tests/zfs-tests/include/libtest.shlib
+++ b/tests/zfs-tests/include/libtest.shlib
@@ -456,6 +456,11 @@ function default_cleanup_noexit
[[ -d $TESTDIR ]] && \
log_must $RM -rf $TESTDIR
+
+ disk1=${DISKS%% *}
+ if is_mpath_device $disk1; then
+ delete_partitions
+ fi
}
@@ -734,6 +739,69 @@ function set_partition #<slice_num> <slice_start> <size_plus_units> <whole_disk
}
#
+# Delete all partitions on all disks - this is specifically for the use of multipath
+# devices which currently can only be used in the test suite as raw/un-partitioned
+# devices (ie a zpool cannot be created on a whole mpath device that has partitions)
+#
+function delete_partitions
+{
+ typeset -i j=1
+
+ if [[ -z $DISK_ARRAY_NUM ]]; then
+ DISK_ARRAY_NUM=$($ECHO ${DISKS} | $NAWK '{print NF}')
+ fi
+ if [[ -z $DISKSARRAY ]]; then
+ DISKSARRAY=$DISKS
+ fi
+
+ if is_linux; then
+ if (( $DISK_ARRAY_NUM == 1 )); then
+ while ((j < MAX_PARTITIONS)); do
+ $FORMAT $DEV_DSKDIR/$DISK -s rm $j > /dev/null 2>&1
+ if (( $? == 1 )); then
+ $LSBLK | $EGREP ${DISK}${SLICE_PREFIX}${j} > /dev/null
+ if (( $? == 1 )); then
+ log_note "Partitions for $DISK should be deleted"
+ else
+ log_fail "Partition for ${DISK}${SLICE_PREFIX}${j} not deleted"
+ fi
+ return 0
+ else
+ $LSBLK | $EGREP ${DISK}${SLICE_PREFIX}${j} > /dev/null
+ if (( $? == 0 )); then
+ log_fail "Partition for ${DISK}${SLICE_PREFIX}${j} not deleted"
+ fi
+ fi
+ ((j = j+1))
+ done
+ else
+ for disk in `$ECHO $DISKSARRAY`; do
+ while ((j < MAX_PARTITIONS)); do
+ $FORMAT $DEV_DSKDIR/$disk -s rm $j > /dev/null 2>&1
+ if (( $? == 1 )); then
+ $LSBLK | $EGREP ${disk}${SLICE_PREFIX}${j} > /dev/null
+ if (( $? == 1 )); then
+ log_note "Partitions for $disk should be deleted"
+ else
+ log_fail "Partition for ${disk}${SLICE_PREFIX}${j} not deleted"
+ fi
+ j=7
+ else
+ $LSBLK | $EGREP ${disk}${SLICE_PREFIX}${j} > /dev/null
+ if (( $? == 0 )); then
+ log_fail "Partition for ${disk}${SLICE_PREFIX}${j} not deleted"
+ fi
+ fi
+ ((j = j+1))
+ done
+ j=1
+ done
+ fi
+ fi
+ return 0
+}
+
+#
# Get the end cyl of the given slice
#
function get_endslice #<disk> <slice>
@@ -2483,6 +2551,113 @@ function is_physical_device #device
}
#
+# Check if the given device is a real device (ie SCSI device)
+#
+function is_real_device #disk
+{
+ typeset disk=$1
+ [[ -z $disk ]] && log_fail "No argument for disk given."
+
+ if is_linux; then
+ $LSBLK $DEV_RDSKDIR/$disk -o TYPE | $EGREP disk > /dev/null 2>&1
+ return $?
+ fi
+}
+
+#
+# Check if the given device is a loop device
+#
+function is_loop_device #disk
+{
+ typeset disk=$1
+ [[ -z $disk ]] && log_fail "No argument for disk given."
+
+ if is_linux; then
+ $LSBLK $DEV_RDSKDIR/$disk -o TYPE | $EGREP loop > /dev/null 2>&1
+ return $?
+ fi
+}
+
+#
+# Check if the given device is a multipath device and if there is a sybolic
+# link to a device mapper and to a disk
+# Currently no support for dm devices alone without multipath
+#
+function is_mpath_device #disk
+{
+ typeset disk=$1
+ [[ -z $disk ]] && log_fail "No argument for disk given."
+
+ if is_linux; then
+ $LSBLK $DEV_MPATHDIR/$disk -o TYPE | $EGREP mpath > /dev/null 2>&1
+ if (($? == 0)); then
+ $READLINK $DEV_MPATHDIR/$disk > /dev/null 2>&1
+ return $?
+ else
+ return $?
+ fi
+ fi
+}
+
+# Set the slice prefix for disk partitioning depending
+# on whether the device is a real, multipath, or loop device.
+# Currently all disks have to be of the same type, so only
+# checks first disk to determine slice prefix.
+#
+function set_slice_prefix
+{
+ typeset disk
+ typeset -i i=0
+
+ if is_linux; then
+ while (( i < $DISK_ARRAY_NUM )); do
+ disk="$($ECHO $DISKS | $NAWK '{print $(i + 1)}')"
+ if ( is_mpath_device $disk ) && [[ -z $($ECHO $disk | awk 'substr($1,18,1)\
+ ~ /^[[:digit:]]+$/') ]] || ( is_real_device $disk ); then
+ export SLICE_PREFIX=""
+ return 0
+ elif ( is_mpath_device $disk || is_loop_device $disk ); then
+ export SLICE_PREFIX="p"
+ return 0
+ else
+ log_fail "$disk not supported for partitioning."
+ fi
+ (( i = i + 1))
+ done
+ fi
+}
+
+#
+# Set the directory path of the listed devices in $DISK_ARRAY_NUM
+# Currently all disks have to be of the same type, so only
+# checks first disk to determine device directory
+# default = /dev (linux)
+# real disk = /dev (linux)
+# multipath device = /dev/mapper (linux)
+#
+function set_device_dir
+{
+ typeset disk
+ typeset -i i=0
+
+ if is_linux; then
+ while (( i < $DISK_ARRAY_NUM )); do
+ disk="$($ECHO $DISKS | $NAWK '{print $(i + 1)}')"
+ if is_mpath_device $disk; then
+ export DEV_DSKDIR=$DEV_MPATHDIR
+ return 0
+ else
+ export DEV_DSKDIR=$DEV_RDSKDIR
+ return 0
+ fi
+ (( i = i + 1))
+ done
+ else
+ export DEV_DSKDIR=$DEV_RDSKDIR
+ fi
+}
+
+#
# Get the directory path of given device
#
function get_device_dir #device
diff --git a/tests/zfs-tests/tests/functional/cache/cache.cfg b/tests/zfs-tests/tests/functional/cache/cache.cfg
index f8a795d15..f3155323d 100644
--- a/tests/zfs-tests/tests/functional/cache/cache.cfg
+++ b/tests/zfs-tests/tests/functional/cache/cache.cfg
@@ -30,12 +30,12 @@
. $STF_SUITE/include/libtest.shlib
+export DISK_ARRAY_NUM=0
+
function set_disks
{
set -A disk_array $(find_disks $DISKS)
- typeset -i DISK_ARRAY_NUM=0
-
if (( ${#disk_array[*]} <= 1 )); then
export DISK=${DISKS%% *}
else
@@ -58,6 +58,7 @@ function set_disks
}
set_disks
+set_device_dir
export SIZE=64M
diff --git a/tests/zfs-tests/tests/functional/cache/setup.ksh b/tests/zfs-tests/tests/functional/cache/setup.ksh
index 832dfe92b..713eca9a2 100755
--- a/tests/zfs-tests/tests/functional/cache/setup.ksh
+++ b/tests/zfs-tests/tests/functional/cache/setup.ksh
@@ -34,7 +34,7 @@
verify_runnable "global"
-if ! $(is_physical_device $LDEV) ; then
+if ! is_physical_device $LDEV; then
log_unsupported "Only physical disk could be cache device"
fi
diff --git a/tests/zfs-tests/tests/functional/clean_mirror/cleanup.ksh b/tests/zfs-tests/tests/functional/clean_mirror/cleanup.ksh
index e09fb596f..05ef9c16a 100755
--- a/tests/zfs-tests/tests/functional/clean_mirror/cleanup.ksh
+++ b/tests/zfs-tests/tests/functional/clean_mirror/cleanup.ksh
@@ -38,6 +38,12 @@ $DF -F zfs -h | $GREP "$TESTFS " >/dev/null
[[ $? == 0 ]] && log_must $ZFS umount -f $TESTDIR
destroy_pool $TESTPOOL
+if is_mpath_device $MIRROR_PRIMARY; then
+ $FORMAT $DEV_DSKDIR/$MIRROR_PRIMARY -s rm 1
+fi
+if is_mpath_device $MIRROR_SECONDARY; then
+ $FORMAT $DEV_DSKDIR/$MIRROR_SECONDARY -s rm 1
+fi
# recreate and destroy a zpool over the disks to restore the partitions to
# normal
if [[ -n $SINGLE_DISK ]]; then
diff --git a/tests/zfs-tests/tests/functional/clean_mirror/default.cfg b/tests/zfs-tests/tests/functional/clean_mirror/default.cfg
index 35cd14161..756ce2308 100644
--- a/tests/zfs-tests/tests/functional/clean_mirror/default.cfg
+++ b/tests/zfs-tests/tests/functional/clean_mirror/default.cfg
@@ -44,9 +44,23 @@ if [[ -z $MIRROR_SECONDARY ]]; then
SIDE_SECONDARY_PART=1
if is_linux; then
- SIDE_PRIMARY=${SINGLE_DISK}p1
- SIDE_SECONDARY=${SINGLE_DISK}p2
+ if is_mpath_device $SINGLE_DISK; then
+ export DEV_DSKDIR=$DEV_MPATHDIR
+ else
+ export DEV_DSKDIR=$DEV_RDSKDIR
+ fi
+ if ( is_mpath_device $SINGLE_DISK ) && [[ -z $($ECHO $SINGLE_DISK | awk 'substr($1,18,1)\
+ ~ /^[[:digit:]]+$/') ]] || ( is_real_device $SINGLE_DISK ); then
+ SIDE_PRIMARY=${SINGLE_DISK}1
+ SIDE_SECONDARY=${SINGLE_DISK}2
+ elif ( is_mpath_device $SINGLE_DISK || is_loop_device $SINGLE_DISK ); then
+ SIDE_PRIMARY=${SINGLE_DISK}p1
+ SIDE_SECONDARY=${SINGLE_DISK}p2
+ else
+ log_fail "$SINGLE_DISK not supported for partitioning."
+ fi
else
+ export DEV_DSKDIR="/dev"
SIDE_PRIMARY=${SINGLE_DISK}s${SIDE_PRIMARY_PART}
SIDE_SECONDARY=${SINGLE_DISK}s${SIDE_SECONDARY_PART}
fi
@@ -54,9 +68,30 @@ else
SIDE_PRIMARY_PART=0
SIDE_SECONDARY_PART=0
if is_linux; then
- SIDE_PRIMARY=${MIRROR_PRIMARY}p1
- SIDE_SECONDARY=${MIRROR_SECONDARY}p1
+ if is_mpath_device $MIRROR_PRIMARY; then
+ export DEV_DSKDIR=$DEV_MPATHDIR
+ else
+ export DEV_DSKDIR=$DEV_RDSKDIR
+ fi
+ if ( is_mpath_device $MIRROR_PRIMARY ) && [[ -z $($ECHO $MIRROR_PRIMARY | awk 'substr($1,18,1)\
+ ~ /^[[:digit:]]+$/') ]] || ( is_real_device $MIRROR_PRIMARY ); then
+ SIDE_PRIMARY=${MIRROR_PRIMARY}1
+ elif ( is_mpath_device $MIRROR_PRIMARY || is_loop_device $MIRROR_PRIMARY ); then
+ SIDE_PRIMARY=${MIRROR_PRIMARY}p1
+ else
+ log_fail "$MIRROR_PRIMARY not supported for partitioning."
+ fi
+ if ( is_mpath_device $MIRROR_SECONDARY ) && [[ -z $($ECHO $MIRROR_SECONDARY | awk 'substr($1,18,1)\
+ ~ /^[[:digit:]]+$/') ]] || ( is_real_device $MIRROR_SECONDARY ); then
+ SIDE_SECONDARY=${MIRROR_SECONDARY}1
+ elif ( is_mpath_device $MIRROR_SECONDARY || is_loop_device $MIRROR_SECONDARY ); then
+ SIDE_SECONDARY=${MIRROR_SECONDARY}p1
+ else
+ log_fail "$MIRROR_SECONDARY not supported for partitioning."
+ fi
+
else
+ export DEV_DSKDIR="/dev"
SIDE_PRIMARY=${MIRROR_PRIMARY}s${SIDE_PRIMARY_PART}
SIDE_SECONDARY=${MIRROR_SECONDARY}s${SIDE_SECONDARY_PART}
fi
diff --git a/tests/zfs-tests/tests/functional/clean_mirror/setup.ksh b/tests/zfs-tests/tests/functional/clean_mirror/setup.ksh
index 6ea2f1ef2..2d17bf9cb 100755
--- a/tests/zfs-tests/tests/functional/clean_mirror/setup.ksh
+++ b/tests/zfs-tests/tests/functional/clean_mirror/setup.ksh
@@ -34,7 +34,7 @@
verify_runnable "global"
-if ! $(is_physical_device $DISKS) ; then
+if ! is_physical_device $DISKS; then
log_unsupported "This directory cannot be run on raw files."
fi
diff --git a/tests/zfs-tests/tests/functional/cli_root/zpool_add/cleanup.ksh b/tests/zfs-tests/tests/functional/cli_root/zpool_add/cleanup.ksh
index b4916f957..48a6bc301 100755
--- a/tests/zfs-tests/tests/functional/cli_root/zpool_add/cleanup.ksh
+++ b/tests/zfs-tests/tests/functional/cli_root/zpool_add/cleanup.ksh
@@ -32,6 +32,11 @@
. $STF_SUITE/include/libtest.shlib
. $STF_SUITE/tests/functional/cli_root/zpool_add/zpool_add.kshlib
+DISK=${DISKS%% *}
+if is_mpath_device $DISK; then
+ delete_partitions
+fi
+
cleanup_devices $DISKS
log_pass
diff --git a/tests/zfs-tests/tests/functional/cli_root/zpool_add/setup.ksh b/tests/zfs-tests/tests/functional/cli_root/zpool_add/setup.ksh
index f35dedd3c..131876f8c 100755
--- a/tests/zfs-tests/tests/functional/cli_root/zpool_add/setup.ksh
+++ b/tests/zfs-tests/tests/functional/cli_root/zpool_add/setup.ksh
@@ -38,6 +38,11 @@ if ! $(is_physical_device $DISKS) ; then
log_unsupported "This directory cannot be run on raw files."
fi
+disk1=${DISKS%% *}
+if is_mpath_device $disk1; then
+ delete_partitions
+fi
+
if [[ -n $DISK ]]; then
#
# Use 'zpool create' to clean up the infomation in
diff --git a/tests/zfs-tests/tests/functional/cli_root/zpool_add/zpool_add.cfg b/tests/zfs-tests/tests/functional/cli_root/zpool_add/zpool_add.cfg
index c18c6aa4f..f12a883dc 100644
--- a/tests/zfs-tests/tests/functional/cli_root/zpool_add/zpool_add.cfg
+++ b/tests/zfs-tests/tests/functional/cli_root/zpool_add/zpool_add.cfg
@@ -72,7 +72,8 @@ export SIZE="150m"
export SIZE1="250m"
if is_linux; then
- export SLICE_PREFIX="p"
+ set_device_dir
+ set_slice_prefix
export SLICE0=1
export SLICE1=2
export SLICE3=4
@@ -80,6 +81,7 @@ if is_linux; then
export SLICE5=6
export SLICE6=7
else
+ export DEV_DSKDIR="/dev"
export SLICE_PREFIX="s"
export SLICE0=0
export SLICE1=1
diff --git a/tests/zfs-tests/tests/functional/cli_root/zpool_create/setup.ksh b/tests/zfs-tests/tests/functional/cli_root/zpool_create/setup.ksh
index 409d5d04d..fa79e0bfa 100755
--- a/tests/zfs-tests/tests/functional/cli_root/zpool_create/setup.ksh
+++ b/tests/zfs-tests/tests/functional/cli_root/zpool_create/setup.ksh
@@ -32,6 +32,13 @@
. $STF_SUITE/include/libtest.shlib
. $STF_SUITE/tests/functional/cli_root/zpool_create/zpool_create.shlib
+[[ -z $FORMAT ]] || \
+[[ -z $MKDIR ]] || \
+[[ -z $LSBLK ]] || \
+[[ -z $READLINK ]] || \
+[[ -z $TOUCH ]] && \
+ log_fail "Missing required commands"
+
verify_runnable "global"
if ! $(is_physical_device $DISKS) ; then
diff --git a/tests/zfs-tests/tests/functional/cli_root/zpool_create/zpool_create.cfg b/tests/zfs-tests/tests/functional/cli_root/zpool_create/zpool_create.cfg
index d39b98749..33dd8866e 100644
--- a/tests/zfs-tests/tests/functional/cli_root/zpool_create/zpool_create.cfg
+++ b/tests/zfs-tests/tests/functional/cli_root/zpool_create/zpool_create.cfg
@@ -41,6 +41,7 @@ function set_disks
if (( ${#disk_array[*]} <= 1 )); then
export DISK=${DISKS%% *}
+ export DISK_ARRAY_NUM=1
else
export DISK=""
typeset -i i=0
@@ -63,7 +64,8 @@ export SIZE="200m"
export SIZE1="250m"
if is_linux; then
- export SLICE_PREFIX="p"
+ set_device_dir
+ set_slice_prefix
export SLICE0=1
export SLICE1=2
export SLICE2=3
@@ -72,6 +74,10 @@ if is_linux; then
export SLICE5=6
export SLICE6=7
export SLICE7=8
+ disk1=${DISKS%% *}
+ if is_mpath_device $disk1; then
+ delete_partitions
+ fi
else
export SLICE_PREFIX="s"
export SLICE0=0
diff --git a/tests/zfs-tests/tests/functional/cli_root/zpool_create/zpool_create_003_pos.ksh b/tests/zfs-tests/tests/functional/cli_root/zpool_create/zpool_create_003_pos.ksh
index 008828b88..e7917e826 100755
--- a/tests/zfs-tests/tests/functional/cli_root/zpool_create/zpool_create_003_pos.ksh
+++ b/tests/zfs-tests/tests/functional/cli_root/zpool_create/zpool_create_003_pos.ksh
@@ -51,7 +51,7 @@ function cleanup
tmpfile="/var/tmp/zpool_create_003.tmp$$"
-log_assert "'zpool create -n <pool> <vspec> ...' can display the configureation" \
+log_assert "'zpool create -n <pool> <vspec> ...' can display the configuration" \
"without actually creating the pool."
log_onexit cleanup
@@ -62,6 +62,11 @@ else
disk=$DISK0
fi
+DISK=${DISKS%% *}
+if is_mpath_device $DISK; then
+ partition_disk $SIZE $disk 1
+fi
+
#
# Make sure disk is clean before we use it
#
diff --git a/tests/zfs-tests/tests/functional/cli_root/zpool_create/zpool_create_006_pos.ksh b/tests/zfs-tests/tests/functional/cli_root/zpool_create/zpool_create_006_pos.ksh
index 70dcadc91..56c6e54ee 100755
--- a/tests/zfs-tests/tests/functional/cli_root/zpool_create/zpool_create_006_pos.ksh
+++ b/tests/zfs-tests/tests/functional/cli_root/zpool_create/zpool_create_006_pos.ksh
@@ -26,6 +26,7 @@
#
. $STF_SUITE/include/libtest.shlib
+. $STF_SUITE/tests/functional/cli_root/zpool_create/zpool_create.shlib
#
# DESCRIPTION:
diff --git a/tests/zfs-tests/tests/functional/cli_root/zpool_create/zpool_create_021_pos.ksh b/tests/zfs-tests/tests/functional/cli_root/zpool_create/zpool_create_021_pos.ksh
index c4884413a..df40f401d 100755
--- a/tests/zfs-tests/tests/functional/cli_root/zpool_create/zpool_create_021_pos.ksh
+++ b/tests/zfs-tests/tests/functional/cli_root/zpool_create/zpool_create_021_pos.ksh
@@ -31,6 +31,7 @@
. $STF_SUITE/include/libtest.shlib
. $STF_SUITE/tests/functional/cli_root/zfs_create/zfs_create_common.kshlib
+. $STF_SUITE/tests/functional/cli_root/zpool_create/zpool_create.shlib
#
# DESCRIPTION:
diff --git a/tests/zfs-tests/tests/functional/cli_root/zpool_create/zpool_create_022_pos.ksh b/tests/zfs-tests/tests/functional/cli_root/zpool_create/zpool_create_022_pos.ksh
index 9cc78a16f..2186d6cf7 100755
--- a/tests/zfs-tests/tests/functional/cli_root/zpool_create/zpool_create_022_pos.ksh
+++ b/tests/zfs-tests/tests/functional/cli_root/zpool_create/zpool_create_022_pos.ksh
@@ -31,6 +31,7 @@
. $STF_SUITE/include/libtest.shlib
. $STF_SUITE/tests/functional/cli_root/zfs_create/zfs_create_common.kshlib
+. $STF_SUITE/tests/functional/cli_root/zpool_create/zpool_create.shlib
#
# DESCRIPTION:
diff --git a/tests/zfs-tests/tests/functional/cli_root/zpool_create/zpool_create_features_001_pos.ksh b/tests/zfs-tests/tests/functional/cli_root/zpool_create/zpool_create_features_001_pos.ksh
index 296a7b47f..746c5041a 100755
--- a/tests/zfs-tests/tests/functional/cli_root/zpool_create/zpool_create_features_001_pos.ksh
+++ b/tests/zfs-tests/tests/functional/cli_root/zpool_create/zpool_create_features_001_pos.ksh
@@ -25,6 +25,7 @@
#
. $STF_SUITE/include/libtest.shlib
+. $STF_SUITE/tests/functional/cli_root/zpool_create/zpool_create.shlib
################################################################################
#
diff --git a/tests/zfs-tests/tests/functional/cli_root/zpool_create/zpool_create_features_002_pos.ksh b/tests/zfs-tests/tests/functional/cli_root/zpool_create/zpool_create_features_002_pos.ksh
index ce24b38dd..f0e2086ca 100755
--- a/tests/zfs-tests/tests/functional/cli_root/zpool_create/zpool_create_features_002_pos.ksh
+++ b/tests/zfs-tests/tests/functional/cli_root/zpool_create/zpool_create_features_002_pos.ksh
@@ -25,6 +25,7 @@
#
. $STF_SUITE/include/libtest.shlib
+. $STF_SUITE/tests/functional/cli_root/zpool_create/zpool_create.shlib
################################################################################
#
diff --git a/tests/zfs-tests/tests/functional/cli_root/zpool_create/zpool_create_features_003_pos.ksh b/tests/zfs-tests/tests/functional/cli_root/zpool_create/zpool_create_features_003_pos.ksh
index 936a1cd57..9d45dfd40 100755
--- a/tests/zfs-tests/tests/functional/cli_root/zpool_create/zpool_create_features_003_pos.ksh
+++ b/tests/zfs-tests/tests/functional/cli_root/zpool_create/zpool_create_features_003_pos.ksh
@@ -25,6 +25,7 @@
#
. $STF_SUITE/include/libtest.shlib
+. $STF_SUITE/tests/functional/cli_root/zpool_create/zpool_create.shlib
################################################################################
#
diff --git a/tests/zfs-tests/tests/functional/cli_root/zpool_create/zpool_create_features_004_neg.ksh b/tests/zfs-tests/tests/functional/cli_root/zpool_create/zpool_create_features_004_neg.ksh
index 2d3ffc8b8..a52e86251 100755
--- a/tests/zfs-tests/tests/functional/cli_root/zpool_create/zpool_create_features_004_neg.ksh
+++ b/tests/zfs-tests/tests/functional/cli_root/zpool_create/zpool_create_features_004_neg.ksh
@@ -25,6 +25,7 @@
#
. $STF_SUITE/include/libtest.shlib
+. $STF_SUITE/tests/functional/cli_root/zpool_create/zpool_create.shlib
################################################################################
#
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 63051e2d6..e9d8831f8 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
@@ -31,7 +31,8 @@
export DISK=${DISKS%% *}
if is_linux; then
- export SLICE_PREFIX="p"
+ set_device_dir
+ set_slice_prefix
export SLICE0=1
export SLICE1=2
else
diff --git a/tests/zfs-tests/tests/functional/cli_root/zpool_export/Makefile.am b/tests/zfs-tests/tests/functional/cli_root/zpool_export/Makefile.am
index a1d97ebab..d0af877f3 100644
--- a/tests/zfs-tests/tests/functional/cli_root/zpool_export/Makefile.am
+++ b/tests/zfs-tests/tests/functional/cli_root/zpool_export/Makefile.am
@@ -2,6 +2,7 @@ pkgdatadir = $(datadir)/@PACKAGE@/zfs-tests/tests/functional/cli_root/zpool_expo
dist_pkgdata_SCRIPTS = \
setup.ksh \
cleanup.ksh \
+ zpool_export.cfg \
zpool_export_001_pos.ksh \
zpool_export_002_pos.ksh \
zpool_export_003_neg.ksh \
diff --git a/tests/zfs-tests/tests/functional/cli_root/zpool_export/setup.ksh b/tests/zfs-tests/tests/functional/cli_root/zpool_export/setup.ksh
index 9ce5226e6..925f3e4af 100755
--- a/tests/zfs-tests/tests/functional/cli_root/zpool_export/setup.ksh
+++ b/tests/zfs-tests/tests/functional/cli_root/zpool_export/setup.ksh
@@ -26,6 +26,7 @@
#
. $STF_SUITE/include/libtest.shlib
+. $STF_SUITE/tests/functional/cli_root/zpool_export/zpool_export.cfg
DISK=${DISKS%% *}
diff --git a/tests/zfs-tests/tests/functional/cli_root/zpool_export/zpool_export.cfg b/tests/zfs-tests/tests/functional/cli_root/zpool_export/zpool_export.cfg
new file mode 100644
index 000000000..1501c0463
--- /dev/null
+++ b/tests/zfs-tests/tests/functional/cli_root/zpool_export/zpool_export.cfg
@@ -0,0 +1,59 @@
+#
+# 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
+#
+
+#
+# Copyright 2008 Sun Microsystems, Inc. All rights reserved.
+# Use is subject to license terms.
+#
+
+#
+# Copyright (c) 2012, 2014 by Delphix. All rights reserved.
+#
+
+. $STF_SUITE/include/libtest.shlib
+
+export DISK_ARRAY_NUM=0
+export DISK_ARRAY_LIMIT=4
+export DISKSARRAY=""
+export VDEVS_NUM=32
+
+function set_disks
+{
+ typeset -a disk_array=($(find_disks $DISKS))
+
+ if (( ${#disk_array[*]} <= 1 )); then
+ export DISK=${DISKS%% *}
+ else
+ export DISK=""
+ typeset -i i=0
+ while (( i < ${#disk_array[*]} )); do
+ export DISK${i}="${disk_array[$i]}"
+ DISKSARRAY="$DISKSARRAY ${disk_array[$i]}"
+ (( i = i + 1 ))
+ (( i>$DISK_ARRAY_LIMIT )) && break
+ done
+ export DISK_ARRAY_NUM=$i
+ export DISKSARRAY
+ fi
+}
+
+set_disks
+set_device_dir
diff --git a/tests/zfs-tests/tests/functional/cli_root/zpool_export/zpool_export_001_pos.ksh b/tests/zfs-tests/tests/functional/cli_root/zpool_export/zpool_export_001_pos.ksh
index 6f404ce12..af7c6f275 100755
--- a/tests/zfs-tests/tests/functional/cli_root/zpool_export/zpool_export_001_pos.ksh
+++ b/tests/zfs-tests/tests/functional/cli_root/zpool_export/zpool_export_001_pos.ksh
@@ -25,6 +25,7 @@
# Use is subject to license terms.
#
. $STF_SUITE/include/libtest.shlib
+. $STF_SUITE/tests/functional/cli_root/zpool_export/zpool_export.cfg
#
# DESCRIPTION:
diff --git a/tests/zfs-tests/tests/functional/cli_root/zpool_import/cleanup.ksh b/tests/zfs-tests/tests/functional/cli_root/zpool_import/cleanup.ksh
index 03830c434..c55d70c7b 100755
--- a/tests/zfs-tests/tests/functional/cli_root/zpool_import/cleanup.ksh
+++ b/tests/zfs-tests/tests/functional/cli_root/zpool_import/cleanup.ksh
@@ -48,6 +48,10 @@ for dir in "$TESTDIR" "$TESTDIR1" "$DEVICE_DIR" ; do
log_must $RM -rf $dir
done
+DISK=${DISKS%% *}
+if is_mpath_device $DISK; then
+ delete_partitions
+fi
# recreate and destroy a zpool over the disks to restore the partitions to
# normal
case $DISK_COUNT in
diff --git a/tests/zfs-tests/tests/functional/cli_root/zpool_import/setup.ksh b/tests/zfs-tests/tests/functional/cli_root/zpool_import/setup.ksh
index f765da03f..9d0b913a0 100755
--- a/tests/zfs-tests/tests/functional/cli_root/zpool_import/setup.ksh
+++ b/tests/zfs-tests/tests/functional/cli_root/zpool_import/setup.ksh
@@ -68,15 +68,27 @@ fi
log_must $ZFS create $TESTPOOL/$TESTFS
log_must $ZFS set mountpoint=$TESTDIR $TESTPOOL/$TESTFS
-log_must set_partition 0 "" $FS_SIZE $ZFS_DISK2
-$ECHO "y" | $NEWFS -v $DEV_RDSKDIR/$ZFSSIDE_DISK2 >/dev/null 2>&1
-(( $? != 0 )) &&
- log_untested "Unable to setup a $NEWFS_DEFAULT_FS file system"
-
-[[ ! -d $DEVICE_DIR ]] && \
- log_must $MKDIR -p $DEVICE_DIR
-
-log_must $MOUNT $DEV_DSKDIR/$ZFSSIDE_DISK2 $DEVICE_DIR
+DISK2="$($ECHO $DISKS | $NAWK '{print $2}')"
+if is_mpath_device $DISK2; then
+ $ECHO "y" | $NEWFS -v $DEV_DSKDIR/$DISK2 >/dev/null 2>&1
+ (( $? != 0 )) &&
+ log_untested "Unable to setup a $NEWFS_DEFAULT_FS file system"
+
+ [[ ! -d $DEVICE_DIR ]] && \
+ log_must $MKDIR -p $DEVICE_DIR
+
+ log_must $MOUNT $DEV_DSKDIR/$DISK2 $DEVICE_DIR
+else
+ log_must set_partition 0 "" $FS_SIZE $ZFS_DISK2
+ $ECHO "y" | $NEWFS -v $DEV_DSKDIR/$ZFSSIDE_DISK2 >/dev/null 2>&1
+ (( $? != 0 )) &&
+ log_untested "Unable to setup a $NEWFS_DEFAULT_FS file system"
+
+ [[ ! -d $DEVICE_DIR ]] && \
+ log_must $MKDIR -p $DEVICE_DIR
+
+ log_must $MOUNT $DEV_DSKDIR/$ZFSSIDE_DISK2 $DEVICE_DIR
+fi
i=0
while (( i < $MAX_NUM )); do
diff --git a/tests/zfs-tests/tests/functional/cli_root/zpool_import/zpool_import.cfg b/tests/zfs-tests/tests/functional/cli_root/zpool_import/zpool_import.cfg
index 5f1638cec..017874ec0 100644
--- a/tests/zfs-tests/tests/functional/cli_root/zpool_import/zpool_import.cfg
+++ b/tests/zfs-tests/tests/functional/cli_root/zpool_import/zpool_import.cfg
@@ -30,6 +30,8 @@
. $STF_SUITE/include/libtest.shlib
+export DISKSARRAY=$DISKS
+export DISK_ARRAY_NUM=$($ECHO ${DISKS} | $NAWK '{print NF}')
typeset -a disk_array=($(find_disks $DISKS))
case "${#disk_array[*]}" in
0)
@@ -43,10 +45,24 @@ case "${#disk_array[*]}" in
if is_linux; then
DISK_COUNT=1
ZFS_DISK1=${disk_array[0]}
- ZFSSIDE_DISK1=${ZFS_DISK1}p1
ZFS_DISK2=${disk_array[0]}
- ZFSSIDE_DISK2=${ZFS_DISK2}p2
+ if is_mpath_device $ZFS_DISK1; then
+ export DEV_DSKDIR=$DEV_MPATHDIR
+ else
+ export DEV_DSKDIR=$DEV_RDSKDIR
+ fi
+ if ( is_mpath_device $ZFS_DISK1 ) && [[ -z $($ECHO $ZFS_DISK1 | awk 'substr($1,18,1)\
+ ~ /^[[:digit:]]+$/') ]] || ( is_real_device $ZFS_DISK1 ); then
+ ZFSSIDE_DISK1=${ZFS_DISK1}1
+ ZFSSIDE_DISK2=${ZFS_DISK2}2
+ elif ( is_mpath_device $ZFS_DISK1 || is_loop_device $ZFS_DISK1 ); then
+ ZFSSIDE_DISK1=${ZFS_DISK1}p1
+ ZFSSIDE_DISK2=${ZFS_DISK2}p2
+ else
+ log_fail "$ZFS_DISK1 not supported for partitioning."
+ fi
else
+ export DEV_DSKDIR="/dev"
DISK_COUNT=1
ZFS_DISK1=${disk_array[0]}
ZFSSIDE_DISK1=${ZFS_DISK1}s0
@@ -59,10 +75,30 @@ case "${#disk_array[*]}" in
if is_linux; then
DISK_COUNT=2
ZFS_DISK1=${disk_array[0]}
- ZFSSIDE_DISK1=${ZFS_DISK1}p1
+ if is_mpath_device $ZFS_DISK1; then
+ export DEV_DSKDIR=$DEV_MPATHDIR
+ else
+ export DEV_DSKDIR=$DEV_RDSKDIR
+ fi
+ if ( is_mpath_device $ZFS_DISK1 ) && [[ -z $($ECHO $ZFS_DISK1 | awk 'substr($1,18,1)\
+ ~ /^[[:digit:]]+$/') ]] || ( is_real_device $ZFS_DISK1 ); then
+ ZFSSIDE_DISK1=${ZFS_DISK1}1
+ elif ( is_mpath_device $ZFS_DISK1 || is_loop_device $ZFS_DISK1 ); then
+ ZFSSIDE_DISK1=${ZFS_DISK1}p1
+ else
+ log_fail "$ZFS_DISK1 not supported for partitioning."
+ fi
ZFS_DISK2=${disk_array[1]}
- ZFSSIDE_DISK2=${ZFS_DISK2}p1
+ if ( is_mpath_device $ZFS_DISK2 ) && [[ -z $($ECHO $ZFS_DISK2 | awk 'substr($1,18,1)\
+ ~ /^[[:digit:]]+$/') ]] || ( is_real_device $ZFS_DISK2 ); then
+ ZFSSIDE_DISK2=${ZFS_DISK2}1
+ elif ( is_mpath_device $ZFS_DISK2 || is_loop_device $ZFS_DISK2 ); then
+ ZFSSIDE_DISK2=${ZFS_DISK2}p1
+ else
+ log_fail "$ZFS_DISK2 not supported for partitioning."
+ fi
else
+ export DEV_DSKDIR="/dev"
DISK_COUNT=2
ZFS_DISK1=${disk_array[0]}
ZFSSIDE_DISK1=${ZFS_DISK1}s0
diff --git a/tests/zfs-tests/tests/functional/cli_root/zpool_remove/cleanup.ksh b/tests/zfs-tests/tests/functional/cli_root/zpool_remove/cleanup.ksh
index 4cc6b3bf0..307fae719 100755
--- a/tests/zfs-tests/tests/functional/cli_root/zpool_remove/cleanup.ksh
+++ b/tests/zfs-tests/tests/functional/cli_root/zpool_remove/cleanup.ksh
@@ -26,6 +26,12 @@
#
. $STF_SUITE/include/libtest.shlib
+. $STF_SUITE/tests/functional/cli_root/zpool_remove/zpool_remove.cfg
+
+DISK=${DISKS%% *}
+if is_mpath_device $DISK; then
+ delete_partitions
+fi
cleanup_devices $DISKS
diff --git a/tests/zfs-tests/tests/functional/cli_root/zpool_remove/zpool_remove.cfg b/tests/zfs-tests/tests/functional/cli_root/zpool_remove/zpool_remove.cfg
index c611efd83..345941bc9 100644
--- a/tests/zfs-tests/tests/functional/cli_root/zpool_remove/zpool_remove.cfg
+++ b/tests/zfs-tests/tests/functional/cli_root/zpool_remove/zpool_remove.cfg
@@ -30,9 +30,12 @@
export DISK=${DISKS%% *}
export SIZE="200m"
+export DISK_ARRAY_NUM=$($ECHO ${DISKS} | $NAWK '{print NF}')
+export DISKSARRAY=$DISKS
if is_linux; then
- export SLICE_PREFIX="p"
+ set_device_dir
+ set_slice_prefix
export SLICE0=1
export SLICE1=2
export SLICE2=3
diff --git a/tests/zfs-tests/tests/functional/cli_root/zpool_scrub/zpool_scrub.cfg b/tests/zfs-tests/tests/functional/cli_root/zpool_scrub/zpool_scrub.cfg
index 36b4c0ebe..d0325633d 100644
--- a/tests/zfs-tests/tests/functional/cli_root/zpool_scrub/zpool_scrub.cfg
+++ b/tests/zfs-tests/tests/functional/cli_root/zpool_scrub/zpool_scrub.cfg
@@ -28,5 +28,5 @@
# Copyright (c) 2012 by Delphix. All rights reserved.
#
-export DISK1=$($ECHO $DISKS | $AWK '{print $1}')
+export DISK1=${DISKS%% *}
export DISK2=$($ECHO $DISKS | $AWK '{print $2}')
diff --git a/tests/zfs-tests/tests/functional/grow_pool/grow_pool.cfg b/tests/zfs-tests/tests/functional/grow_pool/grow_pool.cfg
index c2689e84c..8b0563201 100644
--- a/tests/zfs-tests/tests/functional/grow_pool/grow_pool.cfg
+++ b/tests/zfs-tests/tests/functional/grow_pool/grow_pool.cfg
@@ -60,7 +60,8 @@ export TESTFILE1=file$$.1
export WRITE_COUNT=65536000
if is_linux; then
- export SLICE_PREFIX="p"
+ set_device_dir
+ set_slice_prefix
export SLICE=1
export SLICE0=1
export SLICE1=2
diff --git a/tests/zfs-tests/tests/functional/grow_replicas/grow_replicas.cfg b/tests/zfs-tests/tests/functional/grow_replicas/grow_replicas.cfg
index 7b599cfc4..ebf322602 100644
--- a/tests/zfs-tests/tests/functional/grow_replicas/grow_replicas.cfg
+++ b/tests/zfs-tests/tests/functional/grow_replicas/grow_replicas.cfg
@@ -61,7 +61,8 @@ export WRITE_COUNT=65536000
if is_linux; then
export SLICES="0 1 2 3 4"
- export SLICE_PREFIX="p"
+ set_device_dir
+ set_slice_prefix
export SLICE0=1
export SLICE1=2
export SLICE2=3
diff --git a/tests/zfs-tests/tests/functional/inuse/inuse.cfg b/tests/zfs-tests/tests/functional/inuse/inuse.cfg
index 1666cdb8f..7d2b631ca 100644
--- a/tests/zfs-tests/tests/functional/inuse/inuse.cfg
+++ b/tests/zfs-tests/tests/functional/inuse/inuse.cfg
@@ -31,7 +31,8 @@
. $STF_SUITE/include/libtest.shlib
if is_linux; then
- export SLICE_PREFIX="p"
+ set_device_dir
+ set_slice_prefix
export SLICE0=1
export SLICE1=2
else
diff --git a/tests/zfs-tests/tests/functional/migration/cleanup.ksh b/tests/zfs-tests/tests/functional/migration/cleanup.ksh
index 1b146a7b5..0b6efce6a 100755
--- a/tests/zfs-tests/tests/functional/migration/cleanup.ksh
+++ b/tests/zfs-tests/tests/functional/migration/cleanup.ksh
@@ -41,6 +41,11 @@ ismounted $TESTPOOL/$TESTFS
[[ $? == 0 ]] && log_must $ZFS umount -f $TESTDIR
destroy_pool $TESTPOOL
+DISK=${DISKS%% *}
+if is_mpath_device $DISK; then
+ delete_partitions
+fi
+
# recreate and destroy a zpool over the disks to restore the partitions to
# normal
case $DISK_COUNT in
diff --git a/tests/zfs-tests/tests/functional/migration/migration.cfg b/tests/zfs-tests/tests/functional/migration/migration.cfg
index ddae25df1..340288025 100644
--- a/tests/zfs-tests/tests/functional/migration/migration.cfg
+++ b/tests/zfs-tests/tests/functional/migration/migration.cfg
@@ -30,6 +30,8 @@
. $STF_SUITE/include/libtest.shlib
+export DISKSARRAY=$DISKS
+export DISK_ARRAY_NUM=$($ECHO ${DISKS} | $NAWK '{print NF}')
set -A disk_array $(find_disks $DISKS)
case "${#disk_array[*]}" in
0)
@@ -42,9 +44,23 @@ case "${#disk_array[*]}" in
SINGLE_DISK=$ZFS_DISK
NONZFS_DISK=$ZFS_DISK
if is_linux; then
- ZFSSIDE_DISK=${SINGLE_DISK}p1
- NONZFSSIDE_DISK=${SINGLE_DISK}p2
+ if is_mpath_device $ZFS_DISK; then
+ export DEV_DSKDIR=$DEV_MPATHDIR
+ else
+ export DEV_DSKDIR=$DEV_RDSKDIR
+ fi
+ if ( is_mpath_device $ZFS_DISK ) && [[ -z $($ECHO $ZFS_DISK | awk 'substr($1,18,1)\
+ ~ /^[[:digit:]]+$/') ]] || ( is_real_device $ZFS_DISK ); then
+ ZFSSIDE_DISK=${SINGLE_DISK}1
+ NONZFSSIDE_DISK=${SINGLE_DISK}2
+ elif ( is_mpath_device $ZFS_DISK || is_loop_device $ZFS_DISK ); then
+ ZFSSIDE_DISK=${SINGLE_DISK}p1
+ NONZFSSIDE_DISK=${SINGLE_DISK}p2
+ else
+ log_fail "$ZFS_DISK not supported for partitioning."
+ fi
else
+ export DEV_DSKDIR="/dev"
ZFSSIDE_DISK=${SINGLE_DISK}s0
NONZFSSIDE_DISK=${SINGLE_DISK}s1
fi
@@ -55,9 +71,29 @@ case "${#disk_array[*]}" in
ZFS_DISK=${disk_array[0]}
NONZFS_DISK=${disk_array[1]}
if is_linux; then
- ZFSSIDE_DISK=${ZFS_DISK}p1
- NONZFSSIDE_DISK=${NONZFS_DISK}p1
+ if is_mpath_device $ZFS_DISK; then
+ export DEV_DSKDIR=$DEV_MPATHDIR
+ else
+ export DEV_DSKDIR=$DEV_RDSKDIR
+ fi
+ if ( is_mpath_device $ZFS_DISK ) && [[ -z $($ECHO $ZFS_DISK | awk 'substr($1,18,1)\
+ ~ /^[[:digit:]]+$/') ]] || ( is_real_device $ZFS_DISK ); then
+ ZFSSIDE_DISK=${ZFS_DISK}1
+ elif ( is_mpath_device $ZFS_DISK || is_loop_device $ZFS_DISK ); then
+ ZFSSIDE_DISK=${ZFS_DISK}p1
+ else
+ log_fail "$ZFS_DISK not supported for partitioning."
+ fi
+ if ( is_mpath_device $NONZFS_DISK ) && [[ -z $($ECHO $NONZFS_DISK | awk 'substr($1,18,1)\
+ ~ /^[[:digit:]]+$/') ]] || ( is_real_device $NONZFS_DISK ); then
+ NONZFSSIDE_DISK=${NONZFS_DISK}1
+ elif ( is_mpath_device $NONZFS_DISK || is_loop_device $NONZFS_DISK ); then
+ NONZFSSIDE_DISK=${NONZFS_DISK}p1
+ else
+ log_fail "$NONZFS_DISK not supported for partitioning."
+ fi
else
+ export DEV_DSKDIR="/dev"
ZFSSIDE_DISK=${ZFS_DISK}s0
NONZFSSIDE_DISK=${NONZFS_DISK}s0
fi
diff --git a/tests/zfs-tests/tests/functional/migration/setup.ksh b/tests/zfs-tests/tests/functional/migration/setup.ksh
index 18be6257f..2381b5f85 100755
--- a/tests/zfs-tests/tests/functional/migration/setup.ksh
+++ b/tests/zfs-tests/tests/functional/migration/setup.ksh
@@ -64,7 +64,7 @@ log_must $ZFS set mountpoint=$TESTDIR $TESTPOOL/$TESTFS
$RM -rf $NONZFS_TESTDIR || log_unresolved Could not remove $NONZFS_TESTDIR
$MKDIR -p $NONZFS_TESTDIR || log_unresolved Could not create $NONZFS_TESTDIR
-$ECHO "y" | $NEWFS -v ${DEV_RDSKDIR}/$NONZFSSIDE_DISK
+$ECHO "y" | $NEWFS -v ${DEV_DSKDIR}/$NONZFSSIDE_DISK
(( $? != 0 )) &&
log_untested "Unable to setup a UFS file system"
diff --git a/tests/zfs-tests/tests/functional/mmap/Makefile.am b/tests/zfs-tests/tests/functional/mmap/Makefile.am
index a635b3dd0..cb444ec37 100644
--- a/tests/zfs-tests/tests/functional/mmap/Makefile.am
+++ b/tests/zfs-tests/tests/functional/mmap/Makefile.am
@@ -2,5 +2,6 @@ pkgdatadir = $(datadir)/@PACKAGE@/zfs-tests/tests/functional/mmap
dist_pkgdata_SCRIPTS = \
setup.ksh \
cleanup.ksh \
+ mmap.cfg \
mmap_read_001_pos.ksh \
mmap_write_001_pos.ksh
diff --git a/tests/zfs-tests/tests/functional/mmap/mmap.cfg b/tests/zfs-tests/tests/functional/mmap/mmap.cfg
new file mode 100644
index 000000000..1501c0463
--- /dev/null
+++ b/tests/zfs-tests/tests/functional/mmap/mmap.cfg
@@ -0,0 +1,59 @@
+#
+# 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
+#
+
+#
+# Copyright 2008 Sun Microsystems, Inc. All rights reserved.
+# Use is subject to license terms.
+#
+
+#
+# Copyright (c) 2012, 2014 by Delphix. All rights reserved.
+#
+
+. $STF_SUITE/include/libtest.shlib
+
+export DISK_ARRAY_NUM=0
+export DISK_ARRAY_LIMIT=4
+export DISKSARRAY=""
+export VDEVS_NUM=32
+
+function set_disks
+{
+ typeset -a disk_array=($(find_disks $DISKS))
+
+ if (( ${#disk_array[*]} <= 1 )); then
+ export DISK=${DISKS%% *}
+ else
+ export DISK=""
+ typeset -i i=0
+ while (( i < ${#disk_array[*]} )); do
+ export DISK${i}="${disk_array[$i]}"
+ DISKSARRAY="$DISKSARRAY ${disk_array[$i]}"
+ (( i = i + 1 ))
+ (( i>$DISK_ARRAY_LIMIT )) && break
+ done
+ export DISK_ARRAY_NUM=$i
+ export DISKSARRAY
+ fi
+}
+
+set_disks
+set_device_dir
diff --git a/tests/zfs-tests/tests/functional/mmap/mmap_read_001_pos.ksh b/tests/zfs-tests/tests/functional/mmap/mmap_read_001_pos.ksh
index 0b3ddb662..36bcaa802 100755
--- a/tests/zfs-tests/tests/functional/mmap/mmap_read_001_pos.ksh
+++ b/tests/zfs-tests/tests/functional/mmap/mmap_read_001_pos.ksh
@@ -30,6 +30,7 @@
#
. $STF_SUITE/include/libtest.shlib
+. $STF_SUITE/tests/functional/mmap/mmap.cfg
#
# DESCRIPTION:
diff --git a/tests/zfs-tests/tests/functional/mv_files/mv_files.cfg b/tests/zfs-tests/tests/functional/mv_files/mv_files.cfg
index 6c8186237..e0c416638 100644
--- a/tests/zfs-tests/tests/functional/mv_files/mv_files.cfg
+++ b/tests/zfs-tests/tests/functional/mv_files/mv_files.cfg
@@ -29,6 +29,9 @@
#
export DISK=${DISKS%% *}
+export DISKSARRAY=$DISKS
+export DISK_ARRAY_NUM=$($ECHO ${DISKS} | $NAWK '{print NF}')
+set_device_dir
export TESTFILE=testfile
diff --git a/tests/zfs-tests/tests/functional/no_space/cleanup.ksh b/tests/zfs-tests/tests/functional/no_space/cleanup.ksh
index 1ed7ee1c9..6fedeaa58 100755
--- a/tests/zfs-tests/tests/functional/no_space/cleanup.ksh
+++ b/tests/zfs-tests/tests/functional/no_space/cleanup.ksh
@@ -40,6 +40,11 @@ ismounted "$TESTPOOL/$TESTFS"
log_must $ZFS umount $TESTDIR
destroy_pool $TESTPOOL
+
+if is_mpath_device $DISK; then
+ delete_partitions
+fi
+
#
# Remove 100mb partition.
#
diff --git a/tests/zfs-tests/tests/functional/no_space/enospc.cfg b/tests/zfs-tests/tests/functional/no_space/enospc.cfg
index 692482a82..df1c9393a 100644
--- a/tests/zfs-tests/tests/functional/no_space/enospc.cfg
+++ b/tests/zfs-tests/tests/functional/no_space/enospc.cfg
@@ -36,3 +36,7 @@ export ENOSPC=28
export BLOCKSZ=8192
export NUM_WRITES=65536
export DATA=0
+
+export DISKSARRAY=$DISKS
+export DISK_ARRAY_NUM=$($ECHO ${DISKS} | $NAWK '{print NF}')
+set_device_dir
diff --git a/tests/zfs-tests/tests/functional/no_space/setup.ksh b/tests/zfs-tests/tests/functional/no_space/setup.ksh
index 5bd8918f9..7d177c772 100755
--- a/tests/zfs-tests/tests/functional/no_space/setup.ksh
+++ b/tests/zfs-tests/tests/functional/no_space/setup.ksh
@@ -43,7 +43,14 @@ DISK=${DISKS%% *}
log_must set_partition 0 "" $SIZE $DISK
if is_linux; then
- default_setup $DISK"p1"
+ if ( is_mpath_device $DISK ) && [[ -z $($ECHO $DISK | awk 'substr($1,18,1)\
+ ~ /^[[:digit:]]+$/') ]] || ( is_real_device $DISK ); then
+ default_setup $DISK"1"
+ elif ( is_mpath_device $DISK || is_loop_device $DISK ); then
+ default_setup $DISK"p1"
+ else
+ log_fail "$DISK not supported for partitioning."
+ fi
else
default_setup $DISK"s0"
fi
diff --git a/tests/zfs-tests/tests/functional/online_offline/online_offline.cfg b/tests/zfs-tests/tests/functional/online_offline/online_offline.cfg
index e68e8363f..42be907bd 100644
--- a/tests/zfs-tests/tests/functional/online_offline/online_offline.cfg
+++ b/tests/zfs-tests/tests/functional/online_offline/online_offline.cfg
@@ -36,3 +36,7 @@ export HOLES_SEED=${HOLES_SEED-""}
export HOLES_FILEOFFSET=${HOLES_FILEOFFSET-""}
export HOLES_COUNT=${HOLES_COUNT-"16384"} # FILESIZE/BLKSIZE/8
export STF_TIMEOUT=3600
+
+export DISKSARRAY=$DISKS
+export DISK_ARRAY_NUM=$($ECHO ${DISKS} | $NAWK '{print NF}')
+set_device_dir
diff --git a/tests/zfs-tests/tests/functional/rsend/rsend.cfg b/tests/zfs-tests/tests/functional/rsend/rsend.cfg
index 24304075f..29aede558 100644
--- a/tests/zfs-tests/tests/functional/rsend/rsend.cfg
+++ b/tests/zfs-tests/tests/functional/rsend/rsend.cfg
@@ -29,7 +29,7 @@
export BACKDIR=${TEST_BASE_DIR%%/}/backdir-rsend
-export DISK1=$($ECHO $DISKS | $AWK '{print $1}')
+export DISK1=${DISKS%% *}
export DISK2=$($ECHO $DISKS | $AWK '{print $2}')
export POOL=$TESTPOOL
diff --git a/tests/zfs-tests/tests/functional/scrub_mirror/cleanup.ksh b/tests/zfs-tests/tests/functional/scrub_mirror/cleanup.ksh
index da628bcd1..d0d77b79c 100755
--- a/tests/zfs-tests/tests/functional/scrub_mirror/cleanup.ksh
+++ b/tests/zfs-tests/tests/functional/scrub_mirror/cleanup.ksh
@@ -39,6 +39,11 @@ $DF -F zfs -h | $GREP "$TESTFS " >/dev/null
[[ $? == 0 ]] && log_must $ZFS umount -f $TESTDIR
destroy_pool $TESTPOOL
+DISK=${DISKS%% *}
+if is_mpath_device $DISK; then
+ delete_partitions
+fi
+
# recreate and destroy a zpool over the disks to restore the partitions to
# normal
if [[ -n $SINGLE_DISK ]]; then
diff --git a/tests/zfs-tests/tests/functional/scrub_mirror/default.cfg b/tests/zfs-tests/tests/functional/scrub_mirror/default.cfg
index 461212bb9..ee05daec4 100644
--- a/tests/zfs-tests/tests/functional/scrub_mirror/default.cfg
+++ b/tests/zfs-tests/tests/functional/scrub_mirror/default.cfg
@@ -28,6 +28,9 @@
# Copyright (c) 2013 by Delphix. All rights reserved.
#
+export DISKSARRAY=$DISKS
+export DISK_ARRAY_NUM=$($ECHO ${DISKS} | $NAWK '{print NF}')
+
typeset -i NUMBER_OF_DISKS=0
for i in $DISKS; do
[[ -n $MIRROR_PRIMARY ]] && MIRROR_SECONDARY=$i
@@ -41,9 +44,23 @@ if [[ -z $MIRROR_SECONDARY ]]; then
SIDE_PRIMARY_PART=0
SIDE_SECONDARY_PART=1
if is_linux; then
- SIDE_PRIMARY=${SINGLE_DISK}p1
- SIDE_SECONDARY=${SINGLE_DISK}p2
+ if is_mpath_device $MIRROR_PRIMARY; then
+ export DEV_DSKDIR=$DEV_MPATHDIR
+ else
+ export DEV_DSKDIR=$DEV_RDSKDIR
+ fi
+ if ( is_mpath_device $SINGLE_DISK ) && [[ -z $($ECHO $SINGLE_DISK | awk 'substr($1,18,1)\
+ ~ /^[[:digit:]]+$/') ]] || ( is_real_device $SINGLE_DISK ); then
+ SIDE_PRIMARY=${SINGLE_DISK}1
+ SIDE_SECONDARY=${SINGLE_DISK}2
+ elif ( is_mpath_device $SINGLE_DISK || is_loop_device $SINGLE_DISK ); then
+ SIDE_PRIMARY=${SINGLE_DISK}p1
+ SIDE_SECONDARY=${SINGLE_DISK}p2
+ else
+ log_fail "$SINGLE_DISK not supported for partitioning."
+ fi
else
+ export DEV_DSKDIR="/dev"
SIDE_PRIMARY=${SINGLE_DISK}s${SIDE_PRIMARY_PART}
SIDE_SECONDARY=${SINGLE_DISK}s${SIDE_SECONDARY_PART}
fi
@@ -51,9 +68,29 @@ else
SIDE_PRIMARY_PART=0
SIDE_SECONDARY_PART=0
if is_linux; then
- SIDE_PRIMARY=${MIRROR_PRIMARY}p1
- SIDE_SECONDARY=${MIRROR_SECONDARY}p1
+ if is_mpath_device $MIRROR_PRIMARY; then
+ export DEV_DSKDIR=$DEV_MPATHDIR
+ else
+ export DEV_DSKDIR=$DEV_RDSKDIR
+ fi
+ if ( is_mpath_device $MIRROR_PRIMARY ) && [[ -z $($ECHO $MIRROR_PRIMARY | awk 'substr($1,18,1)\
+ ~ /^[[:digit:]]+$/') ]] || ( is_real_device $MIRROR_PRIMARY ); then
+ SIDE_PRIMARY=${MIRROR_PRIMARY}1
+ elif ( is_mpath_device $MIRROR_PRIMARY || is_loop_device $MIRROR_PRIMARY ); then
+ SIDE_PRIMARY=${MIRROR_PRIMARY}p1
+ else
+ log_fail "$MIRROR_PRIMARY not supported for partitioning."
+ fi
+ if ( is_mpath_device $MIRROR_SECONDARY ) && [[ -z $($ECHO $MIRROR_SECONDARY | awk 'substr($1,18,1)\
+ ~ /^[[:digit:]]+$/') ]] || ( is_real_device $MIRROR_SECONDARY ); then
+ SIDE_SECONDARY=${MIRROR_SECONDARY}1
+ elif ( is_mpath_device $MIRROR_SECONDARY || is_loop_device $MIRROR_SECONDARY ); then
+ SIDE_SECONDARY=${MIRROR_SECONDARY}p1
+ else
+ log_fail "$MIRROR_SECONDARY not supported for partitioning."
+ fi
else
+ export DEV_DSKDIR="/dev"
SIDE_PRIMARY=${MIRROR_PRIMARY}s${SIDE_PRIMARY_PART}
SIDE_SECONDARY=${MIRROR_SECONDARY}s${SIDE_SECONDARY_PART}
fi
diff --git a/tests/zfs-tests/tests/functional/sparse/sparse.cfg b/tests/zfs-tests/tests/functional/sparse/sparse.cfg
index ba969ee47..a01677d91 100644
--- a/tests/zfs-tests/tests/functional/sparse/sparse.cfg
+++ b/tests/zfs-tests/tests/functional/sparse/sparse.cfg
@@ -28,6 +28,8 @@
# Copyright (c) 2013 by Delphix. All rights reserved.
#
+. $STF_SUITE/include/libtest.shlib
+
export TESTFILE=testfile.sparse
export HOLES_FILESIZE=${HOLES_FILESIZE-"67108864"} # 64 Mb
export HOLES_BLKSIZE=${HOLES_BLKSIZE-"512"}
@@ -35,3 +37,7 @@ export HOLES_SEED=${HOLES_SEED-""}
export HOLES_FILEOFFSET=${HOLES_FILEOFFSET-""}
export HOLES_COUNT=${HOLES_COUNT-"16384"} # FILESIZE/BLKSIZE/8
export STF_TIMEOUT=3600
+
+export DISKSARRAY=$DISKS
+export DISK_ARRAY_NUM=$($ECHO ${DISKS} | $NAWK '{print NF}')
+set_device_dir
diff --git a/tests/zfs-tests/tests/functional/truncate/truncate.cfg b/tests/zfs-tests/tests/functional/truncate/truncate.cfg
index 703ff50b5..e9449daff 100644
--- a/tests/zfs-tests/tests/functional/truncate/truncate.cfg
+++ b/tests/zfs-tests/tests/functional/truncate/truncate.cfg
@@ -24,9 +24,16 @@
# Use is subject to license terms.
#
+. $STF_SUITE/include/libtest.shlib
+
export TESTFILE=testfile.$$
export TRUNC_FILESIZE=${TRUNC_FILESIZE-"67108864"} # 64 Mb
export TRUNC_BLKSIZE=${TRUNC_BLKSIZE-"512"}
export TRUNC_SEED=${TRUNC_SEED-""}
export TRUNC_FILEOFFSET=${TRUNC_FILEOFFSET-""}
export TRUNC_COUNT=${TRUNC_COUNT-"16384"} # FILESIZE/BLKSIZE/8
+
+export DISKSARRAY=$DISKS
+export DISK_ARRAY_NUM=$($ECHO ${DISKS} | $NAWK '{print NF}')
+
+set_device_dir
diff --git a/tests/zfs-tests/tests/functional/write_dirs/Makefile.am b/tests/zfs-tests/tests/functional/write_dirs/Makefile.am
index 9bdc46b90..80493ab3c 100644
--- a/tests/zfs-tests/tests/functional/write_dirs/Makefile.am
+++ b/tests/zfs-tests/tests/functional/write_dirs/Makefile.am
@@ -2,5 +2,6 @@ pkgdatadir = $(datadir)/@PACKAGE@/zfs-tests/tests/functional/write_dirs
dist_pkgdata_SCRIPTS = \
setup.ksh \
cleanup.ksh \
+ write_dirs.cfg \
write_dirs_001_pos.ksh \
write_dirs_002_pos.ksh
diff --git a/tests/zfs-tests/tests/functional/write_dirs/cleanup.ksh b/tests/zfs-tests/tests/functional/write_dirs/cleanup.ksh
index 3166bd6ec..50526153e 100755
--- a/tests/zfs-tests/tests/functional/write_dirs/cleanup.ksh
+++ b/tests/zfs-tests/tests/functional/write_dirs/cleanup.ksh
@@ -30,5 +30,6 @@
#
. $STF_SUITE/include/libtest.shlib
+. $STF_SUITE/tests/functional/write_dirs/write_dirs.cfg
default_cleanup
diff --git a/tests/zfs-tests/tests/functional/write_dirs/setup.ksh b/tests/zfs-tests/tests/functional/write_dirs/setup.ksh
index 49d5f7aa5..3f10c7f74 100755
--- a/tests/zfs-tests/tests/functional/write_dirs/setup.ksh
+++ b/tests/zfs-tests/tests/functional/write_dirs/setup.ksh
@@ -30,28 +30,18 @@
#
. $STF_SUITE/include/libtest.shlib
+. $STF_SUITE/tests/functional/write_dirs/write_dirs.cfg
verify_runnable "global"
-export SIZE="1gb"
-
-if is_linux; then
- export SLICE_PREFIX="p"
- export SLICE=0
-else
- export SLICE_PREFIX="s"
- export SLICE=0
-fi
-
if ! $(is_physical_device $DISKS) ; then
log_unsupported "This directory cannot be run on raw files."
fi
DISK=${DISKS%% *}
-
-log_must set_partition $SLICE "" $SIZE $DISK
-
-if is_linux; then
- export SLICE=1
+if is_mpath_device $DISK; then
+ delete_partitions
fi
+log_must set_partition 0 "" $SIZE $DISK
+
default_setup "${DISK}${SLICE_PREFIX}${SLICE}"
diff --git a/tests/zfs-tests/tests/functional/write_dirs/write_dirs.cfg b/tests/zfs-tests/tests/functional/write_dirs/write_dirs.cfg
new file mode 100644
index 000000000..fe7b5ab08
--- /dev/null
+++ b/tests/zfs-tests/tests/functional/write_dirs/write_dirs.cfg
@@ -0,0 +1,48 @@
+#!/bin/ksh -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
+#
+
+#
+# Copyright 2009 Sun Microsystems, Inc. All rights reserved.
+# Use is subject to license terms.
+#
+
+#
+# Copyright (c) 2013 by Delphix. All rights reserved.
+#
+
+. $STF_SUITE/include/libtest.shlib
+
+verify_runnable "global"
+
+export SIZE="1gb"
+export DISK_ARRAY_NUM=$($ECHO ${DISKS} | $NAWK '{print NF}')
+export DISKSARRAY=$DISKS
+
+if is_linux; then
+ set_slice_prefix
+ set_device_dir
+ export SLICE=1
+else
+ DEV_DSKDIR="/dev"
+ export SLICE_PREFIX="s"
+ export SLICE=0
+fi
diff --git a/tests/zfs-tests/tests/functional/write_dirs/write_dirs_001_pos.ksh b/tests/zfs-tests/tests/functional/write_dirs/write_dirs_001_pos.ksh
index dc5854bd9..3261af167 100755
--- a/tests/zfs-tests/tests/functional/write_dirs/write_dirs_001_pos.ksh
+++ b/tests/zfs-tests/tests/functional/write_dirs/write_dirs_001_pos.ksh
@@ -30,6 +30,7 @@
#
. $STF_SUITE/include/libtest.shlib
+. $STF_SUITE/tests/functional/write_dirs/write_dirs.cfg
#
# DESCRIPTION:
diff --git a/tests/zfs-tests/tests/functional/write_dirs/write_dirs_002_pos.ksh b/tests/zfs-tests/tests/functional/write_dirs/write_dirs_002_pos.ksh
index bc4aff07f..39c410b9d 100755
--- a/tests/zfs-tests/tests/functional/write_dirs/write_dirs_002_pos.ksh
+++ b/tests/zfs-tests/tests/functional/write_dirs/write_dirs_002_pos.ksh
@@ -30,6 +30,7 @@
#
. $STF_SUITE/include/libtest.shlib
+. $STF_SUITE/tests/functional/write_dirs/write_dirs.cfg
#
# DESCRIPTION:
diff --git a/tests/zfs-tests/tests/functional/zvol/zvol_ENOSPC/Makefile.am b/tests/zfs-tests/tests/functional/zvol/zvol_ENOSPC/Makefile.am
index a10023dca..7007c8cf9 100644
--- a/tests/zfs-tests/tests/functional/zvol/zvol_ENOSPC/Makefile.am
+++ b/tests/zfs-tests/tests/functional/zvol/zvol_ENOSPC/Makefile.am
@@ -2,4 +2,5 @@ pkgdatadir = $(datadir)/@PACKAGE@/zfs-tests/tests/functional/zvol/zvol_ENOSPC
dist_pkgdata_SCRIPTS = \
cleanup.ksh \
setup.ksh \
+ zvol_ENOSPC.cfg \
zvol_ENOSPC_001_pos.ksh
diff --git a/tests/zfs-tests/tests/functional/zvol/zvol_ENOSPC/setup.ksh b/tests/zfs-tests/tests/functional/zvol/zvol_ENOSPC/setup.ksh
index 9a30a0373..e5feb6b58 100755
--- a/tests/zfs-tests/tests/functional/zvol/zvol_ENOSPC/setup.ksh
+++ b/tests/zfs-tests/tests/functional/zvol/zvol_ENOSPC/setup.ksh
@@ -31,9 +31,15 @@
. $STF_SUITE/include/libtest.shlib
. $STF_SUITE/tests/functional/zvol/zvol_common.shlib
+. $STF_SUITE/tests/functional/zvol/zvol_ENOSPC/zvol_ENOSPC.cfg
verify_runnable "global"
+DISK=${DISKS%% *}
+if is_mpath_device $DISK; then
+ delete_partitions
+fi
+
default_zvol_setup $DISK $VOLSIZE
$ECHO "y" | $NEWFS -v ${ZVOL_RDEVDIR}/$TESTPOOL/$TESTVOL >/dev/null 2>&1
diff --git a/tests/zfs-tests/tests/functional/zvol/zvol_ENOSPC/zvol_ENOSPC.cfg b/tests/zfs-tests/tests/functional/zvol/zvol_ENOSPC/zvol_ENOSPC.cfg
new file mode 100644
index 000000000..8284ffb86
--- /dev/null
+++ b/tests/zfs-tests/tests/functional/zvol/zvol_ENOSPC/zvol_ENOSPC.cfg
@@ -0,0 +1,49 @@
+#!/bin/ksh -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
+#
+
+#
+# Copyright 2009 Sun Microsystems, Inc. All rights reserved.
+# Use is subject to license terms.
+#
+
+#
+# Copyright (c) 2013 by Delphix. All rights reserved.
+#
+
+. $STF_SUITE/include/libtest.shlib
+
+verify_runnable "global"
+
+#export SIZE="1gb"
+export DISK_ARRAY_NUM=$($ECHO ${DISKS} | $NAWK '{print NF}')
+export DISKSARRAY=$DISKS
+
+
+if is_linux; then
+ set_slice_prefix
+ set_device_dir
+# export SLICE=1
+else
+ DEV_DSKDIR="/dev"
+ export SLICE_PREFIX="s"
+# export SLICE=0
+fi
diff --git a/tests/zfs-tests/tests/functional/zvol/zvol_cli/Makefile.am b/tests/zfs-tests/tests/functional/zvol/zvol_cli/Makefile.am
index 451b8fe92..c4b803899 100644
--- a/tests/zfs-tests/tests/functional/zvol/zvol_cli/Makefile.am
+++ b/tests/zfs-tests/tests/functional/zvol/zvol_cli/Makefile.am
@@ -2,6 +2,7 @@ pkgdatadir = $(datadir)/@PACKAGE@/zfs-tests/tests/functional/zvol/zvol_cli
dist_pkgdata_SCRIPTS = \
cleanup.ksh \
setup.ksh \
+ zvol_cli.cfg \
zvol_cli_001_pos.ksh \
zvol_cli_002_pos.ksh \
zvol_cli_003_neg.ksh
diff --git a/tests/zfs-tests/tests/functional/zvol/zvol_cli/setup.ksh b/tests/zfs-tests/tests/functional/zvol/zvol_cli/setup.ksh
index 2a6228131..c24933df2 100755
--- a/tests/zfs-tests/tests/functional/zvol/zvol_cli/setup.ksh
+++ b/tests/zfs-tests/tests/functional/zvol/zvol_cli/setup.ksh
@@ -31,9 +31,15 @@
. $STF_SUITE/include/libtest.shlib
. $STF_SUITE/tests/functional/zvol/zvol_common.shlib
+. $STF_SUITE/tests/functional/zvol/zvol_cli/zvol_cli.cfg
verify_runnable "global"
+DISK=${DISKS%% *}
+if is_mpath_device $DISK; then
+ delete_partitions
+fi
+
default_zvol_setup $DISK $VOLSIZE
log_pass
diff --git a/tests/zfs-tests/tests/functional/zvol/zvol_cli/zvol_cli.cfg b/tests/zfs-tests/tests/functional/zvol/zvol_cli/zvol_cli.cfg
new file mode 100644
index 000000000..ebfbe5c5a
--- /dev/null
+++ b/tests/zfs-tests/tests/functional/zvol/zvol_cli/zvol_cli.cfg
@@ -0,0 +1,46 @@
+#!/bin/ksh -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
+#
+
+#
+# Copyright 2009 Sun Microsystems, Inc. All rights reserved.
+# Use is subject to license terms.
+#
+
+#
+# Copyright (c) 2013 by Delphix. All rights reserved.
+#
+
+. $STF_SUITE/include/libtest.shlib
+
+verify_runnable "global"
+
+export DISK_ARRAY_NUM=$($ECHO ${DISKS} | $NAWK '{print NF}')
+export DISKSARRAY=$DISKS
+
+
+if is_linux; then
+ set_slice_prefix
+ set_device_dir
+else
+ DEV_DSKDIR="/dev"
+ export SLICE_PREFIX="s"
+fi