This commit adds an unit test for the "ovs-appctl coverage/show".

Signed-off-by: Alex Wang <al...@nicira.com>
---
 tests/ofproto-dpif.at |   26 ++++++++++++++++++++++++++
 1 file changed, 26 insertions(+)

diff --git a/tests/ofproto-dpif.at b/tests/ofproto-dpif.at
index 9231221..823b07a 100644
--- a/tests/ofproto-dpif.at
+++ b/tests/ofproto-dpif.at
@@ -2549,3 +2549,29 @@ 
in_port=1,vlan_tci=0x0000/0x0fff,dl_src=50:54:00:00:00:0b, n_subfacets:1, used:0
 ])
 OVS_VSWITCHD_STOP
 AT_CLEANUP
+
+AT_SETUP([ofproto-dpif coverage/show])
+OVS_VSWITCHD_START
+
+AT_CHECK([ovs-appctl time/stop]) dnl Want to manipulate the clock
+AT_CHECK([ovs-appctl time/warp 1000 && ovs-appctl time/warp 1000], [0], [warped
+warped
+])
+AT_CHECK([ovs-appctl coverage/show], [0], [stdout], [])
+
+# Check the unixctl_received and unixctl_replied rates
+# There should be in total 4 unixctl_received counts, but the rate should only
+# show 3 counts. This is in that the "ovs-appctl coverage/show" is not included
+# in the rate calculation.
+AT_CHECK([sed -n "s/^\(unixctl_received.*\)$/\1/p" stdout], [0], [dnl
+unixctl_received           0.6/sec       3/min         3/hr   total: 4
+])
+# There should be in total 3 unixctl_replied counts, and the rate should also
+# shouw 3 counts, since at the time of rate calculation, the command is not 
replied
+# yet.
+AT_CHECK([sed -n "s/^\(unixctl_replied.*\)$/\1/p" stdout], [0], [dnl
+unixctl_replied            0.6/sec       3/min         3/hr   total: 3
+])
+
+OVS_VSWITCHD_STOP
+AT_CLEANUP
-- 
1.7.9.5

_______________________________________________
dev mailing list
dev@openvswitch.org
http://openvswitch.org/mailman/listinfo/dev

Reply via email to