aboutsummaryrefslogtreecommitdiffstats
path: root/tests/zfs-tests
diff options
context:
space:
mode:
authorRyan Moeller <[email protected]>2020-02-24 13:17:55 -0500
committerGitHub <[email protected]>2020-02-24 10:17:55 -0800
commit92bd4cabd615684d1fa476f56e73e0d9edf9a902 (patch)
treefabb9255b784247afec59e209abc64fece494db6 /tests/zfs-tests
parent31a69fbccb06bd1b3b1aaaf59e07a9016cea735d (diff)
ZTS: Misc fixes for FreeBSD
* Force UFS sync before snap in vol rollback tests * rw is not a valid share option on FreeBSD, use ro instead * zfs_unmount_nested: mountpoint is in the pool, rmdir *before* export * Fix some more platform checks * Fix disappearing group in delegate tests * Don't try delegating for jailed, only root can set it Reviewed-by: John Kennedy <[email protected]> Reviewed-by: Brian Behlendorf <[email protected]> Signed-off-by: Ryan Moeller <[email protected]> Closes #10038
Diffstat (limited to 'tests/zfs-tests')
-rw-r--r--tests/zfs-tests/tests/functional/cli_root/zfs_rollback/zfs_rollback_common.kshlib17
-rwxr-xr-xtests/zfs-tests/tests/functional/cli_root/zfs_set/canmount_004_pos.ksh2
-rwxr-xr-xtests/zfs-tests/tests/functional/cli_root/zfs_unmount/zfs_unmount_nested.ksh12
-rw-r--r--tests/zfs-tests/tests/functional/delegate/delegate_common.kshlib2
-rwxr-xr-xtests/zfs-tests/tests/functional/delegate/setup.ksh2
-rwxr-xr-xtests/zfs-tests/tests/functional/delegate/zfs_allow_002_pos.ksh16
-rwxr-xr-xtests/zfs-tests/tests/functional/delegate/zfs_allow_010_pos.ksh3
-rwxr-xr-xtests/zfs-tests/tests/functional/xattr/setup.ksh6
8 files changed, 46 insertions, 14 deletions
diff --git a/tests/zfs-tests/tests/functional/cli_root/zfs_rollback/zfs_rollback_common.kshlib b/tests/zfs-tests/tests/functional/cli_root/zfs_rollback/zfs_rollback_common.kshlib
index f9512a480..b2f4b2b8a 100644
--- a/tests/zfs-tests/tests/functional/cli_root/zfs_rollback/zfs_rollback_common.kshlib
+++ b/tests/zfs-tests/tests/functional/cli_root/zfs_rollback/zfs_rollback_common.kshlib
@@ -83,8 +83,7 @@ function setup_snap_env
# Make sure the ufs|ext filesystem hasn't been mounted,
# then mount the new ufs|ext filesystem.
if ! ismounted $TESTDIR1 $NEWFS_DEFAULT_FS; then
- log_must mount \
- $ZVOL_DEVDIR/$TESTPOOL/$TESTVOL $TESTDIR1
+ log_must mount $ZVOL_DEVDIR/$VOL $TESTDIR1
fi
fi
@@ -127,7 +126,21 @@ function setup_snap_env
log_must lockfs -f $TESTDIR1
fi
fi
+ if is_freebsd && [[ $dtst == $VOL ]]; then
+ # Though sync does start a fs sync on
+ # FreeBSD, it does not wait for it to
+ # finish. We can force a blocking sync
+ # by updating the fs mount instead.
+ # Otherwise, the snapshot might occur
+ # with the fs in an unmountable state.
+ log_must mount -ur \
+ $ZVOL_DEVDIR/$VOL $TESTDIR1
+ fi
log_must zfs snapshot $snap
+ if is_freebsd && [[ $dtst == $VOL ]]; then
+ log_must mount -uw \
+ $ZVOL_DEVDIR/$VOL $TESTDIR1
+ fi
fi
if [[ $createclone == "true" ]]; then
if datasetnonexists $clone; then
diff --git a/tests/zfs-tests/tests/functional/cli_root/zfs_set/canmount_004_pos.ksh b/tests/zfs-tests/tests/functional/cli_root/zfs_set/canmount_004_pos.ksh
index 11be1af3c..e75114efd 100755
--- a/tests/zfs-tests/tests/functional/cli_root/zfs_set/canmount_004_pos.ksh
+++ b/tests/zfs-tests/tests/functional/cli_root/zfs_set/canmount_004_pos.ksh
@@ -44,7 +44,7 @@
verify_runnable "global"
# properties
-set -A sharenfs_prop "off" "on" "rw"
+set -A sharenfs_prop "off" "on" "ro"
set -A sharesmb_prop "off" "on"
function cleanup
diff --git a/tests/zfs-tests/tests/functional/cli_root/zfs_unmount/zfs_unmount_nested.ksh b/tests/zfs-tests/tests/functional/cli_root/zfs_unmount/zfs_unmount_nested.ksh
index 73eae6a25..987ecca31 100755
--- a/tests/zfs-tests/tests/functional/cli_root/zfs_unmount/zfs_unmount_nested.ksh
+++ b/tests/zfs-tests/tests/functional/cli_root/zfs_unmount/zfs_unmount_nested.ksh
@@ -45,20 +45,24 @@ function nesting_cleanup
log_onexit nesting_cleanup
set -A test_depths 30 16 3
+typeset mountpoint=/$TESTPOOL/mnt
dsA32=$(printf 'a/%.0s' {1..32})"a"
log_must zfs create -p $TESTPOOL/$dsA32
dsB32=$(printf 'b/%.0s' {1..32})"b"
log_must zfs create -o mountpoint=none -p $TESTPOOL/$dsB32
-log_mustnot mount -t zfs $TESTPOOL/$dsB32 /mnt
+# FreeBSD's mount command ignores the mountpoint property.
+if ! is_freebsd; then
+ log_mustnot mount -t zfs $TESTPOOL/$dsB32 /mnt
+fi
dsC32=$(printf 'c/%.0s' {1..32})"c"
log_must zfs create -o mountpoint=legacy -p $TESTPOOL/$dsC32
log_must mount -t zfs $TESTPOOL/$dsC32 /mnt
dsD32=$(printf 'd/%.0s' {1..32})"d"
-log_must zfs create -o mountpoint=/$TESTPOOL/mnt -p $TESTPOOL/$dsD32
+log_must zfs create -o mountpoint=$mountpoint -p $TESTPOOL/$dsD32
for d in ${test_depths[@]}; do
@@ -152,7 +156,7 @@ for d in ${test_depths[@]}; do
fi
- # mountpoint=testpool/mnt
+ # mountpoint=/testpool/mnt
ds_pre=$(printf 'd/%.0s' {1..$(($d-2))})"d"
ds=$(printf 'd/%.0s' {1..$(($d-1))})"d"
ds_post=$(printf 'd/%.0s' {1..$(($d))})"d"
@@ -182,8 +186,8 @@ for d in ${test_depths[@]}; do
fi
done
+log_must rmdir $mountpoint # remove the mountpoint we created
log_must zpool export $TESTPOOL
-log_must rmdir /testpool/mnt # remove the mountpoint we created
log_must zpool import $TESTPOOL
log_pass "Verified nested dataset are unmounted."
diff --git a/tests/zfs-tests/tests/functional/delegate/delegate_common.kshlib b/tests/zfs-tests/tests/functional/delegate/delegate_common.kshlib
index 6643f938d..073a39f83 100644
--- a/tests/zfs-tests/tests/functional/delegate/delegate_common.kshlib
+++ b/tests/zfs-tests/tests/functional/delegate/delegate_common.kshlib
@@ -101,7 +101,7 @@ function verify_perm
log_note "Check $type $user $perm $dtst"
if ((ret != 0)) ; then
- log_note "Fail: $user should have $perm " \
+ log_note "Fail: $user should have $perm" \
"on $dtst"
return 1
fi
diff --git a/tests/zfs-tests/tests/functional/delegate/setup.ksh b/tests/zfs-tests/tests/functional/delegate/setup.ksh
index 13d0f3bfb..2f13da750 100755
--- a/tests/zfs-tests/tests/functional/delegate/setup.ksh
+++ b/tests/zfs-tests/tests/functional/delegate/setup.ksh
@@ -33,7 +33,7 @@
. $STF_SUITE/include/libtest.shlib
. $STF_SUITE/tests/functional/delegate/delegate_common.kshlib
-if ! is_linux; then
+if is_illumos; then
# check svc:/network/nis/client:default state
# disable it if the state is ON
# and the state will be restored during cleanup.ksh
diff --git a/tests/zfs-tests/tests/functional/delegate/zfs_allow_002_pos.ksh b/tests/zfs-tests/tests/functional/delegate/zfs_allow_002_pos.ksh
index 23ed806ad..fc603eae1 100755
--- a/tests/zfs-tests/tests/functional/delegate/zfs_allow_002_pos.ksh
+++ b/tests/zfs-tests/tests/functional/delegate/zfs_allow_002_pos.ksh
@@ -50,6 +50,14 @@ function cleanup
{
if id $STAFF_GROUP > /dev/null 2>&1; then
log_must del_user $STAFF_GROUP
+ if is_freebsd; then
+ # pw userdel also deletes the group with the same name
+ # and has no way to opt out of this behavior (yet).
+ # Recreate the group as a workaround.
+ log_must add_group $STAFF_GROUP
+ log_must add_user $STAFF_GROUP $STAFF1
+ log_must add_user $STAFF_GROUP $STAFF2
+ fi
fi
restore_root_datasets
@@ -71,6 +79,14 @@ done
log_must restore_root_datasets
log_must del_user $STAFF_GROUP
+if is_freebsd; then
+ # pw userdel also deletes the group with the same name
+ # and has no way to opt out of this behavior (yet).
+ # Recreate the group as a workaround.
+ log_must add_group $STAFF_GROUP
+ log_must add_user $STAFF_GROUP $STAFF1
+ log_must add_user $STAFF_GROUP $STAFF2
+fi
for dtst in $datasets ; do
log_must zfs allow $STAFF_GROUP $perms $dtst
log_must verify_perm $dtst $perms $STAFF1 $STAFF2
diff --git a/tests/zfs-tests/tests/functional/delegate/zfs_allow_010_pos.ksh b/tests/zfs-tests/tests/functional/delegate/zfs_allow_010_pos.ksh
index 0cba911ab..3a8ef5e62 100755
--- a/tests/zfs-tests/tests/functional/delegate/zfs_allow_010_pos.ksh
+++ b/tests/zfs-tests/tests/functional/delegate/zfs_allow_010_pos.ksh
@@ -93,7 +93,7 @@ elif is_freebsd; then
# Permission Filesystem Volume
#
# Removed for FreeBSD
-# - zoned - spelled "jailed"
+# - jailed - jailing requires superuser privileges
# - sharenfs - sharing requires superuser privileges
# - share - sharing requires superuser privileges
# - xattr - Not supported on FreeBSD
@@ -125,7 +125,6 @@ set -A perms create true false \
clone true true \
rename true true \
promote true true \
- jailed true false \
receive true false \
destroy true true
diff --git a/tests/zfs-tests/tests/functional/xattr/setup.ksh b/tests/zfs-tests/tests/functional/xattr/setup.ksh
index e623cd79b..d9228c426 100755
--- a/tests/zfs-tests/tests/functional/xattr/setup.ksh
+++ b/tests/zfs-tests/tests/functional/xattr/setup.ksh
@@ -32,9 +32,7 @@
# if we're running NIS, turn it off until we clean up
# (it can cause useradd to take a long time, hitting our TIMEOUT)
-if is_linux; then
- USED_NIS=false
-else
+if is_illumos; then
USES_NIS=false
svcs svc:/network/nis/client:default | grep online > /dev/null
if [ $? -eq 0 ]
@@ -42,6 +40,8 @@ else
svcadm disable -t svc:/network/nis/client:default
USES_NIS=true
fi
+else
+ USES_NIS=false
fi
# Make sure we use a brand new user for this