From a3bddd49f8397b3e10872a793d60c8bbbdbe2a80 Mon Sep 17 00:00:00 2001 From: Ryan Moeller Date: Fri, 31 Jan 2020 11:51:23 -0500 Subject: [PATCH] ZTS: Fix a few defaults Linux was missing a default value for DEV_DSKDIR. Set it to /dev. Fix resulting fallout. SLICE_PREFIX seems like a good candidate for including in the defaults. Reviewed-by: John Kennedy Reviewed-by: Brian Behlendorf Signed-off-by: Ryan Moeller Closes #9898 --- tests/zfs-tests/include/blkdev.shlib | 7 ++----- tests/zfs-tests/include/default.cfg.in | 7 +++++-- tests/zfs-tests/include/libtest.shlib | 7 ++++--- .../tests/functional/cli_root/zpool_add/zpool_add.cfg | 2 -- .../functional/cli_root/zpool_create/zpool_create.cfg | 1 - .../functional/cli_root/zpool_destroy/zpool_destroy.cfg | 1 - .../functional/cli_root/zpool_remove/zpool_remove.cfg | 1 - .../functional/cli_root/zpool_reopen/zpool_reopen.cfg | 2 -- tests/zfs-tests/tests/functional/fault/fault.cfg | 2 -- tests/zfs-tests/tests/functional/inuse/inuse.cfg | 1 - tests/zfs-tests/tests/functional/migration/migration.cfg | 2 -- tests/zfs-tests/tests/functional/write_dirs/write_dirs.cfg | 2 -- .../tests/functional/zvol/zvol_ENOSPC/zvol_ENOSPC.cfg | 7 ------- .../zfs-tests/tests/functional/zvol/zvol_cli/zvol_cli.cfg | 4 ---- 14 files changed, 11 insertions(+), 35 deletions(-) diff --git a/tests/zfs-tests/include/blkdev.shlib b/tests/zfs-tests/include/blkdev.shlib index 5a750bf1b1..2269131a45 100644 --- a/tests/zfs-tests/include/blkdev.shlib +++ b/tests/zfs-tests/include/blkdev.shlib @@ -89,8 +89,8 @@ function block_device_wait # function is_physical_device #device { - typeset device=${1#$DEV_DSKDIR} - device=${device#$DEV_RDSKDIR} + typeset device=${1#$DEV_DSKDIR/} + device=${device#$DEV_RDSKDIR/} if is_linux; then is_disk_device "$DEV_DSKDIR/$device" && \ @@ -216,9 +216,6 @@ function set_slice_prefix fi (( i = i + 1)) done - elif is_freebsd; then - export SLICE_PREFIX="p" - return 0 fi } diff --git a/tests/zfs-tests/include/default.cfg.in b/tests/zfs-tests/include/default.cfg.in index 1281176cba..741c0d3b2c 100644 --- a/tests/zfs-tests/include/default.cfg.in +++ b/tests/zfs-tests/include/default.cfg.in @@ -173,6 +173,7 @@ if is_linux; then ZVOL_DEVDIR="/dev/zvol" ZVOL_RDEVDIR="/dev/zvol" + DEV_DSKDIR="/dev" DEV_RDSKDIR="/dev" DEV_MPATHDIR="/dev/mapper" @@ -182,8 +183,8 @@ if is_linux; then VDEVID_CONF="$ZEDLET_DIR/vdev_id.conf" VDEVID_CONF_ETC="/etc/zfs/vdev_id.conf" - NEWFS_DEFAULT_FS="ext2" + SLICE_PREFIX="" elif is_freebsd; then unpack_opts="xv" pack_opts="cf" @@ -198,6 +199,7 @@ elif is_freebsd; then DEV_MPATHDIR="/dev/multipath" NEWFS_DEFAULT_FS="ufs" + SLICE_PREFIX="p" else unpack_opts="xv" pack_opts="cf" @@ -211,8 +213,9 @@ else DEV_RDSKDIR="/dev/rdsk" NEWFS_DEFAULT_FS="ufs" + SLICE_PREFIX="s" fi export unpack_opts pack_opts verbose unpack_preserve pack_preserve \ ZVOL_DEVDIR ZVOL_RDEVDIR DEV_DSKDIR DEV_RDSKDIR DEV_MPATHDIR \ ZEDLET_DIR ZED_LOG ZED_DEBUG_LOG VDEVID_CONF VDEVID_CONF_ETC \ - NEWFS_DEFAULT_FS + NEWFS_DEFAULT_FS SLICE_PREFIX diff --git a/tests/zfs-tests/include/libtest.shlib b/tests/zfs-tests/include/libtest.shlib index 4ad3ee9bf6..ac9ff61836 100644 --- a/tests/zfs-tests/include/libtest.shlib +++ b/tests/zfs-tests/include/libtest.shlib @@ -914,14 +914,15 @@ function set_partition typeset -i slicenum=$1 typeset start=$2 typeset size=$3 - typeset disk=$4 + typeset disk=${4#$DEV_DSKDIR/} + disk=${disk#$DEV_RDSKDIR/} case "$(uname)" in Linux) if [[ -z $size || -z $disk ]]; then log_fail "The size or disk name is unspecified." fi - [[ -n $DEV_DSKDIR ]] && disk=$DEV_DSKDIR/$disk + disk=$DEV_DSKDIR/$disk typeset size_mb=${size%%[mMgG]} size_mb=${size_mb%%[mMgG][bB]} @@ -969,7 +970,7 @@ function set_partition if [[ -z $size || -z $disk ]]; then log_fail "The size or disk name is unspecified." fi - [[ -n $DEV_DSKDIR ]] && disk=$DEV_DSKDIR/$disk + disk=$DEV_DSKDIR/$disk if [[ $slicenum -eq 0 ]] || ! gpart show $disk >/dev/null 2>&1; then gpart destroy -F $disk >/dev/null 2>&1 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 b9e687c2b4..e1c7d47cea 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 @@ -73,8 +73,6 @@ if is_linux || is_freebsd; then export SLICE5=6 export SLICE6=7 else - export DEV_DSKDIR="/dev" - export SLICE_PREFIX="s" export SLICE0=0 export SLICE1=1 export SLICE3=3 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 d58cece040..d3ccc47e73 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 @@ -78,7 +78,6 @@ if is_linux; then delete_partitions fi else - export SLICE_PREFIX="s" export SLICE0=0 export SLICE1=1 export SLICE2=2 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 65b43da2da..9349e5ff63 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 @@ -38,7 +38,6 @@ if is_linux; then export SLICE0=1 export SLICE1=2 else - export SLICE_PREFIX="s" export SLICE0=0 export SLICE1=1 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 7def918e8d..bf4b3e3d0b 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 @@ -45,7 +45,6 @@ if is_linux; then export SLICE6=7 export SLICE7=8 else - export SLICE_PREFIX="s" export SLICE0=0 export SLICE1=1 export SLICE2=2 diff --git a/tests/zfs-tests/tests/functional/cli_root/zpool_reopen/zpool_reopen.cfg b/tests/zfs-tests/tests/functional/cli_root/zpool_reopen/zpool_reopen.cfg index 3d6a291e06..7451ffd8c5 100644 --- a/tests/zfs-tests/tests/functional/cli_root/zpool_reopen/zpool_reopen.cfg +++ b/tests/zfs-tests/tests/functional/cli_root/zpool_reopen/zpool_reopen.cfg @@ -40,6 +40,4 @@ if is_linux; then devs_id[1]=$(get_persistent_disk_name $DISK2) devs_id[2]=$(get_persistent_disk_name $DISK3) export devs_id -else - DEV_DSKDIR="/dev" fi diff --git a/tests/zfs-tests/tests/functional/fault/fault.cfg b/tests/zfs-tests/tests/functional/fault/fault.cfg index 25601a71a3..839330ed47 100644 --- a/tests/zfs-tests/tests/functional/fault/fault.cfg +++ b/tests/zfs-tests/tests/functional/fault/fault.cfg @@ -47,8 +47,6 @@ if is_linux; then devs_id[1]=$(get_persistent_disk_name $DISK2) devs_id[2]=$(get_persistent_disk_name $DISK3) export devs_id -else - DEV_DSKDIR="/dev" fi export VDEV_FILES="$TEST_BASE_DIR/file-1 $TEST_BASE_DIR/file-2 \ diff --git a/tests/zfs-tests/tests/functional/inuse/inuse.cfg b/tests/zfs-tests/tests/functional/inuse/inuse.cfg index bbc32f1f10..70b22b4b7a 100644 --- a/tests/zfs-tests/tests/functional/inuse/inuse.cfg +++ b/tests/zfs-tests/tests/functional/inuse/inuse.cfg @@ -38,7 +38,6 @@ if is_linux; then export SLICE0=1 export SLICE1=2 else - export SLICE_PREFIX="s" export SLICE0=0 export SLICE1=1 fi diff --git a/tests/zfs-tests/tests/functional/migration/migration.cfg b/tests/zfs-tests/tests/functional/migration/migration.cfg index 7d86436709..12a5a7799b 100644 --- a/tests/zfs-tests/tests/functional/migration/migration.cfg +++ b/tests/zfs-tests/tests/functional/migration/migration.cfg @@ -60,7 +60,6 @@ case "${#disk_array[*]}" in 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 @@ -93,7 +92,6 @@ case "${#disk_array[*]}" in 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/write_dirs/write_dirs.cfg b/tests/zfs-tests/tests/functional/write_dirs/write_dirs.cfg index 400d5bcb1a..356e454a5d 100644 --- a/tests/zfs-tests/tests/functional/write_dirs/write_dirs.cfg +++ b/tests/zfs-tests/tests/functional/write_dirs/write_dirs.cfg @@ -41,7 +41,5 @@ if is_linux; then 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_ENOSPC/zvol_ENOSPC.cfg b/tests/zfs-tests/tests/functional/zvol/zvol_ENOSPC/zvol_ENOSPC.cfg index 84986b832d..8a99225ba9 100644 --- a/tests/zfs-tests/tests/functional/zvol/zvol_ENOSPC/zvol_ENOSPC.cfg +++ b/tests/zfs-tests/tests/functional/zvol/zvol_ENOSPC/zvol_ENOSPC.cfg @@ -32,17 +32,10 @@ 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/zvol_cli.cfg b/tests/zfs-tests/tests/functional/zvol/zvol_cli/zvol_cli.cfg index bede6694c0..8a99225ba9 100644 --- a/tests/zfs-tests/tests/functional/zvol/zvol_cli/zvol_cli.cfg +++ b/tests/zfs-tests/tests/functional/zvol/zvol_cli/zvol_cli.cfg @@ -35,11 +35,7 @@ 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