From 740683a97873a5f80a34556ea9cc782a94344610 Mon Sep 17 00:00:00 2001 From: Alan Somers Date: Wed, 30 Oct 2019 02:03:37 +0000 Subject: [PATCH] MFC r353117-r353118, r353281-r353282, r353284-r353289, r353309-r353310, r353360-r353361, r353366, r353379 r353117: ZFS: the hotspare_add_004_neg test needs at least two disks Sponsored by: Axcient r353118: ZFS: fix several of the "zpool create" tests * Remove zpool_create_013_neg. FreeBSD doesn't have an equivalent of Solaris's metadevices. GEOM would be the equivalent, but since all geoms are the same from ZFS's perspective, this test would be redundant with zpool_create_012_neg * Remove zpool_create_014_neg. FreeBSD does not support swapping to regular files. * Remove zpool_create_016_pos. This test is redundant with literally every other test that creates a disk-backed pool. * s:/etc/vfstab:/etc/fstab in zpool_create_011_neg * Delete the VTOC-related portion of zpool_create_008_pos. FreeBSD doesn't use VTOC. * Replace dumpadm with dumpon and swap with swapon in multiple tests. * In zpool_create_015_neg, don't require "zpool create -n" to fail. It's reasonable for that variant to succeed, because it doesn't actually open the zvol. * Greatly simplify zpool_create_012_neg. Make it safer, too, but not interfering with the system's regular swap devices. * Expect zpool_create_011_neg to fail (PR 241070) * Delete some redundant cleanup steps in various tests * Remove some unneeeded ATF timeout specifications. The default is fine. PR: 241070 Sponsored by: Axcient r353281: ZFS: fix several zvol_misc tests * Adapt zvol_misc_001_neg to use dumpon instead of Solaris's dumpadm * Disable zvol_misc_003_neg, zvol_misc_005_neg, and zvol_misc_006_pos, because they involve using a zvol as a dump device, which FreeBSD does not yet support. Sponsored by: Axcient r353282: zfs: fix the slog_012_neg test This test attempts to corrupt a file-backed vdev by deleting it and then recreating it with truncate. But that doesn't work, because the pool already has the vdev open, and it happily hangs on to the open-but-deleted file. Fix by truncating the file without deleting it. Sponsored by: Axcient r353284: ZFS: fix the zpool_get_002_pos test ZFS has grown some additional properties that hadn't been added to the config file yet. While I'm here, improve the error message, and remove a superfluous command. Sponsored by: Axcient r353285: zfs: fix the zdb_001_neg test The test needed to be updated for r331701 (MFV illumos 8671400), which added a "-k" option. Sponsored by: Axcient r353286: zfs: skip the zfsd tests if zfsd is not running Sponsored by: Axcient Differential Revision: https://reviews.freebsd.org/D21878 r353287: ZFS: fix the delegate tests These tests have never worked correctly * Replace runwattr with sudo * Fix a scoping bug with the "dtst" variable * Cleanup user properties created during tests * Eliminate the checks for refreservation and send support. They will always be supported. * Fix verify_fs_snapshot. It seemed to assume that permissions would not yet be delegated, but that's not how it's actually used. * Combine verify_fs_promote with verify_vol_promote * Remove some useless sleeps * Fix backwards condition in verify_vol_volsize * Remove some redundant cleanup steps in the tests. cleanup.ksh will handle everything. * Disable some parts of the tests that FreeBSD doesn't support: * Creating snapshots with mkdir * devices * shareisci * sharenfs * xattr * zoned The sharenfs parts could probably be reenabled with more work to remove the Solarisms. Sponsored by: Axcient Differential Revision: https://reviews.freebsd.org/D21898 r353288: ZFS: mark hotspare_scrub_002_pos as an expected failure "zpool scrub" doesn't detect all errors on active spares in raidz arrays PR: 241069 Sponsored by: Axcient r353289: ZFS: fix the redundancy tests * Fix force_sync_path, which ensures that a file is fully flushed to disk. Apparently "zpool history"'s performance has improved, but exporting and importing the pool still works. * Fix file_dva by using undocumented zdb syntax to clarify that we're interested in the pool's root file system, not the pool itself. This should also fix the zpool_clear_001_pos test. * Remove a redundant cleanup step Sponsored by: Axcient Differential Revision: https://reviews.freebsd.org/D21901 r353309: zfs: fix the zfsd_autoreplace_003_pos test The test declared that it only needed 5 disks, but actually tried to use 6. Fix it to use just 5, which is all it really needs. Sponsored by: Axcient r353310: zfs: fix the zfsd_hotspare_007_pos test It was trying to destroy the pool while zfsd was detaching the spare, and "zpool destroy" failed. Fix by waiting until the spare has fully detached. Sponsored by: Axcient r353360: ZFS: multiple fixes to the zpool_import tests * Don't create a UFS mountpoint just to store some temporary files. The tests should always be executed with a sufficiently large TMPDIR. Creating the UFS mountpoint is not only unneccessary, but it slowed zpool_import_missing_002_pos greatly, because that test moves large files between TMPDIR and the UFS mountpoint. This change also allows many of the tests to be executed with just a single test disk, instead of two. * Move zpool_import_missing_002_pos's backup device dir from / to $PWD to prevent cross-device moves. On my system, these two changes improved that test's speed by 39x. It should also prevent ENOSPC errors seen in CI. * If insufficient disks are available, don't try to partition one of them. Just rely on Kyua to skip the test. Users who care will configure Kyua with sufficient disks. Sponsored by: Axcient r353361: ZFS: in the tests, don't override PWD The ZFS test suite was overriding the common $PWD variable with the path to the pwd command, even though no test wanted to use it that way. Most tests didn't notice, because ksh93 eventually restored it to its proper meaning. Sponsored by: Axcient r353366: ZFS: fix the zpool_add_010_pos test The test is necessarily racy, because it depends on being able to complete a "zpool add" before a previous resilver finishes. But it was racier than it needed to be. Move the first "zpool add" to before the resilver starts. Sponsored by: Axcient r353379: zfs: multiple improvements to the zpool_add tests * Don't partition a disk if too few are available. Just rely on Kyua to ensure that the tests aren't run with insufficient disks. * Remove redundant cleanup steps * In zpool_add_003_pos, store the temporary file in $PWD so Kyua will automatically clean it up. * Update zpool_add_005_pos to use dumpon instead of dumpadm. This test had never been ported to FreeBSD. * In zpool_add_005_pos, don't format the dump disk with UFS. That was pointless. Sponsored by: Axcient --- ObsoleteFiles.inc | 4 + tests/sys/cddl/zfs/include/commands.txt | 2 +- tests/sys/cddl/zfs/include/libtest.kshlib | 11 +- .../zfs/tests/cli_root/zdb/zdb_001_neg.ksh | 2 +- .../zfs/tests/cli_root/zpool_add/cleanup.ksh | 2 + .../zfs/tests/cli_root/zpool_add/setup.ksh | 15 - .../cli_root/zpool_add/zpool_add_001_pos.ksh | 47 +-- .../cli_root/zpool_add/zpool_add_002_pos.ksh | 20 +- .../cli_root/zpool_add/zpool_add_003_pos.ksh | 21 +- .../cli_root/zpool_add/zpool_add_004_pos.ksh | 9 +- .../cli_root/zpool_add/zpool_add_005_pos.ksh | 20 +- .../cli_root/zpool_add/zpool_add_006_pos.ksh | 15 +- .../cli_root/zpool_add/zpool_add_007_neg.ksh | 14 +- .../cli_root/zpool_add/zpool_add_008_neg.ksh | 15 +- .../cli_root/zpool_add/zpool_add_009_neg.ksh | 18 +- .../cli_root/zpool_add/zpool_add_010_pos.ksh | 12 +- .../cli_root/zpool_add/zpool_add_test.sh | 21 +- .../zfs/tests/cli_root/zpool_create/Makefile | 3 - .../cli_root/zpool_create/zpool_create.kshlib | 34 +-- .../zpool_create/zpool_create_008_pos.ksh | 78 ----- .../zpool_create/zpool_create_011_neg.ksh | 16 +- .../zpool_create/zpool_create_012_neg.ksh | 24 +- .../zpool_create/zpool_create_013_neg.ksh | 116 -------- .../zpool_create/zpool_create_014_neg.ksh | 103 ------- .../zpool_create/zpool_create_015_neg.ksh | 21 +- .../zpool_create/zpool_create_016_pos.ksh | 100 ------- .../zpool_create/zpool_create_test.sh | 106 +------ .../tests/cli_root/zpool_get/zpool_get.cfg | 4 + .../cli_root/zpool_get/zpool_get_002_pos.ksh | 4 +- .../tests/cli_root/zpool_import/cleanup.ksh | 15 - .../zfs/tests/cli_root/zpool_import/setup.ksh | 26 +- .../cli_root/zpool_import/zpool_import.cfg | 34 +-- .../zpool_import/zpool_import_all_001_pos.ksh | 4 +- .../zpool_import/zpool_import_test.sh | 30 +- .../zfs/tests/delegate/delegate_common.kshlib | 280 +++--------------- .../zfs/tests/delegate/zfs_allow_001_pos.ksh | 3 - .../zfs/tests/delegate/zfs_allow_002_pos.ksh | 2 - .../zfs/tests/delegate/zfs_allow_003_pos.ksh | 7 - .../zfs/tests/delegate/zfs_allow_007_pos.ksh | 1 - .../zfs/tests/delegate/zfs_allow_010_pos.ksh | 16 +- .../zfs/tests/delegate/zfs_allow_012_neg.ksh | 14 +- .../cddl/zfs/tests/delegate/zfs_allow_test.sh | 30 +- .../tests/delegate/zfs_unallow_007_neg.ksh | 2 +- .../zfs/tests/delegate/zfs_unallow_test.sh | 16 +- .../cddl/zfs/tests/hotspare/hotspare_test.sh | 3 +- .../zfs/tests/redundancy/redundancy.kshlib | 4 +- .../tests/redundancy/redundancy_001_pos.ksh | 1 - .../sys/cddl/zfs/tests/slog/slog_012_neg.ksh | 4 +- .../tests/zfsd/zfsd_autoreplace_003_pos.ksh | 10 +- .../zfs/tests/zfsd/zfsd_hotspare_007_pos.ksh | 3 + tests/sys/cddl/zfs/tests/zfsd/zfsd_test.sh | 22 ++ .../zvol/zvol_misc/zvol_misc_001_neg.ksh | 11 +- .../tests/zvol/zvol_misc/zvol_misc_test.sh | 5 +- 53 files changed, 254 insertions(+), 1146 deletions(-) delete mode 100644 tests/sys/cddl/zfs/tests/cli_root/zpool_create/zpool_create_013_neg.ksh delete mode 100644 tests/sys/cddl/zfs/tests/cli_root/zpool_create/zpool_create_014_neg.ksh delete mode 100644 tests/sys/cddl/zfs/tests/cli_root/zpool_create/zpool_create_016_pos.ksh diff --git a/ObsoleteFiles.inc b/ObsoleteFiles.inc index 3afecbbac2c..b485aa87e3f 100644 --- a/ObsoleteFiles.inc +++ b/ObsoleteFiles.inc @@ -38,6 +38,10 @@ # xargs -n1 | sort | uniq -d; # done +# 20191003: Remove useless ZFS tests +OLD_FILES+=usr/tests/sys/cddl/zfs/tests/cli_root/zpool_create/zpool_create_013_neg.ksh +OLD_FILES+=usr/tests/sys/cddl/zfs/tests/cli_root/zpool_create/zpool_create_014_neg.ksh +OLD_FILES+=usr/tests/sys/cddl/zfs/tests/cli_root/zpool_create/zpool_create_016_pos.ksh # 20190811: sys/pwm.h renamed to dev/pwmc.h and pwm(9) removed OLD_FILES+=usr/include/sys/pwm.h usr/share/man/man9/pwm.9 # 20190723: new clang import which bumps version from 8.0.0 to 8.0.1. diff --git a/tests/sys/cddl/zfs/include/commands.txt b/tests/sys/cddl/zfs/include/commands.txt index 8c90e6f8f42..774a29710e6 100644 --- a/tests/sys/cddl/zfs/include/commands.txt +++ b/tests/sys/cddl/zfs/include/commands.txt @@ -65,6 +65,7 @@ /usr/bin/dirname /usr/bin/du #%%STFSUITEDIR%%/bin/dumpadm +/sbin/dumpon /bin/echo /usr/bin/egrep /usr/bin/env @@ -131,7 +132,6 @@ /bin/pkill /bin/ps #/usr/sbin/psrinfo -/bin/pwd /usr/sbin/quotaon /bin/rcp /sbin/reboot diff --git a/tests/sys/cddl/zfs/include/libtest.kshlib b/tests/sys/cddl/zfs/include/libtest.kshlib index c1bbec0dc50..389f6ac4cfa 100644 --- a/tests/sys/cddl/zfs/include/libtest.kshlib +++ b/tests/sys/cddl/zfs/include/libtest.kshlib @@ -2676,8 +2676,7 @@ function gen_dataset_name # # Ensure that a given path has been synced, not just ZIL committed. # -# XXX The implementation currently requires calling 'zpool history'. On -# FreeBSD, the sync(8) command (via $SYNC) calls zfs_sync() which just +# XXX On FreeBSD, the sync(8) command (via $SYNC) calls zfs_sync() which just # does a zil_commit(), as opposed to a txg_wait_synced(). For things that # require writing to their final destination (e.g. for intentional # corruption purposes), zil_commit() is not good enough. @@ -2686,10 +2685,8 @@ function force_sync_path # path { typeset path="$1" - zfspath=$($DF $path 2>/dev/null | tail -1 | cut -d" " -f1 | cut -d/ -f1) - [ -z "$zfspath" ] && return false - log_note "Force syncing ${zfspath} for ${path} ..." - $ZPOOL history $zfspath >/dev/null 2>&1 + log_must $ZPOOL export $TESTPOOL + log_must $ZPOOL import -d $path $TESTPOOL } # @@ -3326,7 +3323,7 @@ function file_dva # dataset filepath [level] [offset] [dva_num] # The inner match is for 'DVA[0]=<0:1b412600:200>', in which the # text surrounding the actual DVA is a fixed size with 8 characters # before it and 1 after. - $ZDB -P -vvvvv $dataset $inode | \ + $ZDB -P -vvvvv "$dataset/" $inode | \ $AWK -v level=${level} -v dva_num=${dva_num} ' BEGIN { stage = 0; } (stage == 0) && ($1=="Object") { stage = 1; next; } diff --git a/tests/sys/cddl/zfs/tests/cli_root/zdb/zdb_001_neg.ksh b/tests/sys/cddl/zfs/tests/cli_root/zdb/zdb_001_neg.ksh index 4c9b7b87cad..d9b93761889 100644 --- a/tests/sys/cddl/zfs/tests/cli_root/zdb/zdb_001_neg.ksh +++ b/tests/sys/cddl/zfs/tests/cli_root/zdb/zdb_001_neg.ksh @@ -69,7 +69,7 @@ set -A args "create" "add" "destroy" "import fakepool" \ "add mirror fakepool" "add raidz fakepool" \ "add raidz1 fakepool" "add raidz2 fakepool" \ "setvprop" "blah blah" "-%" "--?" "-*" "-=" \ - "-a" "-f" "-g" "-h" "-j" "-k" "-m" "-n" "-p" "-p /tmp" \ + "-a" "-f" "-g" "-h" "-j" "-m" "-n" "-p" "-p /tmp" \ "-r" "-t" "-w" "-x" "-y" "-z" \ "-D" "-E" "-G" "-H" "-I" "-J" "-K" "-M" \ "-N" "-Q" "-T" "-W" diff --git a/tests/sys/cddl/zfs/tests/cli_root/zpool_add/cleanup.ksh b/tests/sys/cddl/zfs/tests/cli_root/zpool_add/cleanup.ksh index 083ab9e34bd..1d88e4cf91d 100644 --- a/tests/sys/cddl/zfs/tests/cli_root/zpool_add/cleanup.ksh +++ b/tests/sys/cddl/zfs/tests/cli_root/zpool_add/cleanup.ksh @@ -32,6 +32,8 @@ . $STF_SUITE/include/libtest.kshlib . $STF_SUITE/tests/cli_root/zpool_add/zpool_add.kshlib +poolexists $TESTPOOL && \ + destroy_pool $TESTPOOL cleanup_devices $DISKS log_pass diff --git a/tests/sys/cddl/zfs/tests/cli_root/zpool_add/setup.ksh b/tests/sys/cddl/zfs/tests/cli_root/zpool_add/setup.ksh index 9b6adb17007..810c9be1be6 100644 --- a/tests/sys/cddl/zfs/tests/cli_root/zpool_add/setup.ksh +++ b/tests/sys/cddl/zfs/tests/cli_root/zpool_add/setup.ksh @@ -34,19 +34,4 @@ verify_runnable "global" -if [[ -n $DISK ]]; then - # - # Use 'zpool create' to clean up the infomation in - # in the given disk to avoid slice overlapping. - # - cleanup_devices $DISK - - partition_disk $SIZE $DISK 7 -else - for disk in `$ECHO $DISKSARRAY`; do - cleanup_devices $disk - partition_disk $SIZE $disk 7 - done -fi - log_pass diff --git a/tests/sys/cddl/zfs/tests/cli_root/zpool_add/zpool_add_001_pos.ksh b/tests/sys/cddl/zfs/tests/cli_root/zpool_add/zpool_add_001_pos.ksh index c27329d8156..dfc76f6a1a3 100644 --- a/tests/sys/cddl/zfs/tests/cli_root/zpool_add/zpool_add_001_pos.ksh +++ b/tests/sys/cddl/zfs/tests/cli_root/zpool_add/zpool_add_001_pos.ksh @@ -58,44 +58,23 @@ verify_runnable "global" -function cleanup -{ - poolexists $TESTPOOL && \ - destroy_pool $TESTPOOL - - partition_cleanup -} - log_assert "'zpool add ...' can add devices to the pool." -log_onexit cleanup - set -A keywords "" "mirror" "raidz" "raidz1" "spare" -typeset diskname=${disk#/dev/} +set_disks + typeset diskname0=${DISK0#/dev/} typeset diskname1=${DISK1#/dev/} +typeset diskname2=${DISK2#/dev/} +typeset diskname3=${DISK3#/dev/} +typeset diskname4=${DISK4#/dev/} -case $DISK_ARRAY_NUM in -0|1) - pooldevs="${diskname}p1 \ - /dev/${diskname}p1 \ - \"${diskname}p1 ${diskname}p2\"" - mirrordevs="\"/dev/${diskname}p1 ${diskname}p2\"" - raidzdevs="\"/dev/${diskname}p1 ${diskname}p2\"" - - ;; -2|*) - pooldevs="${diskname0}p1\ - \"/dev/${diskname0}p1 ${diskname1}p1\" \ - \"${diskname0}p1 ${diskname0}p2 ${diskname1}p2\"\ - \"${diskname0}p1 ${diskname1}p1 ${diskname0}p2\ - ${diskname1}p2\"" - mirrordevs="\"/dev/${diskname0}p1 ${diskname1}p1\"" - raidzdevs="\"/dev/${diskname0}p1 ${diskname1}p1\"" - - ;; -esac +pooldevs="${diskname0}\ + \"/dev/${diskname0} ${diskname1}\" \ + \"${diskname0} ${diskname1} ${diskname2}\"" +mirrordevs="\"/dev/${diskname0} ${diskname1}\"" +raidzdevs="\"/dev/${diskname0} ${diskname1}\"" typeset -i i=0 typeset vdev @@ -107,7 +86,7 @@ while (( $i < ${#keywords[*]} )); do case ${keywords[i]} in ""|spare) for vdev in "${poolarray[@]}"; do - create_pool "$TESTPOOL" "${diskname}p6" + create_pool "$TESTPOOL" "${diskname3}" log_must poolexists "$TESTPOOL" log_must $ZPOOL add -f "$TESTPOOL" ${keywords[i]} \ $vdev @@ -119,7 +98,7 @@ while (( $i < ${#keywords[*]} )); do mirror) for vdev in "${mirrorarray[@]}"; do create_pool "$TESTPOOL" "${keywords[i]}" \ - "${diskname}p4" "${diskname}p5" + "${diskname3}" "${diskname4}" log_must poolexists "$TESTPOOL" log_must $ZPOOL add "$TESTPOOL" ${keywords[i]} \ $vdev @@ -131,7 +110,7 @@ while (( $i < ${#keywords[*]} )); do raidz|raidz1) for vdev in "${raidzarray[@]}"; do create_pool "$TESTPOOL" "${keywords[i]}" \ - "${diskname}p4" "${diskname}p5" + "${diskname3}" "${diskname4}" log_must poolexists "$TESTPOOL" log_must $ZPOOL add "$TESTPOOL" ${keywords[i]} \ $vdev diff --git a/tests/sys/cddl/zfs/tests/cli_root/zpool_add/zpool_add_002_pos.ksh b/tests/sys/cddl/zfs/tests/cli_root/zpool_add/zpool_add_002_pos.ksh index 0a1b2ae8a1c..d8e980d5d71 100644 --- a/tests/sys/cddl/zfs/tests/cli_root/zpool_add/zpool_add_002_pos.ksh +++ b/tests/sys/cddl/zfs/tests/cli_root/zpool_add/zpool_add_002_pos.ksh @@ -60,26 +60,18 @@ verify_runnable "global" -function cleanup -{ - poolexists $TESTPOOL && \ - destroy_pool $TESTPOOL - - partition_cleanup -} +set_disks log_assert "'zpool add -f ...' can successfully add" \ "devices to the pool in some cases." -log_onexit cleanup - -create_pool "$TESTPOOL" mirror "${disk}p1" "${disk}p2" +create_pool "$TESTPOOL" mirror "${DISK0}" "${DISK1}" log_must poolexists "$TESTPOOL" -log_mustnot $ZPOOL add "$TESTPOOL" ${disk}p3 -log_mustnot iscontained "$TESTPOOL" "${disk}p3" +log_mustnot $ZPOOL add "$TESTPOOL" ${DISK2} +log_mustnot iscontained "$TESTPOOL" "${DISK2}" -log_must $ZPOOL add -f "$TESTPOOL" ${disk}p3 -log_must iscontained "$TESTPOOL" "${disk}p3" +log_must $ZPOOL add -f "$TESTPOOL" ${DISK2} +log_must iscontained "$TESTPOOL" "${DISK2}" log_pass "'zpool add -f ...' executes successfully." diff --git a/tests/sys/cddl/zfs/tests/cli_root/zpool_add/zpool_add_003_pos.ksh b/tests/sys/cddl/zfs/tests/cli_root/zpool_add/zpool_add_003_pos.ksh index df2bd34da9b..c8e668a7ff7 100644 --- a/tests/sys/cddl/zfs/tests/cli_root/zpool_add/zpool_add_003_pos.ksh +++ b/tests/sys/cddl/zfs/tests/cli_root/zpool_add/zpool_add_003_pos.ksh @@ -58,30 +58,19 @@ verify_runnable "global" -function cleanup -{ - poolexists $TESTPOOL && \ - destroy_pool $TESTPOOL - - partition_cleanup - - [[ -e $tmpfile ]] && \ - log_must $RM -f $tmpfile -} +set_disks log_assert "'zpool add -n ...' can display the configuration" \ "without actually adding devices to the pool." -log_onexit cleanup - -tmpfile="$TMPDIR/zpool_add_003.tmp${TESTCASE_ID}" +tmpfile="zpool_add_003.tmp${TESTCASE_ID}" -create_pool "$TESTPOOL" "${disk}p1" +create_pool "$TESTPOOL" "${DISK0}" log_must poolexists "$TESTPOOL" -$ZPOOL add -n "$TESTPOOL" ${disk}p2 > $tmpfile +$ZPOOL add -n "$TESTPOOL" ${DISK1} > $tmpfile -log_mustnot iscontained "$TESTPOOL" "${disk}p2" +log_mustnot iscontained "$TESTPOOL" "${DISK1}" str="would update '$TESTPOOL' to the following configuration:" $CAT $tmpfile | $GREP "$str" >/dev/null 2>&1 diff --git a/tests/sys/cddl/zfs/tests/cli_root/zpool_add/zpool_add_004_pos.ksh b/tests/sys/cddl/zfs/tests/cli_root/zpool_add/zpool_add_004_pos.ksh index f3764575c62..41c038a1ce3 100644 --- a/tests/sys/cddl/zfs/tests/cli_root/zpool_add/zpool_add_004_pos.ksh +++ b/tests/sys/cddl/zfs/tests/cli_root/zpool_add/zpool_add_004_pos.ksh @@ -58,6 +58,8 @@ verify_runnable "global" +set_disks + function cleanup { poolexists $TESTPOOL && \ @@ -67,19 +69,16 @@ function cleanup log_must $ZFS destroy -f $TESTPOOL1/$TESTVOL poolexists $TESTPOOL1 && \ destroy_pool "$TESTPOOL1" - - partition_cleanup - } log_assert "'zpool add ...' can add zfs volume to the pool." log_onexit cleanup -create_pool "$TESTPOOL" "${disk}p1" +create_pool "$TESTPOOL" "${DISK0}" log_must poolexists "$TESTPOOL" -create_pool "$TESTPOOL1" "${disk}p2" +create_pool "$TESTPOOL1" "${DISK1}" log_must poolexists "$TESTPOOL1" log_must $ZFS create -V $VOLSIZE $TESTPOOL1/$TESTVOL diff --git a/tests/sys/cddl/zfs/tests/cli_root/zpool_add/zpool_add_005_pos.ksh b/tests/sys/cddl/zfs/tests/cli_root/zpool_add/zpool_add_005_pos.ksh index 4f02d884ac3..8bd0220a9fe 100644 --- a/tests/sys/cddl/zfs/tests/cli_root/zpool_add/zpool_add_005_pos.ksh +++ b/tests/sys/cddl/zfs/tests/cli_root/zpool_add/zpool_add_005_pos.ksh @@ -61,6 +61,8 @@ verify_runnable "global" +set_disks + function cleanup { poolexists "$TESTPOOL" && \ @@ -68,11 +70,7 @@ function cleanup poolexists "$TESTPOOL1" && \ destroy_pool "$TESTPOOL1" - if [[ -n $saved_dump_dev ]]; then - log_must eval "$DUMPADM -u -d $saved_dump_dev > /dev/null" - fi - - partition_cleanup + $DUMPON -r $dump_dev } log_assert "'zpool add' should fail with inapplicable scenarios." @@ -81,22 +79,20 @@ log_onexit cleanup mnttab_dev=$(find_mnttab_dev) vfstab_dev=$(find_vfstab_dev) -saved_dump_dev=$(save_dump_dev) -dump_dev=${disk}p3 +dump_dev=${DISK2} -create_pool "$TESTPOOL" "${disk}p1" +create_pool "$TESTPOOL" "${DISK0}" log_must poolexists "$TESTPOOL" -create_pool "$TESTPOOL1" "${disk}p2" +create_pool "$TESTPOOL1" "${DISK1}" log_must poolexists "$TESTPOOL1" -log_mustnot $ZPOOL add -f "$TESTPOOL" ${disk}p2 +log_mustnot $ZPOOL add -f "$TESTPOOL" ${DISK1} log_mustnot $ZPOOL add -f "$TESTPOOL" $mnttab_dev log_mustnot $ZPOOL add -f "$TESTPOOL" $vfstab_dev -log_must $ECHO "y" | $NEWFS /dev/$dump_dev > /dev/null 2>&1 -log_must $DUMPADM -u -d /dev/$dump_dev > /dev/null +log_must $DUMPON $dump_dev log_mustnot $ZPOOL add -f "$TESTPOOL" $dump_dev log_pass "'zpool add' should fail with inapplicable scenarios." diff --git a/tests/sys/cddl/zfs/tests/cli_root/zpool_add/zpool_add_006_pos.ksh b/tests/sys/cddl/zfs/tests/cli_root/zpool_add/zpool_add_006_pos.ksh index decdc01af2c..bf43cc28747 100644 --- a/tests/sys/cddl/zfs/tests/cli_root/zpool_add/zpool_add_006_pos.ksh +++ b/tests/sys/cddl/zfs/tests/cli_root/zpool_add/zpool_add_006_pos.ksh @@ -66,16 +66,12 @@ function cleanup poolexists $TESTPOOL1 && \ destroy_pool $TESTPOOL1 - datasetexists $TESTPOOL/$TESTFS && \ - log_must $ZFS destroy -f $TESTPOOL/$TESTFS poolexists $TESTPOOL && \ destroy_pool $TESTPOOL if [[ -d $TESTDIR ]]; then log_must $RM -rf $TESTDIR fi - - partition_cleanup } @@ -101,7 +97,6 @@ function setup_vdevs # # Minus $largest_num/20 to leave 5% space for metadata. (( vdevs_num=largest_num - largest_num/20 )) file_size=64 - vdev=$disk else vdevs_num=$VDEVS_NUM (( file_size = fs_size / (1024 * 1024 * (vdevs_num + vdevs_num/20)) )) @@ -112,8 +107,8 @@ function setup_vdevs # (( slice_size = file_size * (vdevs_num + vdevs_num/20) )) wipe_partition_table $disk set_partition 0 "" ${slice_size}m $disk - vdev=${disk}p1 fi + vdev=${disk} create_pool $TESTPOOL $vdev [[ -d $TESTDIR ]] && \ @@ -143,17 +138,11 @@ log_assert " 'zpool add [-f]' can add large numbers of vdevs to the specified" \ " pool without any errors." log_onexit cleanup -if [[ $DISK_ARRAY_NUM == 0 ]]; then - disk=$DISK -else - disk=$DISK0 -fi - vdevs_list="" vdevs_num=$VDEVS_NUM file_size=$FILE_SIZE -setup_vdevs $disk +setup_vdevs $DISK0 log_must $ZPOOL add -f "$TESTPOOL1" $vdevs_list log_must iscontained "$TESTPOOL1" "$vdevs_list" diff --git a/tests/sys/cddl/zfs/tests/cli_root/zpool_add/zpool_add_007_neg.ksh b/tests/sys/cddl/zfs/tests/cli_root/zpool_add/zpool_add_007_neg.ksh index ba2baddd7d9..d2255b806a0 100644 --- a/tests/sys/cddl/zfs/tests/cli_root/zpool_add/zpool_add_007_neg.ksh +++ b/tests/sys/cddl/zfs/tests/cli_root/zpool_add/zpool_add_007_neg.ksh @@ -57,22 +57,14 @@ verify_runnable "global" -function cleanup -{ - poolexists "$TESTPOOL" && \ - destroy_pool "$TESTPOOL" - - partition_cleanup -} +set_disks log_assert "'zpool add' should return an error with badly-formed parameters." -log_onexit cleanup - set -A args "" "-f" "-n" "-?" "-nf" "-fn" "-f -n" "--f" "-blah" \ - "-? $TESTPOOL ${disk}p2" + "-? $TESTPOOL ${DISK1}" -create_pool "$TESTPOOL" "${disk}p1" +create_pool "$TESTPOOL" "${DISK0}" log_must poolexists "$TESTPOOL" typeset -i i=0 diff --git a/tests/sys/cddl/zfs/tests/cli_root/zpool_add/zpool_add_008_neg.ksh b/tests/sys/cddl/zfs/tests/cli_root/zpool_add/zpool_add_008_neg.ksh index 39ebeeb665b..3997e2606a3 100644 --- a/tests/sys/cddl/zfs/tests/cli_root/zpool_add/zpool_add_008_neg.ksh +++ b/tests/sys/cddl/zfs/tests/cli_root/zpool_add/zpool_add_008_neg.ksh @@ -57,23 +57,12 @@ verify_runnable "global" -function cleanup -{ - - poolexists "$TESTPOOL" && \ - destroy_pool "$TESTPOOL" - - partition_cleanup -} - log_assert "'zpool add' should return an error with nonexistent pools and vdevs" -log_onexit cleanup - -set -A args "" "-f nonexistent_pool ${disk}p2" \ +set -A args "" "-f nonexistent_pool ${DISK1}" \ "-f $TESTPOOL nonexistent_vdev" -create_pool "$TESTPOOL" "${disk}p1" +create_pool "$TESTPOOL" "${DISK0}" log_must poolexists "$TESTPOOL" typeset -i i=0 diff --git a/tests/sys/cddl/zfs/tests/cli_root/zpool_add/zpool_add_009_neg.ksh b/tests/sys/cddl/zfs/tests/cli_root/zpool_add/zpool_add_009_neg.ksh index f0854ed7a41..afe83f7bf70 100644 --- a/tests/sys/cddl/zfs/tests/cli_root/zpool_add/zpool_add_009_neg.ksh +++ b/tests/sys/cddl/zfs/tests/cli_root/zpool_add/zpool_add_009_neg.ksh @@ -58,26 +58,14 @@ verify_runnable "global" -function cleanup -{ - - poolexists "$TESTPOOL" && \ - destroy_pool "$TESTPOOL" - - partition_cleanup - -} - log_assert "'zpool add' should fail if vdevs are the same or vdev is " \ "contained in the given pool." -log_onexit cleanup - -create_pool "$TESTPOOL" "${disk}p1" +create_pool "$TESTPOOL" "${DISK1}" log_must poolexists "$TESTPOOL" -log_mustnot $ZPOOL add -f "$TESTPOOL" ${disk}p2 ${disk}p2 -log_mustnot $ZPOOL add -f "$TESTPOOL" ${disk}p1 +log_mustnot $ZPOOL add -f "$TESTPOOL" ${DISK0} ${DISK0} +log_mustnot $ZPOOL add -f "$TESTPOOL" ${DISK1} log_pass "'zpool add' get fail as expected if vdevs are the same or vdev is " \ "contained in the given pool." diff --git a/tests/sys/cddl/zfs/tests/cli_root/zpool_add/zpool_add_010_pos.ksh b/tests/sys/cddl/zfs/tests/cli_root/zpool_add/zpool_add_010_pos.ksh index 3578340bfca..24a26bc2f89 100644 --- a/tests/sys/cddl/zfs/tests/cli_root/zpool_add/zpool_add_010_pos.ksh +++ b/tests/sys/cddl/zfs/tests/cli_root/zpool_add/zpool_add_010_pos.ksh @@ -31,25 +31,15 @@ verify_runnable "global" -function cleanup -{ - poolexists $TESTPOOL && \ - destroy_pool $TESTPOOL - - partition_cleanup -} - log_assert "'zpool add' can add devices, even if a replacing vdev with a spare child is present" -log_onexit cleanup - create_pool $TESTPOOL mirror ${DISK0} ${DISK1} # A replacing vdev will automatically detach the older member when resilvering # is complete. We don't want that to happen during this test, so write some # data just to slow down resilvering. $TIMEOUT 60s $DD if=/dev/zero of=/$TESTPOOL/zerofile bs=128k -log_must $ZPOOL replace $TESTPOOL ${DISK0} ${DISK2} log_must $ZPOOL add $TESTPOOL spare ${DISK3} +log_must $ZPOOL replace $TESTPOOL ${DISK0} ${DISK2} log_must $ZPOOL replace $TESTPOOL ${DISK0} ${DISK3} log_must $ZPOOL add $TESTPOOL spare ${DISK4} diff --git a/tests/sys/cddl/zfs/tests/cli_root/zpool_add/zpool_add_test.sh b/tests/sys/cddl/zfs/tests/cli_root/zpool_add/zpool_add_test.sh index 83c422047f4..ea49c928dc4 100755 --- a/tests/sys/cddl/zfs/tests/cli_root/zpool_add/zpool_add_test.sh +++ b/tests/sys/cddl/zfs/tests/cli_root/zpool_add/zpool_add_test.sh @@ -39,7 +39,7 @@ zpool_add_001_pos_body() . $(atf_get_srcdir)/zpool_add.kshlib . $(atf_get_srcdir)/zpool_add.cfg - verify_disk_count "$DISKS" 2 + verify_disk_count "$DISKS" 5 ksh93 $(atf_get_srcdir)/setup.ksh || atf_fail "Setup failed" ksh93 $(atf_get_srcdir)/zpool_add_001_pos.ksh || atf_fail "Testcase failed" } @@ -66,7 +66,7 @@ zpool_add_002_pos_body() . $(atf_get_srcdir)/zpool_add.kshlib . $(atf_get_srcdir)/zpool_add.cfg - verify_disk_count "$DISKS" 1 + verify_disk_count "$DISKS" 3 ksh93 $(atf_get_srcdir)/setup.ksh || atf_fail "Setup failed" ksh93 $(atf_get_srcdir)/zpool_add_002_pos.ksh || atf_fail "Testcase failed" } @@ -93,7 +93,7 @@ zpool_add_003_pos_body() . $(atf_get_srcdir)/zpool_add.kshlib . $(atf_get_srcdir)/zpool_add.cfg - verify_disk_count "$DISKS" 1 + verify_disk_count "$DISKS" 2 ksh93 $(atf_get_srcdir)/setup.ksh || atf_fail "Setup failed" ksh93 $(atf_get_srcdir)/zpool_add_003_pos.ksh || atf_fail "Testcase failed" } @@ -120,6 +120,7 @@ zpool_add_004_pos_body() . $(atf_get_srcdir)/zpool_add.kshlib . $(atf_get_srcdir)/zpool_add.cfg + verify_disk_count "$DISKS" 2 verify_zvol_recursive ksh93 $(atf_get_srcdir)/setup.ksh || atf_fail "Setup failed" ksh93 $(atf_get_srcdir)/zpool_add_004_pos.ksh || atf_fail "Testcase failed" @@ -138,7 +139,7 @@ atf_test_case zpool_add_005_pos cleanup zpool_add_005_pos_head() { atf_set "descr" "'zpool add' should fail with inapplicable scenarios." - atf_set "require.progs" dumpadm zpool + atf_set "require.progs" zpool atf_set "timeout" 2400 } zpool_add_005_pos_body() @@ -147,8 +148,8 @@ zpool_add_005_pos_body() . $(atf_get_srcdir)/zpool_add.kshlib . $(atf_get_srcdir)/zpool_add.cfg - verify_disk_count "$DISKS" 1 - verify_disk_count "$DISKS" 1 + verify_disk_count "$DISKS" 3 + atf_expect_fail "PR 241070 dumpon opens geom devices non-exclusively" ksh93 $(atf_get_srcdir)/setup.ksh || atf_fail "Setup failed" ksh93 $(atf_get_srcdir)/zpool_add_005_pos.ksh || atf_fail "Testcase failed" } @@ -175,7 +176,7 @@ zpool_add_006_pos_body() . $(atf_get_srcdir)/zpool_add.kshlib . $(atf_get_srcdir)/zpool_add.cfg - verify_disk_count "$DISKS" 2 + verify_disk_count "$DISKS" 1 ksh93 $(atf_get_srcdir)/setup.ksh || atf_fail "Setup failed" ksh93 $(atf_get_srcdir)/zpool_add_006_pos.ksh || atf_fail "Testcase failed" } @@ -202,7 +203,7 @@ zpool_add_007_neg_body() . $(atf_get_srcdir)/zpool_add.kshlib . $(atf_get_srcdir)/zpool_add.cfg - verify_disk_count "$DISKS" 1 + verify_disk_count "$DISKS" 2 ksh93 $(atf_get_srcdir)/setup.ksh || atf_fail "Setup failed" ksh93 $(atf_get_srcdir)/zpool_add_007_neg.ksh || atf_fail "Testcase failed" } @@ -229,7 +230,7 @@ zpool_add_008_neg_body() . $(atf_get_srcdir)/zpool_add.kshlib . $(atf_get_srcdir)/zpool_add.cfg - verify_disk_count "$DISKS" 1 + verify_disk_count "$DISKS" 2 ksh93 $(atf_get_srcdir)/setup.ksh || atf_fail "Setup failed" ksh93 $(atf_get_srcdir)/zpool_add_008_neg.ksh || atf_fail "Testcase failed" } @@ -256,7 +257,7 @@ zpool_add_009_neg_body() . $(atf_get_srcdir)/zpool_add.kshlib . $(atf_get_srcdir)/zpool_add.cfg - verify_disk_count "$DISKS" 1 + verify_disk_count "$DISKS" 2 ksh93 $(atf_get_srcdir)/setup.ksh || atf_fail "Setup failed" ksh93 $(atf_get_srcdir)/zpool_add_009_neg.ksh || atf_fail "Testcase failed" } diff --git a/tests/sys/cddl/zfs/tests/cli_root/zpool_create/Makefile b/tests/sys/cddl/zfs/tests/cli_root/zpool_create/Makefile index c6d23dae265..7e8db013296 100644 --- a/tests/sys/cddl/zfs/tests/cli_root/zpool_create/Makefile +++ b/tests/sys/cddl/zfs/tests/cli_root/zpool_create/Makefile @@ -13,8 +13,6 @@ TEST_METADATA+= is_exclusive=true ${PACKAGE}FILES+= zpool_create_003_pos.ksh ${PACKAGE}FILES+= zpool_create_020_pos.ksh ${PACKAGE}FILES+= zpool_create_017_neg.ksh -${PACKAGE}FILES+= zpool_create_013_neg.ksh -${PACKAGE}FILES+= zpool_create_016_pos.ksh ${PACKAGE}FILES+= zpool_create_012_neg.ksh ${PACKAGE}FILES+= zpool_create_006_pos.ksh ${PACKAGE}FILES+= zpool_create_002_pos.ksh @@ -22,7 +20,6 @@ ${PACKAGE}FILES+= zpool_create_021_pos.ksh ${PACKAGE}FILES+= zpool_create_007_neg.ksh ${PACKAGE}FILES+= setup.ksh ${PACKAGE}FILES+= cleanup.ksh -${PACKAGE}FILES+= zpool_create_014_neg.ksh ${PACKAGE}FILES+= zpool_create_010_neg.ksh ${PACKAGE}FILES+= zpool_create_019_pos.ksh ${PACKAGE}FILES+= zpool_create_008_pos.ksh diff --git a/tests/sys/cddl/zfs/tests/cli_root/zpool_create/zpool_create.kshlib b/tests/sys/cddl/zfs/tests/cli_root/zpool_create/zpool_create.kshlib index 864039b2c0f..37fd6dab977 100644 --- a/tests/sys/cddl/zfs/tests/cli_root/zpool_create/zpool_create.kshlib +++ b/tests/sys/cddl/zfs/tests/cli_root/zpool_create/zpool_create.kshlib @@ -96,36 +96,22 @@ function clean_blockfile # # Find the storage device in /etc/vfstab # -function find_vfstab_dev +function find_fstab_dev { - typeset vfstab="/etc/vfstab" - typeset tmpfile="$TMPDIR/vfstab.tmp" - typeset vfstabdev - typeset vfstabdevs="" + typeset fstab="/etc/fstab" + typeset tmpfile="$TMPDIR/fstab.tmp" + typeset fstabdev + typeset fstabdevs="" typeset line - $CAT $vfstab | $GREP "^/dev" >$tmpfile + $CAT $fstab | $GREP "^/dev" >$tmpfile while read -r line do - vfstabdev=`$ECHO "$line" | $AWK '{print $1}'` - vfstabdev=${vfstabdev%%:} - vfstabdevs="$vfstabdev $vfstabdevs" + fstabdev=`$ECHO "$line" | $AWK '{print $1}'` + fstabdev=${fstabdev%%:} + fstabdevs="$fstabdev $fstabdevs" done <$tmpfile $RM -f $tmpfile - $ECHO $vfstabdevs + $ECHO $fstabdevs } - -# -# Save the systme current dump device configuration -# -function save_dump_dev -{ - - typeset dumpdev - typeset fnd="Dump device" - - dumpdev=`$DUMPADM | $GREP "$fnd" | $CUT -f2 -d : | \ - $AWK '{print $1}'` - $ECHO $dumpdev -} diff --git a/tests/sys/cddl/zfs/tests/cli_root/zpool_create/zpool_create_008_pos.ksh b/tests/sys/cddl/zfs/tests/cli_root/zpool_create/zpool_create_008_pos.ksh index de98816e202..ae1b62a0d66 100644 --- a/tests/sys/cddl/zfs/tests/cli_root/zpool_create/zpool_create_008_pos.ksh +++ b/tests/sys/cddl/zfs/tests/cli_root/zpool_create/zpool_create_008_pos.ksh @@ -57,70 +57,7 @@ verify_runnable "global" -function cleanup -{ - if [[ $exported_pool == true ]]; then - if [[ $force_pool == true ]]; then - log_must $ZPOOL create -f $TESTPOOL ${disk}p1 - else - log_must $ZPOOL import $TESTPOOL - fi - fi - - if poolexists $TESTPOOL ; then - destroy_pool $TESTPOOL - fi - - if poolexists $TESTPOOL1 ; then - destroy_pool $TESTPOOL1 - fi - - # - # recover it back to EFI label - # - wipe_partition_table $disk -} - -# -# create overlap slice 0 and 1 on $disk -# -function create_overlap_slice -{ - typeset format_file=$TMPDIR/format_overlap.${TESTCASE_ID} - typeset disk=$1 - - $ECHO "partition" >$format_file - $ECHO "0" >> $format_file - $ECHO "" >> $format_file - $ECHO "" >> $format_file - $ECHO "0" >> $format_file - $ECHO "200m" >> $format_file - $ECHO "1" >> $format_file - $ECHO "" >> $format_file - $ECHO "" >> $format_file - $ECHO "0" >> $format_file - $ECHO "400m" >> $format_file - $ECHO "label" >> $format_file - $ECHO "" >> $format_file - $ECHO "q" >> $format_file - $ECHO "q" >> $format_file - - $FORMAT -e -s -d $disk -f $format_file - typeset -i ret=$? - $RM -fr $format_file - - if (( ret != 0 )); then - log_fail "unable to create overlap slice." - fi - - return 0 -} - log_assert "'zpool create' have to use '-f' scenarios" -log_onexit cleanup - -typeset exported_pool=false -typeset force_pool=false if [[ -n $DISK ]]; then disk=$DISK @@ -128,31 +65,16 @@ else disk=$DISK0 fi -# overlapped slices as vdev need -f to create pool - # Make the disk is EFI labeled first via pool creation create_pool $TESTPOOL $disk destroy_pool $TESTPOOL -# Make the disk is VTOC labeled since only VTOC label supports overlap -log_must labelvtoc $disk -log_must create_overlap_slice $disk - -log_mustnot $ZPOOL create $TESTPOOL ${disk}p1 -log_must $ZPOOL create -f $TESTPOOL ${disk}p1 -destroy_pool $TESTPOOL - # exported device to be as spare vdev need -f to create pool - -log_must $ZPOOL create -f $TESTPOOL $disk -destroy_pool $TESTPOOL log_must partition_disk $SIZE $disk 6 create_pool $TESTPOOL ${disk}p1 ${disk}p2 log_must $ZPOOL export $TESTPOOL -exported_pool=true log_mustnot $ZPOOL create $TESTPOOL1 ${disk}p3 spare ${disk}p2 create_pool $TESTPOOL1 ${disk}p3 spare ${disk}p2 -force_pool=true destroy_pool $TESTPOOL1 log_pass "'zpool create' have to use '-f' scenarios" diff --git a/tests/sys/cddl/zfs/tests/cli_root/zpool_create/zpool_create_011_neg.ksh b/tests/sys/cddl/zfs/tests/cli_root/zpool_create/zpool_create_011_neg.ksh index 214d9e74f18..afd27320cb1 100644 --- a/tests/sys/cddl/zfs/tests/cli_root/zpool_create/zpool_create_011_neg.ksh +++ b/tests/sys/cddl/zfs/tests/cli_root/zpool_create/zpool_create_011_neg.ksh @@ -41,7 +41,7 @@ # 'zpool create' will fail in the following cases: # existent pool; device is part of an active pool; nested virtual devices; # differently sized devices without -f option; device being currently -# mounted; devices in /etc/vfstab; specified as the dedicated dump device. +# mounted; devices in /etc/fstab; specified as the dedicated dump device. # # STRATEGY: # 1. Create case scenarios @@ -67,8 +67,8 @@ function cleanup destroy_pool $pool done - if [[ -n $saved_dump_dev ]]; then - log_must $DUMPADM -u -d $saved_dump_dev + if [[ -n $specified_dump_dev ]]; then + $DUMPON -r $specified_dump_dev fi } @@ -87,11 +87,11 @@ mirror2="${disk}p4 ${disk}p5" raidz1=$mirror1 raidz2=$mirror2 diff_size_dev="${disk}p6 ${disk}p7" -vfstab_dev=$(find_vfstab_dev) -specified_dump_dev=${disk}p1 -saved_dump_dev=$(save_dump_dev) +fstab_dev=$(find_fstab_dev) +specified_dump_dev=${disk} lba=$(get_partition_end $disk 6) +$GPART delete -i 7 $disk set_partition 7 "$lba" $SIZE1 $disk create_pool "$TESTPOOL" "$pooldev1" @@ -112,7 +112,7 @@ set -A arg "$TESTPOOL $pooldev2" \ "$TESTPOOL1 raidz $diff_size_dev" \ "$TESTPOOL1 raidz1 $diff_size_dev" \ "$TESTPOOL1 mirror $mirror1 spare $mirror2 spare $diff_size_dev" \ - "$TESTPOOL1 $vfstab_dev" \ + "$TESTPOOL1 $fstab_dev" \ "$TESTPOOL1 ${disk}s10" \ "$TESTPOOL1 spare $pooldev2" @@ -130,7 +130,7 @@ log_must $ZPOOL destroy -f $TESTPOOL log_must $ZPOOL create -f $TESTPOOL3 $disk log_must $ZPOOL destroy -f $TESTPOOL3 -log_must $DUMPADM -d /dev/$specified_dump_dev +log_must dumpon $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/sys/cddl/zfs/tests/cli_root/zpool_create/zpool_create_012_neg.ksh b/tests/sys/cddl/zfs/tests/cli_root/zpool_create/zpool_create_012_neg.ksh index 345437ba3e2..799cf9e861e 100644 --- a/tests/sys/cddl/zfs/tests/cli_root/zpool_create/zpool_create_012_neg.ksh +++ b/tests/sys/cddl/zfs/tests/cli_root/zpool_create/zpool_create_012_neg.ksh @@ -38,13 +38,12 @@ # # # DESCRIPTION: -# 'zpool create' will fail with formal disk slice in swap +# 'zpool create' will fail with disk in swap # # # STRATEGY: -# 1. Get all the disk devices in swap -# 2. For each device, try to create a new pool with this device -# 3. Verify the creation is failed. +# 1. Add a disk to swap +# 2. Try to create a pool on that disk. It should fail. # # TESTABILITY: explicit # @@ -60,21 +59,14 @@ verify_runnable "global" function cleanup { - if poolexists $TESTPOOL; then - destroy_pool $TESTPOOL - fi + $SWAPOFF $DISK0 } -typeset swap_disks=`$SWAP -l | $GREP "c[0-9].*d[0-9].*s[0-9]" | \ - $AWK '{print $1}'` -log_assert "'zpool create' should fail with disk slice in swap." +log_assert "'zpool create' should fail with disk in swap." log_onexit cleanup -for sdisk in $swap_disks; do - for opt in "-n" "" "-f"; do - log_mustnot $ZPOOL create $opt $TESTPOOL $sdisk - done -done +log_must $SWAPON $DISK0 +log_mustnot $ZPOOL create $TESTPOOL $DISK0 -log_pass "'zpool create' passed as expected with inapplicable scenario." +log_pass "'zpool create' cannot use a swap disk" diff --git a/tests/sys/cddl/zfs/tests/cli_root/zpool_create/zpool_create_013_neg.ksh b/tests/sys/cddl/zfs/tests/cli_root/zpool_create/zpool_create_013_neg.ksh deleted file mode 100644 index 730a0213512..00000000000 --- a/tests/sys/cddl/zfs/tests/cli_root/zpool_create/zpool_create_013_neg.ksh +++ /dev/null @@ -1,116 +0,0 @@ -#!/usr/local/bin/ksh93 -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 -# - -# $FreeBSD$ - -# -# Copyright 2008 Sun Microsystems, Inc. All rights reserved. -# Use is subject to license terms. -# -#ident "@(#)zpool_create_013_neg.ksh 1.2 08/02/27 SMI" -# -. $STF_SUITE/include/libtest.kshlib - -################################################################################ -# -# __stc_assertion_start -# -# ID: zpool_create_013_neg -# -# -# DESCRIPTION: -# 'zpool create' will fail with metadevice in swap -# -# STRATEGY: -# 1. Create a one way strip metadevice -# 2. Try to create a new pool with metadevice in swap -# 3. Verify the creation is failed. -# -# TESTABILITY: explicit -# -# TEST_AUTOMATION_LEVEL: automated -# -# CODING_STATUS: COMPLETED (2007-04-17) -# -# __stc_assertion_end -# -################################################################################ - -verify_runnable "global" - -function cleanup -{ - # cleanup SVM - $METASTAT $md_name > /dev/null 2>&1 - if [[ $? -eq 0 ]]; then - $SWAP -l | $GREP /dev/md/$md_name > /dev/null 2>&1 - if [[ $? -eq 0 ]]; then - $SWAP -d /dev/md/$md_name - fi - $METACLEAR $md_name - fi - - $METADB | $GREP $mddb_dev > /dev/null 2>&1 - if [[ $? -eq 0 ]]; then - $METADB -df /dev/$mddb_dev - fi - - if poolexists $TESTPOOL; then - destroy_pool $TESTPOOL - fi - -} - -if [[ -n $DISK ]]; then - disk=$DISK -else - disk=$DISK0 -fi - -typeset mddb_dev=${disk}p1 -typeset md_dev=${disk}p2 -typeset md_name=d0 -typeset MD_DSK=/dev/md/d0 - -log_assert "'zpool create' should fail with metadevice in swap." -log_onexit cleanup - -# -# use metadevice in swap to create pool, which should fail. -# -$METADB | $GREP $mddb_dev > /dev/null 2>&1 -if [[ $? -ne 0 ]]; then - log_must $METADB -af $mddb_dev -fi - -$METASTAT $md_name > /dev/null 2>&1 -if [[ $? -eq 0 ]]; then - $METACLEAR $md_name -fi - -log_must $METAINIT $md_name 1 1 $md_dev -log_must $SWAP -a $MD_DSK -for opt in "-n" "" "-f"; do - log_mustnot $ZPOOL create $opt $TESTPOOL $MD_DSK -done - -log_pass "'zpool create' passed as expected with inapplicable scenario." diff --git a/tests/sys/cddl/zfs/tests/cli_root/zpool_create/zpool_create_014_neg.ksh b/tests/sys/cddl/zfs/tests/cli_root/zpool_create/zpool_create_014_neg.ksh deleted file mode 100644 index 12d80285683..00000000000 --- a/tests/sys/cddl/zfs/tests/cli_root/zpool_create/zpool_create_014_neg.ksh +++ /dev/null @@ -1,103 +0,0 @@ -#!/usr/local/bin/ksh93 -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 -# - -# $FreeBSD$ - -# -# Copyright 2009 Sun Microsystems, Inc. All rights reserved. -# Use is subject to license terms. -# -#ident "@(#)zpool_create_014_neg.ksh 1.3 09/06/22 SMI" -# -. $STF_SUITE/include/libtest.kshlib - -################################################################################ -# -# __stc_assertion_start -# -# ID: zpool_create_014_neg -# -# -# DESCRIPTION: -# 'zpool create' will fail with ordinary file in swap -# -# STRATEGY: -# 1. Create a regular file on top of UFS-zvol filesystem -# 2. Try to create a new pool with regular file in swap -# 3. Verify the creation is failed. -# -# TESTABILITY: explicit -# -# TEST_AUTOMATION_LEVEL: automated -# -# CODING_STATUS: COMPLETED (2007-04-17) -# -# __stc_assertion_end -# -################################################################################ - -verify_runnable "global" - -function cleanup -{ - if datasetexists $vol_name; then - $SWAP -l | $GREP $TMP_FILE > /dev/null 2>&1 - if [[ $? -eq 0 ]]; then - log_must $SWAP -d $TMP_FILE - fi - $RM -f $TMP_FILE - log_must $UMOUNT $mntp - $ZFS destroy $vol_name - fi - - if poolexists $TESTPOOL; then - destroy_pool $TESTPOOL - fi -} - -log_assert "'zpool create' should fail with regular file in swap." -log_onexit cleanup - -if [[ -n $DISK ]]; then - disk=$DISK -else - disk=$DISK0 -fi - -typeset pool_dev=${disk}p1 -typeset vol_name=$TESTPOOL/$TESTVOL -typeset mntp=$TMPDIR -typeset TMP_FILE=$mntp/tmpfile.${TESTCASE_ID} - -create_pool $TESTPOOL $pool_dev -log_must $ZFS create -V 100m $vol_name -log_must $ECHO "y" | $NEWFS /dev/zvol/$vol_name > /dev/null 2>&1 -log_must $MOUNT /dev/zvol/$vol_name $mntp - -log_must $MKFILE 50m $TMP_FILE -log_must $SWAP -a $TMP_FILE - -for opt in "-n" "" "-f"; do - log_mustnot $ZPOOL create $opt $TESTPOOL $TMP_FILE -done - -log_pass "'zpool create' passed as expected with inapplicable scenario." diff --git a/tests/sys/cddl/zfs/tests/cli_root/zpool_create/zpool_create_015_neg.ksh b/tests/sys/cddl/zfs/tests/cli_root/zpool_create/zpool_create_015_neg.ksh index b463b381151..fdef2b371ce 100644 --- a/tests/sys/cddl/zfs/tests/cli_root/zpool_create/zpool_create_015_neg.ksh +++ b/tests/sys/cddl/zfs/tests/cli_root/zpool_create/zpool_create_015_neg.ksh @@ -62,16 +62,7 @@ verify_runnable "global" function cleanup { - # cleanup zfs pool and dataset - if datasetexists $vol_name; then - $SWAP -l | $GREP /dev/zvol/$vol_name > /dev/null 2>&1 - if [[ $? -eq 0 ]]; then - $SWAP -d /dev/zvol/${vol_name} - fi - fi - - destroy_pool $TESTPOOL1 - destroy_pool $TESTPOOL + $SWAPOFF /dev/zvol/${vol_name} } if [[ -n $DISK ]]; then @@ -80,7 +71,7 @@ else disk=$DISK0 fi -typeset pool_dev=${disk}p1 +typeset pool_dev=${disk} typeset vol_name=$TESTPOOL/$TESTVOL log_assert "'zpool create' should fail with zfs vol device in swap." @@ -91,13 +82,9 @@ log_onexit cleanup # create_pool $TESTPOOL $pool_dev log_must $ZFS create -V 100m $vol_name -log_must $SWAP -a /dev/zvol/$vol_name -for opt in "-n" "" "-f"; do +log_must $SWAPON /dev/zvol/$vol_name +for opt in "" "-f"; do log_mustnot $ZPOOL create $opt $TESTPOOL1 /dev/zvol/${vol_name} done -# cleanup -log_must $SWAP -d /dev/zvol/${vol_name} -log_must $ZFS destroy $vol_name - log_pass "'zpool create' passed as expected with inapplicable scenario." diff --git a/tests/sys/cddl/zfs/tests/cli_root/zpool_create/zpool_create_016_pos.ksh b/tests/sys/cddl/zfs/tests/cli_root/zpool_create/zpool_create_016_pos.ksh deleted file mode 100644 index 0f96a96f4c3..00000000000 --- a/tests/sys/cddl/zfs/tests/cli_root/zpool_create/zpool_create_016_pos.ksh +++ /dev/null @@ -1,100 +0,0 @@ -#!/usr/local/bin/ksh93 -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 -# - -# $FreeBSD$ - -# -# Copyright 2008 Sun Microsystems, Inc. All rights reserved. -# Use is subject to license terms. -# -# ident "@(#)zpool_create_016_pos.ksh 1.2 08/08/15 SMI" -# -. $STF_SUITE/include/libtest.kshlib - -################################################################################ -# -# __stc_assertion_start -# -# ID: zpool_create_016_pos -# -# -# DESCRIPTION: -# 'zpool create' will success with no device in swap -# -# -# STRATEGY: -# 1. delete all devices in the swap -# 2. create a zpool -# 3. Verify the creation is successed. -# -# TESTABILITY: explicit -# -# TEST_AUTOMATION_LEVEL: automated -# -# CODING_STATUS: COMPLETED (2007-04-17) -# -# __stc_assertion_end -# -################################################################################ - -verify_runnable "global" - -function cleanup -{ - destroy_pool $TESTPOOL - - #recover swap devices - FSTAB=$TMPDIR/fstab_${TESTCASE_ID} - $RM -f $FSTAB - for sdisk in $swap_disks; do - $ECHO "$sdisk - - swap - no -" >> $FSTAB - done - if [ -e $FSTAB ] - then - log_must $SWAPADD $FSTAB - fi - $RM -f $FSTAB - if [ $dump_device != "none" ] - then - log_must $DUMPADM -u -d $dump_device - fi -} - -if [[ -n $DISK ]]; then - disk=$DISK -else - disk=$DISK0 -fi -typeset pool_dev=${disk}p1 -typeset swap_disks=`$SWAP -l | $GREP -v "swapfile" | $AWK '{print $1}'` -typeset dump_device=`$DUMPADM | $GREP "Dump device" | $AWK '{print $3}'` - -log_assert "'zpool create' should success with no device in swap." -log_onexit cleanup - -for sdisk in $swap_disks; do - log_must $SWAP -d $sdisk -done - -log_must $ZPOOL create $TESTPOOL $pool_dev - -log_pass "'zpool create' passed as expected with applicable scenario." diff --git a/tests/sys/cddl/zfs/tests/cli_root/zpool_create/zpool_create_test.sh b/tests/sys/cddl/zfs/tests/cli_root/zpool_create/zpool_create_test.sh index 068942dc472..67a6ae69229 100755 --- a/tests/sys/cddl/zfs/tests/cli_root/zpool_create/zpool_create_test.sh +++ b/tests/sys/cddl/zfs/tests/cli_root/zpool_create/zpool_create_test.sh @@ -219,7 +219,7 @@ atf_test_case zpool_create_008_pos cleanup zpool_create_008_pos_head() { atf_set "descr" "'zpool create' have to use '-f' scenarios" - atf_set "require.progs" zpool format + atf_set "require.progs" zpool atf_set "timeout" 2400 } zpool_create_008_pos_body() @@ -300,7 +300,7 @@ atf_test_case zpool_create_011_neg cleanup zpool_create_011_neg_head() { atf_set "descr" "'zpool create' should be failed with inapplicable scenarios." - atf_set "require.progs" dumpadm zpool + atf_set "require.progs" zpool atf_set "timeout" 2400 } zpool_create_011_neg_body() @@ -310,6 +310,7 @@ zpool_create_011_neg_body() . $(atf_get_srcdir)/zpool_create.cfg verify_disk_count "$DISKS" 1 + atf_expect_fail "PR 241070 dumpon opens geom devices non-exclusively" ksh93 $(atf_get_srcdir)/setup.ksh || atf_fail "Setup failed" ksh93 $(atf_get_srcdir)/zpool_create_011_neg.ksh || atf_fail "Testcase failed" } @@ -323,12 +324,11 @@ zpool_create_011_neg_cleanup() } -atf_test_case zpool_create_012_neg cleanup +atf_test_case zpool_create_012_neg zpool_create_012_neg_head() { atf_set "descr" "'zpool create' should fail with disk slice in swap." - atf_set "require.progs" zpool swap - atf_set "timeout" 2400 + atf_set "require.progs" zpool } zpool_create_012_neg_body() { @@ -336,69 +336,8 @@ zpool_create_012_neg_body() . $(atf_get_srcdir)/zpool_create.kshlib . $(atf_get_srcdir)/zpool_create.cfg - ksh93 $(atf_get_srcdir)/setup.ksh || atf_fail "Setup failed" - ksh93 $(atf_get_srcdir)/zpool_create_012_neg.ksh || atf_fail "Testcase failed" -} -zpool_create_012_neg_cleanup() -{ - . $(atf_get_srcdir)/../../../include/default.cfg - . $(atf_get_srcdir)/zpool_create.kshlib - . $(atf_get_srcdir)/zpool_create.cfg - - ksh93 $(atf_get_srcdir)/cleanup.ksh || atf_fail "Cleanup failed" -} - - -atf_test_case zpool_create_013_neg cleanup -zpool_create_013_neg_head() -{ - atf_set "descr" "'zpool create' should fail with metadevice in swap." - atf_set "require.progs" metadb metaclear metastat zpool metainit swap - atf_set "timeout" 2400 -} -zpool_create_013_neg_body() -{ - . $(atf_get_srcdir)/../../../include/default.cfg - . $(atf_get_srcdir)/zpool_create.kshlib - . $(atf_get_srcdir)/zpool_create.cfg - - ksh93 $(atf_get_srcdir)/setup.ksh || atf_fail "Setup failed" - ksh93 $(atf_get_srcdir)/zpool_create_013_neg.ksh || atf_fail "Testcase failed" -} -zpool_create_013_neg_cleanup() -{ - . $(atf_get_srcdir)/../../../include/default.cfg - . $(atf_get_srcdir)/zpool_create.kshlib - . $(atf_get_srcdir)/zpool_create.cfg - - ksh93 $(atf_get_srcdir)/cleanup.ksh || atf_fail "Cleanup failed" -} - - -atf_test_case zpool_create_014_neg cleanup -zpool_create_014_neg_head() -{ - atf_set "descr" "'zpool create' should fail with regular file in swap." - atf_set "require.progs" zfs swap zpool - atf_set "timeout" 2400 -} -zpool_create_014_neg_body() -{ - . $(atf_get_srcdir)/../../../include/default.cfg - . $(atf_get_srcdir)/zpool_create.kshlib - . $(atf_get_srcdir)/zpool_create.cfg - verify_disk_count "$DISKS" 1 - ksh93 $(atf_get_srcdir)/setup.ksh || atf_fail "Setup failed" - ksh93 $(atf_get_srcdir)/zpool_create_014_neg.ksh || atf_fail "Testcase failed" -} -zpool_create_014_neg_cleanup() -{ - . $(atf_get_srcdir)/../../../include/default.cfg - . $(atf_get_srcdir)/zpool_create.kshlib - . $(atf_get_srcdir)/zpool_create.cfg - - ksh93 $(atf_get_srcdir)/cleanup.ksh || atf_fail "Cleanup failed" + ksh93 $(atf_get_srcdir)/zpool_create_012_neg.ksh || atf_fail "Testcase failed" } @@ -406,8 +345,7 @@ atf_test_case zpool_create_015_neg cleanup zpool_create_015_neg_head() { atf_set "descr" "'zpool create' should fail with zfs vol device in swap." - atf_set "require.progs" zfs zpool swap - atf_set "timeout" 2400 + atf_set "require.progs" zfs zpool } zpool_create_015_neg_body() { @@ -429,33 +367,6 @@ zpool_create_015_neg_cleanup() } -atf_test_case zpool_create_016_pos cleanup -zpool_create_016_pos_head() -{ - atf_set "descr" "'zpool create' should success with no device in swap." - atf_set "require.progs" dumpadm swapadd zpool swap - atf_set "timeout" 2400 -} -zpool_create_016_pos_body() -{ - . $(atf_get_srcdir)/../../../include/default.cfg - . $(atf_get_srcdir)/zpool_create.kshlib - . $(atf_get_srcdir)/zpool_create.cfg - - verify_disk_count "$DISKS" 1 - ksh93 $(atf_get_srcdir)/setup.ksh || atf_fail "Setup failed" - ksh93 $(atf_get_srcdir)/zpool_create_016_pos.ksh || atf_fail "Testcase failed" -} -zpool_create_016_pos_cleanup() -{ - . $(atf_get_srcdir)/../../../include/default.cfg - . $(atf_get_srcdir)/zpool_create.kshlib - . $(atf_get_srcdir)/zpool_create.cfg - - ksh93 $(atf_get_srcdir)/cleanup.ksh || atf_fail "Cleanup failed" -} - - atf_test_case zpool_create_017_neg cleanup zpool_create_017_neg_head() { @@ -663,10 +574,7 @@ atf_init_test_cases() atf_add_test_case zpool_create_010_neg atf_add_test_case zpool_create_011_neg atf_add_test_case zpool_create_012_neg - atf_add_test_case zpool_create_013_neg - atf_add_test_case zpool_create_014_neg atf_add_test_case zpool_create_015_neg - atf_add_test_case zpool_create_016_pos atf_add_test_case zpool_create_017_neg atf_add_test_case zpool_create_018_pos atf_add_test_case zpool_create_019_pos diff --git a/tests/sys/cddl/zfs/tests/cli_root/zpool_get/zpool_get.cfg b/tests/sys/cddl/zfs/tests/cli_root/zpool_get/zpool_get.cfg index 3501b74b58a..bd59846c09e 100644 --- a/tests/sys/cddl/zfs/tests/cli_root/zpool_get/zpool_get.cfg +++ b/tests/sys/cddl/zfs/tests/cli_root/zpool_get/zpool_get.cfg @@ -54,6 +54,7 @@ typeset -a properties=( "fragmentation" "leaked" "bootsize" + "checkpoint" "feature@async_destroy" "feature@empty_bpobj" "feature@lz4_compress" @@ -66,11 +67,14 @@ typeset -a properties=( "feature@bookmarks" "feature@filesystem_limits" "feature@large_blocks" + "feature@large_dnode" "feature@sha512" "feature@skein" # "feature@edonr" Edonr is not yet implemented on FreeBSD "feature@device_removal" "feature@obsolete_counts" + "feature@zpool_checkpoint" + "feature@spacemap_v2" ) export DISK=${DISKS%% *} diff --git a/tests/sys/cddl/zfs/tests/cli_root/zpool_get/zpool_get_002_pos.ksh b/tests/sys/cddl/zfs/tests/cli_root/zpool_get/zpool_get_002_pos.ksh index 8d79b54a5d7..0f9067686a8 100644 --- a/tests/sys/cddl/zfs/tests/cli_root/zpool_get/zpool_get_002_pos.ksh +++ b/tests/sys/cddl/zfs/tests/cli_root/zpool_get/zpool_get_002_pos.ksh @@ -96,10 +96,10 @@ done # increment the counter to include the header line i=$(( $i + 1 )) -COUNT=$($WC $TMPDIR/values.${TESTCASE_ID} | $AWK '{print $1}') +COUNT=$($WC $TMPDIR/values.${TESTCASE_ID}) if [ $i -ne $COUNT ] then - log_fail "Length of output $COUNT was not equal to number of props + 1." + log_fail "Length of output $COUNT was not equal to number of props + 1 ($i)." fi diff --git a/tests/sys/cddl/zfs/tests/cli_root/zpool_import/cleanup.ksh b/tests/sys/cddl/zfs/tests/cli_root/zpool_import/cleanup.ksh index c7da5449150..59249d5a637 100644 --- a/tests/sys/cddl/zfs/tests/cli_root/zpool_import/cleanup.ksh +++ b/tests/sys/cddl/zfs/tests/cli_root/zpool_import/cleanup.ksh @@ -39,24 +39,9 @@ for pool in "$TESTPOOL" "$TESTPOOL1"; do destroy_pool "$pool" done -ismounted $DEVICE_DIR ufs -(( $? == 0 )) && log_must $UMOUNT -f $DEVICE_DIR - for dir in "$TESTDIR" "$TESTDIR1" "$DEVICE_DIR" ; do [[ -d $dir ]] && \ log_must $RM -rf $dir done -# recreate and destroy a zpool over the disks to restore the partitions to -# normal -case $DISK_COUNT in -0|1) - log_note "No disk devices to restore" - ;; -*) - log_must cleanup_devices $ZFS_DISK1 - log_must cleanup_devices $ZFS_DISK2 - ;; -esac - log_pass diff --git a/tests/sys/cddl/zfs/tests/cli_root/zpool_import/setup.ksh b/tests/sys/cddl/zfs/tests/cli_root/zpool_import/setup.ksh index d179e99dfdc..eebbbec0c38 100644 --- a/tests/sys/cddl/zfs/tests/cli_root/zpool_import/setup.ksh +++ b/tests/sys/cddl/zfs/tests/cli_root/zpool_import/setup.ksh @@ -33,18 +33,7 @@ verify_runnable "global" -DISK=${DISKS%% *} - -for dev in $ZFS_DISK1 $ZFS_DISK2 ; do - log_must cleanup_devices $dev -done - -typeset -i i=0 -if [[ $DISK_COUNT -lt 2 ]]; then - partition_disk $PART_SIZE $ZFS_DISK1 $GROUP_NUM -fi - -create_pool "$TESTPOOL" "$ZFSSIDE_DISK1" +create_pool "$TESTPOOL" "$DISK0" if [[ -d $TESTDIR ]]; then $RM -rf $TESTDIR || log_unresolved Could not remove $TESTDIR @@ -54,22 +43,9 @@ fi log_must $ZFS create $TESTPOOL/$TESTFS log_must $ZFS set mountpoint=$TESTDIR $TESTPOOL/$TESTFS -# Limit the filesystem size to 32GiB; this should be sufficient. -(( MAXSECTS = 32 * 1024 * 1024 )) -NUMSECTS=`diskinfo ${ZFSSIDE_DISK2} | awk '{print $4}'` -if [[ $NUMSECTS -gt $MAXSECTS ]]; then - NUMSECTS=$MAXSECTS -fi - -$ECHO "y" | $NEWFS -s $NUMSECTS $ZFSSIDE_DISK2 >/dev/null 2>&1 -(( $? != 0 )) && - log_untested "Unable to setup a UFS file system" - [[ ! -d $DEVICE_DIR ]] && \ log_must $MKDIR -p $DEVICE_DIR -log_must $MOUNT $ZFSSIDE_DISK2 $DEVICE_DIR - i=0 while (( i < $MAX_NUM )); do log_must create_vdevs ${DEVICE_DIR}/${DEVICE_FILE}$i diff --git a/tests/sys/cddl/zfs/tests/cli_root/zpool_import/zpool_import.cfg b/tests/sys/cddl/zfs/tests/cli_root/zpool_import/zpool_import.cfg index 2847fdf840f..5ba9a6c8ac8 100644 --- a/tests/sys/cddl/zfs/tests/cli_root/zpool_import/zpool_import.cfg +++ b/tests/sys/cddl/zfs/tests/cli_root/zpool_import/zpool_import.cfg @@ -32,43 +32,17 @@ . $STF_SUITE/tests/cli_root/cli.cfg . $STF_SUITE/include/libtest.kshlib -set -A disk_array $(find_disks $DISKS) -case "${#disk_array[*]}" in -0) - # - # on stf_configure, disk_freelist returns empty. - # - DISK_COUNT=0 - ;; -1) - # We need to repartition the single disk to two slices. - DISK_COUNT=1 - ZFS_DISK1=${disk_array[0]} - ZFSSIDE_DISK1=${ZFS_DISK1}p1 - ZFS_DISK2=${disk_array[0]} - ZFSSIDE_DISK2=${ZFS_DISK2}p2 - ;; -*) - # We don't need to repartition anything - DISK_COUNT=2 - ZFS_DISK1=${disk_array[0]} - ZFSSIDE_DISK1=${ZFS_DISK1} - ZFS_DISK2=${disk_array[1]} - ZFSSIDE_DISK2=${ZFS_DISK2} - ;; -esac - -export DISK_COUNT ZFS_DISK1 ZFSSIDE_DISK1 ZFS_DISK2 ZFSSIDE_DISK2 +set_disks export FS_SIZE=2gb export FILE_SIZE=64m export PART_SIZE=128m export MAX_NUM=5 export GROUP_NUM=3 -export DEVICE_DIR=${TMPDIR}/dev${TESTCASE_ID} -export BACKUP_DEVICE_DIR=/bakdev${TESTCASE_ID} +export DEVICE_DIR=$(pwd)/dev +export BACKUP_DEVICE_DIR=$(pwd)/bakdev export DEVICE_FILE=disk -export DEVICE_ARCHIVE=${TMPDIR}/archive${TESTCASE_ID}.tar +export DEVICE_ARCHIVE=$(pwd)/archive${TESTCASE_ID}.tar # MYTESTFILE can be any file that exists and we have r access to export MYTESTFILE=$STF_SUITE/include/default.cfg diff --git a/tests/sys/cddl/zfs/tests/cli_root/zpool_import/zpool_import_all_001_pos.ksh b/tests/sys/cddl/zfs/tests/cli_root/zpool_import/zpool_import_all_001_pos.ksh index e1f4421c739..1f3707ee188 100644 --- a/tests/sys/cddl/zfs/tests/cli_root/zpool_import/zpool_import_all_001_pos.ksh +++ b/tests/sys/cddl/zfs/tests/cli_root/zpool_import/zpool_import_all_001_pos.ksh @@ -183,9 +183,9 @@ while (( number <= $GROUP_NUM )); do continue fi fi - set_partition $number "" $PART_SIZE ${ZFS_DISK2} + set_partition $number "" $PART_SIZE ${DISK1} - setup_single_disk "${ZFS_DISK2}p${number}" \ + setup_single_disk "${DISK1}p${number}" \ "${TESTPOOL}-$number" \ "$TESTFS" \ "$TESTDIR.$number" diff --git a/tests/sys/cddl/zfs/tests/cli_root/zpool_import/zpool_import_test.sh b/tests/sys/cddl/zfs/tests/cli_root/zpool_import/zpool_import_test.sh index 76e6728ee64..296a2222200 100755 --- a/tests/sys/cddl/zfs/tests/cli_root/zpool_import/zpool_import_test.sh +++ b/tests/sys/cddl/zfs/tests/cli_root/zpool_import/zpool_import_test.sh @@ -38,7 +38,7 @@ zpool_import_002_pos_body() . $(atf_get_srcdir)/../../../include/default.cfg . $(atf_get_srcdir)/zpool_import.cfg - verify_disk_count "$DISKS" 2 + verify_disk_count "$DISKS" 1 ksh93 $(atf_get_srcdir)/setup.ksh || atf_fail "Setup failed" ksh93 $(atf_get_srcdir)/zpool_import_002_pos.ksh || atf_fail "Testcase failed" } @@ -63,7 +63,7 @@ zpool_import_003_pos_body() . $(atf_get_srcdir)/../../../include/default.cfg . $(atf_get_srcdir)/zpool_import.cfg - verify_disk_count "$DISKS" 2 + verify_disk_count "$DISKS" 1 ksh93 $(atf_get_srcdir)/setup.ksh || atf_fail "Setup failed" ksh93 $(atf_get_srcdir)/zpool_import_003_pos.ksh || atf_fail "Testcase failed" } @@ -88,7 +88,7 @@ zpool_import_004_pos_body() . $(atf_get_srcdir)/../../../include/default.cfg . $(atf_get_srcdir)/zpool_import.cfg - verify_disk_count "$DISKS" 2 + verify_disk_count "$DISKS" 1 ksh93 $(atf_get_srcdir)/setup.ksh || atf_fail "Setup failed" ksh93 $(atf_get_srcdir)/zpool_import_004_pos.ksh || atf_fail "Testcase failed" } @@ -113,7 +113,7 @@ zpool_import_005_pos_body() . $(atf_get_srcdir)/../../../include/default.cfg . $(atf_get_srcdir)/zpool_import.cfg - verify_disk_count "$DISKS" 2 + verify_disk_count "$DISKS" 1 ksh93 $(atf_get_srcdir)/setup.ksh || atf_fail "Setup failed" ksh93 $(atf_get_srcdir)/zpool_import_005_pos.ksh || atf_fail "Testcase failed" } @@ -138,7 +138,7 @@ zpool_import_006_pos_body() . $(atf_get_srcdir)/../../../include/default.cfg . $(atf_get_srcdir)/zpool_import.cfg - verify_disk_count "$DISKS" 2 + verify_disk_count "$DISKS" 1 ksh93 $(atf_get_srcdir)/setup.ksh || atf_fail "Setup failed" ksh93 $(atf_get_srcdir)/zpool_import_006_pos.ksh || atf_fail "Testcase failed" } @@ -163,7 +163,7 @@ zpool_import_007_pos_body() . $(atf_get_srcdir)/../../../include/default.cfg . $(atf_get_srcdir)/zpool_import.cfg - verify_disk_count "$DISKS" 2 + verify_disk_count "$DISKS" 1 ksh93 $(atf_get_srcdir)/setup.ksh || atf_fail "Setup failed" ksh93 $(atf_get_srcdir)/zpool_import_007_pos.ksh || atf_fail "Testcase failed" } @@ -188,7 +188,7 @@ zpool_import_008_pos_body() . $(atf_get_srcdir)/../../../include/default.cfg . $(atf_get_srcdir)/zpool_import.cfg - verify_disk_count "$DISKS" 2 + verify_disk_count "$DISKS" 1 ksh93 $(atf_get_srcdir)/setup.ksh || atf_fail "Setup failed" ksh93 $(atf_get_srcdir)/zpool_import_008_pos.ksh || atf_fail "Testcase failed" } @@ -213,7 +213,7 @@ zpool_import_009_neg_body() . $(atf_get_srcdir)/../../../include/default.cfg . $(atf_get_srcdir)/zpool_import.cfg - verify_disk_count "$DISKS" 2 + verify_disk_count "$DISKS" 1 ksh93 $(atf_get_srcdir)/setup.ksh || atf_fail "Setup failed" ksh93 $(atf_get_srcdir)/zpool_import_009_neg.ksh || atf_fail "Testcase failed" } @@ -238,7 +238,7 @@ zpool_import_010_pos_body() . $(atf_get_srcdir)/../../../include/default.cfg . $(atf_get_srcdir)/zpool_import.cfg - verify_disk_count "$DISKS" 2 + verify_disk_count "$DISKS" 1 ksh93 $(atf_get_srcdir)/setup.ksh || atf_fail "Setup failed" ksh93 $(atf_get_srcdir)/zpool_import_010_pos.ksh || atf_fail "Testcase failed" } @@ -263,7 +263,7 @@ zpool_import_011_neg_body() . $(atf_get_srcdir)/../../../include/default.cfg . $(atf_get_srcdir)/zpool_import.cfg - verify_disk_count "$DISKS" 2 + verify_disk_count "$DISKS" 1 ksh93 $(atf_get_srcdir)/setup.ksh || atf_fail "Setup failed" ksh93 $(atf_get_srcdir)/zpool_import_011_neg.ksh || atf_fail "Testcase failed" } @@ -288,7 +288,7 @@ zpool_import_012_pos_body() . $(atf_get_srcdir)/../../../include/default.cfg . $(atf_get_srcdir)/zpool_import.cfg - verify_disk_count "$DISKS" 2 + verify_disk_count "$DISKS" 1 ksh93 $(atf_get_srcdir)/setup.ksh || atf_fail "Setup failed" ksh93 $(atf_get_srcdir)/zpool_import_012_pos.ksh || atf_fail "Testcase failed" } @@ -377,7 +377,7 @@ zpool_import_missing_001_pos_body() . $(atf_get_srcdir)/../../../include/default.cfg . $(atf_get_srcdir)/zpool_import.cfg - verify_disk_count "$DISKS" 2 + verify_disk_count "$DISKS" 1 ksh93 $(atf_get_srcdir)/setup.ksh || atf_fail "Setup failed" ksh93 $(atf_get_srcdir)/zpool_import_missing_001_pos.ksh || atf_fail "Testcase failed" } @@ -402,7 +402,7 @@ zpool_import_missing_002_pos_body() . $(atf_get_srcdir)/../../../include/default.cfg . $(atf_get_srcdir)/zpool_import.cfg - verify_disk_count "$DISKS" 2 + verify_disk_count "$DISKS" 1 ksh93 $(atf_get_srcdir)/setup.ksh || atf_fail "Setup failed" ksh93 $(atf_get_srcdir)/zpool_import_missing_002_pos.ksh || atf_fail "Testcase failed" } @@ -427,7 +427,7 @@ zpool_import_missing_003_pos_body() . $(atf_get_srcdir)/../../../include/default.cfg . $(atf_get_srcdir)/zpool_import.cfg - verify_disk_count "$DISKS" 2 + verify_disk_count "$DISKS" 1 ksh93 $(atf_get_srcdir)/setup.ksh || atf_fail "Setup failed" ksh93 $(atf_get_srcdir)/zpool_import_missing_003_pos.ksh || atf_fail "Testcase failed" } @@ -482,7 +482,7 @@ zpool_import_rename_001_pos_body() . $(atf_get_srcdir)/../../../include/default.cfg . $(atf_get_srcdir)/zpool_import.cfg - verify_disk_count "$DISKS" 2 + verify_disk_count "$DISKS" 1 ksh93 $(atf_get_srcdir)/setup.ksh || atf_fail "Setup failed" ksh93 $(atf_get_srcdir)/zpool_import_rename_001_pos.ksh || atf_fail "Testcase failed" } diff --git a/tests/sys/cddl/zfs/tests/delegate/delegate_common.kshlib b/tests/sys/cddl/zfs/tests/delegate/delegate_common.kshlib index 5b7a19e84c5..58179d6366c 100644 --- a/tests/sys/cddl/zfs/tests/delegate/delegate_common.kshlib +++ b/tests/sys/cddl/zfs/tests/delegate/delegate_common.kshlib @@ -159,11 +159,9 @@ function user_run { typeset user=$1 typeset group=$($GROUPS $user) - shift - eval \$RUNWATTR -u \$user -g \$group \"$@\" > /dev/null 2>&1 - return $? + sudo -u $user -g $group $@ } function common_perm @@ -251,7 +249,7 @@ function check_fs_perm ret=$? ;; promote) - verify_fs_promote $user $perm $fs + verify_promote $user $perm $fs ret=$? ;; canmount) @@ -336,7 +334,7 @@ function check_vol_perm ret=$? ;; promote) - verify_vol_promote $user $perm $vol + verify_promote $user $perm $vol ret=$? ;; volsize) @@ -358,6 +356,8 @@ function check_vol_perm function setup_unallow_testenv { + typeset dtst + log_must restore_root_datasets log_must $ZFS create $SUBFS @@ -403,8 +403,9 @@ function verify_send typeset bak_user=$TMPDIR/bak.$user.$stamp typeset bak_root=$TMPDIR/bak.root.$stamp - user_run $user eval "$ZFS send $snap > $bak_user" + user_run $user $ZFS send $snap > $bak_user log_must eval "$ZFS send $snap > $bak_root" + log_must $ZFS destroy $snap if [[ $(checksum $bak_user) == $(checksum $bak_root) ]]; then ret=0 @@ -422,6 +423,7 @@ function verify_fs_receive typeset perm=$2 typeset fs=$3 + typeset dtst typeset oldval typeset stamp=${perm}.${user}.$($DATE +'%F-%R:%S') typeset newfs=$fs/newfs.$stamp @@ -444,27 +446,27 @@ function verify_fs_receive log_must eval "$ZFS send $dtstsnap > $bak_root" log_must $ZFS destroy -rf $dtst - user_run $user eval "$ZFS receive $dtst < $bak_root" + user_run $user $ZFS receive $dtst < $bak_root if datasetexists $dtstsnap ; then return 1 fi log_must $ZFS allow $user create $fs - user_run $user eval "$ZFS receive $dtst < $bak_root" + user_run $user $ZFS receive $dtst < $bak_root log_must $ZFS unallow $user create $fs if datasetexists $dtstsnap ; then return 1 fi log_must $ZFS allow $user mount $fs - user_run $user eval "$ZFS receive $dtst < $bak_root" + user_run $user $ZFS receive $dtst < $bak_root log_must $ZFS unallow $user mount $fs if datasetexists $dtstsnap ; then return 1 fi log_must $ZFS allow $user mount,create $fs - user_run $user eval "$ZFS receive $dtst < $bak_root" + user_run $user $ZFS receive $dtst < $bak_root log_must $ZFS unallow $user mount,create $fs if ! datasetexists $dtstsnap ; then return 1 @@ -500,6 +502,7 @@ function verify_userprop if [[ $stamp != $(get_prop "$user:ts" $dtst) ]]; then return 1 fi + log_must $ZFS inherit "$user:ts" $dtst return 0 } @@ -581,7 +584,6 @@ function verify_fs_create typeset stamp=${perm}.${user}.$($DATE +'%F-%R:%S') typeset newfs=$fs/nfs.$stamp typeset newvol=$fs/nvol.$stamp - typeset check_refrev=false user_run $user $ZFS create $newfs if datasetexists $newfs ; then @@ -594,9 +596,6 @@ function verify_fs_create if ! datasetexists $newfs ; then return 1 fi - if support_refrev $newfs; then - check_refrev=true - fi log_must $ZFS destroy $newfs if is_global_zone ; then @@ -635,26 +634,20 @@ function verify_fs_create return 1 fi - if [[ $check_refrev == true ]]; then - log_must $ZFS allow $user refreservation $fs - user_run $user $ZFS create -V 150m $newvol - log_must $ZFS unallow $user refreservation $fs - if datasetexists $newvol ; then - return 1 - fi + log_must $ZFS allow $user refreservation $fs + user_run $user $ZFS create -V 150m $newvol + log_must $ZFS unallow $user refreservation $fs + if datasetexists $newvol ; then + return 1 fi log_must $ZFS allow $user mount $fs log_must $ZFS allow $user reservation $fs - if [[ $check_refrev == true ]]; then - log_must $ZFS allow $user refreservation $fs - fi + log_must $ZFS allow $user refreservation $fs user_run $user $ZFS create -V 150m $newvol log_must $ZFS unallow $user mount $fs log_must $ZFS unallow $user reservation $fs - if [[ $check_refrev == true ]]; then - log_must $ZFS unallow $user refreservation $fs - fi + log_must $ZFS unallow $user refreservation $fs if ! datasetexists $newvol ; then return 1 fi @@ -708,13 +701,6 @@ function verify_fs_snapshot log_must $ZFS umount $fs fi user_run $user $ZFS snapshot $snap - if datasetexists $snap ; then - return 1 - fi - - log_must $ZFS allow $user mount $fs - user_run $user $ZFS snapshot $snap - log_must $ZFS unallow $user mount $fs if ! datasetexists $snap ; then return 1 fi @@ -724,31 +710,20 @@ function verify_fs_snapshot log_must $ZFS mount $fs fi user_run $user $ZFS snapshot $snap - if datasetexists $snap ; then - return 1 - fi - - log_must $ZFS allow $user mount $fs - user_run $user $ZFS snapshot $snap - log_must $ZFS unallow $user mount $fs if ! datasetexists $snap ; then return 1 fi log_must $ZFS destroy $snap - typeset snapdir=${mntpt}/$(get_snapdir_name)/snap.$stamp - user_run $user $MKDIR $snapdir - if datasetexists $snap ; then - return 1 - fi - - log_must $ZFS allow $user mount $fs - user_run $user $MKDIR $snapdir - log_must $ZFS unallow $user mount $fs - if ! datasetexists $snap ; then - return 1 - fi - log_must $ZFS destroy $snap + # TODO + # FreeBSD does not yet support creating snapshots with mkdir. + # See tests/sys/cddl/zfs/tests/snapshot/snapshot_015_pos.ksh + # typeset snapdir=${mntpt}/$(get_snapdir_name)/snap.$stamp + # user_run $user $MKDIR $snapdir + # if ! datasetexists $snap ; then + # return 1 + # fi + # log_must $ZFS destroy $snap return 0 } @@ -773,23 +748,14 @@ function verify_fs_rollback log_must $TOUCH $mntpt/testfile.$stamp user_run $user $ZFS rollback -R $snap - $SLEEP 10 - if is_global_zone ; then - if [[ $oldval == $(datasetcksum $fs) ]]; then - return 1 - fi - else - # datasetcksum can not be used in local zone - if [[ ! -e $mntpt/testfile.$stamp ]]; then - return 1 - fi + if [[ -e $mntpt/testfile.$stamp ]]; then + return 1 fi # rollback on mounted fs has to be with mount permission log_must $ZFS allow $user mount $fs user_run $user $ZFS rollback -R $snap log_must $ZFS unallow $user mount $fs - $SLEEP 10 if is_global_zone ; then if [[ $oldval != $(datasetcksum $fs) ]]; then return 1 @@ -1083,7 +1049,7 @@ function verify_fs_mountpoint return 0 } -function verify_fs_promote +function verify_promote { typeset user=$1 typeset perm=$2 @@ -1102,13 +1068,14 @@ function verify_fs_promote typeset clone_orig=$(get_prop origin $clone) user_run $user $ZFS promote $fs - # promote should fail if original fs does not have - # promote permission + # promote should fail if original fs does not have mount and promote + # permissions if [[ $fs_orig != $(get_prop origin $fs) || \ $clone_orig != $(get_prop origin $clone) ]]; then return 1 fi + # promote should fail if original fs does not have mount permission log_must $ZFS allow $user promote $clone user_run $user $ZFS promote $fs log_must $ZFS unallow $user promote $clone @@ -1117,6 +1084,7 @@ function verify_fs_promote return 1 fi + # promote should fail if original fs does not have promote permission log_must $ZFS allow $user mount $fs user_run $user $ZFS promote $fs log_must $ZFS unallow $user mount $fs @@ -1503,16 +1471,10 @@ function verify_vol_snapshot typeset snap=$vol@snap.$stamp user_run $user $ZFS snapshot $snap - if datasetexists $snap ; then - return 1 - fi - - log_must $ZFS allow $user mount $vol - user_run $user $ZFS snapshot $snap - log_must $ZFS unallow $user mount $vol if ! datasetexists $snap ; then return 1 fi + log_must $ZFS destroy $snap return 0 } @@ -1535,16 +1497,6 @@ function verify_vol_rollback bs=512 count=1 user_run $user $ZFS rollback -R $snap - $SLEEP 10 - if [[ $oldval == $(datasetcksum $vol) ]]; then - return 1 - fi - - # rollback on volume has to be with mount permission - log_must $ZFS allow $user mount $vol - user_run $user $ZFS rollback -R $snap - $SLEEP 10 - log_must $ZFS unallow $user mount $vol if [[ $oldval != $(datasetcksum $vol) ]]; then return 1 fi @@ -1645,130 +1597,6 @@ function verify_vol_rename return 0 } -function verify_vol_promote -{ - typeset user=$1 - typeset perm=$2 - typeset vol=$3 - - typeset stamp=${perm}.${user}.$($DATE +'%F-%R:%S') - typeset basevol=${vol%/*} - typeset snap=$vol@snap.$stamp - typeset clone=$basevol/cvol.$stamp - - log_must $ZFS snapshot $snap - log_must $ZFS clone $snap $clone - log_must $ZFS promote $clone - - typeset vol_orig=$(get_prop origin $vol) - typeset clone_orig=$(get_prop origin $clone) - - # promote should fail if $vol and $clone - # miss either mount or promote permission - # case 1 - user_run $user $ZFS promote $vol - if [[ $vol_orig != $(get_prop origin $vol) || \ - $clone_orig != $(get_prop origin $clone) ]]; - then - return 1 - fi - - # promote should fail if $vol and $clone - # miss either mount or promote permission - # case 2 - log_must $ZFS allow $user promote $clone - user_run $user $ZFS promote $vol - log_must $ZFS unallow $user promote $clone - if [[ $vol_orig != $(get_prop origin $vol) || \ - $clone_orig != $(get_prop origin $clone) ]]; - then - return 1 - fi - - # promote should fail if $vol and $clone - # miss either mount or promote permission - # case 3 - log_must $ZFS allow $user mount $vol - user_run $user $ZFS promote $vol - log_must $ZFS unallow $user mount $vol - if [[ $vol_orig != $(get_prop origin $vol) || \ - $clone_orig != $(get_prop origin $clone) ]]; - then - return 1 - fi - - # promote should fail if $vol and $clone - # miss either mount or promote permission - # case 4 - log_must $ZFS allow $user mount $clone - user_run $user $ZFS promote $vol - log_must $ZFS unallow $user mount $clone - if [[ $vol_orig != $(get_prop origin $vol) || \ - $clone_orig != $(get_prop origin $clone) ]]; - then - return 1 - fi - - # promote should fail if $vol and $clone - # miss either mount or promote permission - # case 5 - log_must $ZFS allow $user promote $clone - log_must $ZFS allow $user mount $vol - user_run $user $ZFS promote $vol - log_must $ZFS unallow $user promote $clone - log_must $ZFS unallow $user mount $vol - if [[ $vol_orig != $(get_prop origin $vol) || \ - $clone_orig != $(get_prop origin $clone) ]]; - then - return 1 - fi - - # promote should fail if $vol and $clone - # miss either mount or promote permission - # case 6 - log_must $ZFS allow $user promote $clone - log_must $ZFS allow $user mount $clone - user_run $user $ZFS promote $vol - log_must $ZFS unallow $user promote $clone - log_must $ZFS unallow $user mount $vol - if [[ $vol_orig != $(get_prop origin $vol) || \ - $clone_orig != $(get_prop origin $clone) ]]; - then - return 1 - fi - - # promote should fail if $vol and $clone - # miss either mount or promote permission - # case 7 - log_must $ZFS allow $user mount $vol - log_must $ZFS allow $user mount $clone - user_run $user $ZFS promote $vol - log_must $ZFS unallow $user mount $vol - log_must $ZFS unallow $user mount $clone - if [[ $vol_orig != $(get_prop origin $vol) || \ - $clone_orig != $(get_prop origin $clone) ]]; - then - return 1 - fi - - # promote only succeeds when $vol and $clone - # have both mount and promote permission - # case 8 - log_must $ZFS allow $user promote $clone - log_must $ZFS allow $user mount $vol - log_must $ZFS allow $user mount $clone - user_run $user $ZFS promote $vol - log_must $ZFS unallow $user promote $clone - log_must $ZFS unallow $user mount $vol - log_must $ZFS unallow $user mount $clone - if [[ $snap != $(get_prop origin $clone) || \ - $clone_orig != $(get_prop origin $vol) ]]; then - return 1 - fi - - return 0 -} - function verify_vol_volsize { typeset user=$1 @@ -1779,17 +1607,9 @@ function verify_vol_volsize oldval=$(get_prop volsize $vol) (( newval = oldval * 2 )) - typeset check_refrev=false - if support_refrev $vol; then - check_refrev=true - fi typeset reserv_size - if [[ $check_refrev == true ]]; then - reserv_size=$(get_prop refreservation $vol) - else - reserv_size=$(get_prop reservation $vol) - fi + reserv_size=$(get_prop refreservation $vol) if [[ "0" == $reserv_size ]]; then # sparse volume @@ -1803,20 +1623,16 @@ function verify_vol_volsize # normal volume, reservation permission # is required user_run $user $ZFS set volsize=$newval $vol - if [[ $newval == $(get_prop volsize $vol) ]]; + zfs get -p volsize $vol + if [[ $newval != $(get_prop volsize $vol) ]]; then return 1 fi - log_must $ZFS allow $user reservation $vol - if [[ $check_refrev == true ]]; then - log_must $ZFS allow $user refreservation $vol - fi + log_must $ZFS allow $user refreservation $vol user_run $user $ZFS set volsize=$newval $vol log_must $ZFS unallow $user reservation $vol - if [[ $check_refrev == true ]]; then - log_must $ZFS unallow $user refreservation $vol - fi + log_must $ZFS unallow $user refreservation $vol if [[ $oldval == $(get_prop volsize $vol) ]]; then return 1 @@ -1888,15 +1704,3 @@ function verify_allow return 0 } - -function support_refrev -{ - typeset dataset=$1 - - $ZFS get refreservation $dataset > /dev/null 2>&1 - if (( $? != 0 )); then - return 1 - fi - - return 0 -} diff --git a/tests/sys/cddl/zfs/tests/delegate/zfs_allow_001_pos.ksh b/tests/sys/cddl/zfs/tests/delegate/zfs_allow_001_pos.ksh index fdc9b7f0011..f572d037fee 100644 --- a/tests/sys/cddl/zfs/tests/delegate/zfs_allow_001_pos.ksh +++ b/tests/sys/cddl/zfs/tests/delegate/zfs_allow_001_pos.ksh @@ -67,8 +67,6 @@ function cleanup if [[ $group_added == "TRUE" ]] ; then del_group everyone fi - - restore_root_datasets } log_assert "everyone' is interpreted as a keyword even if a user " \ @@ -111,7 +109,6 @@ for dtst in $DATASETS ; do log_must $ZFS allow everyone $perms $dtst log_must verify_perm $dtst $perms $EVERYONE done -log_must restore_root_datasets if [[ $group_added == "TRUE" ]]; then log_must $GROUPDEL everyone fi diff --git a/tests/sys/cddl/zfs/tests/delegate/zfs_allow_002_pos.ksh b/tests/sys/cddl/zfs/tests/delegate/zfs_allow_002_pos.ksh index ed1648c447a..da769473dee 100644 --- a/tests/sys/cddl/zfs/tests/delegate/zfs_allow_002_pos.ksh +++ b/tests/sys/cddl/zfs/tests/delegate/zfs_allow_002_pos.ksh @@ -65,8 +65,6 @@ function cleanup if $ID $STAFF_GROUP > /dev/null 2>&1; then log_must del_user $STAFF_GROUP fi - - restore_root_datasets } log_assert " is interpreted as user if possible, then as group." diff --git a/tests/sys/cddl/zfs/tests/delegate/zfs_allow_003_pos.ksh b/tests/sys/cddl/zfs/tests/delegate/zfs_allow_003_pos.ksh index 6bc558ae9d5..efd31c3857b 100644 --- a/tests/sys/cddl/zfs/tests/delegate/zfs_allow_003_pos.ksh +++ b/tests/sys/cddl/zfs/tests/delegate/zfs_allow_003_pos.ksh @@ -60,7 +60,6 @@ verify_runnable "both" log_assert "Verify option '-l' only allow permission to the dataset itself." -log_onexit restore_root_datasets childfs=$ROOT_TESTFS/childfs @@ -74,10 +73,6 @@ else allow,userprop" fi -if check_version "5.10" ; then - perms="${perms},send" -fi - log_must $ZFS create $childfs for dtst in $DATASETS ; do @@ -113,6 +108,4 @@ for dtst in $DATASETS ; do fi done -log_must restore_root_datasets - log_pass "Verify option '-l' only allow permission to the dataset itself pass." diff --git a/tests/sys/cddl/zfs/tests/delegate/zfs_allow_007_pos.ksh b/tests/sys/cddl/zfs/tests/delegate/zfs_allow_007_pos.ksh index 00d6d8b0210..7f4d70e02a0 100644 --- a/tests/sys/cddl/zfs/tests/delegate/zfs_allow_007_pos.ksh +++ b/tests/sys/cddl/zfs/tests/delegate/zfs_allow_007_pos.ksh @@ -65,7 +65,6 @@ verify_runnable "both" log_assert "Verify permission set can be masked on descendent dataset." -log_onexit restore_root_datasets typeset perms1="snapshot,reservation,compression" eval set -A dataset $DATASETS diff --git a/tests/sys/cddl/zfs/tests/delegate/zfs_allow_010_pos.ksh b/tests/sys/cddl/zfs/tests/delegate/zfs_allow_010_pos.ksh index f03e559bc6d..6c000c1ea58 100644 --- a/tests/sys/cddl/zfs/tests/delegate/zfs_allow_010_pos.ksh +++ b/tests/sys/cddl/zfs/tests/delegate/zfs_allow_010_pos.ksh @@ -60,7 +60,6 @@ verify_runnable "both" log_assert "Verify privileged user has correct permissions once which was "\ "delegated to him in datasets" -log_onexit restore_root_datasets # # Results in Results in @@ -79,7 +78,6 @@ set -A perms create true false \ compression true true \ canmount true false \ atime true false \ - devices true false \ exec true false \ volsize false true \ setuid true false \ @@ -92,16 +90,14 @@ set -A perms create true false \ clone true true \ rename true true \ promote true true \ - zoned true false \ - shareiscsi true true \ - xattr true false \ receive true false \ destroy true true -if is_global_zone; then - typeset -i n=${#perms[@]} - perms[((n))]="sharenfs"; perms[((n+1))]="true"; perms[((n+2))]="false" - perms[((n+3))]="share"; perms[((n+4))]="true"; perms[((n+5))]="false" -fi + # TODO: shareiscsi is not yet supported on FreeBSD + # shareiscsi true true +# the sharenfs test is Solaris-specific. TODO: port it to FreeBSD. +#typeset -i n=${#perms[@]} +#perms[((n))]="sharenfs"; perms[((n+1))]="true"; perms[((n+2))]="false" +#perms[((n+3))]="share"; perms[((n+4))]="true"; perms[((n+5))]="false" for dtst in $DATASETS; do typeset -i k=1 diff --git a/tests/sys/cddl/zfs/tests/delegate/zfs_allow_012_neg.ksh b/tests/sys/cddl/zfs/tests/delegate/zfs_allow_012_neg.ksh index 6a25ab10529..37feb0180b0 100644 --- a/tests/sys/cddl/zfs/tests/delegate/zfs_allow_012_neg.ksh +++ b/tests/sys/cddl/zfs/tests/delegate/zfs_allow_012_neg.ksh @@ -56,24 +56,16 @@ # ################################################################################ -verify_runnable "global" - -function cleanup -{ - log_must $ZPOOL set delegation=on $TESTPOOL - log_must restore_root_datasets -} - log_assert "Verify privileged user can not use permissions properly when " \ "delegation property is set off" -log_onexit cleanup - set -A perms create snapshot mount send allow quota reservation \ recordsize mountpoint checksum compression canmount atime \ devices exec volsize setuid readonly snapdir userprop \ aclmode aclinherit rollback clone rename promote \ - zoned shareiscsi xattr receive destroy sharenfs share + xattr receive destroy +# TODO: add sharenfs and share after the Solarisisms have been removed from +# those tests log_must $ZPOOL set delegation=off $TESTPOOL diff --git a/tests/sys/cddl/zfs/tests/delegate/zfs_allow_test.sh b/tests/sys/cddl/zfs/tests/delegate/zfs_allow_test.sh index d30eaa73ae3..601705d354b 100755 --- a/tests/sys/cddl/zfs/tests/delegate/zfs_allow_test.sh +++ b/tests/sys/cddl/zfs/tests/delegate/zfs_allow_test.sh @@ -30,7 +30,7 @@ atf_test_case zfs_allow_001_pos cleanup zfs_allow_001_pos_head() { atf_set "descr" "everyone' is interpreted as a keyword even if a useror group named 'everyone' exists." - atf_set "require.progs" zfs svcs + atf_set "require.progs" zfs sudo } zfs_allow_001_pos_body() { @@ -56,7 +56,7 @@ atf_test_case zfs_allow_002_pos cleanup zfs_allow_002_pos_head() { atf_set "descr" " is interpreted as user if possible, then as group." - atf_set "require.progs" zfs svcs + atf_set "require.progs" zfs sudo } zfs_allow_002_pos_body() { @@ -82,7 +82,7 @@ atf_test_case zfs_allow_003_pos cleanup zfs_allow_003_pos_head() { atf_set "descr" "Verify option '-l' only allow permission to the dataset itself." - atf_set "require.progs" zfs svcs + atf_set "require.progs" zfs sudo } zfs_allow_003_pos_body() { @@ -108,7 +108,7 @@ atf_test_case zfs_allow_004_pos cleanup zfs_allow_004_pos_head() { atf_set "descr" "Verify option '-d' allow permission to the descendent datasets." - atf_set "require.progs" zfs svcs + atf_set "require.progs" zfs sudo } zfs_allow_004_pos_body() { @@ -134,7 +134,7 @@ atf_test_case zfs_allow_005_pos cleanup zfs_allow_005_pos_head() { atf_set "descr" "Verify option '-c' will be granted locally to the creator." - atf_set "require.progs" zfs svcs runwattr + atf_set "require.progs" zfs sudo } zfs_allow_005_pos_body() { @@ -160,7 +160,7 @@ atf_test_case zfs_allow_006_pos cleanup zfs_allow_006_pos_head() { atf_set "descr" "Changing permissions in a set will change what is allowedwherever the set is used." - atf_set "require.progs" zfs svcs + atf_set "require.progs" zfs sudo } zfs_allow_006_pos_body() { @@ -186,7 +186,7 @@ atf_test_case zfs_allow_007_pos cleanup zfs_allow_007_pos_head() { atf_set "descr" "Verify permission set can be masked on descendent dataset." - atf_set "require.progs" zfs svcs + atf_set "require.progs" zfs sudo } zfs_allow_007_pos_body() { @@ -212,7 +212,7 @@ atf_test_case zfs_allow_008_pos cleanup zfs_allow_008_pos_head() { atf_set "descr" "Verify non-root user can allow permissions." - atf_set "require.progs" zfs svcs runwattr + atf_set "require.progs" zfs sudo } zfs_allow_008_pos_body() { @@ -238,7 +238,7 @@ atf_test_case zfs_allow_009_neg cleanup zfs_allow_009_neg_head() { atf_set "descr" "Verify invalid arguments are handled correctly." - atf_set "require.progs" zfs svcs + atf_set "require.progs" zfs sudo } zfs_allow_009_neg_body() { @@ -263,8 +263,8 @@ zfs_allow_009_neg_cleanup() atf_test_case zfs_allow_010_pos cleanup zfs_allow_010_pos_head() { - atf_set "descr" "Verify privileged user has correct permissions once which wasdelegated to him in datasets" - atf_set "require.progs" zfs svcs + atf_set "descr" "Verify privileged user has correct permissions once which was delegated to him in datasets" + atf_set "require.progs" zfs sudo } zfs_allow_010_pos_body() { @@ -289,8 +289,8 @@ zfs_allow_010_pos_cleanup() atf_test_case zfs_allow_011_neg cleanup zfs_allow_011_neg_head() { - atf_set "descr" "Verify zpool subcmds and system readonly properties can't bedelegated." - atf_set "require.progs" zfs svcs + atf_set "descr" "Verify zpool subcmds and system readonly properties can't be delegated." + atf_set "require.progs" zfs sudo } zfs_allow_011_neg_body() { @@ -315,8 +315,8 @@ zfs_allow_011_neg_cleanup() atf_test_case zfs_allow_012_neg cleanup zfs_allow_012_neg_head() { - atf_set "descr" "Verify privileged user can not use permissions properly whendelegation property is set off" - atf_set "require.progs" zfs zpool svcs + atf_set "descr" "Verify privileged user can not use permissions properly when delegation property is set off" + atf_set "require.progs" zfs sudo } zfs_allow_012_neg_body() { diff --git a/tests/sys/cddl/zfs/tests/delegate/zfs_unallow_007_neg.ksh b/tests/sys/cddl/zfs/tests/delegate/zfs_unallow_007_neg.ksh index cf5d132687c..53457eeafde 100644 --- a/tests/sys/cddl/zfs/tests/delegate/zfs_unallow_007_neg.ksh +++ b/tests/sys/cddl/zfs/tests/delegate/zfs_unallow_007_neg.ksh @@ -62,7 +62,7 @@ log_assert "zfs unallow won't remove those permissions which inherited from " \ "its parent dataset." log_onexit restore_root_datasets -perm1="atime,devices"; perm2="compression,checksum" +perm1="atime"; perm2="compression,checksum" log_must $ZFS create $SUBFS log_must $ZFS allow $STAFF1 $perm1 $ROOT_TESTFS log_must $ZFS allow $STAFF1 $perm2 $SUBFS diff --git a/tests/sys/cddl/zfs/tests/delegate/zfs_unallow_test.sh b/tests/sys/cddl/zfs/tests/delegate/zfs_unallow_test.sh index 5de6a9ad47a..4c91fc2d802 100755 --- a/tests/sys/cddl/zfs/tests/delegate/zfs_unallow_test.sh +++ b/tests/sys/cddl/zfs/tests/delegate/zfs_unallow_test.sh @@ -30,7 +30,7 @@ atf_test_case zfs_unallow_001_pos cleanup zfs_unallow_001_pos_head() { atf_set "descr" "Verify '-l' only removed the local permissions." - atf_set "require.progs" zfs svcs + atf_set "require.progs" zfs sudo } zfs_unallow_001_pos_body() { @@ -56,7 +56,7 @@ atf_test_case zfs_unallow_002_pos cleanup zfs_unallow_002_pos_head() { atf_set "descr" "Verify '-d' only removed the descendent permissions." - atf_set "require.progs" zfs svcs + atf_set "require.progs" zfs sudo } zfs_unallow_002_pos_body() { @@ -82,7 +82,7 @@ atf_test_case zfs_unallow_003_pos cleanup zfs_unallow_003_pos_head() { atf_set "descr" "Verify options '-r' and '-l'+'-d' will unallow permission tothis dataset and the descendent datasets." - atf_set "require.progs" zfs svcs + atf_set "require.progs" zfs sudo } zfs_unallow_003_pos_body() { @@ -108,7 +108,7 @@ atf_test_case zfs_unallow_004_pos cleanup zfs_unallow_004_pos_head() { atf_set "descr" "Verify '-s' will remove permissions from the named set." - atf_set "require.progs" zfs svcs + atf_set "require.progs" zfs sudo } zfs_unallow_004_pos_body() { @@ -134,7 +134,7 @@ atf_test_case zfs_unallow_005_pos cleanup zfs_unallow_005_pos_head() { atf_set "descr" "Verify option '-c' will remove the created permission set." - atf_set "require.progs" zfs svcs runwattr + atf_set "require.progs" zfs sudo } zfs_unallow_005_pos_body() { @@ -160,7 +160,7 @@ atf_test_case zfs_unallow_006_pos cleanup zfs_unallow_006_pos_head() { atf_set "descr" "Verify option '-u', '-g' and '-e' only removed the specified typepermissions set." - atf_set "require.progs" zfs svcs + atf_set "require.progs" zfs sudo } zfs_unallow_006_pos_body() { @@ -186,7 +186,7 @@ atf_test_case zfs_unallow_007_neg cleanup zfs_unallow_007_neg_head() { atf_set "descr" "zfs unallow won't remove those permissions which inherited fromits parent dataset." - atf_set "require.progs" zfs svcs + atf_set "require.progs" zfs sudo } zfs_unallow_007_neg_body() { @@ -212,7 +212,7 @@ atf_test_case zfs_unallow_008_neg cleanup zfs_unallow_008_neg_head() { atf_set "descr" "zfs unallow can handle invalid arguments." - atf_set "require.progs" zfs svcs runwattr + atf_set "require.progs" zfs sudo } zfs_unallow_008_neg_body() { diff --git a/tests/sys/cddl/zfs/tests/hotspare/hotspare_test.sh b/tests/sys/cddl/zfs/tests/hotspare/hotspare_test.sh index f84c2d98652..77adadedadf 100755 --- a/tests/sys/cddl/zfs/tests/hotspare/hotspare_test.sh +++ b/tests/sys/cddl/zfs/tests/hotspare/hotspare_test.sh @@ -115,7 +115,7 @@ hotspare_add_004_neg_body() . $(atf_get_srcdir)/hotspare.kshlib . $(atf_get_srcdir)/hotspare.cfg - verify_disk_count "$DISKS" 1 + verify_disk_count "$DISKS" 2 ksh93 $(atf_get_srcdir)/setup.ksh || atf_fail "Setup failed" ksh93 $(atf_get_srcdir)/hotspare_add_004_neg.ksh || atf_fail "Testcase failed" } @@ -635,6 +635,7 @@ hotspare_scrub_002_pos_body() . $(atf_get_srcdir)/hotspare.kshlib . $(atf_get_srcdir)/hotspare.cfg + atf_expect_fail "PR 241069 scrub does not detect all errors on active spares" ksh93 $(atf_get_srcdir)/setup.ksh || atf_fail "Setup failed" ksh93 $(atf_get_srcdir)/hotspare_scrub_002_pos.ksh || atf_fail "Testcase failed" } diff --git a/tests/sys/cddl/zfs/tests/redundancy/redundancy.kshlib b/tests/sys/cddl/zfs/tests/redundancy/redundancy.kshlib index 4a1142d08d9..2fca88dc446 100644 --- a/tests/sys/cddl/zfs/tests/redundancy/redundancy.kshlib +++ b/tests/sys/cddl/zfs/tests/redundancy/redundancy.kshlib @@ -98,7 +98,7 @@ function setup_test_env typeset file=$TESTDIR/file log_must $FILE_WRITE -o create -f $file -b $BLOCKSZ -c $NUM_WRITES - log_must force_sync_path $TESTDIR + force_sync_path $BASEDIR record_data $TESTPOOL $PRE_RECORD_FILE } @@ -142,7 +142,7 @@ function sync_pool #pool { typeset pool=$1 - log_must force_sync_path $pool + force_sync_path $BASEDIR # If the OS has detected corruption on the pool, it will have # automatically initiated a scrub. In that case, our "zpool scrub" diff --git a/tests/sys/cddl/zfs/tests/redundancy/redundancy_001_pos.ksh b/tests/sys/cddl/zfs/tests/redundancy/redundancy_001_pos.ksh index 2e7e8b11f55..3f57c893174 100644 --- a/tests/sys/cddl/zfs/tests/redundancy/redundancy_001_pos.ksh +++ b/tests/sys/cddl/zfs/tests/redundancy/redundancy_001_pos.ksh @@ -62,7 +62,6 @@ verify_runnable "global" log_assert "Verify raidz pool can withstand one device is failing." -log_onexit cleanup for cnt in 3 2; do setup_test_env $TESTPOOL raidz $cnt diff --git a/tests/sys/cddl/zfs/tests/slog/slog_012_neg.ksh b/tests/sys/cddl/zfs/tests/slog/slog_012_neg.ksh index 0535c4ee4a1..f1d1e09501f 100644 --- a/tests/sys/cddl/zfs/tests/slog/slog_012_neg.ksh +++ b/tests/sys/cddl/zfs/tests/slog/slog_012_neg.ksh @@ -74,7 +74,9 @@ function test_slog_mirror_corruption # log_must $DD if=/dev/urandom of=$mntpnt/testfile.${TESTCASE_ID} count=100 ldev=$(random_get $LDEV) - log_must create_vdevs $ldev + eval `$STAT -s $ldev` + log_must $TRUNCATE -s0 $ldev + log_must $TRUNCATE -s $st_size $ldev log_must $ZPOOL scrub $TESTPOOL log_must display_status $TESTPOOL diff --git a/tests/sys/cddl/zfs/tests/zfsd/zfsd_autoreplace_003_pos.ksh b/tests/sys/cddl/zfs/tests/zfsd/zfsd_autoreplace_003_pos.ksh index beb2a100c35..604071f5ef8 100644 --- a/tests/sys/cddl/zfs/tests/zfsd/zfsd_autoreplace_003_pos.ksh +++ b/tests/sys/cddl/zfs/tests/zfsd/zfsd_autoreplace_003_pos.ksh @@ -78,11 +78,11 @@ function verify_assertion typeset PHYSPATH="some_physical_path" typeset REMOVAL_DISK=$DISK0 typeset REMOVAL_NOP=${DISK0}.nop -typeset NEW_DISK=$DISK4 -typeset NEW_NOP=${DISK4}.nop -typeset SPARE_DISK=${DISK5} -typeset SPARE_NOP=${DISK5}.nop -typeset OTHER_DISKS="${DISK1} ${DISK2} ${DISK3}" +typeset NEW_DISK=$DISK3 +typeset NEW_NOP=${DISK3}.nop +typeset SPARE_DISK=${DISK4} +typeset SPARE_NOP=${DISK4}.nop +typeset OTHER_DISKS="${DISK1} ${DISK2}" typeset OTHER_NOPS=${OTHER_DISKS//~(E)([[:space:]]+|$)/.nop\1} set -A MY_KEYWORDS "mirror" "raidz1" "raidz2" ensure_zfsd_running diff --git a/tests/sys/cddl/zfs/tests/zfsd/zfsd_hotspare_007_pos.ksh b/tests/sys/cddl/zfs/tests/zfsd/zfsd_hotspare_007_pos.ksh index 8dd67e19aec..580b5bba5ba 100644 --- a/tests/sys/cddl/zfs/tests/zfsd/zfsd_hotspare_007_pos.ksh +++ b/tests/sys/cddl/zfs/tests/zfsd/zfsd_hotspare_007_pos.ksh @@ -82,6 +82,9 @@ function verify_assertion # spare_dev # Re-enable the missing disk log_must create_gnop $REMOVAL_DISK $PHYSPATH + + # And now the spare should be released + wait_for_pool_dev_state_change 20 $spare_dev AVAIL } typeset PHYSPATH="some_physical_path" diff --git a/tests/sys/cddl/zfs/tests/zfsd/zfsd_test.sh b/tests/sys/cddl/zfs/tests/zfsd/zfsd_test.sh index ebbc84a382c..6f092509feb 100755 --- a/tests/sys/cddl/zfs/tests/zfsd/zfsd_test.sh +++ b/tests/sys/cddl/zfs/tests/zfsd/zfsd_test.sh @@ -39,6 +39,7 @@ zfsd_fault_001_pos_body() . $(atf_get_srcdir)/zfsd.cfg verify_disk_count "$DISKS" 2 + verify_zfsd_running ksh93 $(atf_get_srcdir)/setup.ksh || atf_fail "Setup failed" ksh93 $(atf_get_srcdir)/zfsd_fault_001_pos.ksh if [[ $? != 0 ]]; then @@ -68,6 +69,7 @@ zfsd_degrade_001_pos_body() . $(atf_get_srcdir)/zfsd.cfg verify_disk_count "$DISKS" 2 + verify_zfsd_running ksh93 $(atf_get_srcdir)/setup.ksh || atf_fail "Setup failed" ksh93 $(atf_get_srcdir)/zfsd_degrade_001_pos.ksh if [[ $? != 0 ]]; then @@ -97,6 +99,7 @@ zfsd_degrade_002_pos_body() . $(atf_get_srcdir)/zfsd.cfg verify_disk_count "$DISKS" 5 + verify_zfsd_running ksh93 $(atf_get_srcdir)/setup.ksh || atf_fail "Setup failed" ksh93 $(atf_get_srcdir)/zfsd_degrade_002_pos.ksh if [[ $? != 0 ]]; then @@ -126,6 +129,7 @@ zfsd_hotspare_001_pos_body() . $(atf_get_srcdir)/../hotspare/hotspare.kshlib . $(atf_get_srcdir)/../hotspare/hotspare.cfg + verify_zfsd_running ksh93 $(atf_get_srcdir)/hotspare_setup.ksh || atf_fail "Setup failed" ksh93 $(atf_get_srcdir)/zfsd_hotspare_001_pos.ksh if [[ $? != 0 ]]; then @@ -155,6 +159,7 @@ zfsd_hotspare_002_pos_body() . $(atf_get_srcdir)/../hotspare/hotspare.kshlib . $(atf_get_srcdir)/../hotspare/hotspare.cfg + verify_zfsd_running ksh93 $(atf_get_srcdir)/hotspare_setup.ksh || atf_fail "Setup failed" ksh93 $(atf_get_srcdir)/zfsd_hotspare_002_pos.ksh if [[ $? != 0 ]]; then @@ -186,6 +191,7 @@ zfsd_hotspare_003_pos_body() . $(atf_get_srcdir)/../hotspare/hotspare.cfg verify_disk_count "$DISKS" 5 + verify_zfsd_running ksh93 $(atf_get_srcdir)/hotspare_setup.ksh || atf_fail "Setup failed" ksh93 $(atf_get_srcdir)/zfsd_hotspare_003_pos.ksh if [[ $? != 0 ]]; then @@ -216,6 +222,7 @@ zfsd_hotspare_004_pos_body() . $(atf_get_srcdir)/../hotspare/hotspare.cfg verify_disk_count "$DISKS" 5 + verify_zfsd_running ksh93 $(atf_get_srcdir)/hotspare_setup.ksh || atf_fail "Setup failed" ksh93 $(atf_get_srcdir)/zfsd_hotspare_004_pos.ksh if [[ $? != 0 ]]; then @@ -245,6 +252,7 @@ zfsd_hotspare_005_pos_body() . $(atf_get_srcdir)/../hotspare/hotspare.kshlib . $(atf_get_srcdir)/../hotspare/hotspare.cfg + verify_zfsd_running ksh93 $(atf_get_srcdir)/hotspare_setup.ksh || atf_fail "Setup failed" ksh93 $(atf_get_srcdir)/zfsd_hotspare_005_pos.ksh if [[ $? != 0 ]]; then @@ -274,6 +282,7 @@ zfsd_hotspare_006_pos_body() . $(atf_get_srcdir)/../hotspare/hotspare.kshlib . $(atf_get_srcdir)/../hotspare/hotspare.cfg + verify_zfsd_running ksh93 $(atf_get_srcdir)/hotspare_setup.ksh || atf_fail "Setup failed" ksh93 $(atf_get_srcdir)/zfsd_hotspare_006_pos.ksh if [[ $? != 0 ]]; then @@ -304,6 +313,7 @@ zfsd_hotspare_007_pos_body() . $(atf_get_srcdir)/../hotspare/hotspare.cfg verify_disk_count "$DISKS" 5 + verify_zfsd_running ksh93 $(atf_get_srcdir)/hotspare_setup.ksh || atf_fail "Setup failed" ksh93 $(atf_get_srcdir)/zfsd_hotspare_007_pos.ksh if [[ $? != 0 ]]; then @@ -394,6 +404,7 @@ zfsd_autoreplace_002_pos_body() . $(atf_get_srcdir)/../hotspare/hotspare.cfg verify_disk_count "$DISKS" 5 + verify_zfsd_running ksh93 $(atf_get_srcdir)/hotspare_setup.ksh || atf_fail "Setup failed" ksh93 $(atf_get_srcdir)/zfsd_autoreplace_002_pos.ksh if [[ $? != 0 ]]; then @@ -424,6 +435,7 @@ zfsd_autoreplace_003_pos_body() . $(atf_get_srcdir)/../hotspare/hotspare.cfg verify_disk_count "$DISKS" 5 + verify_zfsd_running ksh93 $(atf_get_srcdir)/hotspare_setup.ksh || atf_fail "Setup failed" ksh93 $(atf_get_srcdir)/zfsd_autoreplace_003_pos.ksh if [[ $? != 0 ]]; then @@ -452,6 +464,7 @@ zfsd_replace_001_pos_body() . $(atf_get_srcdir)/zfsd.cfg verify_disk_count "$DISKS" 3 + verify_zfsd_running ksh93 $(atf_get_srcdir)/setup.ksh || atf_fail "Setup failed" ksh93 $(atf_get_srcdir)/zfsd_replace_001_pos.ksh if [[ $? != 0 ]]; then @@ -481,6 +494,7 @@ zfsd_replace_002_pos_body() . $(atf_get_srcdir)/zfsd.cfg verify_disk_count "$DISKS" 3 + verify_zfsd_running ksh93 $(atf_get_srcdir)/setup.ksh || atf_fail "Setup failed" ksh93 $(atf_get_srcdir)/zfsd_replace_002_pos.ksh if [[ $? != 0 ]]; then @@ -508,6 +522,7 @@ zfsd_replace_003_pos_body() . $(atf_get_srcdir)/../hotspare/hotspare.kshlib . $(atf_get_srcdir)/../hotspare/hotspare.cfg + verify_zfsd_running ksh93 $(atf_get_srcdir)/setup.ksh || atf_fail "Setup failed" ksh93 $(atf_get_srcdir)/zfsd_replace_003_pos.ksh if [[ $? != 0 ]]; then @@ -537,6 +552,7 @@ zfsd_import_001_pos_body() . $(atf_get_srcdir)/../hotspare/hotspare.cfg verify_disk_count "$DISKS" 5 + verify_zfsd_running ksh93 $(atf_get_srcdir)/setup.ksh || atf_fail "Setup failed" ksh93 $(atf_get_srcdir)/zfsd_import_001_pos.ksh || atf_fail "Testcase failed" if [[ $? != 0 ]]; then @@ -589,3 +605,9 @@ save_artifacts() bzip2 $TC_ARTIFACTS_DIR/zfsd.log fi } + +verify_zfsd_running() +{ + service zfsd onestatus || \ + atf_skip "zfsd(8) must be enabled and running for this test" +} diff --git a/tests/sys/cddl/zfs/tests/zvol/zvol_misc/zvol_misc_001_neg.ksh b/tests/sys/cddl/zfs/tests/zvol/zvol_misc/zvol_misc_001_neg.ksh index 4a30d0dca7b..53e1c57cfd5 100644 --- a/tests/sys/cddl/zfs/tests/zvol/zvol_misc/zvol_misc_001_neg.ksh +++ b/tests/sys/cddl/zfs/tests/zvol/zvol_misc/zvol_misc_001_neg.ksh @@ -44,7 +44,7 @@ # # STRATEGY: # 1. Create a ZFS volume -# 2. Use dumpadm add the volume as dump device +# 2. Use dumpon add the volume as dump device # 3. Verify the return code as expected. # # TESTABILITY: explicit @@ -71,15 +71,10 @@ function cleanup log_assert "Verify that ZFS volume cannot act as dump device until dumpswap supported." log_onexit cleanup -test_requires DUMPADM - voldev=/dev/zvol/$TESTPOOL/$TESTVOL savedumpdev=$(get_dumpdevice) -if ! is_dumpswap_supported $TESTPOOL ; then - log_mustnot $DUMPADM -d $voldev -else - safe_dumpadm $voldev -fi +# FreeBSD doesn't support using zvols as dump devices for any pool version +log_mustnot $DUMPON $voldev log_pass "ZFS volume cannot act as dump device until dumpswap supported as expected." diff --git a/tests/sys/cddl/zfs/tests/zvol/zvol_misc/zvol_misc_test.sh b/tests/sys/cddl/zfs/tests/zvol/zvol_misc/zvol_misc_test.sh index 8c740f9fac0..6f810de3fba 100755 --- a/tests/sys/cddl/zfs/tests/zvol/zvol_misc/zvol_misc_test.sh +++ b/tests/sys/cddl/zfs/tests/zvol/zvol_misc/zvol_misc_test.sh @@ -30,7 +30,6 @@ atf_test_case zvol_misc_001_neg cleanup zvol_misc_001_neg_head() { atf_set "descr" "Verify that ZFS volume cannot act as dump device until dumpswap supported." - atf_set "require.progs" dumpadm } zvol_misc_001_neg_body() { @@ -82,6 +81,7 @@ zvol_misc_003_neg_head() } zvol_misc_003_neg_body() { + atf_skip "FreeBSD does not yet support dumping to a zvol" . $(atf_get_srcdir)/../../../include/default.cfg . $(atf_get_srcdir)/zvol_misc.cfg @@ -106,6 +106,7 @@ zvol_misc_004_pos_head() } zvol_misc_004_pos_body() { + atf_skip "FreeBSD does not yet support dumping to a zvol" . $(atf_get_srcdir)/../../../include/default.cfg . $(atf_get_srcdir)/zvol_misc.cfg @@ -130,6 +131,7 @@ zvol_misc_005_neg_head() } zvol_misc_005_neg_body() { + atf_skip "FreeBSD does not yet support dumping to a zvol" . $(atf_get_srcdir)/../../../include/default.cfg . $(atf_get_srcdir)/zvol_misc.cfg @@ -154,6 +156,7 @@ zvol_misc_006_pos_head() } zvol_misc_006_pos_body() { + atf_skip "FreeBSD does not yet support dumping to a zvol" . $(atf_get_srcdir)/../../../include/default.cfg . $(atf_get_srcdir)/zvol_misc.cfg -- 2.45.0