tests: Make OVS_WAIT_WHILE, OVS_WAIT_UNTIL run even faster in some cases.
authorBen Pfaff <blp@ovn.org>
Sun, 5 Jul 2015 17:20:35 +0000 (10:20 -0700)
committerBen Pfaff <blp@ovn.org>
Thu, 26 Nov 2015 21:28:29 +0000 (13:28 -0800)
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 <blp@ovn.org>
Reviewed-by: Simon Horman <simon.horman@netronome.com>
Acked-by: Flavio Leitner <fbl@sysclose.org>
tests/ovs-macros.at

index 90fb835..bfd0681 100644 (file)
@@ -38,7 +38,10 @@ ovs_setenv() {
 }
 
 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