All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] common/filter: extend _filter_xfs_io to match -nan
@ 2022-04-14 14:22 Eric Whitney
  2022-04-14 15:29 ` Darrick J. Wong
  0 siblings, 1 reply; 3+ messages in thread
From: Eric Whitney @ 2022-04-14 14:22 UTC (permalink / raw)
  To: fstests; +Cc: linux-ext4, Eric Whitney

When run on ext4 with sufficiently fast x86_64 hardware, generic/130
sometimes fails because xfs_io can report rate values as -nan:
0.000000 bytes, 0 ops; 0.0000 sec (-nan bytes/sec and -nan ops/sec)

_filter_xfs_io matches the strings 'inf' or 'nan', but not '-nan'.  In
that case it fails to convert the actual output to a normalized form
matching generic/130's golden output.  Extend the regular expression
used to match xfs_io's output to fix this.

Signed-off-by: Eric Whitney <enwlinux@gmail.com>
---
 common/filter | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/common/filter b/common/filter
index 5fe86756..5b20e848 100644
--- a/common/filter
+++ b/common/filter
@@ -168,9 +168,9 @@ common_line_filter()
 
 _filter_xfs_io()
 {
-    # Apart from standard numeric values, we also filter out 'inf' and 'nan'
-    # which can result from division in some cases
-    sed -e "s/[0-9/.]* [GMKiBbytes]*, [0-9]* ops\; [0-9/:. sec]* ([infa0-9/.]* [EPGMKiBbytes]*\/sec and [infa0-9/.]* ops\/sec)/XXX Bytes, X ops\; XX:XX:XX.X (XXX YYY\/sec and XXX ops\/sec)/"
+    # Apart from standard numeric values, we also filter out 'inf', 'nan', and
+    # '-nan' which can result from division in some cases
+    sed -e "s/[0-9/.]* [GMKiBbytes]*, [0-9]* ops\; [0-9/:. sec]* ([infa0-9/.-]* [EPGMKiBbytes]*\/sec and [infa0-9/.-]* ops\/sec)/XXX Bytes, X ops\; XX:XX:XX.X (XXX YYY\/sec and XXX ops\/sec)/"
 }
 
 # Also filter out the offset part of xfs_io output
-- 
2.30.2


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

* Re: [PATCH] common/filter: extend _filter_xfs_io to match -nan
  2022-04-14 14:22 [PATCH] common/filter: extend _filter_xfs_io to match -nan Eric Whitney
@ 2022-04-14 15:29 ` Darrick J. Wong
  2022-04-15 15:10   ` Eric Whitney
  0 siblings, 1 reply; 3+ messages in thread
From: Darrick J. Wong @ 2022-04-14 15:29 UTC (permalink / raw)
  To: Eric Whitney; +Cc: fstests, linux-ext4

On Thu, Apr 14, 2022 at 10:22:58AM -0400, Eric Whitney wrote:
> When run on ext4 with sufficiently fast x86_64 hardware, generic/130
> sometimes fails because xfs_io can report rate values as -nan:
> 0.000000 bytes, 0 ops; 0.0000 sec (-nan bytes/sec and -nan ops/sec)
> 
> _filter_xfs_io matches the strings 'inf' or 'nan', but not '-nan'.  In
> that case it fails to convert the actual output to a normalized form
> matching generic/130's golden output.  Extend the regular expression
> used to match xfs_io's output to fix this.
> 
> Signed-off-by: Eric Whitney <enwlinux@gmail.com>
> ---
>  common/filter | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/common/filter b/common/filter
> index 5fe86756..5b20e848 100644
> --- a/common/filter
> +++ b/common/filter
> @@ -168,9 +168,9 @@ common_line_filter()
>  
>  _filter_xfs_io()
>  {
> -    # Apart from standard numeric values, we also filter out 'inf' and 'nan'
> -    # which can result from division in some cases
> -    sed -e "s/[0-9/.]* [GMKiBbytes]*, [0-9]* ops\; [0-9/:. sec]* ([infa0-9/.]* [EPGMKiBbytes]*\/sec and [infa0-9/.]* ops\/sec)/XXX Bytes, X ops\; XX:XX:XX.X (XXX YYY\/sec and XXX ops\/sec)/"
> +    # Apart from standard numeric values, we also filter out 'inf', 'nan', and
> +    # '-nan' which can result from division in some cases
> +    sed -e "s/[0-9/.]* [GMKiBbytes]*, [0-9]* ops\; [0-9/:. sec]* ([infa0-9/.-]* [EPGMKiBbytes]*\/sec and [infa0-9/.-]* ops\/sec)/XXX Bytes, X ops\; XX:XX:XX.X (XXX YYY\/sec and XXX ops\/sec)/"

/me squints at this regular expression and /thinks/ its ok.

Took me a while to figure out "infa" tho. :P

Reviewed-by: Darrick J. Wong <djwong@kernel.org>

--D

>  }
>  
>  # Also filter out the offset part of xfs_io output
> -- 
> 2.30.2
> 

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

* Re: [PATCH] common/filter: extend _filter_xfs_io to match -nan
  2022-04-14 15:29 ` Darrick J. Wong
