Sometimes OVS_WAIT_WHILE and OVS_WAIT_UNTIL are used for conditions that
tend to be true immediately but sometimes take a moment or two.  This
change makes such cases 0.1 seconds faster (which could add up over
hundreds of tests).

Signed-off-by: Ben Pfaff <b...@nicira.com>
---
 tests/ovs-macros.at | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/tests/ovs-macros.at b/tests/ovs-macros.at
index 3c3d825..73a3724 100644
--- a/tests/ovs-macros.at
+++ b/tests/ovs-macros.at
@@ -7,7 +7,10 @@ m4_include([m4/compat.at])
 m4_divert_push([PREPARE_TESTS])
 [
 ovs_wait () {
-    # First try a quick sleep, so that the test completes very quickly
+    # First try the condition without waiting.
+    ovs_wait_cond && return 0
+
+    # Try a quick sleep, so that the test completes very quickly
     # in the normal case.  POSIX doesn't require fractional times to
     # work, so this might not work.
     sleep 0.1
-- 
2.1.3

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

Reply via email to