tests: Factor OVSDB_INIT out of OVS_VSCTL_SETUP for other tests to use.
authorBen Pfaff <blp@nicira.com>
Fri, 15 Jan 2010 20:12:36 +0000 (12:12 -0800)
committerBen Pfaff <blp@nicira.com>
Fri, 15 Jan 2010 23:28:16 +0000 (15:28 -0800)
New tests in upcoming commits will use this.

tests/automake.mk
tests/ovs-vsctl.at
tests/ovsdb-macros.at [new file with mode: 0644]
tests/testsuite.at

index ef8b7c3..7a73a84 100644 (file)
@@ -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 \
index 22028d9..8f8354a 100644 (file)
@@ -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 (file)
index 0000000..96c273e
--- /dev/null
@@ -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])])
index f99b438..4117f20 100644 (file)
@@ -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])