Skip to contentSkip to conversation

xfstests: Make some shared tests generic

PATCH New Lukas Czerner 1 participant 2 messages Mar 25, 2014

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/2 xfstests: Make some shared tests generic

There are couple of tests in shared directory which really should be made generic, so move it. It is mostly collapse range tests, which really can be generic to make super we test every file system which adds collapse range support.

Here is what we're moving in this commit.

shared/001 -> generic/004
shared/002 -> generic/009
shared/003 -> generic/012
shared/004 -> generic/016
shared/005 -> generic/017
shared/218 -> generic/018
shared/305 -> generic/019

---
v2: Set missing executable bit on some tests

 tests/generic/004     |  65 ++++++++++++++++++
 tests/generic/004.out |  49 +++++++++++++
 tests/generic/009     |  65 ++++++++++++++++++
 tests/generic/009.out |  49 +++++++++++++
 tests/generic/012     |  65 ++++++++++++++++++
 tests/generic/012.out |  49 +++++++++++++
 tests/generic/016     |  65 ++++++++++++++++++
 tests/generic/016.out |  49 +++++++++++++
 tests/generic/017     |  90 ++++++++++++++++++++++++
 tests/generic/017.out |   4 ++
 tests/generic/018     |  93 +++++++++++++++++++++++++
 tests/generic/018.out |  19 +++++
 tests/generic/019     | 187 ++++++++++++++++++++++++++++++++++++++++++++++++++
 tests/generic/019.out |   9 +++
 tests/generic/group   |   7 ++
 tests/shared/001      |  65 ------------------
 tests/shared/001.out  |  49 -------------
 tests/shared/002      |  65 ------------------
 tests/shared/002.out  |  49 -------------
 tests/shared/003      |  65 ------------------
 tests/shared/003.out  |  49 -------------
 tests/shared/004      |  65 ------------------
 tests/shared/004.out  |  49 -------------
 tests/shared/005      |  90 ------------------------
 tests/shared/005.out  |   4 --
 tests/shared/218      |  93 -------------------------
 tests/shared/218.out  |  19 -----
 tests/shared/305      | 187 --------------------------------------------------
 tests/shared/305.out  |   9 ---
 tests/shared/group    |   8 ---
 30 files changed, 865 insertions(+), 866 deletions(-)
 create mode 100755 tests/generic/004
 create mode 100644 tests/generic/004.out
 create mode 100755 tests/generic/009
 create mode 100644 tests/generic/009.out
 create mode 100755 tests/generic/012
 create mode 100644 tests/generic/012.out
 create mode 100755 tests/generic/016
 create mode 100644 tests/generic/016.out
 create mode 100755 tests/generic/017
 create mode 100644 tests/generic/017.out
 create mode 100755 tests/generic/018
 create mode 100644 tests/generic/018.out
 create mode 100755 tests/generic/019
 create mode 100644 tests/generic/019.out
 delete mode 100755 tests/shared/001
 delete mode 100644 tests/shared/001.out
 delete mode 100644 tests/shared/002
 delete mode 100644 tests/shared/002.out
 delete mode 100644 tests/shared/003
 delete mode 100644 tests/shared/003.out
 delete mode 100644 tests/shared/004
 delete mode 100644 tests/shared/004.out
 delete mode 100644 tests/shared/005
 delete mode 100644 tests/shared/005.out
 delete mode 100755 tests/shared/218
 delete mode 100644 tests/shared/218.out
 delete mode 100755 tests/shared/305
 delete mode 100644 tests/shared/305.out
