Current macros are unable to filter whole seconds, e.g. 'duration:6s'.
This is causing random test failures, most frequently in CirrusCI:

  ./dpif-netdev.at:370: ovs-ofctl -O OpenFlow13 meter-stats br0 | strip_timers
  --- -
  +++ /tmp/cirrus-ci-build/tests/testsuite.dir/at-groups/990/stdout
  @@ -1,5 +1,5 @@
   OFPST_METER reply (OF1.3) (xid=0x2):
  -meter:1 flow_count:1 packet_in_count:10 byte_in_count:600 duration:0.0s 
bands:
  +meter:1 flow_count:1 packet_in_count:10 byte_in_count:600 duration:6s bands:

Fix sed matches to correctly handle that scenario.
Repeating the [0-9\.] twice because it is hard to write a shorter
portable version with sed.

Signed-off-by: Ilya Maximets <[email protected]>
---
 tests/dpif-netdev.at | 10 +++++-----
 tests/stp.at         |  2 +-
 2 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/tests/dpif-netdev.at b/tests/dpif-netdev.at
index 3179e1645..6aff1eda7 100644
--- a/tests/dpif-netdev.at
+++ b/tests/dpif-netdev.at
@@ -6,8 +6,8 @@ m4_divert_push([PREPARE_TESTS])
 # that vary from one run to another (e.g., timing and bond actions).
 strip_timers () {
     sed '
-    s/duration:[0-9]*\.[0-9]*/duration:0.0/
-    s/used:[0-9]*\.[0-9]*/used:0.0/
+    s/duration:[0-9\.][0-9\.]*/duration:0.0/
+    s/used:[0-9\.][0-9\.]*/used:0.0/
 '
 }
 
@@ -15,7 +15,7 @@ strip_xout () {
     sed '
     s/mega_ufid:[-0-9a-f]* //
     s/ufid:[-0-9a-f]* //
-    s/used:[0-9]*\.[0-9]*/used:0.0/
+    s/used:[0-9\.][0-9\.]*/used:0.0/
     s/actions:.*/actions: <del>/
     s/packets:[0-9]*/packets:0/
     s/bytes:[0-9]*/bytes:0/
@@ -26,7 +26,7 @@ strip_xout_keep_actions () {
     sed '
     s/mega_ufid:[-0-9a-f]* //
     s/ufid:[-0-9a-f]* //
-    s/used:[0-9]*\.[0-9]*/used:0.0/
+    s/used:[0-9\.][0-9\.]*/used:0.0/
     s/packets:[0-9]*/packets:0/
     s/bytes:[0-9]*/bytes:0/
 ' | sort
@@ -51,7 +51,7 @@ filter_hw_packet_netdev_dummy () {
 filter_flow_dump () {
     grep 'flow_dump ' | sed '
         s/.*flow_dump //
-        s/used:[0-9]*\.[0-9]*/used:0.0/
+        s/used:[0-9\.][0-9\.]*/used:0.0/
     ' | sort | uniq
 }
 
diff --git a/tests/stp.at b/tests/stp.at
index 7ddacfc3a..69475843e 100644
--- a/tests/stp.at
+++ b/tests/stp.at
@@ -368,7 +368,7 @@ AT_CLEANUP
 # Strips out uninteresting parts of flow output, as well as parts
 # that vary from one run to another (e.g., timing and bond actions).
 m4_define([STRIP_USED], [[sed '
-    s/used:[0-9]*\.[0-9]*/used:0.0/
+    s/used:[0-9\.][0-9\.]*/used:0.0/
     s/duration=[0-9.]*s*/duration=Xs/
     s/idle_age=[0-9]*,/idle_age=X,/
 ']])
-- 
2.37.3

_______________________________________________
dev mailing list
[email protected]
https://mail.openvswitch.org/mailman/listinfo/ovs-dev

Reply via email to