Port a variant of commit a6d1a2997db4:
    ofproto.at: Workaround a race

    While a barrier serializes requests from the same connection,
    it doesn't wait for requests from other connections to the switch.
    Replace the barrier with infamous "sleep 1" to workaround the problem.

to the following tests:
    "ofproto - asynchronous message control (OpenFlow 1.0)",
    "ofproto - asynchronous message control (OpenFlow 1.3)",
    "ofproto - asynchronous message control (OpenFlow 1.4)" and
    "ofproto - asynchronous message control (OpenFlow 1.5)"

Do not use "sleep 1", but wait for log file to have (at least) the same
number of lines we expect (it generally waits less time).

Sometimes one of these tests fails because the OFPT_BARRIER_REPLY is
printed before the other message we expect to have.

Suggested-by: Lance Richardson <lrich...@redhat.com>
Signed-off-by: Timothy Redaelli <tredae...@redhat.com>
---
v2:
* wait for log file to have (at least) the same number of lines we expect
  as per review comment

 tests/ofproto.at | 14 +++++---------
 1 file changed, 5 insertions(+), 9 deletions(-)

diff --git a/tests/ofproto.at b/tests/ofproto.at
index 4431c157..5431f4e8 100644
--- a/tests/ofproto.at
+++ b/tests/ofproto.at
@@ -3212,8 +3212,7 @@ 
udp,vlan_tci=0x0000,dl_src=00:26:b9:8c:b0:f9,dl_dst=00:25:83:df:b4:00,nw_src=172
     fi
     AT_FAIL_IF([test X"$1" != X])
 
-    ovs-appctl -t ovs-ofctl ofctl/barrier
-    echo >>expout "OFPT_BARRIER_REPLY:"
+    OVS_WAIT_UNTIL([test `wc -l < "monitor.log"` -ge `wc -l < "expout"`])
 
     AT_CHECK(
       [[sed '
@@ -3316,7 +3315,7 @@ 
udp,vlan_tci=0x0000,dl_src=00:26:b9:8c:b0:f9,dl_dst=00:25:83:df:b4:00,nw_src=172
     fi
     AT_FAIL_IF([test X"$1" != X])
 
-    sleep 1
+    OVS_WAIT_UNTIL([test `wc -l < "monitor.log"` -ge `wc -l < "expout"`])
 
     AT_CHECK(
       [[sed '
@@ -3435,8 +3434,7 @@ 
udp,vlan_tci=0x0000,dl_src=00:26:b9:8c:b0:f9,dl_dst=00:25:83:df:b4:00,nw_src=172
 
     AT_FAIL_IF([test X"$1" != X])
 
-    ovs-appctl -t ovs-ofctl ofctl/barrier
-    echo >>expout "OFPT_BARRIER_REPLY (OF1.3):"
+    OVS_WAIT_UNTIL([test `wc -l < "monitor.log"` -ge `wc -l < "expout"`])
 
     AT_CHECK(
       [[sed '
@@ -3645,8 +3643,7 @@ table_desc:-
 
     AT_FAIL_IF([test X"$1" != X])
 
-    ovs-appctl -t ovs-ofctl ofctl/barrier
-    echo >>expout "OFPT_BARRIER_REPLY (OF1.4):"
+    OVS_WAIT_UNTIL([test `wc -l < "monitor.log"` -ge `wc -l < "expout"`])
 
     AT_CHECK(
       [[sed '
@@ -3734,8 +3731,7 @@ OFPT_PORT_STATUS (OF1.5): MOD: 2(test): 
addr:aa:55:aa:55:00:0x
 
     AT_FAIL_IF([test X"$1" != X])
 
-    ovs-appctl -t ovs-ofctl ofctl/barrier
-    echo >>expout "OFPT_BARRIER_REPLY (OF1.5):"
+    OVS_WAIT_UNTIL([test `wc -l < "monitor.log"` -ge `wc -l < "expout"`])
 
     AT_CHECK(
       [[sed '
-- 
2.12.2

_______________________________________________
dev mailing list
d...@openvswitch.org
https://mail.openvswitch.org/mailman/listinfo/ovs-dev

Reply via email to