diff options
author | Ryan Moeller <[email protected]> | 2020-04-06 19:07:35 -0400 |
---|---|---|
committer | GitHub <[email protected]> | 2020-04-06 16:07:35 -0700 |
commit | 4a21ec056016bb5738721543af933a8eed2308fb (patch) | |
tree | fdd614cecd284de43e182f4c90f87ecae521bf1d | |
parent | 5a42ef04fd390dc96fbbf31bc9f3d05695998211 (diff) |
ZTS: Fix non-portable date format
The delegate tests use `date(1)` to generate snapshot names, using
the format '%F-%T-%N' to get nanosecond resolution (since multiple
snapshots may be taken in the same second). '%N' is not portable, and
causes tests to fail on FreeBSD.
Since the only purpose these timestamps serve is to create a unique
name, simply use $RANDOM instead.
Reviewed-by: John Kennedy <[email protected]>
Reviewed-by: Brian Behlendorf <[email protected]>
Signed-off-by: Ryan Moeller <[email protected]>
Closes #10170
-rw-r--r-- | tests/zfs-tests/tests/functional/delegate/delegate_common.kshlib | 34 | ||||
-rwxr-xr-x | tests/zfs-tests/tests/functional/delegate/zfs_allow_009_neg.ksh | 1 |
2 files changed, 17 insertions, 18 deletions
diff --git a/tests/zfs-tests/tests/functional/delegate/delegate_common.kshlib b/tests/zfs-tests/tests/functional/delegate/delegate_common.kshlib index 073a39f83..e39b015b2 100644 --- a/tests/zfs-tests/tests/functional/delegate/delegate_common.kshlib +++ b/tests/zfs-tests/tests/functional/delegate/delegate_common.kshlib @@ -379,7 +379,7 @@ function verify_send typeset dtst=$3 typeset oldval - typeset stamp=${perm}.${user}.$(date +'%F-%T-%N') + typeset stamp=${perm}.${user}.$RANDOM typeset snap=$dtst@snap.$stamp typeset -i ret=1 @@ -408,7 +408,7 @@ function verify_fs_receive typeset fs=$3 typeset dtst - typeset stamp=${perm}.${user}.$(date +'%F-%T-%N') + typeset stamp=${perm}.${user}.$RANDOM typeset newfs=$fs/newfs.$stamp typeset newvol=$fs/newvol.$stamp typeset bak_user=$TEST_BASE_DIR/bak.$user.$stamp @@ -480,7 +480,7 @@ function verify_userprop typeset perm=$2 typeset dtst=$3 - typeset stamp=${perm}.${user}.$(date +'%F-%T-%N') + typeset stamp=${perm}.${user}.$RANDOM user_run $user zfs set "$user:ts=$stamp" $dtst zpool sync ${dtst%%/*} @@ -565,7 +565,7 @@ function verify_fs_create typeset perm=$2 typeset fs=$3 - typeset stamp=${perm}.${user}.$(date +'%F-%T-%N') + typeset stamp=${perm}.${user}.$RANDOM typeset newfs=$fs/nfs.$stamp typeset newvol=$fs/nvol.$stamp @@ -693,7 +693,7 @@ function verify_fs_snapshot typeset perm=$2 typeset fs=$3 - typeset stamp=${perm}.${user}.$(date +'%F-%T-%N') + typeset stamp=${perm}.${user}.$RANDOM typeset snap=$fs@snap.$stamp typeset mntpt=$(get_prop mountpoint $fs) @@ -737,7 +737,7 @@ function verify_fs_rollback typeset fs=$3 typeset oldval - typeset stamp=${perm}.${user}.$(date +'%F-%T-%N') + typeset stamp=${perm}.${user}.$RANDOM typeset snap=$fs@snap.$stamp typeset mntpt=$(get_prop mountpoint $fs) @@ -770,7 +770,7 @@ function verify_fs_clone typeset perm=$2 typeset fs=$3 - typeset stamp=${perm}.${user}.$(date +'%F-%T-%N') + typeset stamp=${perm}.${user}.$RANDOM typeset basefs=${fs%/*} typeset snap=$fs@snap.$stamp typeset clone=$basefs/cfs.$stamp @@ -815,7 +815,7 @@ function verify_fs_rename typeset perm=$2 typeset fs=$3 - typeset stamp=${perm}.${user}.$(date +'%F-%T-%N') + typeset stamp=${perm}.${user}.$RANDOM typeset basefs=${fs%/*} typeset snap=$fs@snap.$stamp typeset renamefs=$basefs/nfs.$stamp @@ -898,7 +898,7 @@ function verify_fs_mount typeset perm=$2 typeset fs=$3 - typeset stamp=${perm}.${user}.$(date +'%F-%T-%N') + typeset stamp=${perm}.${user}.$RANDOM typeset mntpt=$(get_prop mountpoint $fs) typeset newmntpt=$TEST_BASE_DIR/mnt.$stamp @@ -966,7 +966,7 @@ function verify_fs_mountpoint typeset perm=$2 typeset fs=$3 - typeset stamp=${perm}.${user}.$(date +'%F-%T-%N') + typeset stamp=${perm}.${user}.$RANDOM typeset mntpt=$(get_prop mountpoint $fs) typeset newmntpt=$TEST_BASE_DIR/mnt.$stamp @@ -1005,7 +1005,7 @@ function verify_fs_promote typeset perm=$2 typeset fs=$3 - typeset stamp=${perm}.${user}.$(date +'%F-%T-%N') + typeset stamp=${perm}.${user}.$RANDOM typeset basefs=${fs%/*} typeset snap=$fs@snap.$stamp typeset clone=$basefs/cfs.$stamp @@ -1061,7 +1061,7 @@ function verify_fs_canmount typeset fs=$3 typeset oldval - typeset stamp=${perm}.${user}.$(date +'%F-%T-%N') + typeset stamp=${perm}.${user}.$RANDOM if ! ismounted $fs ; then set -A modes "on" "off" @@ -1372,7 +1372,7 @@ function verify_vol_snapshot typeset perm=$2 typeset vol=$3 - typeset stamp=${perm}.${user}.$(date +'%F-%T-%N') + typeset stamp=${perm}.${user}.$RANDOM typeset basevol=${vol%/*} typeset snap=$vol@snap.$stamp @@ -1397,7 +1397,7 @@ function verify_vol_rollback typeset perm=$2 typeset vol=$3 - typeset stamp=${perm}.${user}.$(date+'%F-%T-%N') + typeset stamp=${perm}.${user}.$RANDOM typeset basevol=${vol%/*} typeset snap=$vol@snap.$stamp @@ -1432,7 +1432,7 @@ function verify_vol_clone typeset perm=$2 typeset vol=$3 - typeset stamp=${perm}.${user}.$(date+'%F-%T-%N') + typeset stamp=${perm}.${user}.$RANDOM typeset basevol=${vol%/*} typeset snap=$vol@snap.$stamp typeset clone=$basevol/cvol.$stamp @@ -1478,7 +1478,7 @@ function verify_vol_rename typeset perm=$2 typeset vol=$3 - typeset stamp=${perm}.${user}.$(date+'%F-%T-%N') + typeset stamp=${perm}.${user}.$RANDOM typeset basevol=${vol%/*} typeset snap=$vol@snap.$stamp typeset clone=$basevol/cvol.$stamp @@ -1525,7 +1525,7 @@ function verify_vol_promote typeset perm=$2 typeset vol=$3 - typeset stamp=${perm}.${user}.$(date+'%F-%T-%N') + typeset stamp=${perm}.${user}.$RANDOM typeset basevol=${vol%/*} typeset snap=$vol@snap.$stamp typeset clone=$basevol/cvol.$stamp diff --git a/tests/zfs-tests/tests/functional/delegate/zfs_allow_009_neg.ksh b/tests/zfs-tests/tests/functional/delegate/zfs_allow_009_neg.ksh index 45fdb5b85..a6f12244c 100755 --- a/tests/zfs-tests/tests/functional/delegate/zfs_allow_009_neg.ksh +++ b/tests/zfs-tests/tests/functional/delegate/zfs_allow_009_neg.ksh @@ -51,7 +51,6 @@ longset="set123456789012345678901234567890123456789012345678901234567890123" for dtst in $DATASETS ; do log_mustnot eval "zfs allow -s @$longset $dtst" # Create non-existent permission set - typeset timestamp=$(date +'%F-%R:%S') log_mustnot zfs allow -s @non-existent $dtst log_mustnot zfs allow $STAFF "atime,created,mounted" $dtst log_mustnot zfs allow $dtst $TESTPOOL |