diff options
author | Ryan Moeller <[email protected]> | 2020-02-25 19:23:27 -0500 |
---|---|---|
committer | GitHub <[email protected]> | 2020-02-25 16:23:27 -0800 |
commit | 3a192f7d898e78dfdf5c2f7b2dd983b23eaf25f6 (patch) | |
tree | dc5ceb33acd66f834e958c34af33bc1fe3e8bb9c | |
parent | a33cb7e01a72a1b04b75c83607f235438df9281f (diff) |
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 <[email protected]>
Reviewed-by: Brian Behlendorf <[email protected]>
Signed-off-by: Ryan Moeller <[email protected]>
Closes #10047
8 files changed, 35 insertions, 26 deletions
diff --git a/tests/zfs-tests/include/libtest.shlib b/tests/zfs-tests/include/libtest.shlib index 81c4067ea..76743003e 100644 --- a/tests/zfs-tests/include/libtest.shlib +++ b/tests/zfs-tests/include/libtest.shlib @@ -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 diff --git a/tests/zfs-tests/tests/functional/atime/atime_common.kshlib b/tests/zfs-tests/tests/functional/atime/atime_common.kshlib index 90e2de067..fce85c379 100644 --- a/tests/zfs-tests/tests/functional/atime/atime_common.kshlib +++ b/tests/zfs-tests/tests/functional/atime/atime_common.kshlib @@ -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 diff --git a/tests/zfs-tests/tests/functional/cli_root/zfs_create/zfs_create_008_neg.ksh b/tests/zfs-tests/tests/functional/cli_root/zfs_create/zfs_create_008_neg.ksh index 684ebdb85..43c3ab0de 100755 --- a/tests/zfs-tests/tests/functional/cli_root/zfs_create/zfs_create_008_neg.ksh +++ b/tests/zfs-tests/tests/functional/cli_root/zfs_create/zfs_create_008_neg.ksh @@ -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 diff --git a/tests/zfs-tests/tests/functional/cli_root/zpool_create/zpool_create_023_neg.ksh b/tests/zfs-tests/tests/functional/cli_root/zpool_create/zpool_create_023_neg.ksh index 48117555a..0f43db45b 100755 --- a/tests/zfs-tests/tests/functional/cli_root/zpool_create/zpool_create_023_neg.ksh +++ b/tests/zfs-tests/tests/functional/cli_root/zpool_create/zpool_create_023_neg.ksh @@ -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 diff --git a/tests/zfs-tests/tests/functional/cli_root/zpool_import/zpool_import_013_neg.ksh b/tests/zfs-tests/tests/functional/cli_root/zpool_import/zpool_import_013_neg.ksh index 0a221b8e0..7fef6254f 100755 --- a/tests/zfs-tests/tests/functional/cli_root/zpool_import/zpool_import_013_neg.ksh +++ b/tests/zfs-tests/tests/functional/cli_root/zpool_import/zpool_import_013_neg.ksh @@ -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" diff --git a/tests/zfs-tests/tests/functional/cli_user/misc/zdb_001_neg.ksh b/tests/zfs-tests/tests/functional/cli_user/misc/zdb_001_neg.ksh index 579ab1294..3adfc59f5 100755 --- a/tests/zfs-tests/tests/functional/cli_user/misc/zdb_001_neg.ksh +++ b/tests/zfs-tests/tests/functional/cli_user/misc/zdb_001_neg.ksh @@ -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" diff --git a/tests/zfs-tests/tests/functional/cli_user/misc/zfs_001_neg.ksh b/tests/zfs-tests/tests/functional/cli_user/misc/zfs_001_neg.ksh index 46171caf9..bfe8cf4bb 100755 --- a/tests/zfs-tests/tests/functional/cli_user/misc/zfs_001_neg.ksh +++ b/tests/zfs-tests/tests/functional/cli_user/misc/zfs_001_neg.ksh @@ -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" diff --git a/tests/zfs-tests/tests/functional/inheritance/inherit_001_pos.ksh b/tests/zfs-tests/tests/functional/inheritance/inherit_001_pos.ksh index b1c24fa3a..7c5b81287 100755 --- a/tests/zfs-tests/tests/functional/inheritance/inherit_001_pos.ksh +++ b/tests/zfs-tests/tests/functional/inheritance/inherit_001_pos.ksh @@ -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 |