vswitch: Fix memory leak in mirror code.
[sliver-openvswitch.git] / tests / ovs-vsctl.at
index a8deb1a..4f179b6 100644 (file)
@@ -567,7 +567,7 @@ OVS_VSCTL_SETUP
 AT_CHECK([RUN_OVS_VSCTL([create b name=br0])], 
   [0], [stdout], [], [OVS_VSCTL_CLEANUP])
 cp stdout out1
-AT_CHECK([RUN_OVS_VSCTL([list b])], 
+AT_CHECK([RUN_OVS_VSCTL([list b], [get b br0 _uuid])], 
   [0], [stdout], [], [OVS_VSCTL_CLEANUP])
 cp stdout out2
 AT_CHECK([perl $srcdir/uuidfilt.pl out1 out2], [0], 
@@ -584,6 +584,7 @@ netflow             : []
 other_config        : {}
 ports               : []
 sflow               : []
+<0>
 ]], [ignore], [test ! -e pid || kill `cat pid`])
 AT_CHECK(
   [RUN_OVS_VSCTL(
@@ -658,7 +659,13 @@ AT_CHECK([RUN_OVS_VSCTL([get b br0 :y=z])],
   [1], [], [ovs-vsctl: :y=z: missing column name
 ], [OVS_VSCTL_CLEANUP])
 AT_CHECK([RUN_OVS_VSCTL([get b br0 datapath_id:y=z])], 
-  [1], [], [ovs-vsctl: datapath_id:y=z: value not accepted here
+  [1], [], [ovs-vsctl: datapath_id:y=z: trailing garbage "=z" in argument
+], [OVS_VSCTL_CLEANUP])
+AT_CHECK([RUN_OVS_VSCTL([set b br0 'datapath_id:y>=z'])], 
+  [1], [], [ovs-vsctl: datapath_id:y>=z: argument does not end in "=" followed by a value.
+], [OVS_VSCTL_CLEANUP])
+AT_CHECK([RUN_OVS_VSCTL([wait-until b br0 datapath_id:y,z])], 
+  [1], [], [ovs-vsctl: datapath_id:y,z: argument does not end in "=", "!=", "<", ">", "<=", or ">=" followed by a value.
 ], [OVS_VSCTL_CLEANUP])
 AT_CHECK([RUN_OVS_VSCTL([get b br0 datapath_id::])], 
   [1], [], [ovs-vsctl: datapath_id::: trailing garbage ":" in argument
@@ -696,6 +703,58 @@ AT_CHECK([RUN_OVS_VSCTL([destroy b br2])],
 OVS_VSCTL_CLEANUP
 AT_CLEANUP
 
+AT_SETUP([database commands -- wait-until immediately true])
+AT_KEYWORDS([ovs-vsctl])
+OVS_VSCTL_SETUP
+AT_CHECK([RUN_OVS_VSCTL(
+    [add-br br0], 
+    [add-bond br0 bond0 eth0 eth1],
+    [set port bond0 bond_updelay=500 other-config:abc=def])],
+  [0], [], [], [OVS_VSCTL_CLEANUP])
+AT_CHECK([RUN_OVS_VSCTL([[wait-until Open_vSwitch . managers=[]]])],
+  [0], [], [], [OVS_VSCTL_CLEANUP])
+AT_CHECK([RUN_OVS_VSCTL([[wait-until Open_vSwitch . bridges!=[]]])],
+  [0], [], [], [OVS_VSCTL_CLEANUP])
+AT_CHECK([RUN_OVS_VSCTL([[wait-until Port bond0 other-config:abc=def]])],
+  [0], [], [], [OVS_VSCTL_CLEANUP])
+AT_CHECK([RUN_OVS_VSCTL([[wait-until port bond0 'bond_updelay>50' 'other-config:abc>d' 'other-config:abc<e']])],
+  [0], [], [], [OVS_VSCTL_CLEANUP])
+OVS_VSCTL_CLEANUP
+AT_CLEANUP
+
+AT_SETUP([database commands -- wait-until must wait])
+AT_KEYWORDS([ovs-vsctl])
+OVS_VSCTL_SETUP
+
+# Start ovs-vsctls in background.
+(RUN_OVS_VSCTL([[wait-until o . bridges!=[] -- get bridge br10 other-config:abc]])) > stdout1 &
+(RUN_OVS_VSCTL([[wait-until bridge br1 -- get bridge br1 other-config:abc]])) > stdout2 &
+(RUN_OVS_VSCTL([[wait-until b br1 other-config={abc=def} -- get bridge br1 other-config]])) > stdout3 &
+(RUN_OVS_VSCTL([[wait-until port bond0 'bond_updelay>50' -- get port bond0 bond-updelay]])) > stdout4 &
+
+# Give the ovs-vsctls a chance to read the database
+sleep 1
+
+AT_CHECK([RUN_OVS_VSCTL([add-br br10 -- set bridge br1 other-config:abc=quux])
+RUN_OVS_VSCTL([add-br br1 -- set bridge br1 other-config:abc=def -- add-bond br1 bond0 eth0 eth1 -- set port bond0 bond_updelay=500])],
+  [0], [], [], [OVS_VSCTL_CLEANUP])
+
+# Wait for the ovs-vsctls to finish.
+wait
+
+# Check output
+AT_CHECK([cat stdout1], [0], [quux
+], [], [OVS_VSCTL_CLEANUP])
+AT_CHECK([cat stdout2], [0], [def
+], [], [OVS_VSCTL_CLEANUP])
+AT_CHECK([cat stdout3], [0], [{abc=def}
+], [], [OVS_VSCTL_CLEANUP])
+AT_CHECK([cat stdout4], [0], [500
+], [], [OVS_VSCTL_CLEANUP])
+
+OVS_VSCTL_CLEANUP
+AT_CLEANUP
+
 dnl This test really shows a bug -- "create" followed by "list" in
 dnl the same execution shows the wrong UUID on the "list" command.
 dnl The bug is documented in ovs-vsctl.8.