From 24c8ae53303ff25d118bb96d237da21a32085160 Mon Sep 17 00:00:00 2001 From: Ben Pfaff Date: Fri, 15 Jan 2010 12:12:36 -0800 Subject: [PATCH] tests: Factor OVSDB_INIT out of OVS_VSCTL_SETUP for other tests to use. New tests in upcoming commits will use this. --- tests/automake.mk | 1 + tests/ovs-vsctl.at | 18 +----------------- tests/ovsdb-macros.at | 21 +++++++++++++++++++++ tests/testsuite.at | 3 +++ 4 files changed, 26 insertions(+), 17 deletions(-) create mode 100644 tests/ovsdb-macros.at diff --git a/tests/automake.mk b/tests/automake.mk index ef8b7c30..7a73a84f 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 22028d90..8f8354ab 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 00000000..96c273ef --- /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 f99b4389..4117f201 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]) -- 2.30.2