All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] xfs/054: only filter ROOT_INO at the beginning
@ 2016-10-22  5:39 Eryu Guan
  2016-10-25  5:50 ` Dave Chinner
  0 siblings, 1 reply; 3+ messages in thread
From: Eryu Guan @ 2016-10-22  5:39 UTC (permalink / raw)
  To: fstests; +Cc: Eryu Guan

In the test ROOT_INO is filtered out or replaced, but if ROOT_INO is
also 32, more "32"s are filtered or replaced than expected. This
happens to me when testing 512B block size XFS and 1k block size CRC
enabled XFS.

Also the ROOT_INO should be the inode number of TEST_DIR not
SCRATCH_MNT.

Signed-off-by: Eryu Guan <eguan@redhat.com>
---
 tests/xfs/054 | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/tests/xfs/054 b/tests/xfs/054
index 7d08f8a..578b752 100755
--- a/tests/xfs/054
+++ b/tests/xfs/054
@@ -52,13 +52,13 @@ _require_test
 _require_xfs_io_command "inode"
 
 # We know the root inode is there
-ROOT_INO=`ls -id $SCRATCH_MNT | awk '{print $1}'`
+ROOT_INO=`ls -id $TEST_DIR | awk '{print $1}'`
 
 touch $TEST_DIR/file
 
 $XFS_IO_PROG -c "inode"       $TEST_DIR/file
 $XFS_IO_PROG -c "inode -v"    $TEST_DIR/file | \
-		grep -vw $ROOT_INO | sed -e s/.*:/LAST:/g
+		grep -vw "^$ROOT_INO" | sed -e s/.*:/LAST:/g
 
 #  These should fail, -n requires an inode
 $XFS_IO_PROG -c "inode -n"    $TEST_DIR/file 2>&1 | grep -q Query \
@@ -83,15 +83,15 @@ $XFS_IO_PROG -c "inode -n -v badnumber" $TEST_DIR/file | grep -q numeric \
 # These should all work, and return $ROOT_INO or the next inode...
 # grep out ROOT_INO (which is incorrect) when we should be getting next inode
 $XFS_IO_PROG -c "inode       $ROOT_INO" $TEST_DIR/file | \
-		sed -e s/$ROOT_INO/ROOT_INO/g
+		sed -e s/^$ROOT_INO/ROOT_INO/g
 $XFS_IO_PROG -c "inode -v    $ROOT_INO" $TEST_DIR/file | \
-		sed -e s/$ROOT_INO/ROOT_INO/g
+		sed -e s/^$ROOT_INO/ROOT_INO/g
 $XFS_IO_PROG -c "inode -n    $ROOT_INO" $TEST_DIR/file | \
-		grep -vw $ROOT_INO | sed -e s/.*/NEXT/g
+		grep -vw "^$ROOT_INO" | sed -e s/.*/NEXT/g
 $XFS_IO_PROG -c "inode -nv   $ROOT_INO" $TEST_DIR/file | \
-		grep -vw $ROOT_INO | sed -e s/.*:/NEXT:/g
+		grep -vw "^$ROOT_INO" | sed -e s/.*:/NEXT:/g
 $XFS_IO_PROG -c "inode -n -v $ROOT_INO" $TEST_DIR/file | \
-		grep -vw $ROOT_INO | sed -e s/.*:/NEXT:/g
+		grep -vw "^$ROOT_INO" | sed -e s/.*:/NEXT:/g
 
 # Try one that doesn't exist, 2^64-2?  Should get 0
 $XFS_IO_PROG -c "inode       18446744073709551614" $TEST_DIR/file
-- 
2.7.4


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] xfs/054: only filter ROOT_INO at the beginning
  2016-10-22  5:39 [PATCH] xfs/054: only filter ROOT_INO at the beginning Eryu Guan
@ 2016-10-25  5:50 ` Dave Chinner
  2016-10-25  7:11   ` Eryu Guan
  0 siblings, 1 reply; 3+ messages in thread
From: Dave Chinner @ 2016-10-25  5:50 UTC (permalink / raw)
  To: Eryu Guan; +Cc: fstests

On Sat, Oct 22, 2016 at 01:39:56PM +0800, Eryu Guan wrote:
> In the test ROOT_INO is filtered out or replaced, but if ROOT_INO is
> also 32, more "32"s are filtered or replaced than expected. This
> happens to me when testing 512B block size XFS and 1k block size CRC
> enabled XFS.
> 
> Also the ROOT_INO should be the inode number of TEST_DIR not
> SCRATCH_MNT.
> 
> Signed-off-by: Eryu Guan <eguan@redhat.com>
> ---
>  tests/xfs/054 | 14 +++++++-------
>  1 file changed, 7 insertions(+), 7 deletions(-)
> 
> diff --git a/tests/xfs/054 b/tests/xfs/054
> index 7d08f8a..578b752 100755
> --- a/tests/xfs/054
> +++ b/tests/xfs/054
> @@ -52,13 +52,13 @@ _require_test
>  _require_xfs_io_command "inode"
>  
>  # We know the root inode is there
> -ROOT_INO=`ls -id $SCRATCH_MNT | awk '{print $1}'`
> +ROOT_INO=`ls -id $TEST_DIR | awk '{print $1}'`
>  
>  touch $TEST_DIR/file
>  
>  $XFS_IO_PROG -c "inode"       $TEST_DIR/file
>  $XFS_IO_PROG -c "inode -v"    $TEST_DIR/file | \
> -		grep -vw $ROOT_INO | sed -e s/.*:/LAST:/g
> +		grep -vw "^$ROOT_INO" | sed -e s/.*:/LAST:/g

So all of these sed expressions have the modifier "/g" on
them, which means "replace every matching occurrence on the line".
If all we want to do is replace the first match, then we should be
dropping the "g" modifier from the sed expressions...

Cheers,

Dave.
-- 
Dave Chinner
david@fromorbit.com

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] xfs/054: only filter ROOT_INO at the beginning
  2016-10-25  5:50 ` Dave Chinner
