Merge branch 'master' of git://git.kernel.org/pub/scm/fs/xfs/xfstests-dev
authorBen Myers <bpm@sgi.com>
Thu, 13 Sep 2012 20:01:58 +0000 (15:01 -0500)
committerBen Myers <bpm@sgi.com>
Thu, 13 Sep 2012 20:01:58 +0000 (15:01 -0500)
Conflicts:
285
285.out
group

Moved '285: Test xfs projid32bit functionality a bit more extensively' to 287.

275
275.out
287 [new file with mode: 0644]
287.out [new file with mode: 0644]
group

diff --git a/275 b/275
index 214262eada5a283bcf8f2bcd32ffc7da022ff90b..69b2895b8a79ddd1d16f92e8fb1c6b31f5bfbad3 100755 (executable)
--- a/275
+++ b/275
@@ -1,8 +1,8 @@
 #! /bin/bash
 # FS QA Test No. 275
 #
-# The posix write test. when write size is larger than disk free size,
-# should write as more as possible
+# The posix write test.  When write size is larger than disk free size,
+# should write as much as possible until ENOSPC.
 #
 #-----------------------------------------------------------------------
 # Copyright (c) 2011-2012 Fujitsu, Inc.  All Rights Reserved.
@@ -30,13 +30,12 @@ echo "QA output created by $seq"
 
 here=`pwd`
 tmp=/tmp/$$
