tests: Avoid race conditions, by letting the kernel choose ports to bind.
authorBen Pfaff <blp@nicira.com>
Wed, 3 Apr 2013 18:30:18 +0000 (13:30 -0500)
committerBen Pfaff <blp@nicira.com>
Thu, 18 Apr 2013 23:43:15 +0000 (16:43 -0700)
commit1e04fcc879ea09bb8c7512cda6de91f7725627f6
tree7c2b17184703b4447ee05f5d0b119404ffd576b1
parentdf451457ad9a02bcd9793126b66be445f4d5a8a7
tests: Avoid race conditions, by letting the kernel choose ports to bind.

An occasionally occurring problem with "make check", especially when
parallel tests are enabled, is that multiple tests try to bind the same
TCP port and, of course, fail.  This happens because the code to select
a TCP port to bind just generates random numbers until it finds a port that
is not currently in use and uses the first one, which is of course prone
to races.

This commit changes the tests to let the kernel directly choose an
available port, which should avoid this type of failure.

Also, some of the tests that generated a random free TCP port actually
used the port number to bind a UDP socket, which of course doesn't work
well.  This commit fixes that problem too as a side effect.

Signed-off-by: Ben Pfaff <blp@nicira.com>
tests/automake.mk
tests/choose-port.pl [deleted file]
tests/ofproto-dpif.at
tests/ofproto-macros.at
tests/ovsdb-idl.at
tests/ovsdb-server.at