tests/generic/004 new file +65 -0
new file mode 100755
index 0000000..36dcdea
@@ -0,0 +1,65 @@
+#! /bin/bash
+# FS QA Test No. generic/004
+#
+# Standard collapse range tests 
+# This testcase is one of the 4 testcases which tries to
+# test various corner cases for fcollapse range functionality over different
+# type of extents. These tests are based on generic/255 test case.
+# For the type of tests, check the description of _test_generic_punch
+# in common/rc.
+#-----------------------------------------------------------------------
+# Copyright (c) 2013 Samsung Electronics.  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!
+
+_cleanup()
+{
+    rm -f $tmp.*
+}
+
+trap "_cleanup ; exit \$status" 0 1 2 3 15
+
+# get standard environment, filters and checks
+# we need to include common/punch to get defination fo filter functions
+. ./common/rc
+. ./common/filter
+. ./common/punch
+
+# real QA test starts here
+_supported_fs generic
+_supported_os Linux
+
+_require_xfs_io_falloc_punch
+_require_xfs_io_falloc
+_require_xfs_io_fiemap
+_require_xfs_io_falloc_collapse
+
+testfile=$TEST_DIR/$seq.$$
+
+_test_generic_punch falloc fpunch fcollapse fiemap _filter_hole_fiemap $testfile
+_check_test_fs
+
+status=0
+exit
tests/generic/004.out new file +49 -0

49 lines not on this page · raw message

tests/generic/009 new file +65 -0

65 lines not on this page · raw message

tests/generic/009.out new file +49 -0

49 lines not on this page · raw message

tests/generic/012 new file +65 -0

65 lines not on this page · raw message

tests/generic/012.out new file +49 -0

49 lines not on this page · raw message

tests/generic/016 new file +65 -0

65 lines not on this page · raw message

tests/generic/016.out new file +49 -0

49 lines not on this page · raw message

tests/generic/017 new file +90 -0

90 lines not on this page · raw message

tests/generic/017.out new file +4 -0
new file mode 100644
index 0000000..cc524ac
@@ -0,0 +1,4 @@
+QA output created by 017
+80
+80
+80
tests/generic/018 new file +93 -0

93 lines not on this page · raw message

tests/generic/018.out new file +19 -0
new file mode 100644
index 0000000..5f265d1
@@ -0,0 +1,19 @@
+QA output created by 018
+zero-length file:
+Before: 0
+After: 0
+Sparse file (no blocks):
+Before: 0
+After: 0
+Contiguous file:
+Before: 1
+After: 1
+Write backwards sync, but contiguous - should defrag to 1 extent
+Before: 10
+After: 1
+Write backwards sync leaving holes - defrag should do nothing
+Before: 16
+After: 16
+Write forwards sync leaving holes - defrag should do nothing
+Before: 16
+After: 16
tests/generic/019 new file +187 -0

187 lines not on this page · raw message

tests/generic/019.out new file +9 -0
new file mode 100644
index 0000000..36c2af8
@@ -0,0 +1,9 @@
+QA output created by 019
+Allow global fail_make_request feature
+
+Start fsstress..
+
+Start fio..
+Force SCRATCH_DEV device failure
+Make SCRATCH_DEV device operable again
+Disallow global fail_make_request feature
tests/generic/group +7 -0
index a99b6a1..5065780 100644
@@ -6,15 +6,22 @@
 001 rw dir udf auto quick
 002 metadata udf auto quick
 003 atime auto quick
+004 auto quick prealloc
 005 dir udf auto quick
 006 dir udf auto quick
 007 dir udf auto quick
 008 auto quick prealloc
+009 auto quick prealloc
 010 other udf auto
 011 dir udf auto quick
+012 auto quick prealloc
 013 other ioctl udf auto quick
 014 rw udf auto quick
 015 other auto quick
+016 auto quick prealloc
+017 auto prealloc
+018 auto fsr quick
+019 aio dangerous enospc rw stress
 020 metadata attr udf auto quick
 053 acl repair auto quick
 062 attr udf auto quick
tests/shared/001 deleted +0 -65

65 lines not on this page · raw message

tests/shared/001.out deleted +0 -49

49 lines not on this page · raw message

tests/shared/002 deleted +0 -65

65 lines not on this page · raw message

tests/shared/002.out deleted +0 -49

49 lines not on this page · raw message

tests/shared/003 deleted +0 -65

65 lines not on this page · raw message

