summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorAlin Gabriel Serdean <aserdean@ovn.org>2017-08-28 20:14:59 +0300
committerBen Pfaff <blp@ovn.org>2017-10-31 15:29:20 -0700
commit83949879b3952409a30bac6d221e44117b35f994 (patch)
tree645aefa67e76145c0d397003941ff7deb5e54458 /tests
parent45e46e925c7a24573d5e339de0152b1785a971b0 (diff)
downloadopenvswitch-83949879b3952409a30bac6d221e44117b35f994.tar.gz
tests: Add a default timeout for control utilities
Let's suppose that ovsdb-server is running properly, but ovs-vswitchd is not responsive/crashed. We try to add a port via ovs-vsctl and it will hang. This patch aims at that scenario and tries to make life easier when debugging hanging tests. Some shells do not allow dashes in function names (default behavior), we shall try to define an alias to overcome dashes if the shell allows it. Signed-off-by: Alin Gabriel Serdean <aserdean@ovn.org> Suggested-by: Ben Pfaff <blp@ovn.org> Signed-off-by: Ben Pfaff <blp@ovn.org>
Diffstat (limited to 'tests')
-rw-r--r--tests/ovs-macros.at37
1 files changed, 37 insertions, 0 deletions
diff --git a/tests/ovs-macros.at b/tests/ovs-macros.at
index 97ecc52a7..7c57ca1bc 100644
--- a/tests/ovs-macros.at
+++ b/tests/ovs-macros.at
@@ -103,6 +103,43 @@ if test "$IS_WIN32" = "yes"; then
}
fi
+# Try to add a default timeout for the following control utilities:
+# - ovs-vsctl
+# - ovs-ofctl
+# - ovs-appctl
+# - ovn-sbctl
+# - ovn-nbctl
+# - vtep-ctl
+# Set default timeout for 30 seconds.
+# This should be sufficient on all platforms.
+OVS_TIMEOUT=30
+alias ovs-vsctl='OVS_VSCTL_TIMEOUT' >/dev/null 2>&1
+if [ $? -eq 0 ]; then
+ OVS_VSCTL_TIMEOUT () {
+ command ovs-vsctl --timeout=$OVS_TIMEOUT "$@"
+ }
+ alias ovs-ofctl='OVS_OFCTL_TIMEOUT'
+ alias ovs-appctl='OVS_APPCTL_TIMEOUT'
+ alias ovn-sbctl='OVS_SBCTL_TIMEOUT'
+ alias ovn-nbctl='OVN_NBCTL_TIMEOUT'
+ alias vtep-ctl='VTEP_CTL_TIMEOUT'
+ OVS_OFCTL_TIMEOUT () {
+ command ovs-ofctl --timeout=$OVS_TIMEOUT "$@"
+ }
+ OVS_APPCTL_TIMEOUT () {
+ command ovs-appctl --timeout=$OVS_TIMEOUT "$@"
+ }
+ OVS_SBCTL_TIMEOUT () {
+ command ovn-sbctl --timeout=$OVS_TIMEOUT "$@"
+ }
+ OVN_NBCTL_TIMEOUT () {
+ command ovn-nbctl --timeout=$OVS_TIMEOUT "$@"
+ }
+ VTEP_CTL_TIMEOUT () {
+ command vtep-ctl --timeout=$OVS_TIMEOUT "$@"
+ }
+fi
+
# parent_pid PID
#
# Prints the PID of the parent of process PID.