shared: new test to use up free inodes
authorEryu Guan <eguan@redhat.com>
Fri, 4 Apr 2014 06:17:33 +0000 (17:17 +1100)
committerDave Chinner <david@fromorbit.com>
Fri, 4 Apr 2014 06:17:33 +0000 (17:17 +1100)
Test fs by using up all inodes and check fs.

Also a regression test for xfsprogs commit
d586858 xfs_repair: fix sibling pointer tests in verify_dir2_path()

Signed-off-by: Eryu Guan <eguan@redhat.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
tests/shared/006 [new file with mode: 0755]
tests/shared/006.out [new file with mode: 0644]
tests/shared/group

diff --git a/tests/shared/006 b/tests/shared/006
new file mode 100755 (executable)
index 0000000..445c35d
--- /dev/null
@@ -0,0 +1,97 @@
+#! /bin/bash
+# FS QA Test No. shared/006
+#
+# Stress test fs by using up all inodes and check fs.
+#
+# Also a regression test for xfsprogs commit
+# d586858 xfs_repair: fix sibling pointer tests in verify_dir2_path()
+#
+#-----------------------------------------------------------------------
+# Copyright (c) 2014 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
+#-----------------------------------------------------------------------
+#
+
+seq=`basename $0`
+seqres=$RESULT_DIR/$seq
+echo "QA output created by $seq"
+
+here=`pwd`
+tmp=/tmp/$$
+status=1       # failure is the default!
+trap "_cleanup; exit \$status" 0 1 2 3 15
+
+_cleanup()
+{
+    cd /
+    rm -f $tmp.*
+}
+
+create_file()
+{
+       local dir=$1
+       local nr_file=$2
+       local prefix=$3
+       local i=0
+
+       while [ $i -lt $nr_file ]; do
+               echo -n > $dir/${prefix}_${i}
+               let i=$i+1
+       done
+}
+
+# get standard environment, filters and checks
+. ./common/rc
+. ./common/filter
+
+# real QA test starts here
+_supported_fs ext4 ext3 ext2 xfs
+_supported_os Linux
+
+_require_scratch
+
+rm -f $seqres.full
+echo "Silence is golden"
+
+_scratch_mkfs_sized $((1024 * 1024 * 1024)) >>$seqres.full 2>&1
+_scratch_mount
+
+i=0
+free_inode=`$DF_PROG -i $SCRATCH_MNT | tail -1 | awk '{print $3}'`
+file_per_dir=1000
+loop=$((free_inode / file_per_dir + 1))
+mkdir -p $SCRATCH_MNT/testdir
+
+echo "Create $((loop * file_per_dir)) files in $SCRATCH_MNT/testdir" >>$seqres.full
+while [ $i -lt $loop ]; do
+       create_file $SCRATCH_MNT/testdir $file_per_dir $i >>$seqres.full 2>&1 &
+       let i=$i+1
+done
+wait
+
+# log inode status in $seqres.full for debug purpose
+echo "Inode status after taking all inodes" >>$seqres.full
+$DF_PROG -i $SCRATCH_MNT >>$seqres.full
+
+_check_scratch_fs
+
+# Check again after removing all the files
+rm -rf $SCRATCH_MNT/testdir
+echo "Inode status after deleting all test files" >>$seqres.full
+$DF_PROG -i $SCRATCH_MNT >>$seqres.full
+_check_scratch_fs
+
+status=0
+exit
diff --git a/tests/shared/006.out b/tests/shared/006.out
new file mode 100644 (file)
index 0000000..675c1b7
--- /dev/null
@@ -0,0 +1,2 @@
+QA output created by 006
+Silence is golden
index 29f17b051be59238ce1417f4eccbf3e81fbfef59..6313639ea80e922eedf46a210dd6a0425522520e 100644 (file)
@@ -8,6 +8,7 @@
 003 auto quick prealloc
 004 auto quick prealloc
 005 auto prealloc
 003 auto quick prealloc
 004 auto quick prealloc
 005 auto prealloc
+006 auto enospc
 032 mkfs auto quick
 051 acl udf auto quick
 218 auto fsr quick
 032 mkfs auto quick
 051 acl udf auto quick
 218 auto fsr quick