All of lore.kernel.org
 help / color / mirror / Atom feed
From: Xiao Yang <yangx.jy@cn.fujitsu.com>
To: fstests@vger.kernel.org
Cc: Xiao Yang <yangx.jy@cn.fujitsu.com>
Subject: [PATCH 2/2] common: cleanup _require_xfs_io_command
Date: Mon, 15 May 2017 15:17:59 +0800	[thread overview]
Message-ID: <1494832679-13246-2-git-send-email-yangx.jy@cn.fujitsu.com> (raw)
In-Reply-To: <1494832679-13246-1-git-send-email-yangx.jy@cn.fujitsu.com>

We don't need to check specific flags at the end of this function
if we have checked them before. e.g, generic/071 and generic/422
are marked as notrun unexpectedly because xfs_io doesn't support
long-format help for falloc before xfsprogs v4.9.  Actually, xfs_io
has supported falloc, so these case should not be marked as notrun.

Signed-off-by: Xiao Yang <yangx.jy@cn.fujitsu.com>
---
 common/rc | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/common/rc b/common/rc
index 539f153..2c893c0 100644
--- a/common/rc
+++ b/common/rc
@@ -2041,6 +2041,7 @@ _require_xfs_io_command()
 	command=$1
 	shift
 	param="$*"
+	param_check=0
 
 	testfile=$TEST_DIR/$$.xfs_io
 	case $command in
@@ -2055,6 +2056,7 @@ _require_xfs_io_command()
 		;;
 	"falloc" )
 		testio=`$XFS_IO_PROG -F -f -c "falloc $param 0 1m" $testfile 2>&1`
+		param_check=1
 		;;
 	"fpunch" | "fcollapse" | "zero" | "fzero" | "finsert" | "funshare")
 		testio=`$XFS_IO_PROG -F -f -c "pwrite 0 20k" -c "fsync" \
@@ -2063,6 +2065,7 @@ _require_xfs_io_command()
 	"fiemap")
 		testio=`$XFS_IO_PROG -F -f -c "pwrite 0 20k" -c "fsync" \
 			-c "fiemap -v $param" $testfile 2>&1`
+		param_check=1
 		;;
 	"flink" )
 		testio=`$XFS_IO_PROG -T -F -c "flink $testfile" \
@@ -2087,7 +2090,7 @@ _require_xfs_io_command()
 		testio=`$XFS_IO_PROG -f -c "utimes" 0 0 0 0 $testfile 2>&1`
 		;;
 	*)
-		testio=`$XFS_IO_PROG -c "$command help" 2>&1`
+		testio=`$XFS_IO_PROG -c "help $command" 2>&1`
 	esac
 
 	rm -f $testfile 2>&1 > /dev/null
@@ -2100,9 +2103,10 @@ _require_xfs_io_command()
 	echo $testio | grep -q "foreign file active" && \
 		_notrun "xfs_io $command not supported on $FSTYP"
 
-	test -z "$param" && return
-	$XFS_IO_PROG -c "help $command" | grep -q "^ $param --" || \
-		_notrun "xfs_io $command doesn't support $param"
+	if [ -n $param -a $param_check -eq 0 ]; then
+		$XFS_IO_PROG -c "help $command" | grep -q "^ $param --" || \
+			_notrun "xfs_io $command doesn't support $param"
+	fi
 }
 
 # check that kernel and filesystem support direct I/O
-- 
1.8.3.1




  reply	other threads:[~2017-05-15  7:18 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-05-15  7:17 [PATCH 1/2] common: use _require_xfs_io_command() directly to check fiemap Xiao Yang
2017-05-15  7:17 ` Xiao Yang [this message]
2017-05-16  8:04   ` [PATCH 2/2] common: cleanup _require_xfs_io_command Eryu Guan
2017-05-16  8:13     ` Xiao Yang
2017-05-17  1:42     ` [PATCH v2 1/2] common: use _require_xfs_io_command() directly to check fiemap Xiao Yang
2017-05-17  1:42       ` [PATCH v2 2/2] common: cleanup _require_xfs_io_command Xiao Yang
2017-05-16  8:16 ` [PATCH 1/2] common: use _require_xfs_io_command() directly to check fiemap Amir Goldstein
2017-05-17  1:10   ` Xiao Yang

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=1494832679-13246-2-git-send-email-yangx.jy@cn.fujitsu.com \
    --to=yangx.jy@cn.fujitsu.com \
    --cc=fstests@vger.kernel.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.