From 21237e916713e1c53c6314cd86ed0742baf4bbbb Mon Sep 17 00:00:00 2001 From: liaoyuxiangqin Date: Sat, 15 Oct 2016 00:33:51 +0800 Subject: [PATCH] Enable quota_002_pos, quota_004_pos and quota_005_pos In this test the 'ls -ls' command was used to print testfile size in blocks. Because the environment variable BLOCK_SIZE was set the 'ls -ls' command detected this and output its block count as the number of 8192 blocks. Rather than change the variable name the -k was was added to force ls to return 1k blocks. This has the additional advantage of behaving consistently across platforms. For additional details on GNU 'ls' behavior regarding block size: https://www.gnu.org/software/coreutils/manual/html_node/Block-size.html Reviewed-by: Brian Behlendorf Signed-off-by: yuxiang Closes #5269 --- tests/runfiles/linux.run | 7 ++----- tests/zfs-tests/tests/functional/quota/quota.kshlib | 4 ++-- tests/zfs-tests/tests/functional/quota/quota_002_pos.ksh | 2 +- tests/zfs-tests/tests/functional/quota/quota_004_pos.ksh | 2 +- 4 files changed, 6 insertions(+), 9 deletions(-) diff --git a/tests/runfiles/linux.run b/tests/runfiles/linux.run index 91babd76e..5764bb8f9 100644 --- a/tests/runfiles/linux.run +++ b/tests/runfiles/linux.run @@ -500,12 +500,9 @@ tests = ['poolversion_001_pos', 'poolversion_002_pos'] #[tests/functional/privilege] #tests = ['privilege_001_pos', 'privilege_002_pos'] -# DISABLED: -# quota_002_pos - size is less than current used or reserved space -# quota_004_pos - size is less than current used or reserved space -# quota_005_pos - size is less than current used or reserved space [tests/functional/quota] -tests = ['quota_001_pos', 'quota_003_pos', 'quota_006_neg'] +tests = ['quota_001_pos', 'quota_002_pos', 'quota_003_pos', + 'quota_004_pos', 'quota_005_pos', 'quota_006_neg'] [tests/functional/raidz] tests = ['raidz_001_neg', 'raidz_002_pos'] diff --git a/tests/zfs-tests/tests/functional/quota/quota.kshlib b/tests/zfs-tests/tests/functional/quota/quota.kshlib index 3805a447b..bde0a37e2 100644 --- a/tests/zfs-tests/tests/functional/quota/quota.kshlib +++ b/tests/zfs-tests/tests/functional/quota/quota.kshlib @@ -60,9 +60,9 @@ function fill_quota [[ $zret -ne $EDQUOT ]] && \ log_fail "Returned error code: $zret. Expected: $EDQUOT." - typeset -i file_size=`$LS -ls $MNTPT/$TESTFILE1 | $AWK '{ print $1 }'` + typeset -i file_size=`$LS -lsk $MNTPT/$TESTFILE1 | $AWK '{ print $1 }'` typeset -i limit=0 - (( file_size = file_size * 512 )) + (( file_size = file_size * 1024 )) (( limit = QUOTA_VALUE + TOLERANCE )) (( file_size > limit )) && \ log_fail "File was created larger than the quota value, aborting!!!" diff --git a/tests/zfs-tests/tests/functional/quota/quota_002_pos.ksh b/tests/zfs-tests/tests/functional/quota/quota_002_pos.ksh index 3b8ba668a..6de5feafb 100755 --- a/tests/zfs-tests/tests/functional/quota/quota_002_pos.ksh +++ b/tests/zfs-tests/tests/functional/quota/quota_002_pos.ksh @@ -42,7 +42,7 @@ # 1) Apply quota to the ZFS file system # 2) Exceed the quota # 3) Attempt to write another file -# 4) Verify the attempt fails with error code 49 (EDQUOTA) +# 4) Verify the attempt fails with error code EDQUOTA (linux 122, others 49) # # diff --git a/tests/zfs-tests/tests/functional/quota/quota_004_pos.ksh b/tests/zfs-tests/tests/functional/quota/quota_004_pos.ksh index def8b2b37..50106cad7 100755 --- a/tests/zfs-tests/tests/functional/quota/quota_004_pos.ksh +++ b/tests/zfs-tests/tests/functional/quota/quota_004_pos.ksh @@ -42,7 +42,7 @@ # 1) Apply quota to the ZFS file system dataset # 2) Exceed the quota # 3) Attempt to write another file -# 4) Verify the attempt fails with error code 49 (EDQUOTA) +# 4) Verify the attempt fails with error code EDQUOTA (linux 122, others 49) # # -- 2.40.0