Refactor in preparation for the next patch. Signed-off-by: Andy Zhou <az...@nicira.com> --- tests/ofproto-macros.at | 35 ++++++++++++++++++++++------------- 1 file changed, 22 insertions(+), 13 deletions(-)
diff --git a/tests/ofproto-macros.at b/tests/ofproto-macros.at index cbf0ad6..93d8a77 100644 --- a/tests/ofproto-macros.at +++ b/tests/ofproto-macros.at @@ -39,20 +39,12 @@ m4_define([STRIP_USED], [[sed 's/used:[0-9]\.[0-9]*/used:0.0/']]) m4_define([STRIP_UFID], [[sed 's/ufid:[0-9a-f]* //']]) m4_define([TESTABLE_LOG], [-vPATTERN:ANY:'%c|%p|%m']) -# OVS_VSWITCHD_START([vsctl-args], [vsctl-output], [=override]) +# _OVS_VSWITCHD_START([vswitchd-aux-args]) # -# Creates a database and starts ovsdb-server, starts ovs-vswitchd -# connected to that database, calls ovs-vsctl to create a bridge named -# br0 with predictable settings, passing 'vsctl-args' as additional -# commands to ovs-vsctl. If 'vsctl-args' causes ovs-vsctl to provide -# output (e.g. because it includes "create" commands) then 'vsctl-output' -# specifies the expected output after filtering through uuidfilt.pl. +# Creates an empty database and starts ovsdb-server. +# Starts ovs-vswitchd, with additional arguments 'vswitchd-aux-args'. # -# If a test needs to use "system" devices (as dummies), then specify -# =override (literally) as the third argument. Otherwise, system devices -# won't work at all (which makes sense because tests should not access a -# system's real Ethernet devices). -m4_define([OVS_VSWITCHD_START], +m4_define([_OVS_VSWITCHD_START], [OVS_RUNDIR=`pwd`; export OVS_RUNDIR OVS_LOGDIR=`pwd`; export OVS_LOGDIR OVS_DBDIR=`pwd`; export OVS_DBDIR @@ -74,7 +66,7 @@ m4_define([OVS_VSWITCHD_START], AT_CHECK([ovs-vsctl --no-wait init]) dnl Start ovs-vswitchd. - AT_CHECK([ovs-vswitchd --detach --no-chdir --pidfile --enable-dummy$3 --disable-system --log-file -vvconn -vofproto_dpif], [0], [], [stderr]) + AT_CHECK([ovs-vswitchd $1 --detach --no-chdir --pidfile --log-file -vvconn -vofproto_dpif], [0], [], [stderr]) AT_CAPTURE_FILE([ovs-vswitchd.log]) AT_CHECK([[sed < stderr ' /ovs_numa|INFO|Discovered /d @@ -83,6 +75,23 @@ m4_define([OVS_VSWITCHD_START], /reconnect|INFO|/d /ofproto|INFO|using datapath ID/d /ofproto|INFO|datapath ID changed to fedcba9876543210/d']]) +]) + +# OVS_VSWITCHD_START([vsctl-args], [vsctl-output], [=override]) +# +# Creates a database and starts ovsdb-server, starts ovs-vswitchd +# connected to that database, calls ovs-vsctl to create a bridge named +# br0 with predictable settings, passing 'vsctl-args' as additional +# commands to ovs-vsctl. If 'vsctl-args' causes ovs-vsctl to provide +# output (e.g. because it includes "create" commands) then 'vsctl-output' +# specifies the expected output after filtering through uuidfilt.pl. +# +# If a test needs to use "system" devices (as dummies), then specify +# =override (literally) as the third argument. Otherwise, system devices +# won't work at all (which makes sense because tests should not access a +# system's real Ethernet devices). +m4_define([OVS_VSWITCHD_START], + [_OVS_VSWITCHD_START([--enable-dummy$3 --disable-system]) dnl Add bridges, ports, etc. AT_CHECK([ovs-vsctl -- add-br br0 -- set bridge br0 datapath-type=dummy other-config:datapath-id=fedcba9876543210 other-config:hwaddr=aa:55:aa:55:00:00 protocols=[[OpenFlow10,OpenFlow11,OpenFlow12,OpenFlow13,OpenFlow14,OpenFlow15]] fail-mode=secure -- $1 m4_if([$2], [], [], [| ${PERL} $srcdir/uuidfilt.pl])], [0], [$2]) -- 1.9.1 _______________________________________________ dev mailing list dev@openvswitch.org http://openvswitch.org/mailman/listinfo/dev