aboutsummaryrefslogtreecommitdiff
path: root/tests/ovs-vswitchd.at
diff options
context:
space:
mode:
authorBen Pfaff <blp@nicira.com>2013-04-11 14:08:01 -0700
committerBen Pfaff <blp@nicira.com>2013-04-12 10:13:46 -0700
commitb789803140afa5756ea2181455dcb601ab29cb8f (patch)
tree0802736f51670bc91f1cb4ea8d11411a73a991d1 /tests/ovs-vswitchd.at
parent8de6ab5d17afeae08a10546b8fd678a8a8393663 (diff)
tests: Add test for ovs-vswitchd regression with empty db.
Signed-off-by: Ben Pfaff <blp@nicira.com>
Diffstat (limited to 'tests/ovs-vswitchd.at')
-rw-r--r--tests/ovs-vswitchd.at27
1 files changed, 27 insertions, 0 deletions
diff --git a/tests/ovs-vswitchd.at b/tests/ovs-vswitchd.at
new file mode 100644
index 00000000..c5527416
--- /dev/null
+++ b/tests/ovs-vswitchd.at
@@ -0,0 +1,27 @@
+AT_BANNER([ovs-vswitchd])
+
+dnl The OVS initscripts never make an empty database (one without even an
+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])
+OVS_RUNDIR=`pwd`; export OVS_RUNDIR
+OVS_LOGDIR=`pwd`; export OVS_LOGDIR
+OVS_DBDIR=`pwd`; export OVS_DBDIR
+OVS_SYSCONFDIR=`pwd`; export OVS_SYSCONFDIR
+ON_EXIT([kill `cat ovsdb-server.pid ovs-vswitchd.pid`])
+
+dnl Create database.
+touch .conf.db.~lock~
+AT_CHECK([ovsdb-tool create conf.db $abs_top_srcdir/vswitchd/vswitch.ovsschema])
+
+dnl Start ovsdb-server. *Don't* initialize database.
+AT_CHECK([ovsdb-server --detach --no-chdir --pidfile --log-file --remote=punix:$OVS_RUNDIR/db.sock], [0], [ignore], [ignore])
+AT_CAPTURE_FILE([ovsdb-server.log])
+
+dnl Start ovs-vswitchd.
+AT_CHECK([ovs-vswitchd --detach --no-chdir --pidfile --enable-dummy --disable-system --log-file], [0], [], [stderr])
+AT_CAPTURE_FILE([ovs-vswitchd.log])
+
+dnl ovs-vswitchd detached OK or we wouldn't have made it this far. Success.
+AT_CLEANUP