tests: Make parse_listening_port entirely reliable.
authorBen Pfaff <blp@ovn.org>
Thu, 26 Nov 2015 21:13:29 +0000 (13:13 -0800)
committerBen Pfaff <blp@ovn.org>
Thu, 26 Nov 2015 21:28:29 +0000 (13:28 -0800)
commitfb28ef2d6ef847737176bb601ca99879dfc51f9e
treec24e1c078a47829743858bbc8326ab96b2809524
parent4c619f4d8bb2d773e34cc9a608b125b2601c1271
tests: Make parse_listening_port entirely reliable.

In test runs, I've occasionally seen mysterious failures in which
parse_listening_port failed to find the listening port even though an
examination of the log file showed that it was there.  I spent some time
trying to figure out what was going wrong.  It seemed like everything was
lined up properly to ensure that a command like "ovs-vsctl set-controller
br0 tcp:127.0.0.1:0" would only return to the command prompt after the
new listener was ready and the proper log message was written.  It was
obviously a very small race because I could only reproduce it with a large
test parallelism (e.g. -j10 on my quad-core laptop).

The problem turned out to be asynchronous logging in ovs-vswitchd.  If I
turned that off, by commenting out the call to vlog_enable_async() in
bridge.c, parse_listening_port became reliable.

This commit works around the problem by making parse_listening_port retry
for a while if necessary.  It also transforms the shell function into an
m4 macro (so that it can use OVS_WAIT_UNTIL) and renames it to
all-uppercase to follow the convention for macros.

Signed-off-by: Ben Pfaff <blp@ovn.org>
Reviewed-by: Simon Horman <simon.horman@netronome.com>
Acked-by: Flavio Leitner <fbl@sysclose.org>
tests/ofproto-dpif.at
tests/ofproto-macros.at
tests/ovs-vsctl.at
tests/ovsdb-idl.at
tests/ovsdb-server.at