From: Lai Siyao Date: Sat, 30 Sep 2023 20:10:54 +0000 (-0400) Subject: LU-17171 test: improve sanity-quota test_41 X-Git-Tag: 2.15.59~45 X-Git-Url: https://git.whamcloud.com/?a=commitdiff_plain;h=a504f2c869bada922c6211822be432b253921096;p=fs%2Flustre-release.git LU-17171 test: improve sanity-quota test_41 On zfs backend, df result of project quota may print be a slightly larger block used than quota result because the former is calcuated in filesystem block size which is 4K. Update sanity-quota test_41 to make it more robust. Test-Parameters: trivial testlist=sanity-quota fstype=zfs Signed-off-by: Lai Siyao Change-Id: Ide51d9aaeb8907eb77acc30fa4fc76dcc16e8de0 Reviewed-on: https://review.whamcloud.com/c/fs/lustre-release/+/52591 Reviewed-by: Andreas Dilger Reviewed-by: Hongchao Zhang Reviewed-by: Oleg Drokin Tested-by: Maloo Tested-by: jenkins --- diff --git a/lustre/tests/sanity-quota.sh b/lustre/tests/sanity-quota.sh index c2a903a..c643f09 100755 --- a/lustre/tests/sanity-quota.sh +++ b/lustre/tests/sanity-quota.sh @@ -3882,14 +3882,21 @@ test_41() { df -kP $dir; df -iP $dir local bused=$(getquota -p $projid global curspace) local iused=$(getquota -p $projid global curinodes) - # note trailing space to match double printf from awk - local expected="$blimit $bused $ilimit $iused " + local expected="$ilimit$iused" wait_update $HOSTNAME \ - "{ df -kP $dir; df -iP $dir; } | - awk '/$FSNAME/ { printf \\\"%d %d \\\", \\\$2,\\\$3 }'" \ + "df -iP $dir | awk \\\"/$FSNAME/\\\"'{print \\\$2 \\\$3}'" \ "$expected" || error "failed to get correct statfs for project quota" + + expected=$(df -kP $dir | awk "/$FSNAME/"' {print $2}') + (( expected == blimit )) || + error "blimit mismatch: $expected != $blimit" + + # zfs block size is 4K, while quota is printed in 1K, df result may be + # larger than quota result, but it's no more than 3K + expected=$(df -kP $dir | awk "/$FSNAME/"' {print $3}') + (( expected - bused < 4)) || error "bused mismatch: $expected != $bused" } run_test 41 "df should return projid-specific values"