@ 2016-10-25  7:11   ` Eryu Guan
  0 siblings, 0 replies; 3+ messages in thread
From: Eryu Guan @ 2016-10-25  7:11 UTC (permalink / raw)
  To: Dave Chinner; +Cc: fstests

On Tue, Oct 25, 2016 at 04:50:16PM +1100, Dave Chinner wrote:
> On Sat, Oct 22, 2016 at 01:39:56PM +0800, Eryu Guan wrote:
> > In the test ROOT_INO is filtered out or replaced, but if ROOT_INO is
> > also 32, more "32"s are filtered or replaced than expected. This
> > happens to me when testing 512B block size XFS and 1k block size CRC
> > enabled XFS.
> > 
> > Also the ROOT_INO should be the inode number of TEST_DIR not
> > SCRATCH_MNT.
> > 
> > Signed-off-by: Eryu Guan <eguan@redhat.com>
> > ---
> >  tests/xfs/054 | 14 +++++++-------
> >  1 file changed, 7 insertions(+), 7 deletions(-)
> > 
> > diff --git a/tests/xfs/054 b/tests/xfs/054
> > index 7d08f8a..578b752 100755
> > --- a/tests/xfs/054
> > +++ b/tests/xfs/054
> > @@ -52,13 +52,13 @@ _require_test
> >  _require_xfs_io_command "inode"
> >  
> >  # We know the root inode is there
> > -ROOT_INO=`ls -id $SCRATCH_MNT | awk '{print $1}'`
> > +ROOT_INO=`ls -id $TEST_DIR | awk '{print $1}'`
> >  
> >  touch $TEST_DIR/file
> >  
> >  $XFS_IO_PROG -c "inode"       $TEST_DIR/file
> >  $XFS_IO_PROG -c "inode -v"    $TEST_DIR/file | \
> > -		grep -vw $ROOT_INO | sed -e s/.*:/LAST:/g
> > +		grep -vw "^$ROOT_INO" | sed -e s/.*:/LAST:/g
> 
> So all of these sed expressions have the modifier "/g" on
> them, which means "replace every matching occurrence on the line".
> If all we want to do is replace the first match, then we should be
> dropping the "g" modifier from the sed expressions...

I thought about this too, but it only works for "replace" in sed, not
for the "grep -vw" part. One of the problems here is that "grep -vw" is
filtering out more lines, so adding "^" is still needed for grep.

OTOH, all the "g" modifiers in this test seem not necessary to me, I'll
remove all "g"s in v2.

Thanks for the review!

Eryu

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2016-10-25  7:12 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-10-22  5:39 [PATCH] xfs/054: only filter ROOT_INO at the beginning Eryu Guan
2016-10-25  5:50 ` Dave Chinner
2016-10-25  7:11   ` Eryu Guan

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.