ZTS: Misc fixes for FreeBSD

* Check for mountd in is_shared to avoid timeout when not running
* Enhance robustness of some cleanup functions
* Simplify atime lookup
* Skip sharenfs validation for now
* Don't add mountpoint property to inheritance validation on FreeBSD

Reviewed-by: John Kennedy <john.kennedy@delphix.com>
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Ryan Moeller <ryan@iXsystems.com>
Closes #10047
This commit is contained in:
Ryan Moeller 2020-02-25 19:23:27 -05:00 committed by GitHub
parent a33cb7e01a
commit 3a192f7d89
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 35 additions and 26 deletions

View File

@ -1328,7 +1328,7 @@ function is_shared_freebsd
{
typeset fs=$1
showmount -E | grep -qx $fs
pgrep -q mountd && showmount -E | grep -qx $fs
}
function is_shared_illumos

View File

@ -48,7 +48,7 @@ function check_atime_updated
typeset before=$(stat -c %X $filename)
sleep 2
elif is_freebsd; then
typeset before=$(ls -luD "%Y-%m-%d %R.%s" $filename | awk '{print $7}')
typeset before=$(stat -f %a $filename)
sleep 2
else
typeset before=$(ls -Eu $filename | awk '{print $7}')
@ -59,7 +59,7 @@ function check_atime_updated
if is_linux; then
typeset after=$(stat -c %X $filename)
elif is_freebsd; then
typeset after=$(ls -luD "%Y-%m-%d %R.%s" $filename | awk '{print $7}')
typeset after=$(stat -f %a $filename)
else
typeset after=$(ls -Eu $filename | awk '{print $7}')
fi

View File

@ -97,8 +97,16 @@ log_assert "'zfs create' should return an error with badly-formed parameters."
typeset -i i=0
while [[ $i -lt ${#args[*]} ]]; do
log_mustnot zfs create ${args[i]} $TESTPOOL/$TESTFS1
log_mustnot zfs create -p ${args[i]} $TESTPOOL/$TESTFS1
typeset arg=${args[i]}
if is_freebsd; then
# FreeBSD does not strictly validate share options (yet).
if [[ "$arg" == "-o sharenfs="* ]]; then
((i = i + 1))
continue
fi
fi
log_mustnot zfs create $arg $TESTPOOL/$TESTFS1
log_mustnot zfs create -p $arg $TESTPOOL/$TESTFS1
((i = i + 1))
done

View File

@ -81,7 +81,15 @@ log_assert "'zpool create -O' should return an error with badly formed parameter
typeset -i i=0
while (( $i < ${#args[*]} )); do
log_mustnot zpool create -O ${args[i]} -f $TESTPOOL $DISKS
typeset arg=${args[i]}
if is_freebsd; then
# FreeBSD does not strictly validate share opts (yet).
if [[ $arg == "-o sharenfs="* ]]; then
((i = i + 1))
continue
fi
fi
log_mustnot zpool create -O $arg -f $TESTPOOL $DISKS
((i = i + 1))
done

View File

@ -60,9 +60,8 @@ function uncompress_pool
function cleanup
{
poolexists $POOL_NAME && log_must zpool destroy $POOL_NAME
[[ -e /$TESTPOOL/$POOL_FILE ]] && rm /$TESTPOOL/$POOL_FILE
return 0
poolexists $POOL_NAME && destroy_pool $POOL_NAME
rm -f /$TESTPOOL/$POOL_FILE
}
log_assert "'zpool import' fails for pool that was not cleanly exported"

View File

@ -56,11 +56,7 @@ function check_zdb
function cleanup
{
if [ -e $TEST_BASE_DIR/zdb_001_neg.$$.txt ]
then
rm $TEST_BASE_DIR/zdb_001_neg.$$.txt
fi
rm -f $TEST_BASE_DIR/zdb_001_neg.$$.txt $TEST_BASE_DIR/zdb.$$
}
verify_runnable "global"

View File

@ -44,10 +44,7 @@
function cleanup
{
if [ -e "$TEMPFILE" ]
then
rm -f "$TEMPFILE"
fi
rm -f "$TEMPFILE"
}
log_onexit cleanup
@ -55,7 +52,7 @@ log_assert "zfs shows a usage message when run as a user"
TEMPFILE="$TEST_BASE_DIR/zfs_001_neg.$$.txt"
eval "zfs > $TEMPFILE 2>&1"
zfs > $TEMPFILE 2>&1
log_must grep "usage: zfs command args" "$TEMPFILE"
log_must eval "awk '{if (length(\$0) > 80) exit 1}' < $TEMPFILE"

View File

@ -406,14 +406,15 @@ if is_linux; then
def_val+=("off")
local_val+=("off")
else
prop+=("aclmode" "" \
"mountpoint" "")
def_val+=("discard" \
"")
local_val+=("groupmask" \
"$TESTDIR")
prop+=("aclmode" "")
def_val+=("discard")
local_val+=("groupmask")
fi
if is_illumos; then
prop+=("mountpoint" "")
def_val+=("")
local_val+=("$TESTDIR")
fi
#
# Global flag indicating whether the default record size had been