diff mbox series

[ovs-dev,2/2] tests: Check ovsdb-server logs in OVSDB tests.

Message ID 20230517165105.2986692-3-i.maximets@ovn.org
State Accepted
Commit d56366bfa05b90e7b610716ebf9164bfd06e25f1
Headers show
Series ssl: Ignore unexpected EOF + ovsdb log checking in tests. | expand

Checks

Context Check Description
ovsrobot/apply-robot success apply and check: success
ovsrobot/github-robot-_Build_and_Test success github build: passed
ovsrobot/intel-ovs-compilation success test: success

Commit Message

Ilya Maximets May 17, 2023, 4:51 p.m. UTC
Many OVSDB tests are not checking the server log for warnings or
errors.  Some are not even using the log file.  It's mostly OK as we're
usually checking the user-visible behavior.  But it would also be nice
to detect some internal warnings if there are some.

Moving the OVSDB_SERVER_SHUTDOWN macro to the common place, adding
the call to check_logs into it and making OVSDB tests use this macro.

Signed-off-by: Ilya Maximets <i.maximets@ovn.org>
---
 tests/ovsdb-client.at  | 12 +++---
 tests/ovsdb-idl.at     | 10 ++++-
 tests/ovsdb-lock.at    | 10 ++---
 tests/ovsdb-macros.at  | 12 ++++++
 tests/ovsdb-monitor.at | 88 ++++++++++++++++++++--------------------
 tests/ovsdb-server.at  | 91 +++++++++++++++++++++++++-----------------
 tests/ovsdb-tool.at    | 44 ++++++++++----------
 tests/vtep-ctl.at      |  2 +-
 8 files changed, 152 insertions(+), 117 deletions(-)

Comments

Simon Horman May 25, 2023, 1:20 p.m. UTC | #1
On Wed, May 17, 2023 at 06:51:05PM +0200, Ilya Maximets wrote:
> Many OVSDB tests are not checking the server log for warnings or
> errors.  Some are not even using the log file.  It's mostly OK as we're
> usually checking the user-visible behavior.  But it would also be nice
> to detect some internal warnings if there are some.
> 
> Moving the OVSDB_SERVER_SHUTDOWN macro to the common place, adding
> the call to check_logs into it and making OVSDB tests use this macro.
> 
> Signed-off-by: Ilya Maximets <i.maximets@ovn.org>

Reviewed-by: Simon Horman <simon.horman@corigine.com>

As an aside.
Some of the lines in the test suite are excessively long.
Ilya Maximets May 26, 2023, 1:11 p.m. UTC | #2
On 5/25/23 15:20, Simon Horman wrote:
> On Wed, May 17, 2023 at 06:51:05PM +0200, Ilya Maximets wrote:
>> Many OVSDB tests are not checking the server log for warnings or
>> errors.  Some are not even using the log file.  It's mostly OK as we're
>> usually checking the user-visible behavior.  But it would also be nice
>> to detect some internal warnings if there are some.
>>
>> Moving the OVSDB_SERVER_SHUTDOWN macro to the common place, adding
>> the call to check_logs into it and making OVSDB tests use this macro.
>>
>> Signed-off-by: Ilya Maximets <i.maximets@ovn.org>
> 
> Reviewed-by: Simon Horman <simon.horman@corigine.com>
> 
> As an aside.
> Some of the lines in the test suite are excessively long.
> 

I guess, I can post v2 trying to wrap some lines that this patch is touching.
I just thought it would be harder to review this way.  What do you think?

Best regards, Ilya Maximets.
Simon Horman May 30, 2023, 8:05 p.m. UTC | #3
On Fri, May 26, 2023 at 03:11:01PM +0200, Ilya Maximets wrote:
> On 5/25/23 15:20, Simon Horman wrote:
> > On Wed, May 17, 2023 at 06:51:05PM +0200, Ilya Maximets wrote:
> >> Many OVSDB tests are not checking the server log for warnings or
> >> errors.  Some are not even using the log file.  It's mostly OK as we're
> >> usually checking the user-visible behavior.  But it would also be nice
> >> to detect some internal warnings if there are some.
> >>
> >> Moving the OVSDB_SERVER_SHUTDOWN macro to the common place, adding
> >> the call to check_logs into it and making OVSDB tests use this macro.
> >>
> >> Signed-off-by: Ilya Maximets <i.maximets@ovn.org>
> > 
> > Reviewed-by: Simon Horman <simon.horman@corigine.com>
> > 
> > As an aside.
> > Some of the lines in the test suite are excessively long.
> > 
> 
> I guess, I can post v2 trying to wrap some lines that this patch is touching.
> I just thought it would be harder to review this way.  What do you think?

I think that is a change for another time.
Ilya Maximets May 31, 2023, 8:50 p.m. UTC | #4
On 5/30/23 22:05, Simon Horman wrote:
> On Fri, May 26, 2023 at 03:11:01PM +0200, Ilya Maximets wrote:
>> On 5/25/23 15:20, Simon Horman wrote:
>>> On Wed, May 17, 2023 at 06:51:05PM +0200, Ilya Maximets wrote:
>>>> Many OVSDB tests are not checking the server log for warnings or
>>>> errors.  Some are not even using the log file.  It's mostly OK as we're
>>>> usually checking the user-visible behavior.  But it would also be nice
>>>> to detect some internal warnings if there are some.
>>>>
>>>> Moving the OVSDB_SERVER_SHUTDOWN macro to the common place, adding
>>>> the call to check_logs into it and making OVSDB tests use this macro.
>>>>
>>>> Signed-off-by: Ilya Maximets <i.maximets@ovn.org>
>>>
>>> Reviewed-by: Simon Horman <simon.horman@corigine.com>
>>>
>>> As an aside.
>>> Some of the lines in the test suite are excessively long.
>>>
>>
>> I guess, I can post v2 trying to wrap some lines that this patch is touching.
>> I just thought it would be harder to review this way.  What do you think?
> 
> I think that is a change for another time.

OK.  I applied the patch as-is for now.  Thanks!

Best regards, Ilya Maximets.
diff mbox series

Patch

diff --git a/tests/ovsdb-client.at b/tests/ovsdb-client.at
index 2d14f1ac2..68fb962bd 100644
--- a/tests/ovsdb-client.at
+++ b/tests/ovsdb-client.at
@@ -5,7 +5,7 @@  AT_KEYWORDS([ovsdb client positive])
 ordinal_schema > schema
 on_exit 'kill `cat *.pid`'
 AT_CHECK([ovsdb-tool create db schema], [0], [ignore], [ignore])
-AT_CHECK([ovsdb-server --detach --no-chdir --pidfile --remote=punix:socket db], [0], [ignore], [ignore])
+AT_CHECK([ovsdb-server --detach --no-chdir --log-file --pidfile --remote=punix:socket db], [0], [ignore], [ignore])
 AT_CHECK([ovsdb-client get-schema-version unix:socket ordinals], [0], [5.1.3
 ])
 AT_CHECK([ovsdb-client get-schema-cksum unix:socket ordinals], [0], [12345678 9
@@ -19,7 +19,7 @@  on_exit 'kill `cat *.pid`'
 ordinal_schema > schema
 touch .db.~lock~
 AT_CHECK([ovsdb-tool create db schema], [0], [], [ignore])
-AT_CHECK([ovsdb-server --detach --no-chdir --pidfile --remote=punix:socket db], [0], [ignore], [ignore])
+AT_CHECK([ovsdb-server --detach --no-chdir --log-file --pidfile --remote=punix:socket db], [0], [ignore], [ignore])
 AT_CHECK([ovsdb-client needs-conversion unix:socket schema], [0], [no
 ])
 OVSDB_SERVER_SHUTDOWN
@@ -31,7 +31,7 @@  ordinal_schema > schema
 touch .db.~lock~
 on_exit 'kill `cat *.pid`'
 AT_CHECK([ovsdb-tool create db schema], [0], [], [ignore])
-AT_CHECK([ovsdb-server --detach --no-chdir --pidfile --remote=punix:socket db], [0], [ignore], [ignore])
+AT_CHECK([ovsdb-server --detach --no-chdir --log-file --pidfile --remote=punix:socket db], [0], [ignore], [ignore])
 sed 's/5\.1\.3/5.1.4/' < schema > schema2
 AT_CHECK([diff schema schema2], [1], [ignore])
 AT_CHECK([ovsdb-client needs-conversion unix:socket schema2], [0], [yes
@@ -134,7 +134,7 @@  _uuid name number
 ])
 
 dnl Stop the database server, then re-start it based on the backup.
-OVS_APP_EXIT_AND_WAIT([ovsdb-server])
+OVSDB_SERVER_SHUTDOWN
 AT_CHECK([ovsdb-server -vfile -vvlog:off --detach --no-chdir --pidfile --log-file --remote=punix:db.sock backup], [0])
 
 dnl Dump a new copy of the data.
@@ -195,7 +195,7 @@  ordinals table
 _uuid,name,number
 ])
 
