* [PATCH] generic/071: require falloc -k @ 2016-07-18 8:06 Christoph Hellwig 2016-07-18 8:47 ` Eryu Guan 0 siblings, 1 reply; 9+ messages in thread From: Christoph Hellwig @ 2016-07-18 8:06 UTC (permalink / raw) To: fstests NFSv4.2 supports fallocate, but not the FALLOC_FL_KEEP_SIZE option. To avoid a spurious failure test for the correct command. Signed-off-by: Christoph Hellwig <hch@lst.de> --- tests/generic/071 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/generic/071 b/tests/generic/071 index 65ed0c7..9d0d136 100755 --- a/tests/generic/071 +++ b/tests/generic/071 @@ -46,7 +46,7 @@ trap "_cleanup; exit \$status" 0 1 2 3 15 _supported_fs generic _supported_os Linux _require_scratch -_require_xfs_io_command "falloc" +_require_xfs_io_command "falloc" "-k" rm -f $seqres.full -- 2.1.4 ^ permalink raw reply related [flat|nested] 9+ messages in thread
* Re: [PATCH] generic/071: require falloc -k 2016-07-18 8:06 [PATCH] generic/071: require falloc -k Christoph Hellwig @ 2016-07-18 8:47 ` Eryu Guan 2016-07-19 4:17 ` Christoph Hellwig 0 siblings, 1 reply; 9+ messages in thread From: Eryu Guan @ 2016-07-18 8:47 UTC (permalink / raw) To: Christoph Hellwig; +Cc: fstests On Mon, Jul 18, 2016 at 11:06:44AM +0300, Christoph Hellwig wrote: > NFSv4.2 supports fallocate, but not the FALLOC_FL_KEEP_SIZE option. > To avoid a spurious failure test for the correct command. > > Signed-off-by: Christoph Hellwig <hch@lst.de> > --- > tests/generic/071 | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/tests/generic/071 b/tests/generic/071 > index 65ed0c7..9d0d136 100755 > --- a/tests/generic/071 > +++ b/tests/generic/071 > @@ -46,7 +46,7 @@ trap "_cleanup; exit \$status" 0 1 2 3 15 > _supported_fs generic > _supported_os Linux > _require_scratch > -_require_xfs_io_command "falloc" > +_require_xfs_io_command "falloc" "-k" 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. xfs_io -c "help falloc" | grep -q "^ -k --" but "help falloc" doesn't follow the normal xfs_io command help format # xfs_io -c "help falloc" falloc [-c] [-k] [-p] off len -- allocates space associated with part of a file via fallocate So the check always returns false, and test always _notrun, with the additional "-k" switch. Perhaps we should update _require_xfs_io_command to actually run the command with the provided additional option? Thanks, Eryu ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH] generic/071: require falloc -k 2016-07-18 8:47 ` Eryu Guan @ 2016-07-19 4:17 ` Christoph Hellwig 2016-07-19 6:49 ` Eric Sandeen 0 siblings, 1 reply; 9+ messages in thread From: Christoph Hellwig @ 2016-07-19 4:17 UTC (permalink / raw) To: Eryu Guan; +Cc: Christoph Hellwig, fstests 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. ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH] generic/071: require falloc -k 2016-07-19 4:17 ` Christoph Hellwig @ 2016-07-19 6:49 ` Eric Sandeen 2016-07-19 8:30 ` Christoph Hellwig 2016-07-20 4:38 ` Eryu Guan 0 siblings, 2 replies; 9+ messages in thread From: Eric Sandeen @ 2016-07-19 6:49 UTC (permalink / raw) To: Christoph Hellwig, Eryu Guan; +Cc: fstests 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) 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" } ^ permalink raw reply related [flat|nested] 9+ messages in thread
* Re: [PATCH] generic/071: require falloc -k 2016-07-19 6:49 ` Eric Sandeen @ 2016-07-19 8:30 ` Christoph Hellwig 2016-07-20 4:52 ` Eryu Guan 2016-07-20 4:38 ` Eryu Guan 1 sibling, 1 reply; 9+ messages in thread From: Christoph Hellwig @ 2016-07-19 8:30 UTC (permalink / raw) To: Eric Sandeen; +Cc: Christoph Hellwig, Eryu Guan, fstests 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. ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH] generic/071: require falloc -k 2016-07-19 8:30 ` Christoph Hellwig @ 2016-07-20 4:52 ` Eryu Guan 2016-07-20 5:34 ` Eric Sandeen 0 siblings, 1 reply; 9+ messages in thread From: Eryu Guan @ 2016-07-20 4:52 UTC (permalink / raw) To: Christoph Hellwig; +Cc: Eric Sandeen, fstests 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 ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH] generic/071: require falloc -k 2016-07-20 4:52 ` Eryu Guan @ 2016-07-20 5:34 ` Eric Sandeen 2016-07-20 12:40 ` Eryu Guan 0 siblings, 1 reply; 9+ messages in thread From: Eric Sandeen @ 2016-07-20 5:34 UTC (permalink / raw) To: Eryu Guan, Christoph Hellwig; +Cc: fstests On 7/19/16 9:52 PM, Eryu Guan wrote: > 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. Oh right, sorry. So, this? diff --git a/common/rc b/common/rc index 6add69e..f087813 100644 --- a/common/rc +++ b/common/rc @@ -1880,7 +1880,7 @@ _require_xfs_io_command() testfile=$TEST_DIR/$$.xfs_io case $command in "falloc" ) - testio=`$XFS_IO_PROG -F -f -c "falloc 0 1m" $testfile 2>&1` + testio=`$XFS_IO_PROG -F -f -c "falloc $param 0 1m" $testfile 2>&1` ;; "fpunch" | "fcollapse" | "zero" | "fzero" | "finsert" ) testio=`$XFS_IO_PROG -F -f -c "pwrite 0 20k" -c "fsync" \ -Eric ^ permalink raw reply related [flat|nested] 9+ messages in thread
* Re: [PATCH] generic/071: require falloc -k 2016-07-20 5:34 ` Eric Sandeen @ 2016-07-20 12:40 ` Eryu Guan 0 siblings, 0 replies; 9+ messages in thread From: Eryu Guan @ 2016-07-20 12:40 UTC (permalink / raw) To: Eric Sandeen; +Cc: Christoph Hellwig, fstests On Tue, Jul 19, 2016 at 10:34:43PM -0700, Eric Sandeen wrote: > > > On 7/19/16 9:52 PM, Eryu Guan wrote: > > 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. > > Oh right, sorry. So, this? > > diff --git a/common/rc b/common/rc > index 6add69e..f087813 100644 > --- a/common/rc > +++ b/common/rc > @@ -1880,7 +1880,7 @@ _require_xfs_io_command() > testfile=$TEST_DIR/$$.xfs_io > case $command in > "falloc" ) > - testio=`$XFS_IO_PROG -F -f -c "falloc 0 1m" $testfile 2>&1` > + testio=`$XFS_IO_PROG -F -f -c "falloc $param 0 1m" $testfile 2>&1` > ;; > "fpunch" | "fcollapse" | "zero" | "fzero" | "finsert" ) > testio=`$XFS_IO_PROG -F -f -c "pwrite 0 20k" -c "fsync" \ Yes, this works, along with your first update. Or further more, we can set param="" in the "falloc" case after actually running it? Since we've already tested the option, no need to check the help message again. Thanks, Eryu ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH] generic/071: require falloc -k 2016-07-19 6:49 ` Eric Sandeen 2016-07-19 8:30 ` Christoph Hellwig @ 2016-07-20 4:38 ` Eryu Guan 1 sibling, 0 replies; 9+ messages in thread From: Eryu Guan @ 2016-07-20 4:38 UTC (permalink / raw) To: Eric Sandeen; +Cc: Christoph Hellwig, fstests 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 ^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2016-07-20 12:40 UTC | newest] Thread overview: 9+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2016-07-18 8:06 [PATCH] generic/071: require falloc -k Christoph Hellwig 2016-07-18 8:47 ` Eryu Guan 2016-07-19 4:17 ` Christoph Hellwig 2016-07-19 6:49 ` Eric Sandeen 2016-07-19 8:30 ` Christoph Hellwig 2016-07-20 4:52 ` Eryu Guan 2016-07-20 5:34 ` Eric Sandeen 2016-07-20 12:40 ` Eryu Guan 2016-07-20 4:38 ` Eryu Guan
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox