From: Ben Pfaff Date: Fri, 15 Jan 2010 20:12:36 +0000 (-0800) Subject: tests: Factor OVSDB_INIT out of OVS_VSCTL_SETUP for other tests to use. X-Git-Tag: v1.0.0~259^2~286 X-Git-Url: http://git.onelab.eu/?a=commitdiff_plain;h=24c8ae53303ff25d118bb96d237da21a32085160;p=sliver-openvswitch.git tests: Factor OVSDB_INIT out of OVS_VSCTL_SETUP for other tests to use. New tests in upcoming commits will use this. --- diff --git a/tests/automake.mk b/tests/automake.mk index ef8b7c308..7a73a84f6 100644 --- a/tests/automake.mk +++ b/tests/automake.mk @@ -6,6 +6,7 @@ EXTRA_DIST += \ $(srcdir)/tests/testsuite TESTSUITE_AT = \ tests/testsuite.at \ + tests/ovsdb-macros.at \ tests/lcov-pre.at \ tests/library.at \ tests/vconn.at \ diff --git a/tests/ovs-vsctl.at b/tests/ovs-vsctl.at index 22028d900..8f8354ab1 100644 --- a/tests/ovs-vsctl.at +++ b/tests/ovs-vsctl.at @@ -3,23 +3,7 @@ dnl dnl Creates an empty database in the current directory and then starts dnl an ovsdb-server on it for ovs-vsctl to connect to. m4_define([OVS_VSCTL_SETUP], - [OVS_CHECK_LCOV( - [SCHEMA=$abs_top_builddir/vswitchd/vswitch-idl.ovsschema - if test ! -e $SCHEMA; then - SCHEMA=$abs_top_srcdir/vswitchd/vswitch-idl.ovsschema - if test ! -e $SCHEMA; then - echo 'Failed to find vswitch-idl.ovsschema' - exit 1 - fi - fi - ovsdb-tool create db $SCHEMA], - [0], [stdout], [ignore]) - OVS_CHECK_LCOV( - [[ovsdb-tool transact db \ - '[{"op": "insert", - "table": "Open_vSwitch", - "row": {}}]']], - [0], [ignore], [ignore]) + [OVSDB_INIT([db]) AT_CHECK([ovsdb-server --detach --pidfile=$PWD/pid --remote=punix:socket --unixctl=$PWD/unixctl db >/dev/null 2>&1], [0], [ignore], [ignore])]) dnl OVS_VSCTL_CLEANUP diff --git a/tests/ovsdb-macros.at b/tests/ovsdb-macros.at new file mode 100644 index 000000000..96c273efa --- /dev/null +++ b/tests/ovsdb-macros.at @@ -0,0 +1,21 @@ +dnl OVSDB_INIT([$1]) +dnl +dnl Creates an empty database named $1. +m4_define([OVSDB_INIT], + [OVS_CHECK_LCOV( + [SCHEMA=$abs_top_builddir/vswitchd/vswitch-idl.ovsschema + if test ! -e $SCHEMA; then + SCHEMA=$abs_top_srcdir/vswitchd/vswitch-idl.ovsschema + if test ! -e $SCHEMA; then + echo 'Failed to find vswitch-idl.ovsschema' + exit 1 + fi + fi + ovsdb-tool create $1 $SCHEMA], + [0], [stdout], [ignore]) + OVS_CHECK_LCOV( + [[ovsdb-tool transact $1 \ + '[{"op": "insert", + "table": "Open_vSwitch", + "row": {}}]']], + [0], [ignore], [ignore])]) diff --git a/tests/testsuite.at b/tests/testsuite.at index f99b4389d..4117f2015 100644 --- a/tests/testsuite.at +++ b/tests/testsuite.at @@ -32,7 +32,9 @@ m4_define([OVS_WAIT_UNTIL], done exit 1], [0], [ignore], [ignore])]) +m4_include([tests/ovsdb-macros.at]) m4_include([tests/lcov-pre.at]) + m4_include([tests/library.at]) m4_include([tests/vconn.at]) m4_include([tests/dir_name.at]) @@ -46,4 +48,5 @@ m4_include([tests/reconnect.at]) m4_include([tests/ovsdb.at]) m4_include([tests/stp.at]) m4_include([tests/ovs-vsctl.at]) + m4_include([tests/lcov-post.at])