[ovs-dev] [PATCH 2/3] test: add WAIT_FOR_DUMMY_PORTS helper macro for writing tests
Jarno Rajahalme
jrajahalme at nicira.com
Sat Jun 7 02:37:35 UTC 2014
Sent from my iPhone
> On Jun 6, 2014, at 4:35 PM, Andy Zhou <azhou at nicira.com> wrote:
>
> Add a macro to waiting until all ports supplied are connected.
>
> CC: Jarno Rajahalme <jrajahalme at nicira.com>
> Signed-off-by: Andy Zhou <azhou at nicira.com>
> ---
> tests/ofproto-macros.at | 9 +++++++++
> 1 file changed, 9 insertions(+)
>
> diff --git a/tests/ofproto-macros.at b/tests/ofproto-macros.at
> index b4b6dab..f9f2bb0 100644
> --- a/tests/ofproto-macros.at
> +++ b/tests/ofproto-macros.at
> @@ -123,3 +123,12 @@ m4_define([ADD_OF_PORTS],
> [ovs-vsctl m4_foreach([of_port], m4_cdr($@),
> [ \
> -- add-port $1 p[]of_port -- set Interface p[]of_port type=dummy ofport_request=of_port])])
> +
> +# WAIT_FOR_DUMMY_PORTS(NETDEV_DUMMY_PORT[, NETDEV_DUMMY_PORT...])
> +#
> +# Wait until the netdev dummy ports are connected to each other
> +m4_define([WAIT_FOR_DUMMY_PORTS], \
> + [m4_foreach([dummy_port], [$@],
> + [ \
> + OVS_WAIT_WHILE([ovs-appctl netdev-dummy/conn-state dummy_port \
> + | grep "disconnected"], [sleep 1])])])
This would be more robust if you checked for connected instead, and bailed out if "unknown" is seen.
Jarno
More information about the dev
mailing list