From: Jan Kara Date: Tue, 18 Dec 2012 10:35:50 +0000 (+0100) Subject: xfstests: Use qa_user and qa_group for test 219 X-Git-Tag: v2022.05.01~3556 X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=09584ace12a6c79302fe6e16b6f361322c353951;p=users%2Fhch%2Fxfstests-dev.git xfstests: Use qa_user and qa_group for test 219 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 Reviewed-by: Ben Myers Signed-off-by: Ben Myers --- diff --git a/219 b/219 index ad4e64df1..661fb966e 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 23ec57c12..f45658d4b 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 7be078b35..2e8581e00 100644 --- a/common.rc +++ b/common.rc @@ -942,6 +942,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_group + [ "$?" == "0" ] || _notrun "$qa_group user not defined." +} + _filter_user_do() { perl -ne "