aboutsummaryrefslogtreecommitdiffstats
path: root/tests/zfs-tests
diff options
context:
space:
mode:
authorLOLi <[email protected]>2017-11-29 20:59:22 +0100
committerBrian Behlendorf <[email protected]>2017-11-29 11:59:22 -0800
commited15d544812eb720d2fbec55d27e749d7a805bf6 (patch)
tree9d27c0662980067e11e95c1b96e3366f291fa40d /tests/zfs-tests
parent56d8d8ace4724bde16145be25b75d8f551961813 (diff)
Fix 'zfs get {user|group}objused@' functionality
Fix a regression accidentally introduced in 1b81ab4 that prevents 'zfs get {user|group}objused@' from correctly reporting the requested value. Update "userspace_003_pos.ksh" and "groupspace_003_pos.ksh" to verify this functionality. Reviewed-by: Brian Behlendorf <[email protected]> Reviewed-by: George Melikov <[email protected]> Reviewed-by: Giuseppe Di Natale <[email protected]> Signed-off-by: loli10K <[email protected]> Closes #6908
Diffstat (limited to 'tests/zfs-tests')
-rwxr-xr-xtests/zfs-tests/tests/functional/userquota/groupspace_003_pos.ksh14
-rwxr-xr-xtests/zfs-tests/tests/functional/userquota/userspace_003_pos.ksh10
2 files changed, 18 insertions, 6 deletions
diff --git a/tests/zfs-tests/tests/functional/userquota/groupspace_003_pos.ksh b/tests/zfs-tests/tests/functional/userquota/groupspace_003_pos.ksh
index 5f5965b64..56b7af031 100755
--- a/tests/zfs-tests/tests/functional/userquota/groupspace_003_pos.ksh
+++ b/tests/zfs-tests/tests/functional/userquota/groupspace_003_pos.ksh
@@ -30,6 +30,7 @@
#
. $STF_SUITE/include/libtest.shlib
+. $STF_SUITE/include/math.shlib
. $STF_SUITE/tests/functional/userquota/userquota_common.kshlib
#
@@ -56,10 +57,15 @@ function cleanup
function group_object_count
{
typeset fs=$1
- typeset user=$2
- typeset cnt=$(zfs groupspace -oname,objused $fs | grep $user |
- awk '{print $2}')
- echo $cnt
+ typeset group=$2
+ typeset -i groupspacecnt=$(zfs groupspace -oname,objused $fs |
+ awk /$group/'{print $2}')
+ typeset -i zfsgetcnt=$(zfs get -H -ovalue groupobjused@$group $fs)
+
+ # 'zfs groupspace' and 'zfs get groupobjused@' should be equal
+ verify_eq "$groupspacecnt" "$zfsgetcnt" "groupobjused@$group"
+
+ echo $groupspacecnt
}
log_onexit cleanup
diff --git a/tests/zfs-tests/tests/functional/userquota/userspace_003_pos.ksh b/tests/zfs-tests/tests/functional/userquota/userspace_003_pos.ksh
index 671e144b0..96c3b1930 100755
--- a/tests/zfs-tests/tests/functional/userquota/userspace_003_pos.ksh
+++ b/tests/zfs-tests/tests/functional/userquota/userspace_003_pos.ksh
@@ -30,6 +30,7 @@
#
. $STF_SUITE/include/libtest.shlib
+. $STF_SUITE/include/math.shlib
. $STF_SUITE/tests/functional/userquota/userquota_common.kshlib
#
@@ -58,9 +59,14 @@ function user_object_count
{
typeset fs=$1
typeset user=$2
- typeset cnt=$(zfs userspace -oname,objused $fs |
+ typeset -i userspacecnt=$(zfs userspace -oname,objused $fs |
awk /$user/'{print $2}')
- echo $cnt
+ typeset -i zfsgetcnt=$(zfs get -H -ovalue userobjused@$user $fs)
+
+ # 'zfs userspace' and 'zfs get userobjused@' should be equal
+ verify_eq "$userspacecnt" "$zfsgetcnt" "userobjused@$user"
+
+ echo $userspacecnt
}
log_onexit cleanup