xfs
[Top] [All Lists]

[PATCH] Use qa_user and qa_group for test 219

To: xfs@xxxxxxxxxxx
Subject: [PATCH] Use qa_user and qa_group for test 219
From: Jan Kara <jack@xxxxxxx>
Date: Tue, 18 Dec 2012 12:33:55 +0100
Cc: Jan Kara <jack@xxxxxxx>
Test 219 requires a special user. Use $qa_user and $qa_group (added in this
patch) for that purpose instead of hardcoded uid & gid. This also fixes
a false failure when repquota does not report quota for users not in passwd.

Signed-off-by: Jan Kara <jack@xxxxxxx>
---
 219       |   19 +++++++++----------
 219.out   |   12 ------------
 common.rc |    9 +++++++++
 3 files changed, 18 insertions(+), 22 deletions(-)

diff --git a/219 b/219
index ad4e64d..661fb96 100755
--- a/219
+++ b/219
@@ -45,16 +45,18 @@ _supported_fs generic
 _supported_os Linux #IRIX
 _require_scratch
 _require_quota
+_require_user
+_require_group
 
 test_files()
 {
        echo; echo "### create files, setting up ownership (type=$type)"
        rm -f $SCRATCH_MNT/{buffer,direct,mmap}
        touch $SCRATCH_MNT/{buffer,direct,mmap}
-       chown $uid $SCRATCH_MNT/{buffer,direct,mmap}
-       chgrp $gid $SCRATCH_MNT/{buffer,direct,mmap}
+       chown $qa_user $SCRATCH_MNT/{buffer,direct,mmap}
+       chgrp $qa_group $SCRATCH_MNT/{buffer,direct,mmap}
        for file in $SCRATCH_MNT/{buffer,direct,mmap}; do
-               $here/src/lstat64 $file | head -3 | _filter_scratch
+               $here/src/lstat64 $file | head -2 | _filter_scratch
        done
 }
 
@@ -91,23 +93,20 @@ test_accounting()
        echo "--- completed parallel IO ($type)" >>$seq.full
 
        for file in $SCRATCH_MNT/{buffer,direct,mmap}; do
-               $here/src/lstat64 $file | head -3 | _filter_scratch
+               $here/src/lstat64 $file | head -2 | _filter_scratch
        done
 
        if [ $type == 'u' ]; then
-               id=$uid
+               id=$qa_user
        else
-               id=$gid
+               id=$qa_group
        fi
-       repquota -$type -n $SCRATCH_MNT  | grep "^#$id" | check_usage 144 3
+       repquota -$type $SCRATCH_MNT | grep "^$id" | check_usage 144 3
 }
 
 # real QA test starts here
 rm -f $seq.full
 
-uid=1
-gid=2
-
 umount $SCRATCH_DEV 2>/dev/null
 _scratch_mkfs >> $seq.full 2>&1
 _scratch_mount "-o usrquota,grpquota"
diff --git a/219.out b/219.out
index 23ec57c..f45658d 100644
--- a/219.out
+++ b/219.out
@@ -5,23 +5,17 @@ QA output created by 219
 ### create files, setting up ownership (type=u)
   File: "SCRATCH_MNT/buffer"
   Size: 0            Filetype: Regular File
-  Mode: (0644/-rw-r--r--)         Uid: (1)  Gid: (2)
   File: "SCRATCH_MNT/direct"
   Size: 0            Filetype: Regular File
-  Mode: (0644/-rw-r--r--)         Uid: (1)  Gid: (2)
   File: "SCRATCH_MNT/mmap"
   Size: 0            Filetype: Regular File
-  Mode: (0644/-rw-r--r--)         Uid: (1)  Gid: (2)
 ### some controlled buffered, direct and mmapd IO (type=u)
   File: "SCRATCH_MNT/buffer"
   Size: 49152        Filetype: Regular File
-  Mode: (0644/-rw-r--r--)         Uid: (1)  Gid: (2)
   File: "SCRATCH_MNT/direct"
   Size: 49152        Filetype: Regular File
-  Mode: (0644/-rw-r--r--)         Uid: (1)  Gid: (2)
   File: "SCRATCH_MNT/mmap"
   Size: 49152        Filetype: Regular File
-  Mode: (0644/-rw-r--r--)         Uid: (1)  Gid: (2)
 Usage OK (type=u)
 
 ### test group accounting
@@ -29,21 +23,15 @@ Usage OK (type=u)
 ### create files, setting up ownership (type=g)
   File: "SCRATCH_MNT/buffer"
   Size: 0            Filetype: Regular File
-  Mode: (0644/-rw-r--r--)         Uid: (1)  Gid: (2)
   File: "SCRATCH_MNT/direct"
   Size: 0            Filetype: Regular File
-  Mode: (0644/-rw-r--r--)         Uid: (1)  Gid: (2)
   File: "SCRATCH_MNT/mmap"
   Size: 0            Filetype: Regular File
-  Mode: (0644/-rw-r--r--)         Uid: (1)  Gid: (2)
 ### some controlled buffered, direct and mmapd IO (type=g)
   File: "SCRATCH_MNT/buffer"
   Size: 49152        Filetype: Regular File
-  Mode: (0644/-rw-r--r--)         Uid: (1)  Gid: (2)
   File: "SCRATCH_MNT/direct"
   Size: 49152        Filetype: Regular File
-  Mode: (0644/-rw-r--r--)         Uid: (1)  Gid: (2)
   File: "SCRATCH_MNT/mmap"
   Size: 49152        Filetype: Regular File
-  Mode: (0644/-rw-r--r--)         Uid: (1)  Gid: (2)
 Usage OK (type=g)
diff --git a/common.rc b/common.rc
index 602513a..f22a328 100644
--- a/common.rc
+++ b/common.rc
@@ -937,6 +937,15 @@ _require_user()
     [ "$?" == "0" ] || _notrun "$qa_user cannot execute commands."
 }
 
+# check for the fsgqa group on the machine
+#
+_require_group()
+{
+    qa_group=fsgqa
+    _cat_group | grep -q $qa_user
+    [ "$?" == "0" ] || _notrun "$qa_user user not defined."
+}
+
 _filter_user_do()
 {
         perl -ne "
-- 
1.7.1

<Prev in Thread] Current Thread [Next in Thread>