From 7050a65d5c760aa039d195fe0b6773a20a81048b Mon Sep 17 00:00:00 2001 From: Sydney Vanda Date: Fri, 22 Jul 2016 15:07:04 +0000 Subject: [PATCH] Real disk partitioning now enabled in test suite for Linux When using real devices, specify DISKS="sdb sdc sdd" opposed to /dev/sdb in zfs-tests.sh - otherwise errors with directory names and disk names registering as "/dev//dev/sdb" for some tests. The same goes for mpath: DISK="mpatha mpathad mpathb" Expected Usage: $ DISKS="sdb sdc sdd" zfs-tests.sh SLICE_PREFIX is now set as "p" for a loop device (ie loop0p2) or "" for a real device (ie sdb2), or either for multipath devices (ie mpatha1 or mpath1p1) instead of only "p" by default. Note that kpartx partitioning is not currently supported in this patch (ie "partx") and may need to be disabled on Debian distributions. Functions added for determining test directory (/dev or /dev/mapper) as well as slice prefix are determined and exported mostly in the cfg file of each test group directory. Currently zpools cannot be created on whole mpath devices that have been partitioned. In order to fix this tests have either been revised to use a partition instead, or if there is a size constraint and the pool needs to be created on the whole disk, partitions are then deleted if the device is a multipath device. This functionality is added to default_cleanup() or to individual cleanup scripts if a non-default cleanup method is used. The max partitions is currently set at 8 to account for all of the tests thus far. Patch changes are generally encompassed in "if is_linux" construct. Signed-off-by: Sydney Vanda Reviewed-by: John Salinas Reviewed-by: Brian Behlendorf Reviewed-by: David Quigley Closes #4447 Closes #4964 Closes #5074 --- config/user-commands.m4 | 2 + tests/zfs-tests/include/commands.cfg.in | 2 + tests/zfs-tests/include/default.cfg.in | 6 +- tests/zfs-tests/include/libtest.shlib | 175 ++++++++++++++++++ .../tests/functional/cache/cache.cfg | 5 +- .../tests/functional/cache/setup.ksh | 2 +- .../tests/functional/clean_mirror/cleanup.ksh | 6 + .../tests/functional/clean_mirror/default.cfg | 43 ++++- .../tests/functional/clean_mirror/setup.ksh | 2 +- .../functional/cli_root/zpool_add/cleanup.ksh | 5 + .../functional/cli_root/zpool_add/setup.ksh | 5 + .../cli_root/zpool_add/zpool_add.cfg | 4 +- .../cli_root/zpool_create/setup.ksh | 7 + .../cli_root/zpool_create/zpool_create.cfg | 8 +- .../zpool_create/zpool_create_003_pos.ksh | 7 +- .../zpool_create/zpool_create_006_pos.ksh | 1 + .../zpool_create/zpool_create_021_pos.ksh | 1 + .../zpool_create/zpool_create_022_pos.ksh | 1 + .../zpool_create_features_001_pos.ksh | 1 + .../zpool_create_features_002_pos.ksh | 1 + .../zpool_create_features_003_pos.ksh | 1 + .../zpool_create_features_004_neg.ksh | 1 + .../cli_root/zpool_destroy/zpool_destroy.cfg | 3 +- .../cli_root/zpool_export/Makefile.am | 1 + .../cli_root/zpool_export/setup.ksh | 1 + .../cli_root/zpool_export/zpool_export.cfg | 59 ++++++ .../zpool_export/zpool_export_001_pos.ksh | 1 + .../cli_root/zpool_import/cleanup.ksh | 4 + .../cli_root/zpool_import/setup.ksh | 26 ++- .../cli_root/zpool_import/zpool_import.cfg | 44 ++++- .../cli_root/zpool_remove/cleanup.ksh | 6 + .../cli_root/zpool_remove/zpool_remove.cfg | 5 +- .../cli_root/zpool_scrub/zpool_scrub.cfg | 2 +- .../tests/functional/grow_pool/grow_pool.cfg | 3 +- .../grow_replicas/grow_replicas.cfg | 3 +- .../tests/functional/inuse/inuse.cfg | 3 +- .../tests/functional/migration/cleanup.ksh | 5 + .../tests/functional/migration/migration.cfg | 44 ++++- .../tests/functional/migration/setup.ksh | 2 +- .../tests/functional/mmap/Makefile.am | 1 + .../zfs-tests/tests/functional/mmap/mmap.cfg | 59 ++++++ .../functional/mmap/mmap_read_001_pos.ksh | 1 + .../tests/functional/mv_files/mv_files.cfg | 3 + .../tests/functional/no_space/cleanup.ksh | 5 + .../tests/functional/no_space/enospc.cfg | 4 + .../tests/functional/no_space/setup.ksh | 9 +- .../online_offline/online_offline.cfg | 4 + .../tests/functional/rsend/rsend.cfg | 2 +- .../tests/functional/scrub_mirror/cleanup.ksh | 5 + .../tests/functional/scrub_mirror/default.cfg | 45 ++++- .../tests/functional/sparse/sparse.cfg | 6 + .../tests/functional/truncate/truncate.cfg | 7 + .../tests/functional/write_dirs/Makefile.am | 1 + .../tests/functional/write_dirs/cleanup.ksh | 1 + .../tests/functional/write_dirs/setup.ksh | 20 +- .../functional/write_dirs/write_dirs.cfg | 48 +++++ .../write_dirs/write_dirs_001_pos.ksh | 1 + .../write_dirs/write_dirs_002_pos.ksh | 1 + .../functional/zvol/zvol_ENOSPC/Makefile.am | 1 + .../functional/zvol/zvol_ENOSPC/setup.ksh | 6 + .../zvol/zvol_ENOSPC/zvol_ENOSPC.cfg | 49 +++++ .../functional/zvol/zvol_cli/Makefile.am | 1 + .../tests/functional/zvol/zvol_cli/setup.ksh | 6 + .../functional/zvol/zvol_cli/zvol_cli.cfg | 46 +++++ 64 files changed, 774 insertions(+), 56 deletions(-) create mode 100644 tests/zfs-tests/tests/functional/cli_root/zpool_export/zpool_export.cfg create mode 100644 tests/zfs-tests/tests/functional/mmap/mmap.cfg create mode 100644 tests/zfs-tests/tests/functional/write_dirs/write_dirs.cfg create mode 100644 tests/zfs-tests/tests/functional/zvol/zvol_ENOSPC/zvol_ENOSPC.cfg create mode 100644 tests/zfs-tests/tests/functional/zvol/zvol_cli/zvol_cli.cfg diff --git a/config/user-commands.m4 b/config/user-commands.m4 index bda2b8652b..112e4c18c3 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 bea8df6293..10d8ffd8a7 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 13317ea877..ec2eb90f04 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 a9236a3bc7..0c9ddd1cf0 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 } @@ -733,6 +738,69 @@ function set_partition # /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 # @@ -2482,6 +2550,113 @@ function is_physical_device #device fi } +# +# 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 # diff --git a/tests/zfs-tests/tests/functional/cache/cache.cfg b/tests/zfs-tests/tests/functional/cache/cache.cfg index f8a795d155..f3155323d3 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 832dfe92b8..713eca9a20 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 e09fb596f0..05ef9c16a7 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 35cd14161f..756ce23080 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 6ea2f1ef28..2d17bf9cb2 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 b4916f9579..48a6bc3019 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 f35dedd3c7..131876f8c6 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 c18c6aa4f7..f12a883dc8 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 409d5d04d3..fa79e0bfaa 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 d39b98749b..33dd8866e2 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 008828b888..e7917e8266 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 ...' can display the configureation" \ +log_assert "'zpool create -n ...' 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 70dcadc91c..56c6e54eeb 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 c4884413a9..df40f401dd 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 9cc78a16fd..2186d6cf7a 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 296a7b47fb..746c5041a2 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 ce24b38dd8..f0e2086cac 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 936a1cd571..9d45dfd404 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 2d3ffc8b8f..a52e86251d 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 63051e2d6e..e9d8831f82 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 a1d97ebab7..d0af877f3a 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 9ce5226e61..925f3e4af8 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 0000000000..1501c04630 --- /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 6f404ce128..af7c6f2757 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 03830c434f..c55d70c7b1 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 f765da03fa..9d0b913a01 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" +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 + [[ ! -d $DEVICE_DIR ]] && \ + log_must $MKDIR -p $DEVICE_DIR -log_must $MOUNT $DEV_DSKDIR/$ZFSSIDE_DISK2 $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 5f1638cec5..017874ec07 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 4cc6b3bf05..307fae7196 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 c611efd835..345941bc9a 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 36b4c0ebeb..d0325633d2 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 c2689e84c6..8b0563201c 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 7b599cfc4a..ebf3226021 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 1666cdb8f4..7d2b631caa 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 1b146a7b59..0b6efce6ab 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 ddae25df19..340288025e 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 18be6257fc..2381b5f857 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 a635b3dd06..cb444ec379 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 0000000000..1501c04630 --- /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 0b3ddb6626..36bcaa802f 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 6c81862377..e0c4166386 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 1ed7ee1c9e..6fedeaa582 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 692482a82c..df1c9393aa 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 5bd8918f9e..7d177c772f 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 e68e8363f6..42be907bd0 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 24304075f8..29aede5589 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 da628bcd1a..d0d77b79c2 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 461212bb95..ee05daec4b 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 ba969ee479..a01677d911 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 703ff50b50..e9449daff0 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 9bdc46b902..80493ab3ce 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 3166bd6ec1..50526153e5 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 49d5f7aa5d..3f10c7f74f 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 0000000000..fe7b5ab083 --- /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 dc5854bd92..3261af167a 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 bc4aff07f8..39c410b9dc 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 a10023dca5..7007c8cf94 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 9a30a0373a..e5feb6b580 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 0000000000..8284ffb864 --- /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 451b8fe925..c4b8038990 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 2a6228131b..c24933df2f 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 0000000000..ebfbe5c5a8 --- /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