diff options
author | Ryan Moeller <[email protected]> | 2020-01-03 12:08:23 -0500 |
---|---|---|
committer | Brian Behlendorf <[email protected]> | 2020-01-03 09:08:23 -0800 |
commit | d7164b27bee6c2837affcc42892fbd4b45dd13ff (patch) | |
tree | e36eb766d156fee7423943a3159d4c07bd994cd0 /tests | |
parent | cc618d179e87fa13b67c98e93cf92569d995dd20 (diff) |
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 <[email protected]>
Reviewed-by: Brian Behlendorf <[email protected]>
Signed-off-by: Ryan Moeller <[email protected]>
Closes #9794
Diffstat (limited to 'tests')
16 files changed, 95 insertions, 118 deletions
diff --git a/tests/runfiles/common.run b/tests/runfiles/common.run index a3396ac07..2c227875b 100644 --- a/tests/runfiles/common.run +++ b/tests/runfiles/common.run @@ -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] diff --git a/tests/runfiles/sunos.run b/tests/runfiles/sunos.run new file mode 100644 index 000000000..a0dae504a --- /dev/null +++ b/tests/runfiles/sunos.run @@ -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'] diff --git a/tests/test-runner/bin/zts-report.py b/tests/test-runner/bin/zts-report.py index 37b9ccd64..a625917df 100755 --- a/tests/test-runner/bin/zts-report.py +++ b/tests/test-runner/bin/zts-report.py @@ -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], diff --git a/tests/zfs-tests/include/default.cfg.in b/tests/zfs-tests/include/default.cfg.in index 52a03533c..71e675042 100644 --- a/tests/zfs-tests/include/default.cfg.in +++ b/tests/zfs-tests/include/default.cfg.in @@ -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 diff --git a/tests/zfs-tests/include/libtest.shlib b/tests/zfs-tests/include/libtest.shlib index df794418c..d6033bf30 100644 --- a/tests/zfs-tests/include/libtest.shlib +++ b/tests/zfs-tests/include/libtest.shlib @@ -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 diff --git a/tests/zfs-tests/tests/functional/cli_root/zpool_add/zpool_add.kshlib b/tests/zfs-tests/tests/functional/cli_root/zpool_add/zpool_add.kshlib index 9e3bf1795..9a7310e3a 100644 --- a/tests/zfs-tests/tests/functional/cli_root/zpool_add/zpool_add.kshlib +++ b/tests/zfs-tests/tests/functional/cli_root/zpool_add/zpool_add.kshlib @@ -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}'` diff --git a/tests/zfs-tests/tests/functional/cli_root/zpool_add/zpool_add_005_pos.ksh b/tests/zfs-tests/tests/functional/cli_root/zpool_add/zpool_add_005_pos.ksh index 8bffb94a7..bcb463301 100755 --- a/tests/zfs-tests/tests/functional/cli_root/zpool_add/zpool_add_005_pos.ksh +++ b/tests/zfs-tests/tests/functional/cli_root/zpool_add/zpool_add_005_pos.ksh @@ -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 diff --git a/tests/zfs-tests/tests/functional/cli_root/zpool_create/zpool_create.shlib b/tests/zfs-tests/tests/functional/cli_root/zpool_create/zpool_create.shlib index 51735f9c4..bee5c6ddb 100644 --- a/tests/zfs-tests/tests/functional/cli_root/zpool_create/zpool_create.shlib +++ b/tests/zfs-tests/tests/functional/cli_root/zpool_create/zpool_create.shlib @@ -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}'` diff --git a/tests/zfs-tests/tests/functional/cli_root/zpool_create/zpool_create_011_neg.ksh b/tests/zfs-tests/tests/functional/cli_root/zpool_create/zpool_create_011_neg.ksh index 4f2394f0c..8b43bebd5 100755 --- a/tests/zfs-tests/tests/functional/cli_root/zpool_create/zpool_create_011_neg.ksh +++ b/tests/zfs-tests/tests/functional/cli_root/zpool_create/zpool_create_011_neg.ksh @@ -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 diff --git a/tests/zfs-tests/tests/functional/cli_root/zpool_create/zpool_create_016_pos.ksh b/tests/zfs-tests/tests/functional/cli_root/zpool_create/zpool_create_016_pos.ksh index cbb5806d9..1c0d3e2d4 100755 --- a/tests/zfs-tests/tests/functional/cli_root/zpool_create/zpool_create_016_pos.ksh +++ b/tests/zfs-tests/tests/functional/cli_root/zpool_create/zpool_create_016_pos.ksh @@ -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 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 6d7b0e156..62c726e61 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 @@ -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 diff --git a/tests/zfs-tests/tests/functional/inuse/inuse_001_pos.ksh b/tests/zfs-tests/tests/functional/inuse/inuse_001_pos.ksh index e2668fe14..23adc4ecd 100755 --- a/tests/zfs-tests/tests/functional/inuse/inuse_001_pos.ksh +++ b/tests/zfs-tests/tests/functional/inuse/inuse_001_pos.ksh @@ -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 { # diff --git a/tests/zfs-tests/tests/functional/inuse/inuse_003_pos.ksh b/tests/zfs-tests/tests/functional/inuse/inuse_003_pos.ksh index 3a218f40f..c837d28e2 100755 --- a/tests/zfs-tests/tests/functional/inuse/inuse_003_pos.ksh +++ b/tests/zfs-tests/tests/functional/inuse/inuse_003_pos.ksh @@ -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 diff --git a/tests/zfs-tests/tests/functional/inuse/inuse_006_pos.ksh b/tests/zfs-tests/tests/functional/inuse/inuse_006_pos.ksh index ae97620f5..28a2dba93 100755 --- a/tests/zfs-tests/tests/functional/inuse/inuse_006_pos.ksh +++ b/tests/zfs-tests/tests/functional/inuse/inuse_006_pos.ksh @@ -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 diff --git a/tests/zfs-tests/tests/functional/inuse/inuse_007_pos.ksh b/tests/zfs-tests/tests/functional/inuse/inuse_007_pos.ksh index e2d7c4a97..32b264113 100755 --- a/tests/zfs-tests/tests/functional/inuse/inuse_007_pos.ksh +++ b/tests/zfs-tests/tests/functional/inuse/inuse_007_pos.ksh @@ -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 diff --git a/tests/zfs-tests/tests/functional/zvol/zvol_common.shlib b/tests/zfs-tests/tests/functional/zvol/zvol_common.shlib index bb6ade9ea..342700228 100644 --- a/tests/zfs-tests/tests/functional/zvol/zvol_common.shlib +++ b/tests/zfs-tests/tests/functional/zvol/zvol_common.shlib @@ -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}') - - if [[ -n $output ]]; then - (( output = output / 1024 / 1024 )) - (( output = output + output / 5 )) - log_must zfs set volsize=${output}m $volume - fi + 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 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 } |