From b1387877f75b1d9c9112e365364a916416b308fd Mon Sep 17 00:00:00 2001 From: Alex Wang Date: Mon, 14 Oct 2013 22:12:59 -0700 Subject: [PATCH] tests: Make ovsdb-server add/remove remote test faster and more reliable. Until now, the "ovsdb-server/add-remote and remove-remote with --monitor" test killed ovsdb-server with SIGSEGV twice. Each time, the "--monitor" option caused the supervisor process to restart the child, but the second time it incurred a 10-second delay intended to prevent the daemon from wasting CPU time by restarting itself and dying again very quickly in a loop. This made the test take over 10 seconds to execute. It also made it occasionally fail because the OVS_WAIT_UNTIL check waits at most approximately 10 seconds before it decides that the condition that it is testing for will never occur. This commit fixes the problem by breaking the test into two tests, each of which kills ovsdb-server with SIGSEGV only once. Signed-off-by: Alex Wang Signed-off-by: Ben Pfaff --- tests/ovsdb-server.at | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/tests/ovsdb-server.at b/tests/ovsdb-server.at index c87d9c4f6..69ec7a17d 100644 --- a/tests/ovsdb-server.at +++ b/tests/ovsdb-server.at @@ -412,7 +412,7 @@ AT_CHECK([test ! -e socket1]) AT_CHECK([ovs-appctl -t ovsdb-server ovsdb-server/list-remotes]) AT_CLEANUP -AT_SETUP([ovsdb-server/add-remote and remove-remote with --monitor]) +AT_SETUP([ovsdb-server/add-remote with --monitor]) AT_KEYWORDS([ovsdb server positive]) # Start ovsdb-server, initially with no remotes. OVS_RUNDIR=`pwd`; export OVS_RUNDIR @@ -440,6 +440,25 @@ OVS_WAIT_WHILE([kill -0 `cat old.pid`]) OVS_WAIT_UNTIL( [test -s ovsdb-server.pid && test `cat ovsdb-server.pid` != `cat old.pid`]) OVS_WAIT_UNTIL([test -S socket1]) +AT_CLEANUP + +AT_SETUP([ovsdb-server/add-remote and remove-remote with --monitor]) +AT_KEYWORDS([ovsdb server positive]) +# Start ovsdb-server, initially with no remotes. +OVS_RUNDIR=`pwd`; export OVS_RUNDIR +OVS_LOGDIR=`pwd`; export OVS_LOGDIR +ordinal_schema > schema +AT_CHECK([ovsdb-tool create db schema], [0], [ignore], [ignore]) +ON_EXIT([kill `cat *.pid`]) +AT_CHECK([ovsdb-server -v -vvlog:off --monitor --detach --no-chdir --pidfile --log-file db]) + +# Add a remote. +AT_CHECK([test ! -e socket1]) +AT_CHECK([ovs-appctl -t ovsdb-server ovsdb-server/add-remote punix:socket1]) +OVS_WAIT_UNTIL([test -S socket1]) +AT_CHECK([ovs-appctl -t ovsdb-server ovsdb-server/list-remotes], + [0], [punix:socket1 +]) # Remove the remote. AT_CHECK([ovs-appctl -t ovsdb-server ovsdb-server/remove-remote punix:socket1]) -- 2.20.1