xfstests: ensure selinux xattrs don't interfere with quota tests
authorEric Sandeen <sandeen@sandeen.net>
Mon, 4 Apr 2011 18:49:19 +0000 (13:49 -0500)
committerEric Sandeen <sandeen@sandeen.net>
Mon, 4 Apr 2011 18:49:19 +0000 (13:49 -0500)
219 and 235 were failing on ext3 with selinux, because the extra
xattrs upped the quota usage.

Do the same trick we've used in the past to mount with an selinux
global context when doing quota tests.

Note the gross hack for remount,ro, though.

Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Alex Elder <aelder@sgi.com>
235
common.quota

diff --git a/235 b/235
index 5d9c7c0f1e921a814aa529f46d88fdbd6e15d247..7150fca1e099fe0a84341c83ceea6dc7131d2b9d 100755 (executable)
--- a/235
+++ b/235
@@ -61,6 +61,11 @@ chown $qa_user:$qa_user $SCRATCH_MNT/testfile
 
 repquota -u -g $SCRATCH_MNT  | grep -v "^root" | _filter_scratch
 
+# XXX This is a nasty hack.  remount doesn't work on a fileystem
+# with a context; see https://bugzilla.redhat.com/show_bug.cgi?id=563267
+#
+# We work around it by editing the context out of mtab.  Sigh.
+sed -i "s#^$SCRATCH_DEV\(.*\),context=\"system_u:object_r:nfs_t:s0\"#$SCRATCH_DEV\1#" /etc/mtab
 mount -o remount,ro $SCRATCH_DEV 2>&1 | tee -a $seq.full | _filter_scratch
 touch $SCRATCH_MNT/failed 2>&1 | tee -a $seq.full | _filter_scratch
 mount -o remount,rw $SCRATCH_DEV 2>&1 | tee -a $seq.full | _filter_scratch
index 96a36a641d3d0ac528e01f1364d6117fe5be65d9..3c87ce14e60ca9174eb4420333c27b2e211f994c 100644 (file)
@@ -45,6 +45,13 @@ _require_quota()
        _notrun "disk quotas not supported by this filesystem type: $FSTYP"
        ;;
     esac
+
+    # SELinux adds extra xattrs which can mess up our expected output.
+    # So, mount with a context, and they won't be created
+    # nfs_t is a "liberal" context so we can use it.
+    if [ -x /usr/sbin/selinuxenabled ] && /usr/sbin/selinuxenabled; then
+        export SELINUX_MOUNT_OPTIONS="-o context=system_u:object_r:nfs_t:s0"
+    fi
 }
 
 #