Ofproto-dpif bond tests relies on netdev-dummy ports to set up
socket connection before actual tests. The time required
for socket connection varies depends on system load, making the test
prone to failure with simple sleep calls. On the other hand,
conservative sleep value for the slowest machine may be excessive on
a faster machine.

This patch removes the sleep calls. Replace them with
WAIT_FOR_DUMMY_PORTS() introduced in the last patch, thus removing
the timing dependency.

CC: Jarno Rajahalme <jrajaha...@nicira.com>
Signed-off-by: Andy Zhou <az...@nicira.com>
---
 tests/ofproto-dpif.at | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/tests/ofproto-dpif.at b/tests/ofproto-dpif.at
index e587d0d..3eaa01f 100644
--- a/tests/ofproto-dpif.at
+++ b/tests/ofproto-dpif.at
@@ -16,7 +16,7 @@ OVS_VSWITCHD_START(
    add-port br1 p3 -- set interface p3 type=dummy 
options:stream=unix:$OVS_RUNDIR/p1.sock ofport_request=3 -- \
    add-port br1 p4 -- set interface p4 type=dummy 
options:stream=unix:$OVS_RUNDIR/p2.sock ofport_request=4 -- \
    add-port br1 p8 -- set interface p8 ofport_request=8 type=dummy --])
-sleep 2
+WAIT_FOR_DUMMY_PORTS([p3], [p4])
 AT_CHECK([ovs-appctl vlog/set dpif:dbg])
 
 AT_CHECK([ovs-ofctl add-flow br0 action=normal])
@@ -67,12 +67,11 @@ OVS_VSWITCHD_START(
    add-port br1 p5 -- set interface p5 type=dummy 
options:stream=unix:$OVS_RUNDIR/p2.sock ofport_request=5 -- \
    add-port br1 p6 -- set interface p6 type=dummy 
options:stream=unix:$OVS_RUNDIR/p3.sock ofport_request=6 -- \
    add-port br1 p8 -- set interface p8 ofport_request=8 type=dummy --])
-sleep 2
+WAIT_FOR_DUMMY_PORTS([p4], [p5], [p6])
 AT_CHECK([ovs-ofctl add-flow br0 action=normal])
 AT_CHECK([ovs-ofctl add-flow br1 action=normal])
 AT_CHECK([ovs-appctl netdev-dummy/set-admin-state up], 0, [OK
 ])
-ovs-appctl netdev-dummy/set-admin-state up
 ovs-appctl time/stop
 ovs-appctl time/warp 100
 (
@@ -120,7 +119,7 @@ AT_CHECK([ovs-ofctl add-flow br0 action=normal])
 AT_CHECK([ovs-ofctl add-flow br1 action=normal])
 AT_CHECK([ovs-appctl upcall/disable-megaflows], [0], [megaflows disabled
 ], [])
-sleep 2
+WAIT_FOR_DUMMY_PORTS([p4], [p5], [p6])
 ovs-appctl time/stop
 ovs-appctl time/warp 100
 ovs-appctl lacp/show > lacp.txt
-- 
1.9.1

_______________________________________________
dev mailing list
dev@openvswitch.org
http://openvswitch.org/mailman/listinfo/dev

Reply via email to