tests/shared/003.out deleted +0 -49

49 lines not on this page · raw message

tests/shared/004 deleted +0 -65

65 lines not on this page · raw message

tests/shared/004.out deleted +0 -49

49 lines not on this page · raw message

tests/shared/005 deleted +0 -90

90 lines not on this page · raw message

tests/shared/005.out deleted +0 -4
deleted file mode 100644
index 8d30b9d..0000000
@@ -1,4 +0,0 @@
-QA output created by 005
-80
-80
-80
tests/shared/218 deleted +0 -93

93 lines not on this page · raw message

tests/shared/218.out deleted +0 -19
deleted file mode 100644
index 7559cdd..0000000
@@ -1,19 +0,0 @@
-QA output created by 218
-zero-length file:
-Before: 0
-After: 0
-Sparse file (no blocks):
-Before: 0
-After: 0
-Contiguous file:
-Before: 1
-After: 1
-Write backwards sync, but contiguous - should defrag to 1 extent
-Before: 10
-After: 1
-Write backwards sync leaving holes - defrag should do nothing
-Before: 16
-After: 16
-Write forwards sync leaving holes - defrag should do nothing
-Before: 16
-After: 16
tests/shared/305 deleted +0 -187

187 lines not on this page · raw message

tests/shared/305.out deleted +0 -9
deleted file mode 100644
index 1e8cfd6..0000000
@@ -1,9 +0,0 @@
-QA output created by 305
-Allow global fail_make_request feature
-
-Start fsstress..
-
-Start fio..
-Force SCRATCH_DEV device failure
-Make SCRATCH_DEV device operable again
-Disallow global fail_make_request feature
tests/shared/group +0 -8
index 29f17b0..1c6fffb 100644
@@ -3,17 +3,9 @@
 # - do not start group names with a digit
 # - comment line before each group is "new" description
 #
-001 auto quick prealloc
-002 auto quick prealloc
-003 auto quick prealloc
-004 auto quick prealloc
-005 auto prealloc
 032 mkfs auto quick
 051 acl udf auto quick
-218 auto fsr quick
 243 auto quick prealloc
 272 auto enospc rw
 289 auto quick
 298 auto trim
-305 aio dangerous enospc rw stress
-
Signature · 6 lines
1.8.3.1

_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
#1 lore raw

PATCH v2 2/2 xfstests: Make shared/243 ext4 specific

The test shared/243 really is ext4 specific even though currently we would run it on other file systems as well, it would not actually do any testing.

So move it to ext4 specific directory and rename it to 002.

---
v2: nothing changed

 tests/ext4/002       | 180 +++++++++++++++++++++++++++++++++++++++++++++++++++
 tests/ext4/002.out   |  13 ++++
 tests/ext4/group     |   1 +
 tests/shared/243     | 180 ---------------------------------------------------
 tests/shared/243.out |  13 ----
 tests/shared/group   |   1 -
 6 files changed, 194 insertions(+), 194 deletions(-)
 create mode 100755 tests/ext4/002
 create mode 100644 tests/ext4/002.out
 delete mode 100755 tests/shared/243
 delete mode 100644 tests/shared/243.out
