common/filter: extend _filter_xfs_io to match -nan
PATCH 1/1 common/filter: extend _filter_xfs_io to match -nan
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.
--- common/filter | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
common/filter +3 -3
@@ -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
Signature · 1 line
2.30.2
Quoted 19 lines · Eric Whitney
When run on ext4 with sufficiently fast
x86_64hardware, generic/130 sometimes fails becausexfs_iocan report rate values as -nan:
0.000000 bytes, 0 ops; 0.0000 sec (-nan bytes/sec and -nan ops/sec)
_filter_xfs_iomatches 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 <[email protected]>--- common/filter | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)common/filter +0
-0
common/filter common_line_filter() · line 173
Quoted 9 lines
common/filter +3
-3@@ -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
--D
Quoted 6 lines
common/filter +0
-0} # Also filter out the offset part of xfs_io outputSignature · 1 line
2.30.2
* Darrick J. Wong <[email protected]>:
Quoted 32 lines · Eric Whitney
Quoted 19 lines
When run on ext4 with sufficiently fast
x86_64hardware, generic/130 sometimes fails becausexfs_iocan report rate values as -nan:
0.000000 bytes, 0 ops; 0.0000 sec (-nan bytes/sec and -nan ops/sec)
_filter_xfs_iomatches 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 <[email protected]>--- common/filter | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)common/filter +0
-0common/filter common_line_filter() · line 173
Quoted 9 lines
common/filter +3
-3@@ -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.
Quoted 1 line
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.
Quoted 2 lines
Reviewed-by Darrick J. Wong <[email protected]>
Thanks very much for your review!
Eric
Quoted 9 lines
--D
Quoted 6 lines
common/filter +0
-0} # Also filter out the offset part of xfs_io outputSignature · 1 line
2.30.2