Skip to contentSkip to conversation

common/quota: sort lines of repquota output

PATCH New Zorro Lang 1 participant 1 message May 20, 2018

lore
Share & tools
lore

Zorro Lang

author
#0 lore raw

PATCH 1/1 common/quota: sort lines of repquota output

The golden image of some cases (e.g: generic/305 generic/326 generic/327 generic/328 xfs/214 xfs/330 and xfs/440) depend on the output of repquota() function.

When it reports multi-users, we can't control the order of lines, then always hit failures likes:

...
Create the original files
-root 3072 0 0
nobody 0 0 0
fsgqa 0 0 0
+root 3072 0 0
...

So sort the lines to make sure it won't break the golden image.

---
 common/quota  | 4 ++--
 tests/xfs/330 | 2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)
common/quota +2 -2
index f01bd068..68c350ee 100644
@@ -308,12 +308,12 @@ _check_quota_usage()
 
 # Report the block usage of root, $qa_user, and nobody
 _report_quota_blocks() {
-	repquota $1 | egrep "^($qa_user|root|nobody)" | awk '{print $1, $3, $4, $5}'
+	repquota $1 | egrep "^($qa_user|root|nobody)" | awk '{print $1, $3, $4, $5}' | sort -r
 }
 
 # Report the inode usage of root, $qa_user, and nobody
 _report_quota_inodes() {
-	repquota $1 | egrep "^($qa_user|root|nobody)" | awk '{print $1, $6, $7, $8}'
+	repquota $1 | egrep "^($qa_user|root|nobody)" | awk '{print $1, $6, $7, $8}' | sort -r
 }
 
 # make sure this script returns success
tests/xfs/330 +1 -1
index 8260bdda..d49f2723 100755
@@ -53,7 +53,7 @@ _require_nobody
 
 do_repquota()
 {
-	repquota $SCRATCH_MNT | egrep '^(fsgqa|root|nobody)'
+	repquota $SCRATCH_MNT | egrep '^(fsgqa|root|nobody)' | sort -r
 }
 
 rm -f "$seqres.full"
Signature · 1 line
2.14.3