-OVS_APP_EXIT_AND_WAIT([ovsdb-server])
+OVSDB_SERVER_SHUTDOWN
 
 AT_CLEANUP
 
@@ -254,7 +254,7 @@  _uuid,name,number
 ])
 
 dnl Stopping the server.
-OVS_APP_EXIT_AND_WAIT([ovsdb-server])
+OVSDB_SERVER_SHUTDOWN
 dnl ovsdb-client should exit by itself after disconnection form the server.
 OVS_WAIT_WHILE([test -e ovsdb-client.pid])
 
diff --git a/tests/ovsdb-idl.at b/tests/ovsdb-idl.at
index 978a6677b..df5a9d2fd 100644
--- a/tests/ovsdb-idl.at
+++ b/tests/ovsdb-idl.at
@@ -278,7 +278,10 @@  m4_define([OVSDB_CHECK_IDL_SSL_PY],
             [0], [stdout], [ignore])
    AT_CHECK([sort stdout | uuidfilt]m4_if([$6],,, [[| $6]]),
             [0], [$4])
-   OVSDB_SERVER_SHUTDOWN
+   OVSDB_SERVER_SHUTDOWN(["
+     /unexpected SSL connection close/d
+     /Protocol error/d
+   "])
    AT_CLEANUP])
 
 m4_define([OVSDB_CHECK_IDL],
@@ -2309,7 +2312,10 @@  m4_define([CHECK_STREAM_OPEN_BLOCK],
    AT_CHECK([$2 PROTOCOL:$4:$TCP_PORT $SSL_KEY_ARGS], [0], [ignore])
    AT_CHECK([$2 PROTOCOL:$4:$WRONG_PORT $SSL_KEY_ARGS], [1], [ignore],
             [ignore])
-   OVSDB_SERVER_SHUTDOWN
+   OVSDB_SERVER_SHUTDOWN(["
+     /unexpected SSL connection close/d
+     /Protocol error/d
+   "])
    AT_CHECK([$2 PROTOCOL:$4:$TCP_PORT $SSL_KEY_ARGS], [1], [ignore], [ignore])
    AT_CLEANUP])
 
diff --git a/tests/ovsdb-lock.at b/tests/ovsdb-lock.at
index a3acd2f27..6bc247302 100644
--- a/tests/ovsdb-lock.at
+++ b/tests/ovsdb-lock.at
@@ -12,8 +12,8 @@  m4_define([OVSDB_CHECK_LOCK_SETUP],
     AT_KEYWORDS([ovsdb lock $2])
     ordinal_schema > schema
     AT_CHECK([ovsdb-tool create db schema], [0], [stdout], [ignore])
-    AT_CAPTURE_FILE([ovsdb-server-log])
-    AT_CHECK([ovsdb-server --detach --no-chdir --pidfile --remote=punix:socket --log-file="`pwd`"/ovsdb-server-log db >/dev/null 2>&1], [0], [], [])])
+    AT_CAPTURE_FILE([ovsdb-server.log])
+    AT_CHECK([ovsdb-server --detach --no-chdir --pidfile --remote=punix:socket --log-file db], [0], [ignore], [ignore])])
 
 #
 # Two sessions create two locks. Both sessions should be able to get their