@ 2022-04-15 15:10   ` Eric Whitney
  0 siblings, 0 replies; 3+ messages in thread
From: Eric Whitney @ 2022-04-15 15:10 UTC (permalink / raw)
  To: Darrick J. Wong; +Cc: Eric Whitney, fstests, linux-ext4

* Darrick J. Wong <djwong@kernel.org>:
> On Thu, Apr 14, 2022 at 10:22:58AM -0400, Eric Whitney wrote:
> > When run on ext4 with sufficiently fast x86_64 hardware, generic/130
> > sometimes fails because xfs_io can report rate values as -nan:
> > 0.000000 bytes, 0 ops; 0.0000 sec (-nan bytes/sec and -nan ops/sec)
> > 
> > _filter_xfs_io matches the strings 'inf' or 'nan', but not '-nan'.  In
> > that case it fails to convert the actual output to a normalized form
> > matching generic/130's golden output.  Extend the regular expression
> > used to match xfs_io's output to fix this.
> > 
> > Signed-off-by: Eric Whitney <enwlinux@gmail.com>
> > ---
> >  common/filter | 6 +++---
> >  1 file changed, 3 insertions(+), 3 deletions(-)
> > 
> > diff --git a/common/filter b/common/filter
> > index 5fe86756..5b20e848 100644
> > --- a/common/filter
> > +++ b/common/filter
> > @@ -168,9 +168,9 @@ common_line_filter()
> >  
> >  _filter_xfs_io()
> >  {
> > -    # Apart from standard numeric values, we also filter out 'inf' and 'nan'
> > -    # which can result from division in some cases
> > -    sed -e "s/[0-9/.]* [GMKiBbytes]*, [0-9]* ops\; [0-9/:. sec]* ([infa0-9/.]* [EPGMKiBbytes]*\/sec and [infa0-9/.]* ops\/sec)/XXX Bytes, X ops\; XX:XX:XX.X (XXX YYY\/sec and XXX ops\/sec)/"
> > +    # Apart from standard numeric values, we also filter out 'inf', 'nan', and
> > +    # '-nan' which can result from division in some cases
> > +    sed -e "s/[0-9/.]* [GMKiBbytes]*, [0-9]* ops\; [0-9/:. sec]* ([infa0-9/.-]* [EPGMKiBbytes]*\/sec and [infa0-9/.-]* ops\/sec)/XXX Bytes, X ops\; XX:XX:XX.X (XXX YYY\/sec and XXX ops\/sec)/"
> 
> /me squints at this regular expression and /thinks/ its ok.
> 
> Took me a while to figure out "infa" tho. :P

Hi Darrick:

Yeah, me too.  I initially thought that string would not match 'nan', but
then discovered bracket expressions after having not used sed in a very long
time.  It's a sloppy match - it'll recognize fan0 as well as 'inf' or 'nan',
etc. - and I guess the idea is that's good enough for filtering expected output
from xfs_io while being concise.  The sed documentation suggests that a '-' on
the beginning or end of the bracket expression will be treated literally, and
not as a metacharacter (part of a range), so we should be good there.

> 
> Reviewed-by: Darrick J. Wong <djwong@kernel.org>

Thanks very much for your review!

Eric

> 
> --D
> 
> >  }
> >  
> >  # Also filter out the offset part of xfs_io output
> > -- 
> > 2.30.2
> > 

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

end of thread, other threads:[~2022-04-15 15:10 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-04-14 14:22 [PATCH] common/filter: extend _filter_xfs_io to match -nan Eric Whitney
2022-04-14 15:29 ` Darrick J. Wong
2022-04-15 15:10   ` Eric Whitney

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.