netdev-dpdk: fix mbuf leaks
[cascardo/ovs.git] / tests / ovs-vswitchd.at
index 12a179a..848daa3 100644 (file)
@@ -5,7 +5,7 @@ dnl Open_vSwitch record) visible to ovs-vswitchd, but hand-rolled scripts
 dnl sometimes do.  At one point, "ovs-vswitchd --detach" would never detach
 dnl and use 100% CPU if this happened, so this test checks for regression.
 AT_SETUP([ovs-vswitchd detaches correctly with empty db])
-ON_EXIT([kill `cat ovsdb-server.pid ovs-vswitchd.pid`])
+on_exit 'kill `cat ovsdb-server.pid ovs-vswitchd.pid`'
 
 dnl Create database.
 touch .conf.db.~lock~
@@ -163,3 +163,57 @@ OVS_WAIT_UNTIL([test -n "`grep ERR ovs-vswitchd.log | grep overwrite.file`"])
 
 OVS_VSWITCHD_STOP(["/Not adding Unix domain socket controller/d"])
 AT_CLEANUP
+
+dnl ----------------------------------------------------------------------
+dnl OVSDB server before release version 2.5 does not support the monitor2
+dnl method.  This test defeatures the OVSDB server to simulate an older
+dnl OVSDB server and make sure ovs-vswitchd can still work with it
+AT_SETUP([ovs-vswitchd -- Compatible with OVSDB server - w/o monitor2])
+OVS_VSWITCHD_START
+
+dnl defeature OVSDB server -- no monitor2
+AT_CHECK([ovs-appctl -t ovsdb-server ovsdb-server/disable-monitor2])
+
+sleep 1
+
+AT_CHECK([ovs-vsctl add-port br0 p0  -- set interface p0 type=internal])
+AT_CHECK([ovs-vsctl add-port br0 p1  -- set interface p1 type=internal])
+
+dnl ovs-vswitchd should still 'see' ovsdb change with the 'monitor' method
+AT_CHECK([ovs-appctl dpif/show | tail -n +3], [0], [dnl
+               br0 65534/100: (dummy)
+               p0 1/1: (dummy)
+               p1 2/2: (dummy)
+])
+OVS_VSWITCHD_STOP
+AT_CLEANUP
+
+dnl ----------------------------------------------------------------------
+AT_SETUP([ovs-vswitchd - do not create sockets with unsafe names])
+OVS_VSWITCHD_START
+
+# On Unix systems, test for sockets with "test -S".
+#
+# On Windows systems, we simulate a socket with a regular file that contains
+# a TCP port number, so use "test -f" there instead.
+if test $IS_WIN32 = yes; then
+   S=f
+else
+   S=S
+fi
+
+# Create a bridge with an ordinary name and make sure that the management
+# socket gets creatd.
+AT_CHECK([ovs-vsctl add-br a -- set bridge a datapath-type=dummy])
+AT_CHECK([test -$S a.mgmt])
+
+# Create a bridge with an unsafe name and make sure that the management
+# socket does not get created.
+mkdir b
+AT_CHECK([ovs-vsctl add-br b/c -- set bridge b/c datapath-type=dummy], [0],
+  [], [ovs-vsctl: Error detected while setting up 'b/c'.  See ovs-vswitchd log for details.
+])
+AT_CHECK([test ! -e b/c.mgmt])
+
+OVS_VSWITCHD_STOP(['/ignoring bridge with invalid name/d'])
+AT_CLEANUP