@@ -23,7 +23,7 @@  AT_CHECK([ovsdb-client --detach --no-chdir lock unix:socket lock0 >c1-output 2>&
       [0], [], [])
 AT_CHECK([ovsdb-client --detach --no-chdir lock unix:socket lock1 >c2-output 2>&1],
       [0], [], [])
-OVS_APP_EXIT_AND_WAIT([ovsdb-server])
+OVSDB_SERVER_SHUTDOWN
 AT_CHECK([cat c1-output], 0, [{"locked":true}
 ], [])
 AT_CHECK([cat c2-output], 0, [{"locked":true}
@@ -40,7 +40,7 @@  AT_CHECK([ovsdb-client --detach --no-chdir --pidfile lock unix:socket lock0 >c1-
 AT_CHECK([ovsdb-client --detach --no-chdir lock unix:socket lock0 >c2-output 2>&1],
       [0], [], [])
 AT_CHECK([ovs-appctl -t ovsdb-client unlock lock0], [0], [], [])
-OVS_APP_EXIT_AND_WAIT([ovsdb-server])
+OVSDB_SERVER_SHUTDOWN
 AT_CHECK([cat c1-output], 0, [{"locked":true}
 {}
 ])
@@ -60,7 +60,7 @@  AT_CHECK([ovsdb-client --detach --no-chdir lock unix:socket lock0 >c1-output 2>&
 AT_CHECK([ovsdb-client --detach --no-chdir --pidfile steal unix:socket lock0 >c2-output 2>&1],
       [0], [], [])
 AT_CHECK([ovs-appctl -t ovsdb-client unlock lock0], [0], [], [])
-OVS_APP_EXIT_AND_WAIT([ovsdb-server])
+OVSDB_SERVER_SHUTDOWN
 AT_CHECK([cat c1-output], 0, [{"locked":true}
 stolen
 [["lock0"]]
diff --git a/tests/ovsdb-macros.at b/tests/ovsdb-macros.at
index 0f8e4bd20..503b8b722 100644
--- a/tests/ovsdb-macros.at
+++ b/tests/ovsdb-macros.at
@@ -13,6 +13,18 @@  m4_define([OVSDB_INIT],
            "row": {}}]']],
      [0], [ignore], [ignore])])
 
+dnl OVSDB_SERVER_SHUTDOWN([ALLOWLIST])
+dnl
+dnl Gracefully stops ovsdb-server, checking log files for messages with
+dnl severity WARN or higher and signaling an error if any is present.
+dnl The optional ALLOWLIST may contain shell-quoted "sed" commands to
+dnl delete any warnings that are actually expected, e.g.:
+dnl
+dnl   OVSDB_SERVER_SHUTDOWN(["/expected error/d"])
+m4_define([OVSDB_SERVER_SHUTDOWN],
+  [AT_CHECK([check_logs $1])
+   OVS_APP_EXIT_AND_WAIT_BY_TARGET([ovsdb-server], [ovsdb-server.pid])])
+
 # OVSDB_CHECK_POSITIVE(TITLE, TEST-OVSDB-ARGS, OUTPUT, [KEYWORDS], [PREREQ])
 #
 # Runs "test-ovsdb TEST-OVSDB-ARGS" and checks that it exits with
diff --git a/tests/ovsdb-monitor.at b/tests/ovsdb-monitor.at
index 3b622b3ec..7e1ff64f0 100644
--- a/tests/ovsdb-monitor.at
+++ b/tests/ovsdb-monitor.at
@@ -28,7 +28,7 @@  ovsdb_check_monitor () {
     for txn in ${1+"$@"} '[["'$db'"]]'; do
       AT_CHECK([ovsdb-client transact unix:socket "$txn"], [0], [ignore], [ignore])
     done
-    OVS_APP_EXIT_AND_WAIT_BY_TARGET([ovsdb-server], [ovsdb-server.pid])
+    OVSDB_SERVER_SHUTDOWN
     OVS_WAIT_UNTIL([test ! -e ovsdb-client.pid])
     AT_CHECK_UNQUOTED([$PYTHON3 $srcdir/ovsdb-monitor-sort.py < output | uuidfilt], [0], [$output], [ignore])
 }
@@ -88,10 +88,10 @@  m4_define([OVSDB_CHECK_MONITOR_COND],
    for txn in m4_foreach([txn], [$3], ['txn' ]); do
      AT_CHECK([ovsdb-tool transact db "$txn"], [0], [ignore], [ignore])
    done
-   AT_CAPTURE_FILE([ovsdb-server-log])
-   AT_CHECK([ovsdb-server --detach --no-chdir --pidfile --remote=punix:socket --log-file="`pwd`"/ovsdb-server-log db >/dev/null 2>&1])
+   AT_CAPTURE_FILE([ovsdb-server.log])
+   AT_CHECK([ovsdb-server --detach --no-chdir --pidfile --remote=punix:socket --log-file db], [0], [ignore], [ignore])
    on_exit 'kill `cat ovsdb-server.pid`'
-   AT_CHECK([ovsdb-client -vjsonrpc --pidfile --detach --no-chdir -d json monitor-cond --format=csv unix:socket $4 '[$8]' $5 $9 > output],
+   AT_CHECK([ovsdb-client -vjsonrpc --pidfile --detach --no-chdir -d json monitor-cond --format=csv unix:socket $4 '[$8]' $5 $9 > output 2> ovsdb-client.stderr],
           [0], [ignore], [ignore])
    on_exit 'kill `cat ovsdb-client.pid`'
    for txn in m4_foreach([txn], [$6], ['txn' ]); do
@@ -103,7 +103,7 @@  m4_define([OVSDB_CHECK_MONITOR_COND],
    done
    AT_CHECK([ovsdb-client transact unix:socket '[["$4"]]'], [0],
             [ignore], [ignore])
-   AT_CHECK([ovs-appctl -t ovsdb-server -e exit], [0], [ignore], [ignore])
+   OVSDB_SERVER_SHUTDOWN
    OVS_WAIT_UNTIL([test ! -e ovsdb-server.pid && test ! -e ovsdb-client.pid])
    AT_CHECK([$PYTHON3 $srcdir/ovsdb-monitor-sort.py < output | uuidfilt], [0], [$7], [ignore])
    AT_CLEANUP])
@@ -595,9 +595,9 @@  AT_SETUP(monitor-cond-change with many sessions pending)
 AT_KEYWORDS([ovsdb server monitor monitor-cond negative])
 ordinal_schema > schema
 AT_CHECK([ovsdb-tool create db schema], [0], [stdout], [ignore])
-AT_CAPTURE_FILE([ovsdb-server-log])
+AT_CAPTURE_FILE([ovsdb-server.log])
 
-AT_CHECK([ovsdb-server --detach --no-chdir --pidfile --remote=punix:socket --log-file="`pwd`"/ovsdb-server-log db >/dev/null 2>&1])
+AT_CHECK([ovsdb-server --detach --no-chdir --pidfile --remote=punix:socket --log-file db], [0], [ignore], [ignore])
 on_exit 'kill `cat ovsdb-server.pid`'
 for txn in m4_foreach([txn], [[[["ordinals",
       {"op": "insert",
@@ -619,14 +619,14 @@  done
 
 cond='[[["name","==","ten"]]]'
 for i in `seq 1 990`; do
-    AT_CHECK([ovsdb-client -vjsonrpc --pidfile=ovsdb-client$i.pid --detach --no-chdir -d json monitor-cond --format=csv unix:socket ordinals $cond ordinals ["name"]], [0], [ignore], [ignore])
+    AT_CHECK([ovsdb-client -vjsonrpc --pidfile=ovsdb-client$i.pid --detach --no-chdir -d json monitor-cond --format=csv unix:socket ordinals $cond ordinals ["name"] >ovsdb-client$i.out 2>&1], [0], [ignore], [ignore])
 done
 
-AT_CHECK([ovsdb-client -vjsonrpc --pidfile --detach --no-chdir -d json monitor-cond --format=csv unix:socket ordinals $cond ordinals ["name"] > output],
+AT_CHECK([ovsdb-client -vjsonrpc --pidfile --detach --no-chdir -d json monitor-cond --format=csv unix:socket ordinals $cond ordinals ["name"] > output  2> ovsdb-client.stderr],
        [0], [ignore], [ignore])
 
 for i in `seq 991 1000`; do
-    AT_CHECK([ovsdb-client -vjsonrpc --pidfile=ovsdb-client$i.pid --detach --no-chdir -d json monitor-cond --format=csv unix:socket ordinals $cond ordinals ["name"]], [0], [ignore], [ignore])
+    AT_CHECK([ovsdb-client -vjsonrpc --pidfile=ovsdb-client$i.pid --detach --no-chdir -d json monitor-cond --format=csv unix:socket ordinals $cond ordinals ["name"] >ovsdb-client$i.out 2>&1 ], [0], [ignore], [ignore])
 done
 
 for txn in m4_foreach([txn], [[[["ordinals",
@@ -647,7 +647,7 @@  sleep 1
 
 AT_CHECK([ovsdb-client transact unix:socket '[["ordinals"]]'], [0],
          [ignore], [ignore])
-AT_CHECK([ovs-appctl -t ovsdb-server -e exit], [0], [ignore], [ignore])
+OVSDB_SERVER_SHUTDOWN("/Too many open files/d")
 OVS_WAIT_UNTIL([test ! -e ovsdb-server.pid && test ! -e ovsdb-client.pid])
 AT_CHECK([$PYTHON3 $srcdir/ovsdb-monitor-sort.py < output | uuidfilt], [0], [[row,action,name
 <0>,insert,"""ten"""
@@ -666,8 +666,8 @@  AT_SETUP([monitor-cond-since not found])
 AT_KEYWORDS([ovsdb server monitor monitor-cond-since positive])
 ordinal_schema > schema
 AT_CHECK([ovsdb-tool create-cluster db schema unix:db.raft], [0], [stdout], [ignore])
-AT_CAPTURE_FILE([ovsdb-server-log])
-AT_CHECK([ovsdb-server --detach --no-chdir --pidfile --remote=punix:socket --log-file="`pwd`"/ovsdb-server-log db >/dev/null 2>&1])
+AT_CAPTURE_FILE([ovsdb-server.log])
+AT_CHECK([ovsdb-server --detach --no-chdir --pidfile --remote=punix:socket --log-file db], [0], [ignore], [ignore])
 on_exit 'kill `cat ovsdb-server.pid`'
 for txn in m4_foreach([txn], [[[["ordinals",
       {"op": "insert",
@@ -684,7 +684,7 @@  done
 
 # Omitting the last_id parameter in ovsdb-client monitor-cond-since command
 # will by default using all zero uuid, which doesn't exist in any history txn.
-AT_CHECK([ovsdb-client -vjsonrpc --pidfile --detach --no-chdir -d json monitor-cond-since --format=csv unix:socket ordinals '[[["name","==","one"],["name","==","ten"]]]' ordinals > output],
+AT_CHECK([ovsdb-client -vjsonrpc --pidfile --detach --no-chdir -d json monitor-cond-since --format=csv unix:socket ordinals '[[["name","==","one"],["name","==","ten"]]]' ordinals > output 2> ovsdb-client.stderr],
        [0], [ignore], [ignore])
 on_exit 'kill `cat ovsdb-client.pid`'
 for txn in m4_foreach([txn], [[[["ordinals",
@@ -699,7 +699,7 @@  for txn in m4_foreach([txn], [[[["ordinals",
 done
 AT_CHECK([ovsdb-client transact unix:socket '[["ordinals"]]'], [0],
          [ignore], [ignore])
-AT_CHECK([ovs-appctl -t ovsdb-server -e exit], [0], [ignore], [ignore])
+OVSDB_SERVER_SHUTDOWN
 OVS_WAIT_UNTIL([test ! -e ovsdb-server.pid && test ! -e ovsdb-client.pid])
 AT_CHECK([$PYTHON3 $srcdir/ovsdb-monitor-sort.py < output | uuidfilt], [0],
          [[found: false, last_id: <0>
@@ -720,8 +720,8 @@  AT_SETUP([monitor-cond-since db restart])
 AT_KEYWORDS([ovsdb server monitor monitor-cond-since positive])
 ordinal_schema > schema
 AT_CHECK([ovsdb-tool create-cluster db schema unix:db.raft], [0], [stdout], [ignore])
-AT_CAPTURE_FILE([ovsdb-server-log])
-AT_CHECK([ovsdb-server --detach --no-chdir --pidfile --remote=punix:socket --log-file="`pwd`"/ovsdb-server-log db >/dev/null 2>&1])
+AT_CAPTURE_FILE([ovsdb-server.log])
+AT_CHECK([ovsdb-server --detach --no-chdir --pidfile --remote=punix:socket --log-file db], [0], [ignore], [ignore])
 on_exit 'kill `cat ovsdb-server.pid`'
 for txn in m4_foreach([txn], [[[["ordinals",
       {"op": "insert",
@@ -736,19 +736,18 @@  for txn in m4_foreach([txn], [[[["ordinals",
   AT_CHECK([ovsdb-client transact unix:socket "$txn"], [0], [ignore], [ignore])
 done
 
-AT_CHECK([ovsdb-client -vjsonrpc --pidfile --detach --no-chdir -d json monitor-cond-since --format=csv unix:socket ordinals '[[["name","==","one"],["name","==","ten"]]]' ordinals > output],
+AT_CHECK([ovsdb-client -vjsonrpc --pidfile --detach --no-chdir -d json monitor-cond-since --format=csv unix:socket ordinals '[[["name","==","one"],["name","==","ten"]]]' ordinals > output 2> ovsdb-client.stderr],
        [0], [ignore], [ignore])
 on_exit 'kill `cat ovsdb-client.pid`'
 OVS_WAIT_UNTIL([grep last_id output])
 
-kill `cat ovsdb-client.pid`
-kill `cat ovsdb-server.pid`
+OVSDB_SERVER_SHUTDOWN
 OVS_WAIT_UNTIL([test ! -e ovsdb-server.pid && test ! -e ovsdb-client.pid])
 
 # Remember the last_id, which will be used for monitor-cond-since later.
 last_id=`grep last_id output | awk '{print $4}'`
 
-AT_CHECK([ovsdb-server --detach --no-chdir --pidfile --remote=punix:socket --log-file="`pwd`"/ovsdb-server-log db >/dev/null 2>&1])
+AT_CHECK([ovsdb-server --detach --no-chdir --pidfile --remote=punix:socket --log-file db], [0], [ignore], [ignore])
 
 # Some new changes made to db after restarting the server.
 for txn in m4_foreach([txn], [[[["ordinals",
@@ -763,12 +762,12 @@  for txn in m4_foreach([txn], [[[["ordinals",
 done
 
 # Use last_id to monitor and get only the new changes.
-AT_CHECK([ovsdb-client -vjsonrpc --pidfile --detach --no-chdir -d json monitor-cond-since --format=csv unix:socket ordinals $last_id '[[["name","==","one"],["name","==","ten"]]]' ordinals > output],
+AT_CHECK([ovsdb-client -vjsonrpc --pidfile --detach --no-chdir -d json monitor-cond-since --format=csv unix:socket ordinals $last_id '[[["name","==","one"],["name","==","ten"]]]' ordinals > output 2> ovsdb-client.stderr],
        [0], [ignore], [ignore])
 
 AT_CHECK([ovsdb-client transact unix:socket '[["ordinals"]]'], [0],
          [ignore], [ignore])
-AT_CHECK([ovs-appctl -t ovsdb-server -e exit], [0], [ignore], [ignore])
+OVSDB_SERVER_SHUTDOWN
 OVS_WAIT_UNTIL([test ! -e ovsdb-server.pid && test ! -e ovsdb-client.pid])
 AT_CHECK([$PYTHON3 $srcdir/ovsdb-monitor-sort.py < output | uuidfilt], [0],
          [[found: true, last_id: <0>
@@ -784,8 +783,8 @@  AT_SETUP([monitor-cond-since found but no new rows])
 AT_KEYWORDS([ovsdb server monitor monitor-cond-since positive])
 ordinal_schema > schema
 AT_CHECK([ovsdb-tool create-cluster db schema unix:db.raft], [0], [stdout], [ignore])
-AT_CAPTURE_FILE([ovsdb-server-log])
-AT_CHECK([ovsdb-server --detach --no-chdir --pidfile --remote=punix:socket --log-file="`pwd`"/ovsdb-server-log db >/dev/null 2>&1])
+AT_CAPTURE_FILE([ovsdb-server.log])
+AT_CHECK([ovsdb-server --detach --no-chdir --pidfile --remote=punix:socket --log-file db], [0], [ignore], [ignore])
 on_exit 'kill `cat ovsdb-server.pid`'
 for txn in m4_foreach([txn], [[[["ordinals",
       {"op": "insert",
@@ -799,7 +798,7 @@  for txn in m4_foreach([txn], [[[["ordinals",
        "row": {"number": 2, "name": "two"}}]]]], ['txn' ]); do
   AT_CHECK([ovsdb-client transact unix:socket "$txn"], [0], [ignore], [ignore])
 done
-AT_CHECK([ovsdb-client -vjsonrpc --pidfile --detach --no-chdir -d json monitor-cond-since --format=csv unix:socket ordinals '[[["name","==","one"],["name","==","ten"]]]' ordinals > output],
+AT_CHECK([ovsdb-client -vjsonrpc --pidfile --detach --no-chdir -d json monitor-cond-since --format=csv unix:socket ordinals '[[["name","==","one"],["name","==","ten"]]]' ordinals > output 2> ovsdb-client.stderr],
        [0], [ignore], [ignore])
 on_exit 'kill `cat ovsdb-client.pid`'
 OVS_WAIT_UNTIL([grep last_id output])
@@ -807,12 +806,12 @@  OVS_WAIT_UNTIL([grep last_id output])
 kill `cat ovsdb-client.pid`
 OVS_WAIT_UNTIL([test ! -e ovsdb-client.pid])
 last_id=`grep last_id output | awk '{print $4}'`
-AT_CHECK([ovsdb-client -vjsonrpc --pidfile --detach --no-chdir -d json monitor-cond-since --format=csv unix:socket ordinals $last_id '[[["name","==","one"],["name","==","ten"]]]' ordinals > output],
+AT_CHECK([ovsdb-client -vjsonrpc --pidfile --detach --no-chdir -d json monitor-cond-since --format=csv unix:socket ordinals $last_id '[[["name","==","one"],["name","==","ten"]]]' ordinals > output 2> ovsdb-client.stderr],
        [0], [ignore], [ignore])
 
 AT_CHECK([ovsdb-client transact unix:socket '[["ordinals"]]'], [0],
          [ignore], [ignore])
-AT_CHECK([ovs-appctl -t ovsdb-server -e exit], [0], [ignore], [ignore])
+OVSDB_SERVER_SHUTDOWN
 OVS_WAIT_UNTIL([test ! -e ovsdb-server.pid && test ! -e ovsdb-client.pid])
 AT_CHECK([$PYTHON3 $srcdir/ovsdb-monitor-sort.py < output | uuidfilt], [0],
          [[found: true, last_id: <0>
@@ -825,17 +824,17 @@  AT_SETUP([monitor-cond-since empty db])
 AT_KEYWORDS([ovsdb server monitor monitor-cond-since positive])
 ordinal_schema > schema
 AT_CHECK([ovsdb-tool create-cluster db schema unix:db.raft], [0], [stdout], [ignore])
-AT_CAPTURE_FILE([ovsdb-server-log])
-AT_CHECK([ovsdb-server --detach --no-chdir --pidfile --remote=punix:socket --log-file="`pwd`"/ovsdb-server-log db >/dev/null 2>&1])
+AT_CAPTURE_FILE([ovsdb-server.log])
+AT_CHECK([ovsdb-server --detach --no-chdir --pidfile --remote=punix:socket --log-file db], [0], [ignore], [ignore])
 on_exit 'kill `cat ovsdb-server.pid`'
-AT_CHECK([ovsdb-client -vjsonrpc --pidfile --detach --no-chdir -d json monitor-cond-since --format=csv unix:socket ordinals '[[["name","==","one"],["name","==","ten"]]]' ordinals > output],
+AT_CHECK([ovsdb-client -vjsonrpc --pidfile --detach --no-chdir -d json monitor-cond-since --format=csv unix:socket ordinals '[[["name","==","one"],["name","==","ten"]]]' ordinals > output 2> ovsdb-client.stderr],
        [0], [ignore], [ignore])
 on_exit 'kill `cat ovsdb-client.pid`'
 OVS_WAIT_UNTIL([grep last_id output])
 
 AT_CHECK([ovsdb-client transact unix:socket '[["ordinals"]]'], [0],
          [ignore], [ignore])
-AT_CHECK([ovs-appctl -t ovsdb-server -e exit], [0], [ignore], [ignore])
+OVSDB_SERVER_SHUTDOWN
 OVS_WAIT_UNTIL([test ! -e ovsdb-server.pid && test ! -e ovsdb-client.pid])
 AT_CHECK([$PYTHON3 $srcdir/ovsdb-monitor-sort.py < output | uuidfilt], [0],
          [[found: false, last_id: <0>
@@ -848,8 +847,8 @@  AT_SETUP([monitor-cond-since condition change])
 AT_KEYWORDS([ovsdb server monitor monitor-cond-since positive])
 ordinal_schema > schema
 AT_CHECK([ovsdb-tool create-cluster db schema unix:db.raft], [0], [stdout], [ignore])
-AT_CAPTURE_FILE([ovsdb-server-log])
-AT_CHECK([ovsdb-server --detach --no-chdir --pidfile --remote=punix:socket --log-file="`pwd`"/ovsdb-server-log db >/dev/null 2>&1])
+AT_CAPTURE_FILE([ovsdb-server.log])
+AT_CHECK([ovsdb-server --detach --no-chdir --pidfile --remote=punix:socket --log-file -vjsonrpc:file:dbg db], [0], [ignore], [ignore])
 on_exit 'kill `cat ovsdb-server.pid`'
 for txn in m4_foreach([txn], [[[["ordinals",
       {"op": "insert",
@@ -863,7 +862,8 @@  for txn in m4_foreach([txn], [[[["ordinals",
        "row": {"number": 2, "name": "two"}}]]]], ['txn' ]); do
   AT_CHECK([ovsdb-client transact unix:socket "$txn"], [0], [ignore], [ignore])
 done
-AT_CHECK([ovsdb-client -vjsonrpc --pidfile --detach --no-chdir -d json monitor-cond-since --format=csv unix:socket ordinals '[[]]' ordinals > output], [0], [ignore], [ignore])
+AT_CAPTURE_FILE([ovsdb-client.log])
+AT_CHECK([ovsdb-client -vjsonrpc --log-file --pidfile --detach --no-chdir -d json monitor-cond-since --format=csv unix:socket ordinals '[[]]' ordinals > output 2> ovsdb-client.stderr])
 on_exit 'kill `cat ovsdb-client.pid`'
 for cond in m4_foreach([cond],
                        [[[[["name","==","one"],["name","==","two"]]]],
@@ -874,7 +874,7 @@  for cond in m4_foreach([cond],
 done
 AT_CHECK([ovsdb-client transact unix:socket '[["ordinals"]]'], [0],
          [ignore], [ignore])
-AT_CHECK([ovs-appctl -t ovsdb-server -e exit], [0], [ignore], [ignore])
+OVSDB_SERVER_SHUTDOWN
 OVS_WAIT_UNTIL([test ! -e ovsdb-server.pid && test ! -e ovsdb-client.pid])
 AT_CHECK([$PYTHON3 $srcdir/ovsdb-monitor-sort.py < output | uuidfilt], [0],
          [[found: false, last_id: <0>
@@ -909,8 +909,8 @@  AT_SETUP([monitor-cond-since non-cluster])
 AT_KEYWORDS([ovsdb server monitor monitor-cond-since positive])
 ordinal_schema > schema
 AT_CHECK([ovsdb-tool create db schema], [0], [stdout], [ignore])
-AT_CAPTURE_FILE([ovsdb-server-log])
-AT_CHECK([ovsdb-server --detach --no-chdir --pidfile --remote=punix:socket --log-file="`pwd`"/ovsdb-server-log db >/dev/null 2>&1])
+AT_CAPTURE_FILE([ovsdb-server.log])
+AT_CHECK([ovsdb-server --detach --no-chdir --pidfile --remote=punix:socket --log-file db], [0], [ignore], [ignore])
 on_exit 'kill `cat ovsdb-server.pid`'
 for txn in m4_foreach([txn], [[[["ordinals",
       {"op": "insert",
@@ -925,7 +925,7 @@  for txn in m4_foreach([txn], [[[["ordinals",
   AT_CHECK([ovsdb-client transact unix:socket "$txn"], [0], [ignore], [ignore])
 done
 
-AT_CHECK([ovsdb-client -vjsonrpc --pidfile --detach --no-chdir -d json monitor-cond-since --format=csv unix:socket ordinals '[[["name","==","one"],["name","==","ten"]]]' ordinals > output],
+AT_CHECK([ovsdb-client -vjsonrpc --pidfile --detach --no-chdir -d json monitor-cond-since --format=csv unix:socket ordinals '[[["name","==","one"],["name","==","ten"]]]' ordinals > output 2> ovsdb-client.stderr],
        [0], [ignore], [ignore])
 on_exit 'kill `cat ovsdb-client.pid`'
 for txn in m4_foreach([txn], [[[["ordinals",
@@ -940,7 +940,7 @@  for txn in m4_foreach([txn], [[[["ordinals",
 done
 AT_CHECK([ovsdb-client transact unix:socket '[["ordinals"]]'], [0],
          [ignore], [ignore])
-AT_CHECK([ovs-appctl -t ovsdb-server -e exit], [0], [ignore], [ignore])
+OVSDB_SERVER_SHUTDOWN
 OVS_WAIT_UNTIL([test ! -e ovsdb-server.pid && test ! -e ovsdb-client.pid])
 
 # Transaction shouldn't be found, and last_id returned should always
@@ -962,8 +962,8 @@  AT_SETUP([monitor-cond-since non-cluster non-zero last_id])
 AT_KEYWORDS([ovsdb server monitor monitor-cond-since negative])
 ordinal_schema > schema
 AT_CHECK([ovsdb-tool create db schema], [0], [stdout], [ignore])
-AT_CAPTURE_FILE([ovsdb-server-log])
-AT_CHECK([ovsdb-server --detach --no-chdir --pidfile --remote=punix:socket --log-file="`pwd`"/ovsdb-server-log db >/dev/null 2>&1])
+AT_CAPTURE_FILE([ovsdb-server.log])
+AT_CHECK([ovsdb-server --detach --no-chdir --pidfile --remote=punix:socket --log-file db], [0], [ignore], [ignore])
 on_exit 'kill `cat ovsdb-server.pid`'
 for txn in m4_foreach([txn], [[[["ordinals",
       {"op": "insert",
@@ -980,7 +980,7 @@  done
 
 # A non-zero uuid
 last_id=11111111-1111-1111-1111-111111111111
-AT_CHECK([ovsdb-client -vjsonrpc --pidfile --detach --no-chdir -d json monitor-cond-since --format=csv unix:socket ordinals $last_id '[[["name","==","one"],["name","==","ten"]]]' ordinals > output],
+AT_CHECK([ovsdb-client -vjsonrpc --pidfile --detach --no-chdir -d json monitor-cond-since --format=csv unix:socket ordinals $last_id '[[["name","==","one"],["name","==","ten"]]]' ordinals > output  2> ovsdb-client.stderr],
        [0], [ignore], [ignore])
 on_exit 'kill `cat ovsdb-client.pid`'
 for txn in m4_foreach([txn], [[[["ordinals",
@@ -995,7 +995,7 @@  for txn in m4_foreach([txn], [[[["ordinals",
 done
 AT_CHECK([ovsdb-client transact unix:socket '[["ordinals"]]'], [0],
          [ignore], [ignore])
-AT_CHECK([ovs-appctl -t ovsdb-server -e exit], [0], [ignore], [ignore])
+OVSDB_SERVER_SHUTDOWN
 OVS_WAIT_UNTIL([test ! -e ovsdb-server.pid && test ! -e ovsdb-client.pid])
 
 # Transaction shouldn't be found, and last_id returned should always
diff --git a/tests/ovsdb-server.at b/tests/ovsdb-server.at
index bf539b6e5..b53ab8f52 100644
--- a/tests/ovsdb-server.at
+++ b/tests/ovsdb-server.at
@@ -1,15 +1,17 @@ 
 AT_BANNER([OVSDB -- ovsdb-server transactions (Unix sockets)])
 
-m4_define([OVSDB_SERVER_SHUTDOWN],
-  [OVS_APP_EXIT_AND_WAIT_BY_TARGET([ovsdb-server], [ovsdb-server.pid])])
-
+dnl OVSDB_SERVER_SHUTDOWN_N(N, [ALLOWLIST])
+dnl
+dnl Similar to OVSDB_SERVER_SHUTDOWN, but stops the server started with N.pid
+dnl pidfile and unixctlN socket.
 m4_define([OVSDB_SERVER_SHUTDOWN_N],
-  [cp $1.pid savepid$1
+  [AT_CHECK([check_logs $2])
+   cp $1.pid savepid$1
    AT_CHECK([ovs-appctl -t "`pwd`"/unixctl$1 -e exit], [0], [ignore], [ignore])
    OVS_WAIT_WHILE([kill -0 `cat savepid$1`], [kill `cat savepid$1`])])
 
 m4_define([OVSDB_SERVER_SHUTDOWN2],
-  [OVSDB_SERVER_SHUTDOWN_N([2])])
+  [OVSDB_SERVER_SHUTDOWN_N([2], $1)])
 
 # OVSDB_CHECK_EXECUTION(TITLE, SCHEMA, TRANSACTIONS, OUTPUT, [KEYWORDS])
 #
@@ -31,7 +33,7 @@  m4_define([OVSDB_CHECK_EXECUTION],
    $2 > schema
    AT_CHECK([ovsdb-tool create db schema], [0], [stdout], [ignore])
    on_exit 'kill `cat *.pid`'
-   AT_CHECK([ovsdb-server --detach --no-chdir --pidfile --remote=punix:socket db], [0], [ignore], [ignore])
+   AT_CHECK([ovsdb-server --detach --no-chdir --log-file --pidfile --remote=punix:socket db], [0], [ignore], [ignore])
    m4_foreach([txn], [$3], 
      [AT_CHECK([ovsdb-client transact unix:socket 'txn'], [0], [stdout], [ignore])
 cat stdout >> output
@@ -157,7 +159,7 @@  constraint_schema > schema2
 AT_CHECK([ovsdb-tool create db1 schema1], [0], [ignore], [ignore])
 AT_CHECK([ovsdb-tool create db2 schema2], [0], [ignore], [ignore])
 on_exit 'kill `cat *.pid`'
-AT_CHECK([ovsdb-server --detach --no-chdir --pidfile --remote=punix:db.sock db1 db2], [0], [ignore], [ignore])
+AT_CHECK([ovsdb-server --detach --no-chdir --log-file --pidfile --remote=punix:db.sock db1 db2], [0], [ignore], [ignore])
 CHECK_DBS([constraints
 ordinals
 ])
@@ -177,7 +179,7 @@  AT_CHECK([ovsdb-tool create db1 schema1], [0], [ignore], [ignore])
 AT_CHECK([ovsdb-tool create db2 schema2], [0], [ignore], [ignore])
 
 # Start ovsdb-server with just a single database - db1.
-AT_CHECK([ovsdb-server -vfile -vvlog:off --log-file --detach --no-chdir --pidfile --remote=punix:db.sock db1], [0])
+AT_CHECK([ovsdb-server -vfile -vvlog:off --log-file --detach --no-chdir --pidfile --remote=punix:db.sock db1], [0], [ignore], [ignore])
 CHECK_DBS([ordinals
 ])
 
@@ -280,7 +282,7 @@  AT_CHECK([uuidfilt db-change-unaware.stdout], [0], [dnl
 <0> initial _Server
 ])
 
-OVS_APP_EXIT_AND_WAIT([ovsdb-server])
+OVSDB_SERVER_SHUTDOWN(["/no database named ordinals/d"])
 AT_CLEANUP
 
 AT_SETUP([ovsdb-server/add-db with --monitor])
@@ -298,7 +300,7 @@  AT_SKIP_IF([test $TESTS_WITH_UBSAN = yes])
 ordinal_schema > schema
 AT_CHECK([ovsdb-tool create db1 schema], [0], [ignore], [ignore])
 on_exit 'kill `cat *.pid`'
-AT_CHECK([ovsdb-server -vfile -vvlog:off --monitor --detach --no-chdir --pidfile --log-file --remote=punix:db.sock db1])
+AT_CHECK([ovsdb-server -vfile -vvlog:off --monitor --detach --no-chdir --pidfile --log-file --remote=punix:db.sock db1], [0], [ignore], [ignore])
 
 # Add the second database.
 constraint_schema > schema2
@@ -319,7 +321,10 @@  OVS_WAIT_UNTIL([ovs-appctl -t ovsdb-server version])
 CHECK_DBS([constraints
 ordinals
 ])
-OVS_APP_EXIT_AND_WAIT([ovsdb-server])
+OVSDB_SERVER_SHUTDOWN(["
+    /backtrace/d
+    /killed/d
+"])
 AT_CLEANUP
 
 AT_SETUP([ovsdb-server/add-db and remove-db with --monitor])
@@ -339,7 +344,7 @@  AT_CHECK([ovsdb-tool create db1 schema], [0], [ignore], [ignore])
 constraint_schema > schema2
 AT_CHECK([ovsdb-tool create db2 schema2], [0], [ignore], [ignore])
 on_exit 'kill `cat *.pid`'
-AT_CHECK([ovsdb-server -vfile -vvlog:off --monitor --detach --no-chdir --pidfile --log-file --remote=punix:db.sock db1 db2])
+AT_CHECK([ovsdb-server -vfile -vvlog:off --monitor --detach --no-chdir --pidfile --log-file --remote=punix:db.sock db1 db2], [0], [ignore], [ignore])
 
 # Remove the second database.
 AT_CHECK([ovs-appctl -t ovsdb-server ovsdb-server/remove-db constraints])
@@ -356,7 +361,10 @@  OVS_WAIT_UNTIL(
 OVS_WAIT_UNTIL([ovs-appctl -t ovsdb-server version])
 CHECK_DBS([ordinals
 ])
-OVS_APP_EXIT_AND_WAIT([ovsdb-server])
+OVSDB_SERVER_SHUTDOWN(["
+    /backtrace/d
+    /killed/d
+"])
 AT_CLEANUP
 
 AT_SETUP([--remote=db: implementation])
@@ -400,7 +408,7 @@  AT_CHECK(
         "uuid-name": "x",
         "row": {"target": "punix:socket2"}}]']], [0], [ignore], [ignore])
 on_exit 'kill `cat *.pid`'
-AT_CHECK([ovsdb-server --detach --no-chdir --pidfile --remote=db:mydb,Root,managers --remote=db:mydb,Root,manager_options --log-file db], [0], [ignore], [ignore])
+AT_CHECK([ovsdb-server --detach --no-chdir --log-file --pidfile --remote=db:mydb,Root,managers --remote=db:mydb,Root,manager_options db], [0], [ignore], [ignore])
 ovs-appctl -t ovsdb-server time/warp 6000 1000
 AT_CHECK(
   [[ovsdb-client transact unix:socket1 \
@@ -420,7 +428,7 @@  AT_CHECK(
   [[[{"rows":[{"managers":"punix:socket1"}]},{"rows":[{"is_connected":false,"target":"punix:socket2"}]}]
 ]], 
   [ignore])
-OVS_APP_EXIT_AND_WAIT([ovsdb-server])
+OVSDB_SERVER_SHUTDOWN
 AT_CLEANUP
 
 AT_SETUP([ovsdb-server/add-remote and remove-remote])
@@ -428,7 +436,7 @@  AT_KEYWORDS([ovsdb server positive])
 ordinal_schema > schema
 AT_CHECK([ovsdb-tool create db schema], [0], [ignore], [ignore])
 on_exit 'kill `cat *.pid`'
-AT_CHECK([ovsdb-server --detach --no-chdir --pidfile db])
+AT_CHECK([ovsdb-server --detach --no-chdir --log-file --pidfile db], [0], [ignore], [ignore])
 
 AT_CHECK([test ! -e socket1])
 AT_CHECK([ovs-appctl -t ovsdb-server ovsdb-server/add-remote punix:socket1])
@@ -473,7 +481,7 @@  AT_CHECK([ovs-appctl -t ovsdb-server ovsdb-server/remove-remote punix:socket2])
 OVS_WAIT_UNTIL([test ! -e socket2])
 AT_CHECK([test ! -e socket1])
 AT_CHECK([ovs-appctl -t ovsdb-server ovsdb-server/list-remotes])
-OVS_APP_EXIT_AND_WAIT([ovsdb-server])
+OVSDB_SERVER_SHUTDOWN
 AT_CLEANUP
 
 AT_SETUP([ovsdb-server/add-remote with --monitor])
@@ -491,7 +499,7 @@  AT_SKIP_IF([test $TESTS_WITH_UBSAN = yes])
 ordinal_schema > schema
 AT_CHECK([ovsdb-tool create db schema], [0], [ignore], [ignore])
 on_exit 'kill `cat *.pid`'
-AT_CHECK([ovsdb-server -vfile -vvlog:off --monitor --detach --no-chdir --pidfile --log-file db])
+AT_CHECK([ovsdb-server -vfile -vvlog:off --monitor --detach --no-chdir --pidfile --log-file db], [0], [ignore], [ignore])
 
 # Add a remote.
 AT_CHECK([test ! -e socket1])
@@ -512,7 +520,10 @@  OVS_WAIT_UNTIL(
   [test -s ovsdb-server.pid && test `cat ovsdb-server.pid` != `cat old.pid`])
 OVS_WAIT_UNTIL([ovs-appctl -t ovsdb-server version])
 OVS_WAIT_UNTIL([test -S socket1])
-OVS_APP_EXIT_AND_WAIT([ovsdb-server])
+OVSDB_SERVER_SHUTDOWN(["
+    /backtrace/d
+    /killed/d
+"])
 AT_CLEANUP
 
 AT_SETUP([ovsdb-server/add-remote and remove-remote with --monitor])
@@ -530,7 +541,7 @@  AT_SKIP_IF([test $TESTS_WITH_UBSAN = yes])
 ordinal_schema > schema
 AT_CHECK([ovsdb-tool create db schema], [0], [ignore], [ignore])
 on_exit 'kill `cat *.pid`'
-AT_CHECK([ovsdb-server -vfile -vvlog:off --monitor --detach --no-chdir --pidfile --log-file db])
+AT_CHECK([ovsdb-server -vfile -vvlog:off --monitor --detach --no-chdir --pidfile --log-file db], [0], [ignore], [ignore])
 
 # Add a remote.
 AT_CHECK([test ! -e socket1])
@@ -555,7 +566,10 @@  OVS_WAIT_UNTIL(
   [test -s ovsdb-server.pid && test `cat ovsdb-server.pid` != `cat old.pid`])
 OVS_WAIT_UNTIL([ovs-appctl -t ovsdb-server version])
 AT_CHECK([test ! -e socket1])
-OVS_APP_EXIT_AND_WAIT([ovsdb-server])
+OVSDB_SERVER_SHUTDOWN(["
+    /backtrace/d
+    /killed/d
+"])
 AT_CLEANUP
 
 AT_SETUP([SSL db: implementation])
@@ -674,7 +688,10 @@  AT_CHECK_UNQUOTED(
   [grep "sslv3 alert handshake failure" output], [0],
   [stdout],
   [ignore])
-OVSDB_SERVER_SHUTDOWN
+OVSDB_SERVER_SHUTDOWN(["
+  /stream_ssl|WARN/d
+  /Protocol error/d
+"])
 AT_CLEANUP
 
 OVS_START_SHELL_HELPERS
@@ -701,7 +718,7 @@  ovsdb_check_online_compaction() {
               fi])
     dnl Start ovsdb-server.
     on_exit 'kill `cat *.pid`'
-    AT_CHECK([ovsdb-server -vvlog:off -vconsole:off --detach --no-chdir --pidfile --remote=punix:socket --log-file db], [0])
+    AT_CHECK([ovsdb-server -vvlog:off -vconsole:off --detach --no-chdir --pidfile --remote=punix:socket --log-file db], [0], [ignore], [ignore])
     AT_CHECK([ovsdb_client_wait unix:socket ordinals connected])
     AT_CAPTURE_FILE([ovsdb-server.log])
     dnl Do a bunch of random transactions that put crap in the database log.
@@ -837,8 +854,8 @@  _uuid                                name  number
     dnl Then check that the dumped data is correct.  This time first kill
     dnl and restart the database server to ensure that the data is correct on
     dnl disk as well as in memory.
-    OVS_APP_EXIT_AND_WAIT([ovsdb-server])
-    AT_CHECK([ovsdb-server -vvlog:off -vconsole:off --detach --no-chdir --pidfile --remote=punix:socket --log-file db])
+    OVSDB_SERVER_SHUTDOWN
+    AT_CHECK([ovsdb-server -vvlog:off -vconsole:off --detach --no-chdir --pidfile --remote=punix:socket --log-file db], [0], [ignore], [ignore])
     AT_CHECK([ovsdb-client dump unix:socket ordinals], [0], [stdout])
     AT_CHECK([uuidfilt stdout], [0], [dnl
 ordinals table
@@ -893,7 +910,7 @@  ovsdb_check_online_conversion() {
               fi])
 
     dnl Start the database server.
-    AT_CHECK([ovsdb-server -vfile -vvlog:off -vconsole:off --detach --no-chdir --pidfile --log-file --remote=punix:db.sock db], [0])
+    AT_CHECK([ovsdb-server -vfile -vvlog:off -vconsole:off --detach --no-chdir --pidfile --log-file --remote=punix:db.sock db], [0], [ignore], [ignore])
     AT_CAPTURE_FILE([ovsdb-server.log])
 
     dnl Put some data in the database.
@@ -1109,9 +1126,9 @@  _uuid                                number
 ])
     dnl Now kill and restart the database server to ensure that the data is
     dnl correct on disk as well as in memory.
-    OVS_APP_EXIT_AND_WAIT([ovsdb-server])
+    OVSDB_SERVER_SHUTDOWN
     AT_CHECK([[ovsdb-server -vfile -vvlog:off -vconsole:off --detach --no-chdir --pidfile --log-file --remote=punix:db.sock db]],
-      [0])
+      [0], [ignore], [ignore])
     AT_CHECK([ovsdb-client dump unix:db.sock ordinals | uuidfilt], [0], [dnl
 ordinals table
 _uuid                                number
@@ -1134,7 +1151,7 @@  _uuid                                number
         AT_CHECK([test -f dir/.db.~lock~])
     fi
 
-    OVS_APP_EXIT_AND_WAIT([ovsdb-server])
+    OVSDB_SERVER_SHUTDOWN
 }
 OVS_END_SHELL_HELPERS
 
@@ -1243,7 +1260,7 @@  AT_CHECK([test $logged_updates -lt $logged_nonblock_updates])
 AT_CHECK_UNQUOTED([ovs-vsctl get open_vswitch . system_version], [0],
   [xyzzy$counter
 ])
-OVS_APP_EXIT_AND_WAIT([ovsdb-server])
+OVSDB_SERVER_SHUTDOWN
 AT_CLEANUP
 
 AT_SETUP([ovsdb-server transaction history size])
@@ -1326,7 +1343,7 @@  dnl still has a reasonable size.
 check_atoms
 AT_CHECK([test $(get_memory_value atoms) -eq $db_atoms_before_conversion])
 
-OVS_APP_EXIT_AND_WAIT([ovsdb-server])
+OVSDB_SERVER_SHUTDOWN
 AT_CLEANUP
 
 AT_BANNER([OVSDB -- ovsdb-server transactions (SSL IPv4 sockets)])
@@ -1709,7 +1726,7 @@  AT_KEYWORDS([ovsdb server replication get-active])
 ordinal_schema > schema
 AT_CHECK([ovsdb-tool create db schema], [0], [ignore], [ignore])
 on_exit 'kill `cat *.pid`'
-AT_CHECK([ovsdb-server --detach --no-chdir --pidfile --sync-from=tcp:127.0.0.1:9999 db])
+AT_CHECK([ovsdb-server --detach --no-chdir --log-file --pidfile --sync-from=tcp:127.0.0.1:9999 db], [0], [ignore], [ignore])
 
 AT_CHECK([ovs-appctl -t ovsdb-server ovsdb-server/get-active-ovsdb-server],
   [0], [tcp:127.0.0.1:9999
@@ -1722,7 +1739,7 @@  AT_KEYWORDS([ovsdb server replication set-active])
 ordinal_schema > schema
 AT_CHECK([ovsdb-tool create db schema], [0], [ignore], [ignore])
 on_exit 'kill `cat *.pid`'
-AT_CHECK([ovsdb-server --detach --no-chdir --pidfile db])
+AT_CHECK([ovsdb-server --detach --no-chdir --log-file --pidfile db], [0], [ignore], [ignore])
 
 AT_CHECK([ovs-appctl -t ovsdb-server ovsdb-server/set-active-ovsdb-server tcp:127.0.0.1:9999])
 AT_CHECK([ovs-appctl -t ovsdb-server ovsdb-server/get-active-ovsdb-server],
@@ -1736,7 +1753,7 @@  AT_KEYWORDS([ovsdb server replication get-exclude-tables])
 ordinal_schema > schema
 AT_CHECK([ovsdb-tool create db schema], [0], [ignore], [ignore])
 on_exit 'kill `cat *.pid`'
-AT_CHECK([ovsdb-server --detach --no-chdir --pidfile --sync-exclude-tables=mydb:db1,mydb:db2 db])
+AT_CHECK([ovsdb-server --detach --no-chdir --log-file --pidfile --sync-exclude-tables=mydb:db1,mydb:db2 db], [0], [ignore], [ignore])
 
 AT_CHECK([ovs-appctl -t ovsdb-server ovsdb-server/get-sync-exclude-tables],
   [0], [mydb:db1,mydb:db2
@@ -2079,7 +2096,7 @@  AT_CHECK(
         "row": {"target": "ptcp:0:127.0.0.1",
                "read_only": true}}]']], [0], [ignore], [ignore])
 
-AT_CHECK([ovsdb-server --log-file --detach --no-chdir --pidfile --remote=db:mydb,Root,managers db], [0], [ignore], [ignore])
+AT_CHECK([ovsdb-server --detach --no-chdir --log-file --pidfile --remote=db:mydb,Root,managers db], [0], [ignore], [ignore])
 PARSE_LISTENING_PORT([ovsdb-server.log], [TCP_PORT])
 AT_CHECK([ovsdb-client get-schema-version tcp:127.0.0.1:$TCP_PORT mydb], [0], [5.1.3
 ])
@@ -2310,8 +2327,8 @@  AT_CHECK([uuidfilt monitor.stdout | sed '/^$/d'], [0], [dnl
 <8> delete 4 four
 <9> insert 4 four
 ])
-OVSDB_SERVER_SHUTDOWN
-OVSDB_SERVER_SHUTDOWN2
+OVSDB_SERVER_SHUTDOWN(["/Address already in use/d"])
+OVSDB_SERVER_SHUTDOWN2(["/Address already in use/d"])
 
 dnl Starting a replay.
 AT_CHECK([ovsdb-server --replay=./replay_dir                      dnl
diff --git a/tests/ovsdb-tool.at b/tests/ovsdb-tool.at
index 5496ccda7..d8d2b1c99 100644
--- a/tests/ovsdb-tool.at
+++ b/tests/ovsdb-tool.at
@@ -118,11 +118,11 @@  AT_CHECK([[uuidfilt db | grep -v ^OVSDB | sed 's/"_date":[0-9]*/"_date":0/' | \
 
 dnl Dump out and check the actual database contents.
 on_exit 'kill `cat ovsdb-server.pid`'
-AT_CHECK([[ovsdb-server --detach --pidfile --no-chdir --remote=punix:socket db]],
+AT_CHECK([[ovsdb-server --detach --pidfile --log-file --no-chdir --remote=punix:socket db]],
          [0], [stdout], [ignore])
 AT_CHECK([[ovsdb-client dump unix:socket ordinals]],
          [0], [stdout], [ignore])
-OVS_APP_EXIT_AND_WAIT([ovsdb-server])
+OVSDB_SERVER_SHUTDOWN
 
 AT_CHECK([uuidfilt stdout], [0], [dnl
 ordinals table
@@ -151,11 +151,11 @@  dnl in it now.
 AT_CAPTURE_FILE([db])
 AT_CHECK([test `wc -l < db` -eq 4])
 dnl And check that the dumped data is the same too:
-AT_CHECK([[ovsdb-server --detach --pidfile --no-chdir --remote=punix:socket db]],
+AT_CHECK([[ovsdb-server --detach --pidfile --log-file --no-chdir --remote=punix:socket db]],
          [0], [stdout], [ignore])
 AT_CHECK([[ovsdb-client dump unix:socket ordinals]],
          [0], [stdout], [ignore])
-OVS_APP_EXIT_AND_WAIT([ovsdb-server])
+OVSDB_SERVER_SHUTDOWN
 
 AT_CHECK([uuidfilt stdout], [0], [dnl
 ordinals table
@@ -196,8 +196,8 @@  AT_CHECK(
     done]],
   [0], [stdout], [ignore])
 dnl Dump out and check the actual database contents.
-AT_CHECK([[ovsdb-server --detach --no-chdir --pidfile --remote=punix:socket db]],
-  [0])
+AT_CHECK([ovsdb-server --detach --no-chdir --log-file --pidfile --remote=punix:socket db],
+  [0], [ignore], [ignore])
 AT_CHECK([ovsdb-client dump unix:socket ordinals], [0], [stdout], [ignore])
 AT_CHECK([uuidfilt stdout], [0], [dnl
 ordinals table
@@ -210,7 +210,7 @@  _uuid                                name  number
 <4> two   2
 <5> zero  0
 ])
-OVS_APP_EXIT_AND_WAIT([ovsdb-server])
+OVSDB_SERVER_SHUTDOWN
 dnl Now convert the database in-place.
 touch .db.tmp.~lock~
 AT_CHECK([[ovsdb-tool convert db new-schema]], [0], [], [ignore])
@@ -220,8 +220,8 @@  dnl in it now.
 AT_CAPTURE_FILE([db])
 AT_CHECK([test `wc -l < db` -eq 4])
 dnl And check that the dumped data is the same except for the removed column:
-AT_CHECK([[ovsdb-server --detach --no-chdir --pidfile --remote=punix:socket db]],
-  [0])
+AT_CHECK([ovsdb-server --detach --no-chdir --log-file --pidfile --remote=punix:socket db],
+  [0], [ignore], [ignore])
 AT_CHECK([ovsdb-client dump unix:socket ordinals], [0], [stdout], [ignore])
 AT_CHECK([uuidfilt stdout], [0], [dnl
 ordinals table
@@ -234,7 +234,7 @@  _uuid                                number
 <4> 4
 <5> 5
 ])
-OVS_APP_EXIT_AND_WAIT([ovsdb-server])
+OVSDB_SERVER_SHUTDOWN
 AT_CLEANUP
 
 AT_SETUP([ovsdb-tool convert -- adding a column])
@@ -262,8 +262,8 @@  AT_CHECK(
     done]],
   [0], [stdout], [ignore])
 dnl Dump out and check the actual database contents.
-AT_CHECK([[ovsdb-server --detach --no-chdir --pidfile --remote=punix:socket db]],
-  [0])
+AT_CHECK([ovsdb-server --detach --no-chdir --log-file --pidfile --remote=punix:socket db],
+  [0], [ignore], [ignore])
 AT_CHECK([ovsdb-client dump unix:socket ordinals], [0], [stdout], [ignore])
 AT_CHECK([uuidfilt stdout], [0], [dnl
 ordinals table
@@ -276,7 +276,7 @@  _uuid                                number
 <4> 4
 <5> 5
 ])
-OVS_APP_EXIT_AND_WAIT([ovsdb-server])
+OVSDB_SERVER_SHUTDOWN
 dnl Now convert the database in-place.
 touch .db.tmp.~lock~
 AT_CHECK([[ovsdb-tool convert db new-schema]], [0], [], [ignore])
@@ -286,8 +286,8 @@  dnl in it now.
 AT_CAPTURE_FILE([db])
 AT_CHECK([test `wc -l < db` -eq 4])
 dnl And check that the dumped data is the same except for the added column:
-AT_CHECK([[ovsdb-server --detach --no-chdir --pidfile --remote=punix:socket db]],
-  [0])
+AT_CHECK([ovsdb-server --detach --no-chdir --log-file --pidfile --remote=punix:socket db],
+  [0], [ignore], [ignore])
 AT_CHECK([ovsdb-client dump unix:socket ordinals], [0], [stdout], [ignore])
 AT_CHECK([uuidfilt stdout], [0], [dnl
 ordinals table
@@ -300,7 +300,7 @@  _uuid                                name number
 <4> ""   4
 <5> ""   5
 ])
-OVS_APP_EXIT_AND_WAIT([ovsdb-server])
+OVSDB_SERVER_SHUTDOWN
 AT_CLEANUP
 
 AT_SETUP([ovsdb-tool unsupported cluster operations])
@@ -446,7 +446,7 @@  AT_CHECK(
 # Dump the data.
 AT_CHECK([ovsdb-server -vfile -vvlog:off --detach --no-chdir --pidfile --log-file --remote=punix:db.sock db1])
 AT_CHECK([ovsdb-client dump > expout])
-OVS_APP_EXIT_AND_WAIT([ovsdb-server])
+OVSDB_SERVER_SHUTDOWN
 
 # Create a clustered database from the standalone one.
 ovsdb-tool create-cluster db2 db1 unix:s1.raft
@@ -455,7 +455,7 @@  ovsdb-tool create-cluster db2 db1 unix:s1.raft
 AT_CHECK([ovsdb-server -vconsole:off -vfile -vvlog:off --detach --no-chdir --pidfile --log-file --remote=punix:db.sock db2])
 AT_CHECK([ovsdb_client_wait ordinals connected])
 AT_CHECK([ovsdb-client dump > dump2])
-OVS_APP_EXIT_AND_WAIT([ovsdb-server])
+OVSDB_SERVER_SHUTDOWN
 
 # Make sure that the clustered data matched the standalone data.
 AT_CHECK([cat dump2], [0], [expout])
@@ -482,7 +482,7 @@  done
 AT_CHECK([ovsdb-client transact unix:socket '[["ordinals"]]'], [0],
          [ignore], [ignore])
 AT_CHECK([ovsdb-client dump unix:socket > clusterdump])
-AT_CHECK([ovs-appctl -t ovsdb-server -e exit], [0], [ignore], [ignore])
+OVSDB_SERVER_SHUTDOWN
 
 # Convert to standalone database from clustered database.
 AT_CHECK(ovsdb-tool cluster-to-standalone db1 db)
@@ -494,7 +494,7 @@  AT_CHECK([ovsdb-tool db-is-standalone db1])
 AT_CHECK([ovsdb-server -vconsole:off -vfile -vvlog:off --detach --no-chdir --pidfile --log-file --remote=punix:db.sock db1])
 AT_CHECK([ovsdb_client_wait ordinals connected])
 AT_CHECK([ovsdb-client dump  > standalonedump])
-OVS_APP_EXIT_AND_WAIT([ovsdb-server])
+OVSDB_SERVER_SHUTDOWN
 
 # Make sure both standalone and cluster db data matches.
 AT_CHECK([diff standalonedump clusterdump])
@@ -549,7 +549,7 @@  _uuid                                is_seven name  number
 <3> true     seven 7
 ])
 
-OVS_APP_EXIT_AND_WAIT([ovsdb-server])
+OVSDB_SERVER_SHUTDOWN
 
 dnl Convert to standalone database from clustered database.
 AT_CHECK(ovsdb-tool cluster-to-standalone db1 db)
@@ -562,7 +562,7 @@  AT_CHECK([ovsdb-server -vconsole:off -vfile -vvlog:off --detach --no-chdir dnl
                        --pidfile --log-file --remote=punix:db.sock db1])
 AT_CHECK([ovsdb_client_wait ordinals connected])
 AT_CHECK([ovsdb-client dump > standalonedump])
-OVS_APP_EXIT_AND_WAIT([ovsdb-server])
+OVSDB_SERVER_SHUTDOWN
 
 dnl Make sure both standalone and cluster db data matches.
 AT_CHECK([diff standalonedump clusterdump])
diff --git a/tests/vtep-ctl.at b/tests/vtep-ctl.at
index 980676584..d4e4bda46 100644
--- a/tests/vtep-ctl.at
+++ b/tests/vtep-ctl.at
@@ -19,7 +19,7 @@  dnl Creates an empty database in the current directory and then starts
 dnl an ovsdb-server on it for vtep-ctl to connect to.
 m4_define([VTEP_CTL_SETUP],
   [VTEP_OVSDB_INIT([db])
-   AT_CHECK([ovsdb-server --detach --no-chdir --pidfile --remote=punix:socket db >/dev/null 2>&1], [0], [ignore], [ignore])])
+   AT_CHECK([ovsdb-server --detach --no-chdir --log-file --pidfile --remote=punix:socket db], [0], [ignore], [ignore])])
 
 dnl VTEP_CTL_CLEANUP
 dnl