xfstests: optionally run all tests under quota
authorEric Sandeen <sandeen@redhat.com>
Tue, 9 Feb 2010 19:26:31 +0000 (19:26 +0000)
committerRich Johnston <rjohnston@sgi.com>
Fri, 26 Oct 2012 15:39:23 +0000 (10:39 -0500)
This patch might be a little heavy handed, but it seems to
work; if you set USE_QUOTA=1 in your environment, all
tests should be run with quota on and enabled.

This will hopefully help shake out some of the ext4
quota problems, although one needs to keep an eye
on the console to see whether warnings scroll by.

Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Reviewed-by: Rich Johnston <rjohnston@sgi.com>
Signed-off-by: Rich Johnston <rjohnston@sgi.com>
common.rc

index f7c16887c11f2a1c066053220ed433d131da1c02..bfc63928315705e46a449f31a7bbb87c21b9587b 100644 (file)
--- a/common.rc
+++ b/common.rc
@@ -100,6 +100,9 @@ _mount_opts()
     *)
        ;;
     esac
+    if [ ! -z "$USE_QUOTA" ]; then
+       export MOUNT_OPTIONS="$MOUNT_OPTIONS -o usrquota,grpquota"
+    fi
 }
 
 _mkfs_opts()
@@ -200,6 +203,10 @@ _test_options()
     type=$1
     TEST_OPTIONS=""
 
+    if [ ! -z "$USE_QUOTA" ]; then
+       TEST_OPTIONS="-o usrquota,grpquota"
+    fi
+
     if [ "$FSTYP" != "xfs" ]; then
         return
     fi
@@ -241,6 +248,25 @@ _mount_ops_filter()
 
 }
 
+_setup_quota()
+{
+    mountpoint=$1
+    if [ ! -z "$USE_QUOTA" ]; then
+       case $FSTYP in
+       xfs)
+           ;;
+       ext*|reiserfs)
+           quotaoff $mountpoint &>/dev/null
+           quotacheck -u -g $mountpoint
+           quotaon $mountpoint
+           ;;
+       *)
+           _fail "Don't know how to turn on quota on $FSTYP"
+           ;;
+       esac
+    fi
+}
+
 _scratch_mount_options()
 {
     _scratch_options mount
@@ -251,6 +277,7 @@ _scratch_mount_options()
 _scratch_mount()
 {
     _mount -t $FSTYP `_scratch_mount_options $*`
+    _setup_quota $SCRATCH_MNT
 }
 
 _scratch_unmount()
@@ -268,6 +295,7 @@ _test_mount()
 {
     _test_options mount
     _mount -t $FSTYP $TEST_OPTIONS $TEST_FS_MOUNT_OPTS $SELINUX_MOUNT_OPTIONS $* $TEST_DEV $TEST_DIR
+    _setup_quota $TEST_DIR
 }
 
 _scratch_mkfs_options()