diff mbox

generic/071: require falloc -k

Message ID 7bd28494-84e9-1458-5e28-893d02dd5c06@sandeen.net (mailing list archive)
State New, archived
Headers show

Commit Message

Eric Sandeen July 19, 2016, 6:49 a.m. UTC
On 7/18/16 9:17 PM, Christoph Hellwig wrote:
> On Mon, Jul 18, 2016 at 04:47:14PM +0800, Eryu Guan wrote:
>> This stops generic/071 from running no matter what filesystem it's
>> testing, this is because _require_xfs_io_command only checks whether
>> xfs_io knows the option (-k) by searching it in help message, not really
>> running it, i.e.
> 
> Well, we can at least add the documentation as that would be useful
> on it's own.  I'll look into a patch.
> 
>> Perhaps we should update _require_xfs_io_command to actually run the
>> command with the provided additional option?
> 
> I'll have to look at the archives, but I remember we had a reason for
> this way of probing for feature support.

Some tests actually do run xfs_io on a real file, but we probably
don't want to go that way.

The test for finding it in help output seems way too specific,

_require_xfs_io_command "pwrite" "-Z"

fails as well because it doesn't hit the specific format in
the grep.

What if we loosen up the test; is this too loose? (look for param
preceded by whitespace or square bracket)

--
To unsubscribe from this list: send the line "unsubscribe fstests" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Comments

Christoph Hellwig July 19, 2016, 8:30 a.m. UTC | #1
On Mon, Jul 18, 2016 at 11:49:57PM -0700, Eric Sandeen wrote:
> Some tests actually do run xfs_io on a real file, but we probably
> don't want to go that way.
> 
> The test for finding it in help output seems way too specific,
> 
> _require_xfs_io_command "pwrite" "-Z"
> 
> fails as well because it doesn't hit the specific format in
> the grep.
> 
> What if we loosen up the test; is this too loose? (look for param
> preceded by whitespace or square bracket)

Seems like it's not loose enough as it still tries to run the test
on NFS.
--
To unsubscribe from this list: send the line "unsubscribe fstests" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Eryu Guan July 20, 2016, 4:38 a.m. UTC | #2
On Mon, Jul 18, 2016 at 11:49:57PM -0700, Eric Sandeen wrote:
> 
> 
> On 7/18/16 9:17 PM, Christoph Hellwig wrote:
> > On Mon, Jul 18, 2016 at 04:47:14PM +0800, Eryu Guan wrote:
> >> This stops generic/071 from running no matter what filesystem it's
> >> testing, this is because _require_xfs_io_command only checks whether
> >> xfs_io knows the option (-k) by searching it in help message, not really
> >> running it, i.e.
> > 
> > Well, we can at least add the documentation as that would be useful
> > on it's own.  I'll look into a patch.
> > 
> >> Perhaps we should update _require_xfs_io_command to actually run the
> >> command with the provided additional option?
> > 
> > I'll have to look at the archives, but I remember we had a reason for
> > this way of probing for feature support.
> 
> Some tests actually do run xfs_io on a real file, but we probably
> don't want to go that way.
> 
> The test for finding it in help output seems way too specific,
> 
> _require_xfs_io_command "pwrite" "-Z"
> 
> fails as well because it doesn't hit the specific format in
> the grep.

Zorro's commit a6f6e594f74a ("common/rc: teach _require_xfs_io_command
accept multi-parameters") addressed this issue, but it requires
something like "_require_xfs_io_command pwrite -Z N" to match the help
message.

> 
> What if we loosen up the test; is this too loose? (look for param
> preceded by whitespace or square bracket)
> 
> diff --git a/common/rc b/common/rc
> index 6add69e..0eef3d5 100644
> --- a/common/rc
> +++ b/common/rc
> @@ -1907,7 +1907,7 @@ _require_xfs_io_command()
>  		_notrun "xfs_io $command failed (old kernel/wrong fs?)"
>  
>  	test -z "$param" && return
> -	$XFS_IO_PROG -c "help $command" | grep -q "^ $param --" || \
> +	$XFS_IO_PROG -c "help $command" | egrep -qw "[ \[]$param" || \
>  		_notrun "xfs_io $command doesn't support $param"
>  }

This looks better to me, at least better than current code :)

Thanks,
Eryu
--
To unsubscribe from this list: send the line "unsubscribe fstests" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Eryu Guan July 20, 2016, 4:52 a.m. UTC | #3
On Tue, Jul 19, 2016 at 10:30:47AM +0200, Christoph Hellwig wrote:
> On Mon, Jul 18, 2016 at 11:49:57PM -0700, Eric Sandeen wrote:
> > Some tests actually do run xfs_io on a real file, but we probably
> > don't want to go that way.
> > 
> > The test for finding it in help output seems way too specific,
> > 
> > _require_xfs_io_command "pwrite" "-Z"
> > 
> > fails as well because it doesn't hit the specific format in
> > the grep.
> > 
> > What if we loosen up the test; is this too loose? (look for param
> > preceded by whitespace or square bracket)
> 
> Seems like it's not loose enough as it still tries to run the test
> on NFS.

For this NFSv4.2 case, I think we have to actually run "falloc -k" to
check whether the underlying fs supports (FALLOC_FL_KEEP_SIZE) or not.

Current check in _require_xfs_io_command only checks whether xfs_io
knows the given option, not the underlying fs. And in this NFSv4.2 case,
NFSv4.2 supports fallocate(2), and xfs_io falloc command knows "-k"
option, so test runs on NFS.

Thanks,
Eryu
--
To unsubscribe from this list: send the line "unsubscribe fstests" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/common/rc b/common/rc
index 6add69e..0eef3d5 100644
--- a/common/rc
+++ b/common/rc
@@ -1907,7 +1907,7 @@  _require_xfs_io_command()
 		_notrun "xfs_io $command failed (old kernel/wrong fs?)"
 
 	test -z "$param" && return
-	$XFS_IO_PROG -c "help $command" | grep -q "^ $param --" || \
+	$XFS_IO_PROG -c "help $command" | egrep -qw "[ \[]$param" || \
 		_notrun "xfs_io $command doesn't support $param"
 }