tests/ext4/002 new file +180 -0
new file mode 100755
index 0000000..12be253
@@ -0,0 +1,180 @@
+#! /bin/bash
+# FS QA Test No. ext4/002
+#
+# Test to ensure that the EOFBLOCK_FL gets set/unset correctly.
+#
+# As found by Theodore Ts'o:
+# If a 128K file is falloc'ed using the KEEP_SIZE flag, and then
+# write exactly 128K, the EOFBLOCK_FL doesn't get cleared correctly.
+# This is bad since it forces e2fsck to complain about that inode.
+# If you have a large number of inodes that are written with fallocate
+# using KEEP_SIZE, and then fill them up to their expected size,
+# e2fsck will potentially complain about a _huge_ number of inodes.
+# This would also cause a huge increase in the time taken by e2fsck
+# to complete its check.
+#
+# Test scenarios covered:
+# 1. Fallocating X bytes and writing Y (Y<X) (buffered and direct io)
+# 2. Fallocating X bytes and writing Y (Y=X) (buffered and direct io)
+# 3. Fallocating X bytes and writing Y (Y>X) (buffered and direct io)
+#
+# These test cases exercise the normal and edge case conditions using
+# falloc (and KEEP_SIZE).
+#
+# Ref: http://thread.gmane.org/gmane.comp.file-systems.ext4/20682
+#
+#-----------------------------------------------------------------------
+# Copyright (c) 2010 Google, 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
+
+# Test specific macros.
+BIT_NOT_SET=0   # inode flag - 0x400000 bit is not set.
+BIT_SET=1       # inode flag - 0x400000 bit is set.
+
+# Generic test cleanup function.
+_cleanup()
+{
+  cd /
+  rm -f $tmp.*
+}
+
+# Ext4 uses the EOFBLOCKS_FL bit when fallocating blocks with KEEP_SIZE
+# enabled. The only time this bit should be set is when extending the allocated
+# blocks further than what the i_size represents. In the situations wherein the
+# i_size covers all allocated blocks, this bit should be cleared.
+
+# Checks the state of the sample file in the filesystem and returns whether
+# the inode flag 0x400000 is set or not.
+_check_ext4_eof_flag()
+{
+  # Check whether EOFBLOCK_FL is set.
+  # For ext4 filesystems: use debugfs to check if EOFBLOCKS_FL is set.
+  # Other filesystems: do nothing. The default fsck at the end of the test
+  # should catch any potential errors.
+  if [ "${FSTYP}" == "ext4" ]; then
+    bit_set=1
+
+    # Unmount the ${TEST_DEV}
+    umount ${TEST_DEV}
+
+    # Run debugfs to gather file_parameters - specifically iflags.
+    file_params=`debugfs ${TEST_DEV} -R "stat ${1}" 2>&1 | grep -e Flags:`
+    iflags=${file_params#*Flags: }
+
+    # Ensure that the iflags value was parsed correctly.
+    if [ -z ${iflags} ]; then
+      echo "iFlags value was not parsed successfully." >> $seqres.full
+      status=1
+      exit ${status}
+    fi
+
+    # Check if EOFBLOCKS_FL is set.
+    if ((${iflags} & 0x400000)); then
+      echo "EOFBLOCK_FL bit is set." >> $seqres.full
+      bit_set=1
+    else
+      echo "EOFBLOCK_FL bit is not set." >> $seqres.full
+      bit_set=0
+    fi
+
+    # Check current bit state to expected value.
+    if [ ${bit_set} -ne ${2} ]; then
+      echo "Error: Current bit state incorrect." >> $seqres.full
+      status=1
+      exit ${status}
+    fi
+
+    # Mount the ${TEST_DEV}
+    mount ${TEST_DEV} -t ${FSTYP} ${TEST_DIR}
+  fi
+}
+
+# Get standard environment, filters and checks.
+. ./common/rc
+. ./common/filter
+
+# Prerequisites for the test run.
+_supported_fs ext4
+_supported_os Linux
+_require_xfs_io_falloc
+
+# Real QA test starts here.
+rm -f $seqres.full
+
+# Remove any leftover files from last run.
+rm -f ${TEST_DIR}/test_?
+
+# Begin test cases.
+echo "Test 1: Fallocate 40960 bytes and write 4096 bytes (buffered io)." \
+    >> $seqres.full
+${XFS_IO_PROG} -f                       \
+    -c 'falloc -k 0 40960'              \
+    -c 'pwrite 0 4096'                  \
+    ${TEST_DIR}/test_1 | _filter_xfs_io_unique
+_check_ext4_eof_flag test_1 ${BIT_SET}
+
+echo "Test 2: Fallocate 40960 bytes and write 4096 bytes (direct io)." \
+    >> $seqres.full
+${XFS_IO_PROG} -f -d                    \
+    -c 'falloc -k 0 40960'              \
+    -c 'pwrite 0 4096'                  \
+    ${TEST_DIR}/test_2 | _filter_xfs_io_unique
+_check_ext4_eof_flag test_2 ${BIT_SET}
+
+echo "Test 3: Fallocate 40960 bytes and write 40960 bytes (buffered io)." \
+    >> $seqres.full
+${XFS_IO_PROG} -f                       \
+    -c 'falloc -k 0 40960'              \
+    -c 'pwrite 0 40960'                 \
+    ${TEST_DIR}/test_3 | _filter_xfs_io_unique
+_check_ext4_eof_flag test_3 ${BIT_NOT_SET}
+
+echo "Test 4: Fallocate 40960 bytes and write 40960 bytes (direct io)." \
+    >> $seqres.full
+${XFS_IO_PROG} -f -d                    \
+    -c 'falloc -k 0 40960'              \
+    -c 'pwrite 0 40960'                 \
+    ${TEST_DIR}/test_4 | _filter_xfs_io_unique
+_check_ext4_eof_flag test_4 ${BIT_NOT_SET}
+
+echo "Test 5: Fallocate 128k, seek 256k and write 4k block (buffered io)." \
+    >> $seqres.full
+${XFS_IO_PROG} -f                       \
+    -c 'falloc -k 0 128k'               \
+    -c 'pwrite 256k 4k'                 \
+    ${TEST_DIR}/test_5 | _filter_xfs_io_unique
+_check_ext4_eof_flag test_5 ${BIT_NOT_SET}
+
+echo "Test 6: Fallocate 128k, seek to 256k and write a 4k block (direct io)." \
+    >> $seqres.full
+${XFS_IO_PROG} -f -d                    \
+    -c 'falloc -k 0 128k'               \
+    -c 'pwrite 256k 4k'                 \
+    ${TEST_DIR}/test_6 | _filter_xfs_io_unique
+_check_ext4_eof_flag test_6 ${BIT_NOT_SET}
+
+status=0
+exit ${status}
tests/ext4/002.out new file +13 -0
new file mode 100644
index 0000000..3dcca87
@@ -0,0 +1,13 @@
+QA output created by 002
+wrote 4096/4096 bytes at offset 0
+XXX Bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
+wrote 4096/4096 bytes at offset 0
+XXX Bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
+wrote 40960/40960 bytes at offset 0
+XXX Bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
+wrote 40960/40960 bytes at offset 0
+XXX Bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
+wrote 4096/4096 bytes at offset 262144
+XXX Bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
+wrote 4096/4096 bytes at offset 262144
+XXX Bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
tests/ext4/group +1 -0
index dd2841e..7e66035 100644
@@ -4,6 +4,7 @@
 # - comment line before each group is "new" description
 #
 001 auto prealloc quick
+002 auto quick prealloc
 271 auto rw quick
 301 aio dangerous ioctl rw stress
 302 aio dangerous ioctl rw stress
tests/shared/243 deleted +0 -180

180 lines not on this page · raw message

tests/shared/243.out deleted +0 -13
deleted file mode 100644
index 290a005..0000000
@@ -1,13 +0,0 @@
-QA output created by 243
-wrote 4096/4096 bytes at offset 0
-XXX Bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
-wrote 4096/4096 bytes at offset 0
-XXX Bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
-wrote 40960/40960 bytes at offset 0
-XXX Bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
-wrote 40960/40960 bytes at offset 0
-XXX Bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
-wrote 4096/4096 bytes at offset 262144
-XXX Bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
-wrote 4096/4096 bytes at offset 262144
-XXX Bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
tests/shared/group +0 -1
index 1c6fffb..2165aac 100644
@@ -5,7 +5,6 @@
 #
 032 mkfs auto quick
 051 acl udf auto quick
-243 auto quick prealloc
 272 auto enospc rw
 289 auto quick
 298 auto trim
Signature · 6 lines
1.8.3.1

_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs