ZTS: Move dumpdev tests to sunos.run

Neither FreeBSD nor Linux support dumping to zvols.

DilOS still uses these tests, so the files are kept and the tests have
been relocated to sunos.run.

An `is_illumos` function was added to libtest.shlib to eliminate some
awkward platform checks.

A few functions that are not expected to be used outside of illumos
have been sanitized of extraneous FreeBSD adaptations.

Reviewed-by: Igor Kozhukhov <igor@dilos.org>
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Ryan Moeller <ryan@ixsystems.com>
Closes #9794
This commit is contained in:
Ryan Moeller 2020-01-03 12:08:23 -05:00 committed by Brian Behlendorf
parent cc618d179e
commit d7164b27be
16 changed files with 94 additions and 117 deletions

View File

@ -287,9 +287,8 @@ tags = ['functional', 'cli_root', 'zpool']
[tests/functional/cli_root/zpool_add]
tests = ['zpool_add_001_pos', 'zpool_add_002_pos', 'zpool_add_003_pos',
'zpool_add_004_pos', 'zpool_add_005_pos', 'zpool_add_006_pos',
'zpool_add_007_neg', 'zpool_add_008_neg', 'zpool_add_009_neg',
'zpool_add_010_pos',
'zpool_add_004_pos', 'zpool_add_006_pos', 'zpool_add_007_neg',
'zpool_add_008_neg', 'zpool_add_009_neg', 'zpool_add_010_pos',
'add-o_ashift', 'add_prop_ashift', 'add_nested_replacing_spare']
tags = ['functional', 'cli_root', 'zpool_add']
@ -307,11 +306,10 @@ tests = ['zpool_create_001_pos', 'zpool_create_002_pos',
'zpool_create_003_pos', 'zpool_create_004_pos', 'zpool_create_005_pos',
'zpool_create_006_pos', 'zpool_create_007_neg', 'zpool_create_008_pos',
'zpool_create_009_neg', 'zpool_create_010_neg', 'zpool_create_011_neg',
'zpool_create_012_neg', 'zpool_create_014_neg',
'zpool_create_015_neg', 'zpool_create_016_pos', 'zpool_create_017_neg',
'zpool_create_018_pos', 'zpool_create_019_pos', 'zpool_create_020_pos',
'zpool_create_021_pos', 'zpool_create_022_pos', 'zpool_create_023_neg',
'zpool_create_024_pos',
'zpool_create_012_neg', 'zpool_create_014_neg', 'zpool_create_015_neg',
'zpool_create_017_neg', 'zpool_create_018_pos', 'zpool_create_019_pos',
'zpool_create_020_pos', 'zpool_create_021_pos', 'zpool_create_022_pos',
'zpool_create_023_neg', 'zpool_create_024_pos',
'zpool_create_encrypted', 'zpool_create_crypt_combos',
'zpool_create_features_001_pos', 'zpool_create_features_002_pos',
'zpool_create_features_003_pos', 'zpool_create_features_004_neg',
@ -594,9 +592,7 @@ tests = ['sync', 'psync', 'posixaio', 'mmap']
tags = ['functional', 'io']
[tests/functional/inuse]
tests = ['inuse_001_pos', 'inuse_003_pos', 'inuse_004_pos',
'inuse_005_pos', 'inuse_006_pos', 'inuse_007_pos', 'inuse_008_pos',
'inuse_009_pos']
tests = ['inuse_004_pos', 'inuse_005_pos', 'inuse_008_pos', 'inuse_009_pos']
post =
tags = ['functional', 'inuse']
@ -879,10 +875,8 @@ tests = ['zvol_cli_001_pos', 'zvol_cli_002_pos', 'zvol_cli_003_neg']
tags = ['functional', 'zvol', 'zvol_cli']
[tests/functional/zvol/zvol_misc]
tests = ['zvol_misc_001_neg', 'zvol_misc_002_pos', 'zvol_misc_003_neg',
'zvol_misc_004_pos', 'zvol_misc_005_neg', 'zvol_misc_006_pos',
'zvol_misc_hierarchy', 'zvol_misc_rename_inuse', 'zvol_misc_snapdev',
'zvol_misc_volmode', 'zvol_misc_zil']
tests = ['zvol_misc_002_pos', 'zvol_misc_hierarchy', 'zvol_misc_rename_inuse',
'zvol_misc_snapdev', 'zvol_misc_volmode', 'zvol_misc_zil']
tags = ['functional', 'zvol', 'zvol_misc']
[tests/functional/zvol/zvol_swap]

39
tests/runfiles/sunos.run Normal file
View File

@ -0,0 +1,39 @@
#
# This file and its contents are supplied under the terms of the
# Common Development and Distribution License ("CDDL"), version 1.0.
# You may only use this file in accordance with the terms of version
# 1.0 of the CDDL.
#
# A full copy of the text of the CDDL should have accompanied this
# source. A copy of the CDDL is also available via the Internet at
# http://www.illumos.org/license/CDDL.
#
[DEFAULT]
pre = setup
quiet = False
pre_user = root
user = root
timeout = 600
post_user = root
post = cleanup
outputdir = /var/tmp/test_results
tags = ['functional']
[tests/functional/inuse:illumos]
tests = ['inuse_001_pos', 'inuse_003_pos', 'inuse_006_pos', 'inuse_007_pos']
post =
tags = ['functional', 'inuse']
[tests/functional/cli_root/zpool_add:illumos]
tests = ['zpool_add_005_pos']
tags = ['functional', 'cli_root', 'zpool_add']
[tests/functional/cli_root/zpool_create:illumos]
tests = ['zpool_create_016_pos']
tags = ['functional', 'cli_root', 'zpool_create']
[tests/functional/zvol/zvol_misc:illumos]
tests = ['zvol_misc_001_neg', 'zvol_misc_003_neg', 'zvol_misc_004_pos',
'zvol_misc_005_neg', 'zvol_misc_006_pos']
tags = ['functional', 'zvol', 'zvol_misc']

View File

@ -169,13 +169,8 @@ known = {
'cli_root/zfs_receive/zfs_receive_004_neg': ['FAIL', known_reason],
'cli_root/zfs_unshare/zfs_unshare_002_pos': ['SKIP', na_reason],
'cli_root/zfs_unshare/zfs_unshare_006_pos': ['SKIP', na_reason],
'cli_root/zpool_create/zpool_create_016_pos': ['SKIP', na_reason],
'cli_user/misc/zfs_share_001_neg': ['SKIP', na_reason],
'cli_user/misc/zfs_unshare_001_neg': ['SKIP', na_reason],
'inuse/inuse_001_pos': ['SKIP', na_reason],
'inuse/inuse_003_pos': ['SKIP', na_reason],
'inuse/inuse_006_pos': ['SKIP', na_reason],
'inuse/inuse_007_pos': ['SKIP', na_reason],
'privilege/setup': ['SKIP', na_reason],
'refreserv/refreserv_004_pos': ['FAIL', known_reason],
'removal/removal_with_zdb': ['SKIP', known_reason],
@ -185,11 +180,6 @@ known = {
'xattr/xattr_008_pos': ['SKIP', na_reason],
'xattr/xattr_009_neg': ['SKIP', na_reason],
'xattr/xattr_010_neg': ['SKIP', na_reason],
'zvol/zvol_misc/zvol_misc_001_neg': ['SKIP', na_reason],
'zvol/zvol_misc/zvol_misc_003_neg': ['SKIP', na_reason],
'zvol/zvol_misc/zvol_misc_004_pos': ['SKIP', na_reason],
'zvol/zvol_misc/zvol_misc_005_neg': ['SKIP', na_reason],
'zvol/zvol_misc/zvol_misc_006_pos': ['SKIP', na_reason],
'zvol/zvol_swap/zvol_swap_003_pos': ['SKIP', na_reason],
'zvol/zvol_swap/zvol_swap_005_pos': ['SKIP', na_reason],
'zvol/zvol_swap/zvol_swap_006_pos': ['SKIP', na_reason],

View File

@ -143,7 +143,7 @@ export SPA_MINDEVSIZE=$((64 * 1024 * 1024))
# For iscsi target support
export ISCSITGTFILE=/tmp/iscsitgt_file
export ISCSITGT_FMRI=svc:/system/iscsitgt:default
if ! is_linux && ! is_freebsd; then
if is_illumos; then
export AUTO_SNAP=$(svcs -a | grep auto-snapshot | grep online | awk \
'{print $3}')
fi

View File

@ -92,6 +92,18 @@ function is_linux
fi
}
# Determine if this is an illumos test system
#
# Return 0 if platform illumos, 1 if otherwise
function is_illumos
{
if [[ $(uname -o) == "illumos" ]]; then
return 0
else
return 1
fi
}
# Determine if this is a FreeBSD test system
#
# Return 0 if platform FreeBSD, 1 if otherwise

View File

@ -40,12 +40,12 @@ function find_vfstab_dev
typeset vfstabdevs=""
typeset line
if is_freebsd || is_linux; then
vfstab="/etc/fstab"
tmpfile="$TEST_BASE_DIR/fstab.tmp"
else
if is_illumos; then
vfstab="/etc/vfstab"
tmpfile="$TEST_BASE_DIR/vfstab.tmp"
else
vfstab="/etc/fstab"
tmpfile="$TEST_BASE_DIR/fstab.tmp"
fi
cat $vfstab | grep "^${DEV_DSKDIR}" >$tmpfile
@ -100,13 +100,9 @@ function find_mnttab_dev
function save_dump_dev
{
typeset dumpdev
typeset dumpdev=""
if is_freebsd; then
dumpdev=$(dumpon -l)
elif is_linux; then
dumpdev=""
else
if is_illumos; then
typeset fnd="Dump device"
dumpdev=`dumpadm | grep "$fnd" | cut -f2 -d : | \
awk '{print $1}'`

View File

@ -56,11 +56,7 @@ function cleanup
destroy_pool "$TESTPOOL1"
if [[ -n $saved_dump_dev ]]; then
if is_freebsd; then
log_must eval "dumpon $saved_dump_dev > /dev/null"
else
log_must eval "dumpadm -u -d $saved_dump_dev > /dev/null"
fi
log_must eval "dumpadm -u -d $saved_dump_dev > /dev/null"
fi
partition_cleanup
@ -90,13 +86,9 @@ else
log_mustnot zpool add -f "$TESTPOOL" $vfstab_dev
fi
if ! is_linux; then
if is_illumos; then
log_must eval "new_fs ${DEV_DSKDIR}/$dump_dev > /dev/null 2>&1"
if is_freebsd; then
log_must eval "dumpon ${DEV_DSKDIR}/$dump_dev > /dev/null"
else
log_must eval "dumpadm -u -d ${DEV_DSKDIR}/$dump_dev > /dev/null"
fi
log_must eval "dumpadm -u -d ${DEV_DSKDIR}/$dump_dev > /dev/null"
log_mustnot zpool add -f "$TESTPOOL" $dump_dev
fi

View File

@ -123,12 +123,12 @@ function find_vfstab_dev
typeset vfstabdevs=""
typeset line
if is_freebsd || is_linux; then
vfstab="/etc/fstab"
tmpfile="$TEST_BASE_DIR/fstab.tmp"
else
if is_illumos; then
vfstab="/etc/vfstab"
tmpfile="$TEST_BASE_DIR/vfstab.tmp"
else
vfstab="/etc/fstab"
tmpfile="$TEST_BASE_DIR/fstab.tmp"
fi
cat $vfstab | grep "^${DEV_DSKDIR}" >$tmpfile
@ -148,13 +148,9 @@ function find_vfstab_dev
#
function save_dump_dev
{
typeset dumpdev
typeset dumpdev=""
if is_freebsd; then
dumpdev=$(dumpon -l)
elif is_linux; then
dumpdev=""
else
if is_illumos; then
typeset fnd="Dump device"
dumpdev=`dumpadm | grep "$fnd" | cut -f2 -d : | \
awk '{print $1}'`

View File

@ -55,11 +55,7 @@ function cleanup
done
if [[ -n $saved_dump_dev ]]; then
if is_freebsd; then
log_must dumpon $saved_dump_dev
else
log_must dumpadm -u -d $saved_dump_dev
fi
log_must dumpadm -u -d $saved_dump_dev
fi
partition_disk $SIZE $disk 7
@ -82,16 +78,16 @@ raidz2=$mirror2
diff_size_dev="${disk}${SLICE_PREFIX}${SLICE6} ${disk}${SLICE_PREFIX}${SLICE7}"
vfstab_dev=$(find_vfstab_dev)
if is_linux; then
partition_disk $SIZE $disk 7
cyl=$(get_endslice $disk $SLICE5)
log_must set_partition $SLICE6 "$cyl" $SIZE1 $disk
else
if is_illumos; then
specified_dump_dev=${disk}${SLICE_PREFIX}${SLICE0}
saved_dump_dev=$(save_dump_dev)
cyl=$(get_endslice $disk $SLICE6)
log_must set_partition $SLICE7 "$cyl" $SIZE1 $disk
else
partition_disk $SIZE $disk 7
cyl=$(get_endslice $disk $SLICE5)
log_must set_partition $SLICE6 "$cyl" $SIZE1 $disk
fi
create_pool "$TESTPOOL" "$pooldev1"
@ -126,17 +122,13 @@ done
# now destroy the pool to be polite
log_must zpool destroy -f $TESTPOOL
if ! is_linux; then
if is_illumos; then
# create/destroy a pool as a simple way to set the partitioning
# back to something normal so we can use this $disk as a dump device
log_must zpool create -f $TESTPOOL3 $disk
log_must zpool destroy -f $TESTPOOL3
if is_freebsd; then
log_must dumpon ${DEV_DSKDIR}/$specified_dump_dev
else
log_must dumpadm -d ${DEV_DSKDIR}/$specified_dump_dev
fi
log_must dumpadm -d ${DEV_DSKDIR}/$specified_dump_dev
log_mustnot zpool create -f $TESTPOOL1 "$specified_dump_dev"
# Also check to see that in-use checking prevents us from creating

View File

@ -46,10 +46,6 @@
verify_runnable "global"
if is_linux; then
log_unsupported "Test case isn't useful under Linux."
fi
function cleanup
{
if poolexists $TESTPOOL; then

View File

@ -47,7 +47,7 @@ done
typeset -i i=0
while (( i <= $GROUP_NUM )); do
if ! is_linux && ! is_freebsd; then
if is_illumos; then
if (( i == 2 )); then
(( i = i + 1 ))
continue

View File

@ -43,10 +43,6 @@
verify_runnable "global"
if is_linux || is_freebsd; then
log_unsupported "Test case isn't applicable to Linux/FreeBSD"
fi
function cleanup
{
#

View File

@ -50,10 +50,6 @@
verify_runnable "global"
if is_linux || is_freebsd; then
log_unsupported "Test case isn't applicable to Linux/FreeBSD"
fi
function cleanup
{
poolexists $TESTPOOL1 && destroy_pool $TESTPOOL1

View File

@ -44,10 +44,6 @@
verify_runnable "global"
if is_linux || is_freebsd; then
log_unsupported "Test case isn't applicable to Linux/FreeBSD"
fi
function cleanup
{
if [[ -n $PREVDUMPDEV ]]; then

View File

@ -45,10 +45,6 @@
verify_runnable "global"
if is_linux || is_freebsd; then
log_unsupported "Test case isn't applicable to Linux/FreeBSD"
fi
function cleanup
{
if [[ -n $PREVDUMPDEV ]]; then

View File

@ -87,15 +87,13 @@ function set_dumpsize
log_must zfs set volsize=64m $volume
if ! is_linux; then
output=$(dumpadm -d /dev/zvol/dsk/$volume 2>&1 | \
tail -1 | awk '{print $3}')
output=$(dumpadm -d /dev/zvol/dsk/$volume 2>&1 | \
tail -1 | awk '{print $3}')
if [[ -n $output ]]; then
(( output = output / 1024 / 1024 ))
(( output = output + output / 5 ))
log_must zfs set volsize=${output}m $volume
fi
if [[ -n $output ]]; then
(( output = output / 1024 / 1024 ))
(( output = output + output / 5 ))
log_must zfs set volsize=${output}m $volume
fi
return 0
@ -114,23 +112,11 @@ function safe_dumpadm
set_dumpsize $volume
log_must dumpadm -d $device
else
if is_freebsd; then
log_must swapon
else
log_must swapadd
fi
log_must swapadd
if ! is_swap_inuse $device ; then
if is_freebsd; then
log_must swapctl -a $device
else
log_must swap -a $device
fi
fi
if is_freebsd; then
log_must dumpon $device
else
log_must dumpadm -d swap
log_must swap -a $device
fi
log_must dumpadm -d swap
fi
}