From: Lukas Czerner <lczerner@redhat.com>
To: linux-ext4@vger.kernel.org
Cc: xfs@oss.sgi.com, linux-fsdevel@vger.kernel.org,
Lukas Czerner <lczerner@redhat.com>
Subject: [PATCH 1/8] xfstests: Create single function for testing xfs_io commands
Date: Fri, 28 Feb 2014 17:10:58 +0100 [thread overview]
Message-ID: <1393603865-26198-1-git-send-email-lczerner@redhat.com> (raw)
Currently there are several function testing various xfs_io commands.
This commit creates _require_xfs_io_command() to test any xfs_command.
Signed-off-by: Lukas Czerner <lczerner@redhat.com>
---
common/rc | 72 +++++++++++++++++++++++++++++++++------------------------------
1 file changed, 38 insertions(+), 34 deletions(-)
diff --git a/common/rc b/common/rc
index f2c3c3a..7f530d0 100644
--- a/common/rc
+++ b/common/rc
@@ -1296,12 +1296,43 @@ _user_do()
fi
}
+_require_xfs_io_command()
+{
+ if [ $# -ne 1 ]
+ then
+ echo "Usage: _require_xfs_io_command command" 1>&2
+ exit 1
+ fi
+ command=$1
+
+ testfile=$TEST_DIR/$$.xfs_io
+ case $command in
+ "falloc" )
+ testio=`$XFS_IO_PROG -F -f -c "falloc 0 1m" $testfile 2>&1`
+ ;;
+ "fpunch" | "fcollapse" | "zero" )
+ testio=`$XFS_IO_PROG -F -f -c "pwrite 0 20k" -c "fsync" \
+ -c "$command 4k 8k" $testfile 2>&1`
+ ;;
+ "fiemap")
+ testio=`$XFS_IO_PROG -F -f -c "pwrite 0 20k" -c "fsync" \
+ -c "fiemap -v" $testfile 2>&1`
+ ;;
+ *)
+ testio=`$XFS_IO_PROG -c "$command help" 2>&1`
+ esac
+
+ rm -f $testfile 2>&1 > /dev/null
+ echo $testio | grep -q "not found" && \
+ _notrun "xfs_io $command support is missing"
+ echo $testio | grep -q "Operation not supported" && \
+ _notrun "xfs_io $command failed (old kernel/wrong fs?)"
+}
+
# check that xfs_io, kernel, and filesystem all support zero
_require_xfs_io_zero()
{
- testio=`$XFS_IO_PROG -c "zero help" 2>&1`
- echo $testio | grep -q 'command "zero" not found' && \
- _notrun "zero command not supported"
+ _require_xfs_io_command "zero"
}
# check that xfs_io, glibc, kernel, and filesystem all (!) support
@@ -1309,54 +1340,27 @@ _require_xfs_io_zero()
#
_require_xfs_io_falloc()
{
- testfile=$TEST_DIR/$$.falloc
- testio=`$XFS_IO_PROG -F -f -c "falloc 0 1m" $testfile 2>&1`
- rm -f $testfile 2>&1 > /dev/null
- echo $testio | grep -q "not found" && \
- _notrun "xfs_io fallocate support is missing"
- echo $testio | grep -q "Operation not supported" && \
- _notrun "xfs_io fallocate command failed (old kernel/wrong fs?)"
+ _require_xfs_io_command "falloc"
}
# check that xfs_io, kernel and filesystem all support fallocate with hole
# punching
_require_xfs_io_falloc_punch()
{
- testfile=$TEST_DIR/$$.falloc
- testio=`$XFS_IO_PROG -F -f -c "pwrite 0 20k" -c "fsync" \
- -c "fpunch 4k 8k" $testfile 2>&1`
- rm -f $testfile 2>&1 > /dev/null
- echo $testio | grep -q "not found" && \
- _notrun "xfs_io fallocate punch support is missing"
- echo $testio | grep -q "Operation not supported" && \
- _notrun "xfs_io fallocate punch command failed (no fs support?)"
+ _require_xfs_io_command "fpunch"
}
# check that xfs_io, kernel and filesystem all support fallocate with collapse
# range
_require_xfs_io_falloc_collapse()
{
- testfile=$TEST_DIR/$$.falloc
- testio=`$XFS_IO_PROG -f -c "pwrite 0 20k" -c "fsync" \
- -c "fcollapse 4k 8k" $testfile 2>&1`
- rm -f $testfile 2>&1 > /dev/null
- echo $testio | grep -q "not found" && \
- _notrun "xfs_io fallocate collapse range support is missing"
- echo $testio | grep -q "Operation not supported" && \
- _notrun "xfs_io fallocate collapse range failed (no fs support?)"
+ _require_xfs_io_command "fcollapse"
}
# check that xfs_io, kernel and filesystem support fiemap
_require_xfs_io_fiemap()
{
- testfile=$TEST_DIR/$$.fiemap
- testio=`$XFS_IO_PROG -F -f -c "pwrite 0 20k" -c "fsync" \
- -c "fiemap -v" $testfile 2>&1`
- rm -f $testfile 2>&1 > /dev/null
- echo $testio | grep -q "not found" && \
- _notrun "xfs_io fiemap support is missing"
- echo $testio | grep -q "Operation not supported" && \
- _notrun "xfs_io fiemap command failed (no fs support?)"
+ _require_xfs_io_command "fiemap"
}
# Check that a fs has enough free space (in 1024b blocks)
--
1.8.3.1
next reply other threads:[~2014-02-28 16:10 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-02-28 16:10 Lukas Czerner [this message]
2014-02-28 16:10 ` [PATCH 2/8] xfstests: create _test_block_boundaries in common/punch Lukas Czerner
2014-02-28 16:11 ` [PATCH 3/8] generic/008: Add test for fallocate zero range at block boundary Lukas Czerner
2014-02-28 16:11 ` [PATCH 4/8] xfstests: Move fallocate include into global.h Lukas Czerner
2014-02-28 17:17 ` Eric Sandeen
2014-02-28 22:31 ` Dave Chinner
2014-02-28 16:11 ` [PATCH 5/8] xfstests: Add fallocate zero range operation to fsstress Lukas Czerner
2014-02-28 17:40 ` Eric Sandeen
2014-03-03 12:16 ` Lukáš Czerner
2014-02-28 16:11 ` [PATCH 6/8] fsstress: translate flags in fiemap_f Lukas Czerner
2014-02-28 17:55 ` Eric Sandeen
2014-02-28 16:11 ` [PATCH 7/8] xfstests: Add fallocate zero range operation to fsx Lukas Czerner
2014-02-28 18:11 ` Eric Sandeen
2014-02-28 19:08 ` Andreas Dilger
2014-03-03 12:21 ` Lukáš Czerner
2014-02-28 16:11 ` [PATCH 8/8] ext4/001: Add ext4 specific test for fallocate zero range Lukas Czerner
2014-02-28 16:40 ` [PATCH 1/8] xfstests: Create single function for testing xfs_io commands Eric Sandeen
2014-02-28 16:51 ` Lukáš Czerner
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1393603865-26198-1-git-send-email-lczerner@redhat.com \
--to=lczerner@redhat.com \
--cc=linux-ext4@vger.kernel.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=xfs@oss.sgi.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).