-status=0    # success is the default!
+status=1    # failure is the default!
 trap "_cleanup; exit \$status" 0 1 2 3 15
 
 _cleanup()
 {
        cd /
-       rm -f $SCRATCH_MNT/* $tmp.*
        _scratch_unmount
 }
 
@@ -49,41 +48,48 @@ _supported_os IRIX Linux
 _require_scratch
 
 echo "------------------------------"
-echo "write lack test"
+echo "write until ENOSPC test"
 echo "------------------------------"
 
 rm -f $seq.full
 
 umount $SCRATCH_DEV 2>/dev/null
-_scratch_mkfs_sized $((1 * 1024 * 1024 * 1024)) >>$seq.full 2>&1
+_scratch_mkfs_sized $((2 * 1024 * 1024 * 1024)) >>$seq.full 2>&1
 _scratch_mount
 
 rm -rf $SCRATCH_MNT/*
-cd $SCRATCH_MNT
 
-dd if=/dev/zero of=tmp1 bs=4K count=1 >/dev/null 2>&1
-if [ $? -ne 0 ]
-then
-       echo "create file err"
-       status=1
-       exit
-fi
+dd if=/dev/zero of=$SCRATCH_MNT/tmp1 bs=256K count=1 >>$seq.full 2>&1
+[ $? -ne 0 ] && _fail "Error creating file"
 
-dd if=/dev/zero of=tmp2 bs=1M >/dev/null 2>&1
-dd if=/dev/zero of=tmp3 bs=4K >/dev/null 2>&1
+# Attempt to completely fill fs
+dd if=/dev/zero of=$SCRATCH_MNT/tmp2 bs=1M >>$seq.full 2>&1
 sync
+dd if=/dev/zero of=$SCRATCH_MNT/tmp3 bs=4K >>$seq.full 2>&1
+sync
+# Last effort, use O_SYNC
+dd if=/dev/zero of=$SCRATCH_MNT/tmp4 bs=4K oflag=sync >>$seq.full 2>&1
+# Save space usage info to the full file
+echo "Pre rm space:" >> $seq.full
+df $SCRATCH_MNT >>$seq.full 2>&1
 
-rm -f tmp1
+# Should leave approx 256k free
+rm -f $SCRATCH_MNT/tmp1
 sync
+echo "Post rm space:" >> $seq.full
+df $SCRATCH_MNT >>$seq.full 2>&1
+_freespace=`df -k $SCRATCH_MNT | tail -n 1 | awk '{print $4}'`
+[ $_freespace -gt 1024 ] && _fail "could not sufficiently fill filesystem"
+
+# Try a write larger than available space
+dd if=/dev/zero of=$SCRATCH_MNT/tmp1 bs=1M count=1 >>$seq.full 2>&1
+echo "Bytes written until ENOSPC:" >>$seq.full
+du $SCRATCH_MNT/tmp1 >>$seq.full
 
-dd if=/dev/zero of=tmp1 bs=8K count=1 >/dev/null 2>&1
-_filesize=`du tmp1 | awk '{print $1}'`
-if [ $_filesize -ne 4 ]
-then
-       echo "write file err"
-       status=1
-       exit
-fi
+# And at least some of it should succeed.
+_filesize=`ls -l $SCRATCH_MNT/tmp1 | awk '{print $5}'`
+[ $_filesize -eq 0 ] && _fail "write file err: Partial write until enospc failed; wrote 0 bytes."
 
 echo "done"
+status=0
 exit
diff --git a/275.out b/275.out
index 30af43c0ea26e6b67a1af7ca1fdf48d411132891..69b9d52d33dff3c23e3be0159351e4fa0106cc86 100644 (file)
--- a/275.out
+++ b/275.out
@@ -1,5 +1,5 @@
 QA output created by 275
 ------------------------------
-write lack test
+write until ENOSPC test
 ------------------------------
 done
diff --git a/287 b/287
new file mode 100644 (file)
index 0000000..beb2234
--- /dev/null
+++ b/287
@@ -0,0 +1,144 @@
+#! /bin/bash
+# FS QA Test No. 285
+#
+# Test to verify project quota xfs_admin, xfsdump/xfsrestore and
+# xfs_db functionality
+#
+#-----------------------------------------------------------------------
+# Copyright (c) 2012 Red Hat, Inc. All Rights Reserved.
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License as
+# published by the Free Software Foundation.
+#
+# This program is distributed in the hope that it would be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write the Free Software Foundation,
+# Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+#
+#-----------------------------------------------------------------------
+#
+# creator
+owner=ranto.boris@gmail.com
+
+seq=`basename $0`
+echo "QA output created by $seq"
+tmp=/tmp/$$
+here=`pwd`
+status=1       # failure is the default!
+trap "_cleanup; exit \$status" 0 1 2 3 15
+rm -f $seq.full
+
+# get standard environment, filters and checks
+. ./common.rc
+. ./common.quota
+
+_cleanup()
+{
+       cd /
+       umount $SCRATCH_MNT 2>/dev/null
+       rm -rf $tmp.*
+}
+
+_print_projid()
+{
+       $XFS_DB_PROG -c "inode $1" \
+               -c "print core.projid_lo" \
+               -c "print core.projid_hi" \
+               $SCRATCH_DEV
+}
+
+# real QA test starts here
+_supported_fs xfs
+_require_xfs_quota
+_require_scratch
+_require_projid32bit
+
+# create xfs fs without projid32bit ability, will be gained by xfs_admin
+_scratch_mkfs_xfs -i projid32bit=0 -d size=200m >> $seq.full \
+               || _fail "mkfs failed"
+_qmount_option "pquota"
+_qmount
+# require project quotas
+_require_prjquota $SCRATCH_DEV
+
+dir=$SCRATCH_MNT/pquota
+
+status=1
+
+mkdir -p $dir
+touch $dir/{16,32}bit
+inode16a=$(ls -i $dir/16bit | cut -d ' ' -f 1)
+inode32a=$(ls -i $dir/32bit | cut -d ' ' -f 1)
+$XFS_QUOTA_PROG -x -c "project -s -p $dir/16bit 1234" $SCRATCH_DEV \
+               >> $seq.full
+$XFS_QUOTA_PROG -x -c "project -s -p $dir/32bit 2123456789" $SCRATCH_DEV \
+               >> $seq.full 2>&1
+
+echo "No 32bit project quotas:"
+$XFS_IO_PROG -r -c "lsproj" $dir/16bit
+$XFS_IO_PROG -r -c "lsproj" $dir/32bit
+
+umount $SCRATCH_MNT
+
+# Now, enable projid32bit support by xfs_admin
+xfs_admin -p $SCRATCH_DEV >> $seq.full 2>&1 || _fail "xfs_admin failed"
+
+# Now mount the fs, 32bit project quotas shall be supported, now
+_qmount_option "pquota"
+_qmount
+$XFS_QUOTA_PROG -x -c "project -s -p $dir/32bit 2123456789" $SCRATCH_DEV \
+               >> $seq.full
+
+# These will be checked by $seq.out
+echo "With 32bit project quota support:"
+$XFS_IO_PROG -r -c "lsproj" $dir/16bit
+$XFS_IO_PROG -r -c "lsproj" $dir/32bit
+
+# Dump the fs to a temporary file
+rm -f $tmp.dump.img
+$XFSDUMP_PROG -f $tmp.dump -L label -M media -l 0 $SCRATCH_MNT >> $seq.full \
+               || _fail "dump failed"
+
+# Prepare the device to restore the dumped file system
+restore_dir=$SCRATCH_MNT/restore/pquota
+
+# Just make the restore dir, the pquota dir will be created by xfsrestore
+mkdir -p $SCRATCH_MNT/restore
+
+# Restore
+$XFSRESTORE_PROG -f $tmp.dump $SCRATCH_MNT/restore >> $seq.full 2>&1 \
+               || _fail "xfsrestore failed"
+
+# Check that they are the same
+diff -urpN $SCRATCH_MNT/{,restore}/pquota || _fail "diff failed"
+
+touch $restore_dir/32bitv2
+inode16b=$(ls -i $restore_dir/16bit | cut -d ' ' -f 1)
+inode32b=$(ls -i $restore_dir/32bit | cut -d ' ' -f 1)
+inode32v2=$(ls -i $restore_dir/32bitv2 | cut -d ' ' -f 1)
+$XFS_QUOTA_PROG -x -c "project -s -p $restore_dir/32bitv2 2123456789" \
+               $SCRATCH_MNT >> $seq.full
+echo "The restored file system + one additional file:"
+$XFS_IO_PROG -r -c "lsproj" $restore_dir/16bit
+$XFS_IO_PROG -r -c "lsproj" $restore_dir/32bit
+$XFS_IO_PROG -r -c "lsproj" $restore_dir/32bitv2
+
+umount $SCRATCH_MNT
+
+# Now, we can examine the file systems with xfs_db
+echo "These two values of 16bit project quota ids shall be the same"
+_print_projid $inode16a
+_print_projid $inode16b
+
+echo "These three values of 32bit project quota ids shall be the same"
+_print_projid $inode32b
+_print_projid $inode32a
+_print_projid $inode32v2
+
+status=0
+exit
diff --git a/287.out b/287.out
new file mode 100644 (file)
index 0000000..1a8d05a
--- /dev/null
+++ b/287.out
@@ -0,0 +1,23 @@
+QA output created by 287
+No 32bit project quotas:
+projid = 1234
+projid = 0
+With 32bit project quota support:
+projid = 1234
+projid = 2123456789
+The restored file system + one additional file:
+projid = 1234
+projid = 2123456789
+projid = 2123456789
+These two values of 16bit project quota ids shall be the same
+core.projid_lo = 1234
+core.projid_hi = 0
+core.projid_lo = 1234
+core.projid_hi = 0
+These three values of 32bit project quota ids shall be the same
+core.projid_lo = 24853
+core.projid_hi = 32401
+core.projid_lo = 24853
+core.projid_hi = 32401
+core.projid_lo = 24853
+core.projid_hi = 32401
diff --git a/group b/group
index cbe91014ad6ea487be12d970bc15be93622bea0a..f52c5d5746ac8d8297164c754917d2f7651feb0a 100644 (file)
--- a/group
+++ b/group
@@ -405,3 +405,4 @@ deprecated
 284 auto
 285 auto rw
 286 other
+287 auto dump quota quick