2
0
mirror of https://github.com/openvswitch/ovs synced 2025-08-30 05:47:55 +00:00

tests: Get rid of overly specific --pidfile and --unixctl options.

At an early point in OVS development, OVS was built with fixed default
directories for pidfiles and sockets.  This meant that it was necessary to
use lots of --pidfile and --unixctl options in the testsuite, to point the
daemons to where they should put these files (since the testsuite cannot
and generally should not touch the real system /var/run).  Later on,
the environment variables OVS_RUNDIR, OVS_LOGDIR, etc. were introduced
to override these defaults, and even later the testsuite was changed to
always set these variables correctly in every test.  Thus, these days it
isn't usually necessary to specify a filename on --pidfile or to specify
--unixctl at all.  However, many of the tests are built by cut-and-paste,
so they tended to keep appearing anyhow.  This commit drops most of them,
making the testsuite easier to read and understand.

This commit also sweeps away some other historical detritus.  In
particular, in early days of the testsuite there was no way to
automatically kill daemons when a test failed (or otherwise ended).  This
meant that some tests were littered with calls to "kill `cat pidfile`" on
almost every line (or m4 macros that expanded to the same thing) so that if
a test failed partway through the testsuite would not hang waiting for a
daemon to die that was never going to die without manual intervention.
However, a long time ago we introduced the "on_exit" mechanism that
obsoletes this.  This commit eliminates a lot of the old litter of kill
invocations, which also makes those tests easier to read.

Signed-off-by: Ben Pfaff <blp@ovn.org>
Acked-by: Andy Zhou <azhou@ovn.org>
This commit is contained in:
Ben Pfaff 2016-10-05 20:07:56 -07:00
parent a8cb456227
commit 561205007e
15 changed files with 262 additions and 340 deletions

View File

@ -10,7 +10,7 @@ m4_define([DAEMON_PYN],
AT_CAPTURE_FILE([expected]) AT_CAPTURE_FILE([expected])
# Start the daemon and wait for the pidfile to get created # Start the daemon and wait for the pidfile to get created
# and that its contents are the correct pid. # and that its contents are the correct pid.
AT_CHECK([$3 $srcdir/test-daemon.py --pidfile=`pwd`/pid& echo $! > expected], [0]) AT_CHECK([$3 $srcdir/test-daemon.py --pidfile=pid& echo $! > expected], [0])
OVS_WAIT_UNTIL([test -s pid], [kill `cat expected`]) OVS_WAIT_UNTIL([test -s pid], [kill `cat expected`])
AT_CHECK( AT_CHECK(
[pid=`cat pid` && expected=`cat expected` && test "$pid" = "$expected"], [pid=`cat pid` && expected=`cat expected` && test "$pid" = "$expected"],
@ -35,40 +35,35 @@ m4_define([DAEMON_MONITOR_PYN],
AT_CAPTURE_FILE([parentpid]) AT_CAPTURE_FILE([parentpid])
AT_CAPTURE_FILE([newpid]) AT_CAPTURE_FILE([newpid])
# Start the daemon and wait for the pidfile to get created. # Start the daemon and wait for the pidfile to get created.
AT_CHECK([$3 $srcdir/test-daemon.py --pidfile=`pwd`/pid --monitor& echo $! > parent], [0]) AT_CHECK([$3 $srcdir/test-daemon.py --pidfile=pid --monitor& echo $! > parent], [0])
OVS_WAIT_UNTIL([test -s pid], [kill `cat parent`]) on_exit 'kill `cat parent`'
OVS_WAIT_UNTIL([test -s pid])
# Check that the pidfile names a running process, # Check that the pidfile names a running process,
# and that the parent process of that process is our child process. # and that the parent process of that process is our child process.
AT_CHECK([kill -0 `cat pid`], [0], [], [], [kill `cat parent`]) AT_CHECK([kill -0 `cat pid`])
AT_CHECK([parent_pid `cat pid` > parentpid], AT_CHECK([parent_pid `cat pid` > parentpid])
[0], [], [], [kill `cat parent`])
AT_CHECK( AT_CHECK(
[parentpid=`cat parentpid` && [parentpid=`cat parentpid` &&
parent=`cat parent` && parent=`cat parent` &&
test $parentpid = $parent], test $parentpid = $parent])
[0], [], [], [kill `cat parent`])
# Kill the daemon process, making it look like a segfault, # Kill the daemon process, making it look like a segfault,
# and wait for a new child process to get spawned. # and wait for a new child process to get spawned.
AT_CHECK([cp pid oldpid], [0], [], [], [kill `cat parent`]) AT_CHECK([cp pid oldpid])
AT_CHECK([kill -SEGV `cat pid`], [0], [], [ignore], [kill `cat parent`]) AT_CHECK([kill -SEGV `cat pid`], [0], [], [ignore])
OVS_WAIT_WHILE([kill -0 `cat oldpid`], [kill `cat parent`]) OVS_WAIT_WHILE([kill -0 `cat oldpid`])
OVS_WAIT_UNTIL([test -s pid && test `cat pid` != `cat oldpid`], OVS_WAIT_UNTIL([test -s pid && test `cat pid` != `cat oldpid`])
[kill `cat parent`]) AT_CHECK([cp pid newpid])
AT_CHECK([cp pid newpid], [0], [], [], [kill `cat parent`])
# Check that the pidfile names a running process, # Check that the pidfile names a running process,
# and that the parent process of that process is our child process. # and that the parent process of that process is our child process.
AT_CHECK([parent_pid `cat pid` > parentpid], AT_CHECK([parent_pid `cat pid` > parentpid])
[0], [], [], [kill `cat parent`])
AT_CHECK( AT_CHECK(
[parentpid=`cat parentpid` && [parentpid=`cat parentpid` &&
parent=`cat parent` && parent=`cat parent` &&
test $parentpid = $parent], test $parentpid = $parent])
[0], [], [], [kill `cat parent`])
# Kill the daemon process with SIGTERM, and wait for the daemon # Kill the daemon process with SIGTERM, and wait for the daemon
# and the monitor processes to go away and the pidfile to get deleted. # and the monitor processes to go away and the pidfile to get deleted.
AT_CHECK([kill `cat pid`], [0], [], [ignore], [kill `cat parent`]) AT_CHECK([kill `cat pid`])
OVS_WAIT_WHILE([kill -0 `cat parent` || kill -0 `cat newpid` || test -e pid], OVS_WAIT_WHILE([kill -0 `cat parent` || kill -0 `cat newpid` || test -e pid])
[kill `cat parent`])
AT_CLEANUP]) AT_CLEANUP])
DAEMON_MONITOR_PYN([Python2], [$HAVE_PYTHON], [$PYTHON]) DAEMON_MONITOR_PYN([Python2], [$HAVE_PYTHON], [$PYTHON])
@ -84,40 +79,35 @@ m4_define([DAEMON_MONITOR_RESTART_PYN],
AT_CAPTURE_FILE([parentpid]) AT_CAPTURE_FILE([parentpid])
AT_CAPTURE_FILE([newpid]) AT_CAPTURE_FILE([newpid])
# Start the daemon and wait for the pidfile to get created. # Start the daemon and wait for the pidfile to get created.
AT_CHECK([$3 $srcdir/test-daemon.py --pidfile=`pwd`/pid --monitor& echo $! > parent], [0]) AT_CHECK([$3 $srcdir/test-daemon.py --pidfile=pid --monitor& echo $! > parent], [0])
OVS_WAIT_UNTIL([test -s pid], [kill `cat parent`]) on_exit 'kill `cat parent`'
OVS_WAIT_UNTIL([test -s pid])
# Check that the pidfile names a running process, # Check that the pidfile names a running process,
# and that the parent process of that process is our child process. # and that the parent process of that process is our child process.
AT_CHECK([kill -0 `cat pid`], [0], [], [], [kill `cat parent`]) AT_CHECK([kill -0 `cat pid`])
AT_CHECK([parent_pid `cat pid` > parentpid], AT_CHECK([parent_pid `cat pid` > parentpid])
[0], [], [], [kill `cat parent`])
AT_CHECK( AT_CHECK(
[parentpid=`cat parentpid` && [parentpid=`cat parentpid` &&
parent=`cat parent` && parent=`cat parent` &&
test $parentpid = $parent], test $parentpid = $parent])
[0], [], [], [kill `cat parent`])
# HUP the daemon process causing it to throw an exception, # HUP the daemon process causing it to throw an exception,
# and wait for a new child process to get spawned. # and wait for a new child process to get spawned.
AT_CHECK([cp pid oldpid], [0], [], [], [kill `cat parent`]) AT_CHECK([cp pid oldpid])
AT_CHECK([kill -HUP `cat pid`], [0], [], [ignore], [kill `cat parent`]) AT_CHECK([kill -HUP `cat pid`])
OVS_WAIT_WHILE([kill -0 `cat oldpid`], [kill `cat parent`]) OVS_WAIT_WHILE([kill -0 `cat oldpid`])
OVS_WAIT_UNTIL([test -s pid && test `cat pid` != `cat oldpid`], OVS_WAIT_UNTIL([test -s pid && test `cat pid` != `cat oldpid`])
[kill `cat parent`]) AT_CHECK([cp pid newpid])
AT_CHECK([cp pid newpid], [0], [], [], [kill `cat parent`])
# Check that the pidfile names a running process, # Check that the pidfile names a running process,
# and that the parent process of that process is our child process. # and that the parent process of that process is our child process.
AT_CHECK([parent_pid `cat pid` > parentpid], AT_CHECK([parent_pid `cat pid` > parentpid])
[0], [], [], [kill `cat parent`])
AT_CHECK( AT_CHECK(
[parentpid=`cat parentpid` && [parentpid=`cat parentpid` &&
parent=`cat parent` && parent=`cat parent` &&
test $parentpid = $parent], test $parentpid = $parent])
[0], [], [], [kill `cat parent`])
# Kill the daemon process with SIGTERM, and wait for the daemon # Kill the daemon process with SIGTERM, and wait for the daemon
# and the monitor processes to go away and the pidfile to get deleted. # and the monitor processes to go away and the pidfile to get deleted.
AT_CHECK([kill `cat pid`], [0], [], [ignore], [kill `cat parent`]) AT_CHECK([kill `cat pid`], [0], [], [ignore])
OVS_WAIT_WHILE([kill -0 `cat parent` || kill -0 `cat newpid` || test -e pid], OVS_WAIT_WHILE([kill -0 `cat parent` || kill -0 `cat newpid` || test -e pid])
[kill `cat parent`])
AT_CLEANUP]) AT_CLEANUP])
DAEMON_MONITOR_RESTART_PYN([Python2], [$HAVE_PYTHON], [$PYTHON]) DAEMON_MONITOR_RESTART_PYN([Python2], [$HAVE_PYTHON], [$PYTHON])
@ -132,7 +122,7 @@ m4_define([DAEMON_DETACH_PYN],
# Start the daemon and make sure that the pidfile exists immediately. # Start the daemon and make sure that the pidfile exists immediately.
# We don't wait for the pidfile to get created because the daemon is # We don't wait for the pidfile to get created because the daemon is
# supposed to do so before the parent exits. # supposed to do so before the parent exits.
AT_CHECK([$3 $srcdir/test-daemon.py --pidfile=`pwd`/pid --detach], [0]) AT_CHECK([$3 $srcdir/test-daemon.py --pidfile=pid --detach], [0])
AT_CHECK([test -s pid]) AT_CHECK([test -s pid])
AT_CHECK([kill -0 `cat pid`]) AT_CHECK([kill -0 `cat pid`])
# Kill the daemon and make sure that the pidfile gets deleted. # Kill the daemon and make sure that the pidfile gets deleted.
@ -145,8 +135,6 @@ m4_define([DAEMON_DETACH_PYN],
DAEMON_DETACH_PYN([Python2], [$HAVE_PYTHON], [$PYTHON]) DAEMON_DETACH_PYN([Python2], [$HAVE_PYTHON], [$PYTHON])
DAEMON_DETACH_PYN([Python3], [$HAVE_PYTHON3], [$PYTHON3]) DAEMON_DETACH_PYN([Python3], [$HAVE_PYTHON3], [$PYTHON3])
m4_define([CHECK],
[AT_CHECK([$1], [$2], [$3], [$4], [kill `cat daemon monitor`])])
m4_define([DAEMON_DETACH_MONITOR_PYN], m4_define([DAEMON_DETACH_MONITOR_PYN],
[AT_SETUP([daemon --detach --monitor - $1]) [AT_SETUP([daemon --detach --monitor - $1])
AT_SKIP_IF([test $2 = no]) AT_SKIP_IF([test $2 = no])
@ -161,50 +149,48 @@ m4_define([DAEMON_DETACH_MONITOR_PYN],
# Start the daemon and make sure that the pidfile exists immediately. # Start the daemon and make sure that the pidfile exists immediately.
# We don't wait for the pidfile to get created because the daemon is # We don't wait for the pidfile to get created because the daemon is
# supposed to do so before the parent exits. # supposed to do so before the parent exits.
AT_CHECK([$3 $srcdir/test-daemon.py --pidfile=`pwd`/daemon --detach --monitor], [0]) AT_CHECK([$3 $srcdir/test-daemon.py --pidfile=daemon --detach --monitor], [0])
on_exit 'kill `cat daemon olddaemon newdaemon monitor`'
AT_CHECK([test -s daemon]) AT_CHECK([test -s daemon])
# Check that the pidfile names a running process, # Check that the pidfile names a running process,
# and that the parent process of that process is a running process, # and that the parent process of that process is a running process,
# and that the parent process of that process is init. # and that the parent process of that process is init.
CHECK([kill -0 `cat daemon`]) AT_CHECK([kill -0 `cat daemon`])
CHECK([parent_pid `cat daemon` > monitor]) AT_CHECK([parent_pid `cat daemon` > monitor])
CHECK([kill -0 `cat monitor`]) AT_CHECK([kill -0 `cat monitor`])
CHECK([parent_pid `cat monitor` > init]) AT_CHECK([parent_pid `cat monitor` > init])
CHECK([test `cat init` != $$]) AT_CHECK([test `cat init` != $$])
# Kill the daemon process, making it look like a segfault, # Kill the daemon process, making it look like a segfault,
# and wait for a new daemon process to get spawned. # and wait for a new daemon process to get spawned.
CHECK([cp daemon olddaemon]) AT_CHECK([cp daemon olddaemon])
CHECK([kill -SEGV `cat daemon`], [0], [ignore], [ignore]) AT_CHECK([kill -SEGV `cat daemon`], [0], [ignore], [ignore])
OVS_WAIT_WHILE([kill -0 `cat olddaemon`], [kill `cat olddaemon daemon`]) OVS_WAIT_WHILE([kill -0 `cat olddaemon`])
OVS_WAIT_UNTIL([test -s daemon && test `cat daemon` != `cat olddaemon`], OVS_WAIT_UNTIL([test -s daemon && test `cat daemon` != `cat olddaemon`])
[kill `cat olddaemon daemon`]) AT_CHECK([cp daemon newdaemon])
CHECK([cp daemon newdaemon])
# Check that the pidfile names a running process, # Check that the pidfile names a running process,
# and that the parent process of that process is our child process. # and that the parent process of that process is our child process.
CHECK([kill -0 `cat daemon`]) AT_CHECK([kill -0 `cat daemon`])
CHECK([diff olddaemon newdaemon], [1], [ignore]) AT_CHECK([diff olddaemon newdaemon], [1], [ignore])
CHECK([parent_pid `cat daemon` > newmonitor]) AT_CHECK([parent_pid `cat daemon` > newmonitor])
CHECK([diff monitor newmonitor]) AT_CHECK([diff monitor newmonitor])
CHECK([kill -0 `cat newmonitor`]) AT_CHECK([kill -0 `cat newmonitor`])
CHECK([parent_pid `cat newmonitor` > init]) AT_CHECK([parent_pid `cat newmonitor` > init])
CHECK([test `cat init` != $$]) AT_CHECK([test `cat init` != $$])
# Kill the daemon process with SIGTERM, and wait for the daemon # Kill the daemon process with SIGTERM, and wait for the daemon
# and the monitor processes to go away and the pidfile to get deleted. # and the monitor processes to go away and the pidfile to get deleted.
CHECK([kill `cat daemon`], [0], [], [ignore]) AT_CHECK([kill `cat daemon`], [0], [], [ignore])
OVS_WAIT_WHILE( OVS_WAIT_WHILE(
[kill -0 `cat monitor` || kill -0 `cat newdaemon` || test -e daemon], [kill -0 `cat monitor` || kill -0 `cat newdaemon` || test -e daemon])
[kill `cat monitor newdaemon`])
AT_CLEANUP]) AT_CLEANUP])
DAEMON_DETACH_MONITOR_PYN([Python2], [$HAVE_PYTHON], [$PYTHON]) DAEMON_DETACH_MONITOR_PYN([Python2], [$HAVE_PYTHON], [$PYTHON])
DAEMON_DETACH_MONITOR_PYN([Python3], [$HAVE_PYTHON3], [$PYTHON3]) DAEMON_DETACH_MONITOR_PYN([Python3], [$HAVE_PYTHON3], [$PYTHON3])
m4_undefine([CHECK])
m4_define([DAEMON_DETACH_ERRORS_PYN], m4_define([DAEMON_DETACH_ERRORS_PYN],
[AT_SETUP([daemon --detach startup errors - $1]) [AT_SETUP([daemon --detach startup errors - $1])
AT_SKIP_IF([test $2 = no]) AT_SKIP_IF([test $2 = no])
AT_CAPTURE_FILE([pid]) AT_CAPTURE_FILE([pid])
AT_CHECK([$3 $srcdir/test-daemon.py --pidfile=`pwd`/pid --detach --bail], [1], [], [stderr]) AT_CHECK([$3 $srcdir/test-daemon.py --pidfile=pid --detach --bail], [1], [], [stderr])
AT_CHECK([grep 'test-daemon.py: exiting after daemonize_start() as requested' stderr], AT_CHECK([grep 'test-daemon.py: exiting after daemonize_start() as requested' stderr],
[0], [ignore], []) [0], [ignore], [])
AT_CHECK([test ! -s pid]) AT_CHECK([test ! -s pid])
@ -217,7 +203,7 @@ m4_define([DAEMON_DETACH_MONITOR_ERRORS_PYN],
[AT_SETUP([daemon --detach --monitor startup errors - $1]) [AT_SETUP([daemon --detach --monitor startup errors - $1])
AT_SKIP_IF([test $2 = no]) AT_SKIP_IF([test $2 = no])
AT_CAPTURE_FILE([pid]) AT_CAPTURE_FILE([pid])
AT_CHECK([$3 $srcdir/test-daemon.py --pidfile=`pwd`/pid --detach --monitor --bail], [1], [], [stderr]) AT_CHECK([$3 $srcdir/test-daemon.py --pidfile=pid --detach --monitor --bail], [1], [], [stderr])
AT_CHECK([grep 'test-daemon.py: exiting after daemonize_start() as requested' stderr], AT_CHECK([grep 'test-daemon.py: exiting after daemonize_start() as requested' stderr],
[0], [ignore], []) [0], [ignore], [])
AT_CHECK([test ! -s pid]) AT_CHECK([test ! -s pid])
@ -234,7 +220,7 @@ m4_define([DAEMON_DETACH_CLOSES_FDS_PYN],
AT_CAPTURE_FILE([pid]) AT_CAPTURE_FILE([pid])
AT_CAPTURE_FILE([status]) AT_CAPTURE_FILE([status])
AT_CAPTURE_FILE([stderr]) AT_CAPTURE_FILE([stderr])
AT_CHECK([(yes 2>stderr; echo $? > status) | $3 $srcdir/test-daemon.py --pidfile=`pwd`/pid --detach], [0], [], []) AT_CHECK([(yes 2>stderr; echo $? > status) | $3 $srcdir/test-daemon.py --pidfile=pid --detach])
AT_CHECK([kill `cat pid`]) AT_CHECK([kill `cat pid`])
AT_CHECK([test -s status]) AT_CHECK([test -s status])
if grep '[[bB]]roken pipe' stderr >/dev/null 2>&1; then if grep '[[bB]]roken pipe' stderr >/dev/null 2>&1; then
@ -261,7 +247,7 @@ m4_define([DAEMON_DETACH_MONITOR_CLOSES_FDS_PYN],
AT_CAPTURE_FILE([status]) AT_CAPTURE_FILE([status])
AT_CAPTURE_FILE([stderr]) AT_CAPTURE_FILE([stderr])
OVSDB_INIT([db]) OVSDB_INIT([db])
AT_CHECK([(yes 2>stderr; echo $? > status) | $3 $srcdir/test-daemon.py --pidfile=`pwd`/pid --detach], [0], [], []) AT_CHECK([(yes 2>stderr; echo $? > status) | $3 $srcdir/test-daemon.py --pidfile=pid --detach], [0], [], [])
AT_CHECK([kill `cat pid`]) AT_CHECK([kill `cat pid`])
AT_CHECK([test -s status]) AT_CHECK([test -s status])
if grep '[[bB]]roken pipe' stderr >/dev/null 2>&1; then if grep '[[bB]]roken pipe' stderr >/dev/null 2>&1; then

View File

@ -16,16 +16,15 @@ AT_CAPTURE_FILE([pid])
AT_CAPTURE_FILE([expected]) AT_CAPTURE_FILE([expected])
# Start the daemon and wait for the pidfile to get created # Start the daemon and wait for the pidfile to get created
# and that its contents are the correct pid. # and that its contents are the correct pid.
AT_CHECK([ovsdb-server --pidfile="`pwd`"/pid --remote=punix:socket --unixctl="`pwd`"/unixctl db 2>/dev/null & echo $! > expected], [0]) AT_CHECK([ovsdb-server --pidfile --remote=punix:socket db 2>/dev/null & echo $! > expected], [0])
OVS_WAIT_UNTIL([test -s pid], [kill `cat expected`]) on_exit 'kill `cat expected`'
AT_CHECK( OVS_WAIT_UNTIL([test -s ovsdb-server.pid])
[pid=`cat pid` && expected=`cat expected` && test "$pid" = "$expected"], AT_CHECK([pid=`cat ovsdb-server.pid` && expected=`cat expected` && test "$pid" = "$expected"])
[0], [], [], [kill `cat expected`]) AT_CHECK([kill -0 `cat ovsdb-server.pid`])
AT_CHECK([kill -0 `cat pid`], [0], [], [], [kill `cat expected`])
# Kill the daemon and make sure that the pidfile gets deleted. # Kill the daemon and make sure that the pidfile gets deleted.
kill `cat expected` kill `cat expected`
OVS_WAIT_WHILE([kill -0 `cat expected`]) OVS_WAIT_WHILE([kill -0 `cat expected`])
AT_CHECK([test ! -e pid]) AT_CHECK([test ! -e ovsdb-server.pid])
AT_CLEANUP AT_CLEANUP
AT_SETUP([daemon --monitor]) AT_SETUP([daemon --monitor])
@ -36,12 +35,12 @@ AT_CAPTURE_FILE([parent])
AT_CAPTURE_FILE([parentpid]) AT_CAPTURE_FILE([parentpid])
AT_CAPTURE_FILE([newpid]) AT_CAPTURE_FILE([newpid])
# Start the daemon and wait for the pidfile to get created. # Start the daemon and wait for the pidfile to get created.
AT_CHECK([ovsdb-server --monitor --pidfile="`pwd`"/pid --remote=punix:socket --unixctl="`pwd`"/unixctl db 2>/dev/null & echo $! > parent], [0]) AT_CHECK([ovsdb-server --monitor --pidfile --remote=punix:socket db 2>/dev/null & echo $! > parent], [0])
OVS_WAIT_UNTIL([test -s pid], [kill `cat parent`]) OVS_WAIT_UNTIL([test -s ovsdb-server.pid], [kill `cat parent`])
# Check that the pidfile names a running process, # Check that the pidfile names a running process,
# and that the parent process of that process is our child process. # and that the parent process of that process is our child process.
AT_CHECK([kill -0 `cat pid`], [0], [], [], [kill `cat parent`]) AT_CHECK([kill -0 `cat ovsdb-server.pid`], [0], [], [], [kill `cat parent`])
AT_CHECK([parent_pid `cat pid` > parentpid], AT_CHECK([parent_pid `cat ovsdb-server.pid` > parentpid],
[0], [], [], [kill `cat parent`]) [0], [], [], [kill `cat parent`])
AT_CHECK( AT_CHECK(
[parentpid=`cat parentpid` && [parentpid=`cat parentpid` &&
@ -51,19 +50,19 @@ AT_CHECK(
# Avoid a race between pidfile creation and notifying the parent, # Avoid a race between pidfile creation and notifying the parent,
# which can easily trigger if ovsdb-server is slow (e.g. due to valgrind). # which can easily trigger if ovsdb-server is slow (e.g. due to valgrind).
OVS_WAIT_UNTIL( OVS_WAIT_UNTIL(
[ovs-appctl --timeout=10 -t "`pwd`/unixctl" version], [ovs-appctl --timeout=10 -t ovsdb-server version],
[kill `cat pid`]) [kill `cat ovsdb-server.pid`])
# Kill the daemon process, making it look like a segfault, # Kill the daemon process, making it look like a segfault,
# and wait for a new child process to get spawned. # and wait for a new child process to get spawned.
AT_CHECK([cp pid oldpid], [0], [], [], [kill `cat parent`]) AT_CHECK([cp ovsdb-server.pid oldpid], [0], [], [], [kill `cat parent`])
AT_CHECK([kill -SEGV `cat pid`], [0], [], [ignore], [kill `cat parent`]) AT_CHECK([kill -SEGV `cat ovsdb-server.pid`], [0], [], [ignore], [kill `cat parent`])
OVS_WAIT_WHILE([kill -0 `cat oldpid`], [kill `cat parent`]) OVS_WAIT_WHILE([kill -0 `cat oldpid`], [kill `cat parent`])
OVS_WAIT_UNTIL([test -s pid && test `cat pid` != `cat oldpid`], OVS_WAIT_UNTIL([test -s ovsdb-server.pid && test `cat ovsdb-server.pid` != `cat oldpid`],
[kill `cat parent`]) [kill `cat parent`])
AT_CHECK([cp pid newpid], [0], [], [], [kill `cat parent`]) AT_CHECK([cp ovsdb-server.pid newpid], [0], [], [], [kill `cat parent`])
# Check that the pidfile names a running process, # Check that the pidfile names a running process,
# and that the parent process of that process is our child process. # and that the parent process of that process is our child process.
AT_CHECK([parent_pid `cat pid` > parentpid], AT_CHECK([parent_pid `cat ovsdb-server.pid` > parentpid],
[0], [], [], [kill `cat parent`]) [0], [], [], [kill `cat parent`])
AT_CHECK( AT_CHECK(
[parentpid=`cat parentpid` && [parentpid=`cat parentpid` &&
@ -72,8 +71,8 @@ AT_CHECK(
[0], [], [], [kill `cat parent`]) [0], [], [], [kill `cat parent`])
# Kill the daemon process with SIGTERM, and wait for the daemon # Kill the daemon process with SIGTERM, and wait for the daemon
# and the monitor processes to go away and the pidfile to get deleted. # and the monitor processes to go away and the pidfile to get deleted.
AT_CHECK([kill `cat pid`], [0], [], [ignore], [kill `cat parent`]) AT_CHECK([kill `cat ovsdb-server.pid`], [0], [], [ignore], [kill `cat parent`])
OVS_WAIT_WHILE([kill -0 `cat parent` || kill -0 `cat newpid` || test -e pid], OVS_WAIT_WHILE([kill -0 `cat parent` || kill -0 `cat newpid` || test -e ovsdb-server.pid],
[kill `cat parent`]) [kill `cat parent`])
AT_CLEANUP AT_CLEANUP
@ -83,27 +82,25 @@ OVSDB_INIT([db])
# Start the daemon and make sure that the pidfile exists immediately. # Start the daemon and make sure that the pidfile exists immediately.
# We don't wait for the pidfile to get created because the daemon is # We don't wait for the pidfile to get created because the daemon is
# supposed to do so before the parent exits. # supposed to do so before the parent exits.
AT_CHECK([ovsdb-server --detach --no-chdir --pidfile="`pwd`"/pid --remote=punix:socket --unixctl="`pwd`"/unixctl db], [0]) AT_CHECK([ovsdb-server --detach --no-chdir --pidfile --remote=punix:socket db], [0])
AT_CHECK([test -s pid]) AT_CHECK([test -s ovsdb-server.pid])
AT_CHECK([kill -0 `cat pid`]) AT_CHECK([kill -0 `cat ovsdb-server.pid`])
# Kill the daemon and make sure that the pidfile gets deleted. # Kill the daemon and make sure that the pidfile gets deleted.
cp pid saved-pid cp ovsdb-server.pid saved-pid
if test "$IS_WIN32" = "yes"; then if test "$IS_WIN32" = "yes"; then
# When a 'kill pid' is done on windows (through 'taskkill //F'), # When a 'kill pid' is done on windows (through 'taskkill //F'),
# pidfiles are not deleted (because it is force kill), so use # pidfiles are not deleted (because it is force kill), so use
# 'ovs-appctl exit' instead # 'ovs-appctl exit' instead
OVS_APP_EXIT_AND_WAIT_BY_TARGET([`pwd`/unixctl], [`pwd`/pid]) OVS_APP_EXIT_AND_WAIT([ovsdb-server])
else else
kill `cat pid` kill `cat ovsdb-server.pid`
fi fi
OVS_WAIT_WHILE([kill -0 `cat saved-pid`]) OVS_WAIT_WHILE([kill -0 `cat saved-pid`])
AT_CHECK([test ! -e pid]) AT_CHECK([test ! -e ovsdb-server.pid])
AT_CLEANUP AT_CLEANUP
AT_SETUP([daemon --detach --monitor]) AT_SETUP([daemon --detach --monitor])
AT_SKIP_IF([test "$IS_WIN32" = "yes"]) AT_SKIP_IF([test "$IS_WIN32" = "yes"])
m4_define([CHECK],
[AT_CHECK([$1], [$2], [$3], [$4], [kill `cat daemon monitor`])])
OVSDB_INIT([db]) OVSDB_INIT([db])
AT_CAPTURE_FILE([daemon]) AT_CAPTURE_FILE([daemon])
AT_CAPTURE_FILE([olddaemon]) AT_CAPTURE_FILE([olddaemon])
@ -114,49 +111,46 @@ AT_CAPTURE_FILE([init])
# Start the daemon and make sure that the pidfile exists immediately. # Start the daemon and make sure that the pidfile exists immediately.
# We don't wait for the pidfile to get created because the daemon is # We don't wait for the pidfile to get created because the daemon is
# supposed to do so before the parent exits. # supposed to do so before the parent exits.
AT_CHECK([ovsdb-server --detach --no-chdir --pidfile="`pwd`"/daemon --monitor --remote=punix:socket --unixctl="`pwd`"/unixctl db], [0]) AT_CHECK([ovsdb-server --detach --no-chdir --pidfile --monitor --remote=punix:socket db], [0])
AT_CHECK([test -s daemon]) on_exit 'kill `cat ovsdb-server.pid olddaemon newdaemon monitor newmonitor`'
AT_CHECK([test -s ovsdb-server.pid])
# Check that the pidfile names a running process, # Check that the pidfile names a running process,
# and that the parent process of that process is a running process, # and that the parent process of that process is a running process,
# and that the parent process of that process is init. # and that the parent process of that process is init.
CHECK([kill -0 `cat daemon`]) AT_CHECK([kill -0 `cat ovsdb-server.pid`])
CHECK([parent_pid `cat daemon` > monitor]) AT_CHECK([parent_pid `cat ovsdb-server.pid` > monitor])
CHECK([kill -0 `cat monitor`]) AT_CHECK([kill -0 `cat monitor`])
CHECK([parent_pid `cat monitor` > init]) AT_CHECK([parent_pid `cat monitor` > init])
CHECK([test `cat init` != $$]) AT_CHECK([test `cat init` != $$])
# Kill the daemon process, making it look like a segfault, # Kill the daemon process, making it look like a segfault,
# and wait for a new daemon process to get spawned. # and wait for a new daemon process to get spawned.
CHECK([cp daemon olddaemon]) AT_CHECK([cp ovsdb-server.pid olddaemon])
CHECK([kill -SEGV `cat daemon`], [0]) AT_CHECK([kill -SEGV `cat ovsdb-server.pid`], [0])
OVS_WAIT_WHILE([kill -0 `cat olddaemon`], [kill `cat olddaemon daemon`]) OVS_WAIT_WHILE([kill -0 `cat olddaemon`])
OVS_WAIT_UNTIL([test -s daemon && test `cat daemon` != `cat olddaemon`], OVS_WAIT_UNTIL([test -s ovsdb-server.pid && test `cat ovsdb-server.pid` != `cat olddaemon`])
[kill `cat olddaemon daemon`]) AT_CHECK([cp ovsdb-server.pid newdaemon])
CHECK([cp daemon newdaemon])
# Check that the pidfile names a running process, # Check that the pidfile names a running process,
# and that the parent process of that process is our child process. # and that the parent process of that process is our child process.
CHECK([kill -0 `cat daemon`]) AT_CHECK([kill -0 `cat ovsdb-server.pid`])
CHECK([diff olddaemon newdaemon], [1], [ignore]) AT_CHECK([diff olddaemon newdaemon], [1], [ignore])
CHECK([parent_pid `cat daemon` > newmonitor]) AT_CHECK([parent_pid `cat ovsdb-server.pid` > newmonitor])
CHECK([diff monitor newmonitor]) AT_CHECK([diff monitor newmonitor])
CHECK([kill -0 `cat newmonitor`]) AT_CHECK([kill -0 `cat newmonitor`])
CHECK([parent_pid `cat newmonitor` > init]) AT_CHECK([parent_pid `cat newmonitor` > init])
CHECK([test `cat init` != $$]) AT_CHECK([test `cat init` != $$])
# Kill the daemon process with SIGTERM, and wait for the daemon # Kill the daemon process with SIGTERM, and wait for the daemon
# and the monitor processes to go away and the pidfile to get deleted. # and the monitor processes to go away and the pidfile to get deleted.
CHECK([kill `cat daemon`], [0], [], [ignore]) AT_CHECK([kill `cat ovsdb-server.pid`], [0], [], [ignore])
OVS_WAIT_WHILE( OVS_WAIT_WHILE(
[kill -0 `cat monitor` || kill -0 `cat newdaemon` || test -e daemon], [kill -0 `cat monitor` || kill -0 `cat newdaemon` || test -e ovsdb-server.pid])
[kill `cat monitor newdaemon`])
m4_undefine([CHECK])
AT_CLEANUP AT_CLEANUP
AT_SETUP([daemon --detach startup errors]) AT_SETUP([daemon --detach startup errors])
AT_CAPTURE_FILE([pid]) AT_CAPTURE_FILE([pid])
OVSDB_INIT([db]) OVSDB_INIT([db])
AT_CHECK([ovsdb-server --detach --no-chdir --pidfile="`pwd`"/pid --unixctl="`pwd`"/nonexistent/unixctl db], [1], [], [stderr], AT_CHECK([ovsdb-server --detach --no-chdir --pidfile --unixctl=nonexistent/unixctl db], [1], [], [stderr])
[kill `cat pid`])
AT_CHECK([grep 'ovsdb-server: could not initialize control socket' stderr], AT_CHECK([grep 'ovsdb-server: could not initialize control socket' stderr],
[0], [ignore], []) [0], [ignore])
AT_CHECK([test ! -s pid]) AT_CHECK([test ! -s pid])
AT_CLEANUP AT_CLEANUP
@ -164,9 +158,9 @@ AT_SETUP([daemon --detach --monitor startup errors])
AT_SKIP_IF([test "$IS_WIN32" = "yes"]) AT_SKIP_IF([test "$IS_WIN32" = "yes"])
AT_CAPTURE_FILE([pid]) AT_CAPTURE_FILE([pid])
OVSDB_INIT([db]) OVSDB_INIT([db])
AT_CHECK([ovsdb-server --detach --no-chdir --pidfile="`pwd`"/pid --monitor --unixctl="`pwd`"/nonexistent/unixctl db], [1], [], [stderr]) AT_CHECK([ovsdb-server --detach --no-chdir --pidfile --monitor --unixctl=nonexistent/unixctl db], [1], [], [stderr])
AT_CHECK([grep 'ovsdb-server: could not initialize control socket' stderr], AT_CHECK([grep 'ovsdb-server: could not initialize control socket' stderr],
[0], [ignore], []) [0], [ignore])
AT_CHECK([test ! -s pid]) AT_CHECK([test ! -s pid])
AT_CLEANUP AT_CLEANUP
@ -180,19 +174,19 @@ AT_CAPTURE_FILE([pid])
# To create a Windows service, we need the absolute path for the executable. # To create a Windows service, we need the absolute path for the executable.
abs_path="$(cd $(dirname `which ovsdb-server`); pwd -W; cd $OLDPWD)" abs_path="$(cd $(dirname `which ovsdb-server`); pwd -W; cd $OLDPWD)"
AT_CHECK([sc create ovsdb-server binpath="$abs_path/ovsdb-server `pwd`/db --log-file=`pwd`/ovsdb-server.log --pidfile=`pwd`/pid --remote=punix:`pwd`/socket --unixctl=`pwd`/unixctl --service"], AT_CHECK([sc create ovsdb-server binpath="$abs_path/ovsdb-server `pwd`/db --log-file=`pwd`/ovsdb-server.log --pidfile --remote=punix:`pwd`/socket --service"],
[0], [[[SC]] CreateService SUCCESS [0], [[[SC]] CreateService SUCCESS
]) ])
AT_CHECK([sc start ovsdb-server], [0], [ignore], [ignore], [sc delete ovsdb-server]) AT_CHECK([sc start ovsdb-server], [0], [ignore], [ignore], [sc delete ovsdb-server])
OVS_WAIT_UNTIL([test -s pid]) OVS_WAIT_UNTIL([test -s ovsdb-server.pid])
OVS_WAIT_UNTIL([sc query ovsdb-server | grep STATE | grep RUNNING > /dev/null 2>&1]) OVS_WAIT_UNTIL([sc query ovsdb-server | grep STATE | grep RUNNING > /dev/null 2>&1])
AT_CHECK([kill -0 `cat pid`], [0], [ignore]) AT_CHECK([kill -0 `cat ovsdb-server.pid`], [0], [ignore])
AT_CHECK([ovs-appctl -t `pwd`/unixctl ovsdb-server/list-dbs], [0], AT_CHECK([ovs-appctl -t ovsdb-server ovsdb-server/list-dbs], [0],
[Open_vSwitch [Open_vSwitch
]) ])
AT_CHECK([sc stop ovsdb-server], [0], [ignore]) AT_CHECK([sc stop ovsdb-server], [0], [ignore])
OVS_WAIT_UNTIL([test ! -s pid]) OVS_WAIT_UNTIL([test ! -s ovsdb-server.pid])
AT_CHECK([sc query ovsdb-server | grep STATE | grep STOPPED], [0], [ignore]) AT_CHECK([sc query ovsdb-server | grep STATE | grep STOPPED], [0], [ignore])
AT_CHECK([sc delete ovsdb-server], [0], [[[SC]] DeleteService SUCCESS AT_CHECK([sc delete ovsdb-server], [0], [[[SC]] DeleteService SUCCESS
]) ])

View File

@ -4,14 +4,12 @@ m4_define([JSONRPC_REQ_REPLY_SUCCESS_PYN],
[AT_SETUP([JSON-RPC request and successful reply - $1]) [AT_SETUP([JSON-RPC request and successful reply - $1])
AT_SKIP_IF([test $2 = no]) AT_SKIP_IF([test $2 = no])
AT_KEYWORDS([python jsonrpc]) AT_KEYWORDS([python jsonrpc])
AT_CHECK([$PYTHON $srcdir/test-jsonrpc.py --detach --pidfile=`pwd`/pid listen punix:socket]) AT_CHECK([$PYTHON $srcdir/test-jsonrpc.py --pidfile --detach listen punix:socket])
AT_CHECK([test -s pid]) on_exit 'kill `cat test-jsonrpc.py.pid`'
AT_CHECK([kill -0 `cat pid`])
AT_CHECK( AT_CHECK(
[[$3 $srcdir/test-jsonrpc.py request unix:socket echo '[{"a": "b", "x": null}]']], [0], [[$3 $srcdir/test-jsonrpc.py request unix:socket echo '[{"a": "b", "x": null}]']], [0],
[[{"error":null,"id":0,"result":[{"a":"b","x":null}]} [[{"error":null,"id":0,"result":[{"a":"b","x":null}]}
]], [], [test ! -e pid || kill `cat pid`]) ]])
AT_CHECK([kill `cat pid`])
AT_CLEANUP]) AT_CLEANUP])
JSONRPC_REQ_REPLY_SUCCESS_PYN([Python2], [$HAVE_PYTHON], [$PYTHON]) JSONRPC_REQ_REPLY_SUCCESS_PYN([Python2], [$HAVE_PYTHON], [$PYTHON])
@ -21,14 +19,12 @@ m4_define([JSONRPC_REQ_REPLY_ERROR_PYN],
[AT_SETUP([JSON-RPC request and error reply - $1]) [AT_SETUP([JSON-RPC request and error reply - $1])
AT_SKIP_IF([test $2 = no]) AT_SKIP_IF([test $2 = no])
AT_KEYWORDS([python jsonrpc]) AT_KEYWORDS([python jsonrpc])
AT_CHECK([$PYTHON $srcdir/test-jsonrpc.py --detach --pidfile=`pwd`/pid listen punix:socket]) AT_CHECK([$PYTHON $srcdir/test-jsonrpc.py --pidfile --detach listen punix:socket])
AT_CHECK([test -s pid]) on_exit 'kill `cat test-jsonrpc.py.pid`'
AT_CHECK([kill -0 `cat pid`])
AT_CHECK( AT_CHECK(
[[$3 $srcdir/test-jsonrpc.py request unix:socket bad-request '[]']], [0], [[$3 $srcdir/test-jsonrpc.py request unix:socket bad-request '[]']], [0],
[[{"error":{"error":"unknown method"},"id":0,"result":null} [[{"error":{"error":"unknown method"},"id":0,"result":null}
]], [], [test ! -e pid || kill `cat pid`]) ]])
AT_CHECK([kill `cat pid`])
AT_CLEANUP]) AT_CLEANUP])
JSONRPC_REQ_REPLY_ERROR_PYN([Python2], [$HAVE_PYTHON], [$PYTHON]) JSONRPC_REQ_REPLY_ERROR_PYN([Python2], [$HAVE_PYTHON], [$PYTHON])
@ -38,25 +34,12 @@ m4_define([JSONRPC_NOTIFICATION_PYN],
[AT_SETUP([JSON-RPC notification - $1]) [AT_SETUP([JSON-RPC notification - $1])
AT_SKIP_IF([test $2 = no]) AT_SKIP_IF([test $2 = no])
AT_KEYWORDS([python jsonrpc]) AT_KEYWORDS([python jsonrpc])
AT_CHECK([$3 $srcdir/test-jsonrpc.py --detach --pidfile=`pwd`/pid listen punix:socket]) AT_CHECK([$3 $srcdir/test-jsonrpc.py --pidfile --detach listen punix:socket])
AT_CHECK([test -s pid]) on_exit 'kill `cat test-jsonrpc.py.pid`'
# When a daemon dies it deletes its pidfile, so make a copy. AT_CHECK([test -e test-jsonrpc.py.pid])
AT_CHECK([cp pid pid2]) AT_CHECK([[$3 $srcdir/test-jsonrpc.py notify unix:socket shutdown '[]']])
AT_CHECK([kill -0 `cat pid2`]) # Wait for test-jsonrpc to die, based on its pidfile disappearing
AT_CHECK([[$3 $srcdir/test-jsonrpc.py notify unix:socket shutdown '[]']], [0], [], OVS_WAIT_WHILE([test -e test-jsonrpc.py.pid])
[], [kill `cat pid2`])
AT_CHECK(
[pid=`cat pid2`
# First try a quick sleep, so that the test completes very quickly
# in the normal case. POSIX doesn't require fractional times to
# work, so this might not work.
sleep 0.1; if kill -0 $pid; then :; else echo success; exit 0; fi
# Then wait up to 2 seconds.
sleep 1; if kill -0 $pid; then :; else echo success; exit 0; fi
sleep 1; if kill -0 $pid; then :; else echo success; exit 0; fi
echo failure; exit 1], [0], [success
], [ignore])
AT_CHECK([test ! -e pid])
AT_CLEANUP]) AT_CLEANUP])
JSONRPC_NOTIFICATION_PYN([Python2], [$HAVE_PYTHON], [$PYTHON]) JSONRPC_NOTIFICATION_PYN([Python2], [$HAVE_PYTHON], [$PYTHON])

View File

@ -1,45 +1,29 @@
AT_BANNER([JSON-RPC - C]) AT_BANNER([JSON-RPC - C])
AT_SETUP([JSON-RPC request and successful reply]) AT_SETUP([JSON-RPC request and successful reply])
AT_CHECK([ovstest test-jsonrpc --detach --no-chdir --pidfile="`pwd`"/pid listen punix:socket]) AT_CHECK([ovstest test-jsonrpc --detach --no-chdir --pidfile listen punix:socket])
AT_CHECK([test -s pid]) on_exit 'kill `cat test-jsonrpc.pid`'
AT_CHECK([kill -0 `cat pid`])
AT_CHECK( AT_CHECK(
[[ovstest test-jsonrpc request unix:socket echo '[{"a": "b", "x": null}]']], [0], [[ovstest test-jsonrpc request unix:socket echo '[{"a": "b", "x": null}]']], [0],
[[{"error":null,"id":0,"result":[{"a":"b","x":null}]} [[{"error":null,"id":0,"result":[{"a":"b","x":null}]}
]], [], [test ! -e pid || kill `cat pid`]) ]])
AT_CHECK([kill `cat pid`])
AT_CLEANUP AT_CLEANUP
AT_SETUP([JSON-RPC request and error reply]) AT_SETUP([JSON-RPC request and error reply])
AT_CHECK([ovstest test-jsonrpc --detach --no-chdir --pidfile="`pwd`"/pid listen punix:socket]) AT_CHECK([ovstest test-jsonrpc --detach --no-chdir --pidfile listen punix:socket])
AT_CHECK([test -s pid]) on_exit 'kill `cat test-jsonrpc.pid`'
AT_CHECK([kill -0 `cat pid`])
AT_CHECK( AT_CHECK(
[[ovstest test-jsonrpc request unix:socket bad-request '[]']], [0], [[ovstest test-jsonrpc request unix:socket bad-request '[]']], [0],
[[{"error":{"error":"unknown method"},"id":0,"result":null} [[{"error":{"error":"unknown method"},"id":0,"result":null}
]], [], [test ! -e pid || kill `cat pid`]) ]])
AT_CHECK([kill `cat pid`])
AT_CLEANUP AT_CLEANUP
AT_SETUP([JSON-RPC notification]) AT_SETUP([JSON-RPC notification])
AT_CHECK([ovstest test-jsonrpc --detach --no-chdir --pidfile="`pwd`"/pid listen punix:socket]) AT_CHECK([ovstest test-jsonrpc --detach --no-chdir --pidfile listen punix:socket])
AT_CHECK([test -s pid]) on_exit 'kill `cat test-jsonrpc.pid`'
# When a daemon dies it deletes its pidfile, so make a copy. # Check that the pidfile got created.
AT_CHECK([cp pid pid2]) AT_CHECK([test -e test-jsonrpc.pid])
AT_CHECK([kill -0 `cat pid2`]) AT_CHECK([[ovstest test-jsonrpc notify unix:socket shutdown '[]']])
AT_CHECK([[ovstest test-jsonrpc notify unix:socket shutdown '[]']], [0], [], # Wait for test-jsonrpc to die, based on its pidfile disappearing
[], [kill `cat pid2`]) OVS_WAIT_WHILE([test -e test-jsonrpc.pid])
AT_CHECK(
[pid=`cat pid2`
# First try a quick sleep, so that the test completes very quickly
# in the normal case. POSIX doesn't require fractional times to
# work, so this might not work.
sleep 0.1; if kill -0 $pid; then :; else echo success; exit 0; fi
# Then wait up to 2 seconds.
sleep 1; if kill -0 $pid; then :; else echo success; exit 0; fi
sleep 1; if kill -0 $pid; then :; else echo success; exit 0; fi
echo failure; exit 1], [0], [success
], [ignore])
AT_CHECK([test ! -e pid])
AT_CLEANUP AT_CLEANUP

View File

@ -3683,7 +3683,7 @@ AT_CAPTURE_FILE([monitor2.log])
AT_CAPTURE_FILE([expout2]) AT_CAPTURE_FILE([expout2])
AT_CAPTURE_FILE([experr2]) AT_CAPTURE_FILE([experr2])
for i in 1 2; do for i in 1 2; do
AT_CHECK([ovs-ofctl -O OpenFlow12 monitor br0 --detach --no-chdir --pidfile=`pwd`/c$i.pid --unixctl=`pwd`/c$i]) AT_CHECK([ovs-ofctl -O OpenFlow12 monitor br0 --detach --no-chdir --pidfile=c$i.pid --unixctl=c$i])
ovs-appctl -t `pwd`/c$i ofctl/barrier ovs-appctl -t `pwd`/c$i ofctl/barrier
ovs-appctl -t `pwd`/c$i ofctl/set-output-file monitor$i.log ovs-appctl -t `pwd`/c$i ofctl/set-output-file monitor$i.log
: > expout$i : > expout$i
@ -3748,7 +3748,7 @@ AT_CAPTURE_FILE([monitor2.log])
AT_CAPTURE_FILE([expout2]) AT_CAPTURE_FILE([expout2])
AT_CAPTURE_FILE([experr2]) AT_CAPTURE_FILE([experr2])
for i in 1 2; do for i in 1 2; do
AT_CHECK([ovs-ofctl -O OpenFlow14 monitor br0 --detach --no-chdir --pidfile=`pwd`/c$i.pid --unixctl=`pwd`/c$i]) AT_CHECK([ovs-ofctl -O OpenFlow14 monitor br0 --detach --no-chdir --pidfile=c$i.pid --unixctl=c$i])
ovs-appctl -t `pwd`/c$i ofctl/barrier ovs-appctl -t `pwd`/c$i ofctl/barrier
ovs-appctl -t `pwd`/c$i ofctl/set-output-file monitor$i.log ovs-appctl -t `pwd`/c$i ofctl/set-output-file monitor$i.log
: > expout$i : > expout$i
@ -3813,9 +3813,9 @@ AT_CAPTURE_FILE([expout2])
AT_CAPTURE_FILE([monitor3.log]) AT_CAPTURE_FILE([monitor3.log])
AT_CAPTURE_FILE([expout3]) AT_CAPTURE_FILE([expout3])
ovs-ofctl -O OpenFlow15 monitor br0 --detach --no-chdir --pidfile=`pwd`/c1.pid --unixctl=`pwd`/c1 ovs-ofctl -O OpenFlow15 monitor br0 --detach --no-chdir --pidfile=c1.pid --unixctl=c1
ovs-ofctl -O OpenFlow14 monitor br0 --detach --no-chdir --pidfile=`pwd`/c2.pid --unixctl=`pwd`/c2 ovs-ofctl -O OpenFlow14 monitor br0 --detach --no-chdir --pidfile=c2.pid --unixctl=c2
ovs-ofctl -O OpenFlow14 monitor br0 --detach --no-chdir --pidfile=`pwd`/c3.pid --unixctl=`pwd`/c3 ovs-ofctl -O OpenFlow14 monitor br0 --detach --no-chdir --pidfile=c3.pid --unixctl=c3
check_async () { check_async () {
for i in 1 3; do for i in 1 3; do

View File

@ -24,9 +24,9 @@ m4_define([OVN_CONTROLLER_VTEP_START],
done done
dnl Start ovsdb-server. dnl Start ovsdb-server.
AT_CHECK([ovsdb-server --detach --no-chdir --pidfile=$OVS_RUNDIR/ovsdb-server.pid --log-file --remote=punix:$OVS_RUNDIR/db.sock vswitchd.db vtep.db], [0], [], [stderr]) AT_CHECK([ovsdb-server --detach --no-chdir --pidfile --log-file --remote=punix:$OVS_RUNDIR/db.sock vswitchd.db vtep.db], [0], [], [stderr])
AT_CHECK([ovsdb-server --detach --no-chdir --pidfile=$OVS_RUNDIR/ovsdb-nb-server.pid --log-file=ovsdb-nb-server.log --remote=punix:$OVS_RUNDIR/ovnnb_db.sock ovn-nb.db], [0], [], [stderr]) AT_CHECK([ovsdb-server --detach --no-chdir --pidfile=ovsdb-nb-server.pid --log-file=ovsdb-nb-server.log --remote=punix:$OVS_RUNDIR/ovnnb_db.sock ovn-nb.db], [0], [], [stderr])
AT_CHECK([ovsdb-server --detach --no-chdir --pidfile=$OVS_RUNDIR/ovsdb-sb-server.pid --log-file=ovsdb-sb-server.log --remote=punix:$OVS_RUNDIR/ovnsb_db.sock ovn-sb.db ovn-sb.db], [0], [], [stderr]) AT_CHECK([ovsdb-server --detach --no-chdir --pidfile=ovsdb-sb-server.pid --log-file=ovsdb-sb-server.log --remote=punix:$OVS_RUNDIR/ovnsb_db.sock ovn-sb.db ovn-sb.db], [0], [], [stderr])
on_exit "kill `cat ovsdb-server.pid` `cat ovsdb-nb-server.pid` `cat ovsdb-sb-server.pid`" on_exit "kill `cat ovsdb-server.pid` `cat ovsdb-nb-server.pid` `cat ovsdb-sb-server.pid`"
AT_CHECK([[sed < stderr ' AT_CHECK([[sed < stderr '
/vlog|INFO|opened log file/d /vlog|INFO|opened log file/d

View File

@ -9,8 +9,8 @@ m4_define([OVN_SBCTL_TEST_START],
done done
dnl Start ovsdb-servers. dnl Start ovsdb-servers.
AT_CHECK([ovsdb-server --detach --no-chdir --pidfile=$OVS_RUNDIR/ovnnb_db.pid --unixctl=$OVS_RUNDIR/ovnnb_db.ctl --log-file=$OVS_RUNDIR/ovsdb_nb.log --remote=punix:$OVS_RUNDIR/ovnnb_db.sock ovn-nb.db ], [0], [], [stderr]) AT_CHECK([ovsdb-server --detach --no-chdir --pidfile=ovnnb_db.pid --unixctl=$OVS_RUNDIR/ovnnb_db.ctl --log-file=ovsdb_nb.log --remote=punix:$OVS_RUNDIR/ovnnb_db.sock ovn-nb.db ], [0], [], [stderr])
AT_CHECK([ovsdb-server --detach --no-chdir --pidfile=$OVS_RUNDIR/ovnsb_db.pid --unixctl=$OVS_RUNDIR/ovnsb_db.ctl --log-file=$OVS_RUNDIR/ovsdb_sb.log --remote=punix:$OVS_RUNDIR/ovnsb_db.sock ovn-sb.db], [0], [], [stderr]) AT_CHECK([ovsdb-server --detach --no-chdir --pidfile=ovnsb_db.pid --unixctl=$OVS_RUNDIR/ovnsb_db.ctl --log-file=ovsdb_sb.log --remote=punix:$OVS_RUNDIR/ovnsb_db.sock ovn-sb.db], [0], [], [stderr])
on_exit "kill `cat ovnnb_db.pid` `cat ovnsb_db.pid`" on_exit "kill `cat ovnnb_db.pid` `cat ovnsb_db.pid`"
AT_CHECK([[sed < stderr ' AT_CHECK([[sed < stderr '
/vlog|INFO|opened log file/d /vlog|INFO|opened log file/d

View File

@ -4,12 +4,13 @@ dnl Creates an empty database in the current directory and then starts
dnl an ovsdb-server on it for ovs-vsctl to connect to. dnl an ovsdb-server on it for ovs-vsctl to connect to.
m4_define([OVS_VSCTL_SETUP], m4_define([OVS_VSCTL_SETUP],
[OVSDB_INIT([db]) [OVSDB_INIT([db])
AT_CHECK([ovsdb-server --detach --no-chdir --pidfile="`pwd`"/pid --remote=punix:socket --unixctl="`pwd`"/unixctl db >/dev/null 2>&1], [0], [ignore], [ignore])]) AT_CHECK([ovsdb-server --detach --no-chdir --pidfile --remote=punix:socket db >/dev/null 2>&1], [0], [ignore], [ignore])
on_exit 'kill `cat ovsdb-server.pid`'])
dnl OVS_VSCTL_CLEANUP dnl OVS_VSCTL_CLEANUP
dnl dnl
dnl Kills off the database server. dnl Kills off the database server.
m4_define([OVS_VSCTL_CLEANUP], [OVS_APP_EXIT_AND_WAIT_BY_TARGET(["`pwd`"/unixctl], ["`pwd`"/pid])]) m4_define([OVS_VSCTL_CLEANUP], [OVS_APP_EXIT_AND_WAIT_BY_TARGET([ovsdb-server], [ovsdb-server.pid])])
dnl RUN_OVS_VSCTL(COMMAND, ...) dnl RUN_OVS_VSCTL(COMMAND, ...)
dnl dnl
@ -669,21 +670,21 @@ sflow : []
status : {} status : {}
stp_enable : false stp_enable : false
<0> <0>
]], [ignore], [test ! -e pid || kill `cat pid`]) ]], [ignore])
AT_CHECK( AT_CHECK(
[RUN_OVS_VSCTL([--columns=fail_mode,name,datapath_type list bridge])], [RUN_OVS_VSCTL([--columns=fail_mode,name,datapath_type list bridge])],
[0], [0],
[[fail_mode : [] [[fail_mode : []
name : "br0" name : "br0"
datapath_type : "" datapath_type : ""
]], [ignore], [test ! -e pid || kill `cat pid`]) ]], [ignore])
AT_CHECK( AT_CHECK(
[RUN_OVS_VSCTL([--columns=fail_mode,name,datapath_type find bridge])], [RUN_OVS_VSCTL([--columns=fail_mode,name,datapath_type find bridge])],
[0], [0],
[[fail_mode : [] [[fail_mode : []
name : "br0" name : "br0"
datapath_type : "" datapath_type : ""
]], [ignore], [test ! -e pid || kill `cat pid`]) ]], [ignore])
AT_CHECK([ AT_CHECK([
RUN_OVS_VSCTL_TOGETHER([--id=@br1 create bridge name=br1 datapath_type="foo"], RUN_OVS_VSCTL_TOGETHER([--id=@br1 create bridge name=br1 datapath_type="foo"],
[--id=@br2 create bridge name=br2 external-ids:bar=quux], [--id=@br2 create bridge name=br2 external-ids:bar=quux],
@ -691,7 +692,7 @@ AT_CHECK([
[0], [stdout], [], [OVS_VSCTL_CLEANUP]) [0], [stdout], [], [OVS_VSCTL_CLEANUP])
AT_CHECK( AT_CHECK(
[RUN_OVS_VSCTL([--columns=name find bridge datapath_type!=foo])], [0], [stdout], [RUN_OVS_VSCTL([--columns=name find bridge datapath_type!=foo])], [0], [stdout],
[ignore], [test ! -e pid || kill `cat pid`]) [ignore])
AT_CHECK([sed -n '/./p' stdout | sort], [0], AT_CHECK([sed -n '/./p' stdout | sort], [0],
[[name : "br0" [[name : "br0"
name : "br2" name : "br2"
@ -779,7 +780,7 @@ engine_id : []
engine_type : [] engine_type : []
external_ids : {} external_ids : {}
targets : ["1.2.3.4:567"] targets : ["1.2.3.4:567"]
]], [ignore], [test ! -e pid || kill `cat pid`]) ]], [ignore])
AT_CHECK([RUN_OVS_VSCTL([list interx x])], AT_CHECK([RUN_OVS_VSCTL([list interx x])],
[1], [], [ovs-vsctl: unknown table "interx" [1], [], [ovs-vsctl: unknown table "interx"
], [OVS_VSCTL_CLEANUP]) ], [OVS_VSCTL_CLEANUP])
@ -869,7 +870,6 @@ AT_CLEANUP
AT_SETUP([database commands -- conditions]) AT_SETUP([database commands -- conditions])
AT_KEYWORDS([ovs-vsctl]) AT_KEYWORDS([ovs-vsctl])
on_exit 'kill `cat pid`'
OVS_VSCTL_SETUP OVS_VSCTL_SETUP
AT_CHECK( AT_CHECK(
[RUN_OVS_VSCTL_TOGETHER( [RUN_OVS_VSCTL_TOGETHER(
@ -1168,7 +1168,7 @@ rstp_status : {}
sflow : [] sflow : []
status : {} status : {}
stp_enable : false stp_enable : false
]], [ignore], [test ! -e pid || kill `cat pid`]) ]], [ignore])
OVS_VSCTL_CLEANUP OVS_VSCTL_CLEANUP
AT_CLEANUP AT_CLEANUP
@ -1291,6 +1291,7 @@ OVS_VSWITCHD_STOP
AT_CLEANUP AT_CLEANUP
AT_SETUP([naming in db commands]) AT_SETUP([naming in db commands])
AT_KEYWORDS([ovs-vsctl])
OVS_VSCTL_SETUP OVS_VSCTL_SETUP
dnl First check that the database commands can refer to row by database UUID. dnl First check that the database commands can refer to row by database UUID.
@ -1317,8 +1318,8 @@ AT_CHECK([$OVS_PKI -B 1024 init && $OVS_PKI -B 1024 req+sign vsctl switch && $OV
dnl Create database. dnl Create database.
OVSDB_INIT([conf.db]) OVSDB_INIT([conf.db])
AT_CHECK([ovsdb-server --detach --no-chdir --pidfile="`pwd`"/pid --private-key=$PKIDIR/ovsdbserver-privkey.pem --certificate=$PKIDIR/ovsdbserver-cert.pem --ca-cert=$PKIDIR/pki/switchca/cacert.pem --remote=pssl:0:127.0.0.1 --unixctl="`pwd`"/unixctl --log-file="`pwd`"/ovsdb-server.log conf.db], [0], [ignore], [ignore]) AT_CHECK([ovsdb-server --detach --no-chdir --pidfile --private-key=$PKIDIR/ovsdbserver-privkey.pem --certificate=$PKIDIR/ovsdbserver-cert.pem --ca-cert=$PKIDIR/pki/switchca/cacert.pem --remote=pssl:0:127.0.0.1 --log-file="`pwd`"/ovsdb-server.log conf.db], [0], [ignore], [ignore])
on_exit "kill `cat pid`" on_exit "kill `cat ovsdb-server.pid`"
PARSE_LISTENING_PORT([ovsdb-server.log], [SSL_PORT]) PARSE_LISTENING_PORT([ovsdb-server.log], [SSL_PORT])
# During bootstrap, the connection gets torn down. So the o/p of ovs-vsctl is error. # During bootstrap, the connection gets torn down. So the o/p of ovs-vsctl is error.
@ -1344,8 +1345,8 @@ AT_CHECK([$OVS_PKI -B 1024 init && $OVS_PKI -B 1024 req+sign vsctl switch && $OV
dnl Create database. dnl Create database.
OVSDB_INIT([conf.db]) OVSDB_INIT([conf.db])
AT_CHECK([ovsdb-server --detach --no-chdir --pidfile="`pwd`"/pid --private-key=$PKIDIR/ovsdbserver-privkey.pem --certificate=$PKIDIR/ovsdbserver-cert.pem --ca-cert=$PKIDIR/pki/switchca/cacert.pem --peer-ca-cert=$PKIDIR/pki/controllerca/cacert.pem --remote=pssl:0:127.0.0.1 --unixctl="`pwd`"/unixctl --log-file="`pwd`"/ovsdb-server.log conf.db], [0], [ignore], [ignore]) AT_CHECK([ovsdb-server --detach --no-chdir --pidfile --private-key=$PKIDIR/ovsdbserver-privkey.pem --certificate=$PKIDIR/ovsdbserver-cert.pem --ca-cert=$PKIDIR/pki/switchca/cacert.pem --peer-ca-cert=$PKIDIR/pki/controllerca/cacert.pem --remote=pssl:0:127.0.0.1 --log-file="`pwd`"/ovsdb-server.log conf.db], [0], [ignore], [ignore])
on_exit "kill `cat pid`" on_exit "kill `cat ovsdb-server.pid`"
PARSE_LISTENING_PORT([ovsdb-server.log], [SSL_PORT]) PARSE_LISTENING_PORT([ovsdb-server.log], [SSL_PORT])
# During bootstrap, the connection gets torn down. So the o/p of ovs-vsctl is error. # During bootstrap, the connection gets torn down. So the o/p of ovs-vsctl is error.

View File

@ -70,14 +70,14 @@ AT_SETUP([ovs-vswitchd -- start additional ovs-vswitchd process])
OVS_VSWITCHD_START OVS_VSWITCHD_START
# start another ovs-vswitchd process. # start another ovs-vswitchd process.
ovs-vswitchd --log-file=fakelog --unixctl="`pwd`"/unixctl --pidfile=`pwd`/ovs-vswitchd-2.pid & ovs-vswitchd --log-file=fakelog --unixctl=unixctl2 --pidfile=ovs-vswitchd-2.pid &
on_exit 'kill `cat ovs-vswitchd-2.pid`' on_exit 'kill `cat ovs-vswitchd-2.pid`'
# sleep for a while # sleep for a while
sleep 5 sleep 5
# stop the process. # stop the process.
OVS_APP_EXIT_AND_WAIT_BY_TARGET([`pwd`/unixctl], [`pwd`/ovs-vswitchd-2.pid]) OVS_APP_EXIT_AND_WAIT_BY_TARGET(["`pwd`"/unixctl2], [`pwd`/ovs-vswitchd-2.pid])
# check the fakelog, should only see one ERR for reporting # check the fakelog, should only see one ERR for reporting
# the existing ovs-vswitchd process. # the existing ovs-vswitchd process.
@ -95,7 +95,7 @@ AT_SETUP([ovs-vswitchd -- switch over to another ovs-vswitchd process])
OVS_VSWITCHD_START OVS_VSWITCHD_START
# start a new ovs-vswitchd process. # start a new ovs-vswitchd process.
ovs-vswitchd --log-file=fakelog --enable-dummy --unixctl="`pwd`"/unixctl --pidfile=ovs-vswitchd-2.pid & ovs-vswitchd --log-file=fakelog --enable-dummy --unixctl=unixctl2 --pidfile=ovs-vswitchd-2.pid &
on_exit 'kill `cat ovs-vswitchd-2.pid`' on_exit 'kill `cat ovs-vswitchd-2.pid`'
# sleep for a while. # sleep for a while.
@ -114,7 +114,7 @@ bridge br0: using datapath ID
]) ])
# stop the process. # stop the process.
OVS_APP_EXIT_AND_WAIT_BY_TARGET([`pwd`/unixctl], [ovs-vswitchd-2.pid]) OVS_APP_EXIT_AND_WAIT_BY_TARGET(["`pwd`"/unixctl2], [ovs-vswitchd-2.pid])
# check the fakelog, should not see WARN/ERR/EMER log other than the one # check the fakelog, should not see WARN/ERR/EMER log other than the one
# for reporting the existing ovs-vswitchd process and the one for killing # for reporting the existing ovs-vswitchd process and the one for killing
@ -134,23 +134,23 @@ dnl ----------------------------------------------------------------------
AT_SETUP([ovs-vswitchd -- invalid database path]) AT_SETUP([ovs-vswitchd -- invalid database path])
# start an ovs-vswitchd process with invalid db path. # start an ovs-vswitchd process with invalid db path.
ovs-vswitchd unix:invalid.db.sock --log-file=fakelog --enable-dummy --unixctl="`pwd`"/unixctl --pidfile=ovs-vswitchd-2.pid & ovs-vswitchd unix:invalid.db.sock --log-file --enable-dummy --pidfile &
on_exit 'kill `cat ovs-vswitchd-2.pid`' on_exit 'kill `cat ovs-vswitchd.pid`'
# sleep for a while. # sleep for a while.
sleep 10 sleep 10
# stop the process. # stop the process.
OVS_APP_EXIT_AND_WAIT_BY_TARGET([`pwd`/unixctl], [ovs-vswitchd-2.pid]) OVS_APP_EXIT_AND_WAIT([ovs-vswitchd])
# should not see this log (which indicates high cpu utilization). # should not see this log (which indicates high cpu utilization).
AT_CHECK([grep "wakeup due to" fakelog], [ignore]) AT_CHECK([grep "wakeup due to" ovs-vswitchd.log], [ignore])
# check the fakelog, should not see any WARN/ERR/EMER log. # check the log, should not see any WARN/ERR/EMER log.
AT_CHECK([sed -n " AT_CHECK([sed -n "
/|WARN|/p /|WARN|/p
/|ERR|/p /|ERR|/p
/|EMER|/p" fakelog /|EMER|/p" ovs-vswitchd.log
]) ])
AT_CLEANUP AT_CLEANUP

View File

@ -26,7 +26,7 @@ ovs_vsctl () {
OVS_VSCTL_SETUP OVS_VSCTL_SETUP
# Start ovs-xapi-sync. # Start ovs-xapi-sync.
AT_CHECK([$PYTHON ./ovs-xapi-sync "--pidfile=`pwd`/ovs-xapi-sync.pid" \ AT_CHECK([$PYTHON ./ovs-xapi-sync "--pidfile=ovs-xapi-sync.pid" \
"--root-prefix=`pwd`" unix:socket >log 2>&1 &]) "--root-prefix=`pwd`" unix:socket >log 2>&1 &])
AT_CAPTURE_FILE([log]) AT_CAPTURE_FILE([log])

View File

@ -1,5 +1,18 @@
AT_BANNER([OVSDB -- interface description language (IDL)]) AT_BANNER([OVSDB -- interface description language (IDL)])
m4_divert_text([PREPARE_TESTS], [
# ovsdb_start_idltest [REMOTE] [SCHEMA]
#
# Creates a database using SCHEMA (default: idltest.ovsschema) and
# starts a database server listening on punix:socket and REMOTE (if
# specified).
ovsdb_start_idltest () {
ovsdb-tool create db ${2:-$abs_srcdir/idltest.ovsschema} || return $?
ovsdb-server -vconsole:warn --log-file --detach --no-chdir --pidfile --remote=punix:socket ${1:+--remote=$1} db || return $?
on_exit 'kill `cat ovsdb-server.pid`'
}
])
# OVSDB_CHECK_IDL_C(TITLE, [PRE-IDL-TXN], TRANSACTIONS, OUTPUT, [KEYWORDS], # OVSDB_CHECK_IDL_C(TITLE, [PRE-IDL-TXN], TRANSACTIONS, OUTPUT, [KEYWORDS],
# [FILTER]) # [FILTER])
# #
@ -19,10 +32,7 @@ AT_BANNER([OVSDB -- interface description language (IDL)])
m4_define([OVSDB_CHECK_IDL_C], m4_define([OVSDB_CHECK_IDL_C],
[AT_SETUP([$1 - C]) [AT_SETUP([$1 - C])
AT_KEYWORDS([ovsdb server idl positive $5]) AT_KEYWORDS([ovsdb server idl positive $5])
AT_CHECK([ovsdb-tool create db $abs_srcdir/idltest.ovsschema], AT_CHECK([ovsdb_start_idltest])
[0], [stdout], [ignore])
AT_CHECK([ovsdb-server '-vPATTERN:console:ovsdb-server|%c|%m' --detach --no-chdir --pidfile="`pwd`"/pid --remote=punix:socket --unixctl="`pwd`"/unixctl db], [0], [ignore], [ignore])
on_exit 'kill `cat pid`'
m4_if([$2], [], [], m4_if([$2], [], [],
[AT_CHECK([ovsdb-client transact unix:socket $2], [0], [ignore], [ignore])]) [AT_CHECK([ovsdb-client transact unix:socket $2], [0], [ignore], [ignore])])
AT_CHECK([test-ovsdb '-vPATTERN:console:test-ovsdb|%c|%m' -vjsonrpc -t10 idl unix:socket $3], AT_CHECK([test-ovsdb '-vPATTERN:console:test-ovsdb|%c|%m' -vjsonrpc -t10 idl unix:socket $3],
@ -37,10 +47,7 @@ m4_define([OVSDB_CHECK_IDL_PYN],
[AT_SETUP([$1]) [AT_SETUP([$1])
AT_SKIP_IF([test $7 = no]) AT_SKIP_IF([test $7 = no])
AT_KEYWORDS([ovsdb server idl positive Python $5]) AT_KEYWORDS([ovsdb server idl positive Python $5])
AT_CHECK([ovsdb-tool create db $abs_srcdir/idltest.ovsschema], AT_CHECK([ovsdb_start_idltest])
[0], [stdout], [ignore])
AT_CHECK([ovsdb-server '-vPATTERN:console:ovsdb-server|%c|%m' --detach --no-chdir --pidfile="`pwd`"/pid --remote=punix:socket --unixctl="`pwd`"/unixctl db], [0], [ignore], [ignore])
on_exit 'kill `cat pid`'
m4_if([$2], [], [], m4_if([$2], [], [],
[AT_CHECK([ovsdb-client transact unix:socket $2], [0], [ignore], [ignore])]) [AT_CHECK([ovsdb-client transact unix:socket $2], [0], [ignore], [ignore])])
AT_CHECK([$8 $srcdir/test-ovsdb.py -t10 idl $srcdir/idltest.ovsschema unix:socket $3], AT_CHECK([$8 $srcdir/test-ovsdb.py -t10 idl $srcdir/idltest.ovsschema unix:socket $3],
@ -60,10 +67,7 @@ m4_define([OVSDB_CHECK_IDL_REGISTER_COLUMNS_PYN],
[AT_SETUP([$1 - register_columns]) [AT_SETUP([$1 - register_columns])
AT_SKIP_IF([test $7 = no]) AT_SKIP_IF([test $7 = no])
AT_KEYWORDS([ovsdb server idl positive Python register_columns $5]) AT_KEYWORDS([ovsdb server idl positive Python register_columns $5])
AT_CHECK([ovsdb-tool create db $abs_srcdir/idltest.ovsschema], AT_CHECK([ovsdb_start_idltest])
[0], [stdout], [ignore])
AT_CHECK([ovsdb-server '-vPATTERN:console:ovsdb-server|%c|%m' --detach --no-chdir --pidfile="`pwd`"/pid --remote=punix:socket --unixctl="`pwd`"/unixctl db], [0], [ignore], [ignore])
on_exit 'kill `cat pid`'
m4_if([$2], [], [], m4_if([$2], [], [],
[AT_CHECK([ovsdb-client transact unix:socket $2], [0], [ignore], [ignore])]) [AT_CHECK([ovsdb-client transact unix:socket $2], [0], [ignore], [ignore])])
AT_CHECK([$8 $srcdir/test-ovsdb.py -t10 idl $srcdir/idltest.ovsschema unix:socket ?simple:b,ba,i,ia,r,ra,s,sa,u,ua?link1:i,k,ka,l2?link2:i,l1 $3], AT_CHECK([$8 $srcdir/test-ovsdb.py -t10 idl $srcdir/idltest.ovsschema unix:socket ?simple:b,ba,i,ia,r,ra,s,sa,u,ua?link1:i,k,ka,l2?link2:i,l1 $3],
@ -84,10 +88,7 @@ m4_define([OVSDB_CHECK_IDL_TCP_PYN],
[AT_SETUP([$1 - tcp]) [AT_SETUP([$1 - tcp])
AT_SKIP_IF([test $7 = no]) AT_SKIP_IF([test $7 = no])
AT_KEYWORDS([ovsdb server idl positive Python with tcp socket $5]) AT_KEYWORDS([ovsdb server idl positive Python with tcp socket $5])
AT_CHECK([ovsdb-tool create db $abs_srcdir/idltest.ovsschema], AT_CHECK([ovsdb_start_idltest "ptcp:0:127.0.0.1"])
[0], [stdout], [ignore])
AT_CHECK([ovsdb-server --log-file '-vPATTERN:console:ovsdb-server|%c|%m' --detach --no-chdir --pidfile="`pwd`"/pid --remote=punix:socket --remote=ptcp:0:127.0.0.1 --unixctl="`pwd`"/unixctl db], [0], [ignore], [ignore])
on_exit 'kill `cat pid`'
PARSE_LISTENING_PORT([ovsdb-server.log], [TCP_PORT]) PARSE_LISTENING_PORT([ovsdb-server.log], [TCP_PORT])
m4_if([$2], [], [], m4_if([$2], [], [],
@ -112,10 +113,7 @@ m4_define([OVSDB_CHECK_IDL_TCP6_PYN],
AT_SKIP_IF([test "$IS_WIN32" = "yes"]) AT_SKIP_IF([test "$IS_WIN32" = "yes"])
AT_SKIP_IF([test $HAVE_IPV6 = no]) AT_SKIP_IF([test $HAVE_IPV6 = no])
AT_KEYWORDS([ovsdb server idl positive Python with tcp6 socket $5]) AT_KEYWORDS([ovsdb server idl positive Python with tcp6 socket $5])
AT_CHECK([ovsdb-tool create db $abs_srcdir/idltest.ovsschema], AT_CHECK([ovsdb_start_idltest "ptcp:0:[[::1]]"])
[0], [stdout], [ignore])
AT_CHECK([ovsdb-server --log-file '-vPATTERN:console:ovsdb-server|%c|%m' --detach --no-chdir --pidfile="`pwd`"/pid --remote=ptcp:0:[[::1]] --unixctl="`pwd`"/unixctl db], [0], [ignore], [ignore])
on_exit 'kill `cat pid`'
PARSE_LISTENING_PORT([ovsdb-server.log], [TCP_PORT]) PARSE_LISTENING_PORT([ovsdb-server.log], [TCP_PORT])
echo "TCP_PORT=$TCP_PORT" echo "TCP_PORT=$TCP_PORT"
@ -146,16 +144,14 @@ m4_define([OVSDB_CHECK_IDL_PASSIVE_TCP_PY],
[AT_SETUP([$1 - Python ptcp]) [AT_SETUP([$1 - Python ptcp])
AT_SKIP_IF([test $HAVE_PYTHON = no]) AT_SKIP_IF([test $HAVE_PYTHON = no])
AT_KEYWORDS([ovsdb server idl positive Python with tcp socket $5]) AT_KEYWORDS([ovsdb server idl positive Python with tcp socket $5])
AT_CHECK([ovsdb-tool create db $abs_srcdir/idltest.ovsschema],
[0], [stdout], [ignore])
# find free TCP port # find free TCP port
AT_CHECK([ovsdb-server --log-file '-vPATTERN:console:ovsdb-server|%c|%m' --detach --no-chdir --pidfile="`pwd`"/pid --remote=ptcp:0:127.0.0.1 --unixctl="`pwd`"/unixctl db], [0], [ignore], [ignore]) AT_CHECK([ovsdb_start_idltest "ptcp:0:127.0.0.1"])
on_exit 'kill `cat pid`'
PARSE_LISTENING_PORT([ovsdb-server.log], [TCP_PORT]) PARSE_LISTENING_PORT([ovsdb-server.log], [TCP_PORT])
OVSDB_SERVER_SHUTDOWN OVSDB_SERVER_SHUTDOWN
rm -f db
# start OVSDB server in passive mode # start OVSDB server in passive mode
AT_CHECK([ovsdb-server --log-file '-vPATTERN:console:ovsdb-server|%c|%m' --detach --no-chdir --pidfile="`pwd`"/pid --remote=punix:socket --remote=tcp:127.0.0.1:$TCP_PORT --unixctl="`pwd`"/unixctl db], [0], [ignore], [ignore]) AT_CHECK([ovsdb_start_idltest "tcp:127.0.0.1:$TCP_PORT"])
AT_CHECK([$PYTHON $srcdir/test-ovsdb.py -t10 idl_passive $srcdir/idltest.ovsschema ptcp:127.0.0.1:$TCP_PORT $3], AT_CHECK([$PYTHON $srcdir/test-ovsdb.py -t10 idl_passive $srcdir/idltest.ovsschema ptcp:127.0.0.1:$TCP_PORT $3],
[0], [stdout], [ignore]) [0], [stdout], [ignore])
AT_CHECK([sort stdout | ${PERL} $srcdir/uuidfilt.pl]m4_if([$6],,, [[| $6]]), AT_CHECK([sort stdout | ${PERL} $srcdir/uuidfilt.pl]m4_if([$6],,, [[| $6]]),
@ -729,10 +725,7 @@ AT_KEYWORDS([ovsdb server idl positive])
# table link2 and column l2 have been deleted. But the IDL still # table link2 and column l2 have been deleted. But the IDL still
# expects them to be there, so this test checks that it properly # expects them to be there, so this test checks that it properly
# tolerates them being missing. # tolerates them being missing.
AT_CHECK([ovsdb-tool create db $abs_srcdir/idltest2.ovsschema], AT_CHECK([ovsdb_start_idltest "" "$abs_srcdir/idltest2.ovsschema"])
[0], [stdout], [ignore])
AT_CHECK([ovsdb-server '-vPATTERN:console:ovsdb-server|%c|%m' --detach --no-chdir --pidfile="`pwd`"/pid --remote=punix:socket --unixctl="`pwd`"/unixctl db], [0], [ignore], [ignore])
on_exit 'kill `cat pid`'
AT_CHECK([test-ovsdb '-vPATTERN:console:test-ovsdb|%c|%m' -vjsonrpc -t10 idl unix:socket ['["idltest", AT_CHECK([test-ovsdb '-vPATTERN:console:test-ovsdb|%c|%m' -vjsonrpc -t10 idl unix:socket ['["idltest",
{"op": "insert", {"op": "insert",
"table": "link1", "table": "link1",
@ -801,10 +794,7 @@ m4_define([OVSDB_CHECK_IDL_FETCH_COLUMNS_PY],
[AT_SETUP([$1 - Python fetch]) [AT_SETUP([$1 - Python fetch])
AT_SKIP_IF([test $HAVE_PYTHON = no]) AT_SKIP_IF([test $HAVE_PYTHON = no])
AT_KEYWORDS([ovsdb server idl positive Python increment fetch $6]) AT_KEYWORDS([ovsdb server idl positive Python increment fetch $6])
AT_CHECK([ovsdb-tool create db $abs_srcdir/idltest.ovsschema], AT_CHECK([ovsdb_start_idltest])
[0], [stdout], [ignore])
AT_CHECK([ovsdb-server '-vPATTERN:console:ovsdb-server|%c|%m' --detach --no-chdir --pidfile="`pwd`"/pid --remote=punix:socket --unixctl="`pwd`"/unixctl db], [0], [ignore], [ignore])
on_exit 'kill `cat pid`'
m4_if([$2], [], [], m4_if([$2], [], [],
[AT_CHECK([ovsdb-client transact unix:socket $2], [0], [ignore], [ignore])]) [AT_CHECK([ovsdb-client transact unix:socket $2], [0], [ignore], [ignore])])
AT_CHECK([$PYTHON $srcdir/test-ovsdb.py -t10 idl $srcdir/idltest.ovsschema unix:socket [$3] $4], AT_CHECK([$PYTHON $srcdir/test-ovsdb.py -t10 idl $srcdir/idltest.ovsschema unix:socket [$3] $4],
@ -849,10 +839,8 @@ m4_define([OVSDB_CHECK_IDL_WO_MONITOR_COND_PY],
[AT_SETUP([$1 - Python]) [AT_SETUP([$1 - Python])
AT_SKIP_IF([test $HAVE_PYTHON = no]) AT_SKIP_IF([test $HAVE_PYTHON = no])
AT_KEYWORDS([ovsdb server idl Python monitor $4]) AT_KEYWORDS([ovsdb server idl Python monitor $4])
AT_CHECK([ovsdb-tool create db $abs_srcdir/idltest.ovsschema], AT_CHECK([ovsdb_start_idltest])
[0], [stdout], [ignore]) AT_CHECK([ovs-appctl -t ovsdb-server ovsdb-server/disable-monitor-cond])
AT_CHECK([ovsdb-server '-vPATTERN:console:ovsdb-server|%c|%m' --detach --no-chdir --pidfile="`pwd`"/pid --remote=punix:socket --unixctl="`pwd`"/unixctl db], [0], [ignore], [ignore])
AT_CHECK([ovs-appctl -t "`pwd`"/unixctl ovsdb-server/disable-monitor-cond])
AT_CHECK([$PYTHON $srcdir/test-ovsdb.py -t10 idl $srcdir/idltest.ovsschema unix:socket $2], AT_CHECK([$PYTHON $srcdir/test-ovsdb.py -t10 idl $srcdir/idltest.ovsschema unix:socket $2],
[0], [stdout], [ignore], [kill `cat pid`]) [0], [stdout], [ignore], [kill `cat pid`])
AT_CHECK([sort stdout | ${PERL} $srcdir/uuidfilt.pl]m4_if([$5],,, [[| $5]]), AT_CHECK([sort stdout | ${PERL} $srcdir/uuidfilt.pl]m4_if([$5],,, [[| $5]]),
@ -945,10 +933,7 @@ OVSDB_CHECK_IDL_WO_MONITOR_COND([simple idl disable monitor-cond],
m4_define([OVSDB_CHECK_IDL_TRACK_C], m4_define([OVSDB_CHECK_IDL_TRACK_C],
[AT_SETUP([$1 - C]) [AT_SETUP([$1 - C])
AT_KEYWORDS([ovsdb server idl tracking positive $5]) AT_KEYWORDS([ovsdb server idl tracking positive $5])
AT_CHECK([ovsdb-tool create db $abs_srcdir/idltest.ovsschema], AT_CHECK([ovsdb_start_idltest])
[0], [stdout], [ignore])
AT_CHECK([ovsdb-server '-vPATTERN:console:ovsdb-server|%c|%m' --detach --no-chdir --pidfile="`pwd`"/pid --remote=punix:socket --unixctl="`pwd`"/unixctl db], [0], [ignore], [ignore])
on_exit 'kill `cat pid`'
m4_if([$2], [], [], m4_if([$2], [], [],
[AT_CHECK([ovsdb-client transact unix:socket $2], [0], [ignore], [ignore])]) [AT_CHECK([ovsdb-client transact unix:socket $2], [0], [ignore], [ignore])])
AT_CHECK([test-ovsdb '-vPATTERN:console:test-ovsdb|%c|%m' -vjsonrpc -t10 -c idl unix:socket $3], AT_CHECK([test-ovsdb '-vPATTERN:console:test-ovsdb|%c|%m' -vjsonrpc -t10 -c idl unix:socket $3],
@ -1077,10 +1062,7 @@ OVSDB_CHECK_IDL_TRACK([track, simple idl, initially empty, various ops],
m4_define([OVSDB_CHECK_IDL_PARTIAL_UPDATE_MAP_COLUMN], m4_define([OVSDB_CHECK_IDL_PARTIAL_UPDATE_MAP_COLUMN],
[AT_SETUP([$1 - C]) [AT_SETUP([$1 - C])
AT_KEYWORDS([ovsdb server idl partial update map column positive $5]) AT_KEYWORDS([ovsdb server idl partial update map column positive $5])
AT_CHECK([ovsdb-tool create db $abs_srcdir/idltest.ovsschema], AT_CHECK([ovsdb_start_idltest])
[0], [stdout], [ignore])
AT_CHECK([ovsdb-server '-vPATTERN:console:ovsdb-server|%c|%m' --detach --no-chdir --pidfile="`pwd`"/pid --remote=punix:socket --unixctl="`pwd`"/unixctl db], [0], [ignore], [ignore])
on_exit 'kill `cat pid`'
m4_if([$2], [], [], m4_if([$2], [], [],
[AT_CHECK([ovsdb-client transact unix:socket $2], [0], [ignore], [ignore])]) [AT_CHECK([ovsdb-client transact unix:socket $2], [0], [ignore], [ignore])])
AT_CHECK([test-ovsdb '-vPATTERN:console:test-ovsdb|%c|%m' -vjsonrpc -t10 -c idl-partial-update-map-column unix:socket $3], AT_CHECK([test-ovsdb '-vPATTERN:console:test-ovsdb|%c|%m' -vjsonrpc -t10 -c idl-partial-update-map-column unix:socket $3],
@ -1126,10 +1108,7 @@ OVSDB_CHECK_IDL_PY([partial-map idl],
m4_define([OVSDB_CHECK_IDL_PARTIAL_UPDATE_SET_COLUMN], m4_define([OVSDB_CHECK_IDL_PARTIAL_UPDATE_SET_COLUMN],
[AT_SETUP([$1 - C]) [AT_SETUP([$1 - C])
AT_KEYWORDS([ovsdb server idl partial update set column positive $5]) AT_KEYWORDS([ovsdb server idl partial update set column positive $5])
AT_CHECK([ovsdb-tool create db $abs_srcdir/idltest.ovsschema], AT_CHECK([ovsdb_start_idltest])
[0], [stdout], [ignore])
AT_CHECK([ovsdb-server '-vPATTERN:console:ovsdb-server|%c|%m' --detach --no-chdir --pidfile="`pwd`"/pid --remote=punix:socket --unixctl="`pwd`"/unixctl db], [0], [ignore], [ignore])
on_exit 'kill `cat pid`'
m4_if([$2], [], [], m4_if([$2], [], [],
[AT_CHECK([ovsdb-client transact unix:socket $2], [0], [ignore], [ignore])]) [AT_CHECK([ovsdb-client transact unix:socket $2], [0], [ignore], [ignore])])
AT_CHECK([test-ovsdb '-vPATTERN:console:test-ovsdb|%c|%m' -vjsonrpc -t10 -c idl-partial-update-set-column unix:socket $3], AT_CHECK([test-ovsdb '-vPATTERN:console:test-ovsdb|%c|%m' -vjsonrpc -t10 -c idl-partial-update-set-column unix:socket $3],
@ -1188,9 +1167,7 @@ m4_define([OVSDB_CHECK_IDL_NOTIFY_PY],
[AT_SETUP([$1 - Python]) [AT_SETUP([$1 - Python])
AT_SKIP_IF([test $HAVE_PYTHON = no]) AT_SKIP_IF([test $HAVE_PYTHON = no])
AT_KEYWORDS([ovsdb server idl Python notify $4]) AT_KEYWORDS([ovsdb server idl Python notify $4])
AT_CHECK([ovsdb-tool create db $abs_srcdir/idltest.ovsschema], AT_CHECK([ovsdb_start_idltest])
[0], [stdout], [ignore])
AT_CHECK([ovsdb-server '-vPATTERN:console:ovsdb-server|%c|%m' --detach --no-chdir --pidfile="`pwd`"/pid --remote=punix:socket --unixctl="`pwd`"/unixctl db], [0], [ignore], [ignore])
AT_CHECK([$PYTHON $srcdir/test-ovsdb.py -t10 idl $srcdir/idltest.ovsschema unix:socket $2], AT_CHECK([$PYTHON $srcdir/test-ovsdb.py -t10 idl $srcdir/idltest.ovsschema unix:socket $2],
[0], [stdout], [ignore], [kill `cat pid`]) [0], [stdout], [ignore], [kill `cat pid`])
AT_CHECK([sort stdout | ${PERL} $srcdir/uuidfilt.pl]m4_if([$5],,, [[| $5]]), AT_CHECK([sort stdout | ${PERL} $srcdir/uuidfilt.pl]m4_if([$5],,, [[| $5]]),
@ -1209,12 +1186,13 @@ m4_define([OVSDB_CHECK_IDL_NOTIFY_SSL_PY],
AT_CHECK([ovsdb-tool create db $abs_srcdir/idltest.ovsschema], AT_CHECK([ovsdb-tool create db $abs_srcdir/idltest.ovsschema],
[0], [stdout], [ignore]) [0], [stdout], [ignore])
PKIDIR=$abs_top_builddir/tests PKIDIR=$abs_top_builddir/tests
AT_CHECK([ovsdb-server --log-file '-vPATTERN:console:ovsdb-server|%c|%m' \ AT_CHECK([ovsdb-server -vconsole:warn --log-file --detach --no-chdir \
--detach --no-chdir --pidfile="`pwd`"/pid \ --pidfile \
--private-key=$PKIDIR/testpki-privkey2.pem \ --private-key=$PKIDIR/testpki-privkey2.pem \
--certificate=$PKIDIR/testpki-cert2.pem \ --certificate=$PKIDIR/testpki-cert2.pem \
--ca-cert=$PKIDIR/testpki-cacert.pem \ --ca-cert=$PKIDIR/testpki-cacert.pem \
--remote=pssl:0:127.0.0.1 --unixctl="`pwd`"/unixctl db], [0], [ignore], [ignore]) --remote=pssl:0:127.0.0.1 db])
on_exit 'kill `cat ovsdb-server.pid`'
PARSE_LISTENING_PORT([ovsdb-server.log], [TCP_PORT]) PARSE_LISTENING_PORT([ovsdb-server.log], [TCP_PORT])
AT_CHECK([$PYTHON $srcdir/test-ovsdb.py -t10 idl $srcdir/idltest.ovsschema \ AT_CHECK([$PYTHON $srcdir/test-ovsdb.py -t10 idl $srcdir/idltest.ovsschema \
ssl:127.0.0.1:$TCP_PORT $PKIDIR/testpki-privkey.pem \ ssl:127.0.0.1:$TCP_PORT $PKIDIR/testpki-privkey.pem \

View File

@ -24,24 +24,26 @@ m4_define([OVSDB_CHECK_MONITOR],
m4_foreach([txn], [$3], m4_foreach([txn], [$3],
[AT_CHECK([ovsdb-tool transact db 'txn'], [0], [ignore], [ignore])]) [AT_CHECK([ovsdb-tool transact db 'txn'], [0], [ignore], [ignore])])
AT_CAPTURE_FILE([ovsdb-server-log]) AT_CAPTURE_FILE([ovsdb-server-log])
AT_CHECK([ovsdb-server --detach --no-chdir --pidfile="`pwd`"/server-pid --remote=punix:socket --unixctl="`pwd`"/unixctl --log-file="`pwd`"/ovsdb-server-log db >/dev/null 2>&1], AT_CHECK([ovsdb-server --detach --no-chdir --pidfile --remote=punix:socket --log-file="`pwd`"/ovsdb-server-log db >/dev/null 2>&1],
[0], [], []) [0], [], [])
on_exit 'kill `cat ovsdb-server.pid`'
AT_CAPTURE_FILE([ovsdb-client-log]) AT_CAPTURE_FILE([ovsdb-client-log])
if test "$IS_WIN32" = "yes"; then if test "$IS_WIN32" = "yes"; then
AT_CHECK([ovsdb-client -vjsonrpc --pidfile="`pwd`"/client-pid --log-file="`pwd`"/ovsdb-client-log -d json monitor --format=csv unix:socket $4 $5 $8 > output 2>/dev/null &], AT_CHECK([ovsdb-client -vjsonrpc --pidfile --log-file="`pwd`"/ovsdb-client-log -d json monitor --format=csv unix:socket $4 $5 $8 > output 2>/dev/null &],
[0], [ignore], [ignore], [kill `cat server-pid`]) [0], [ignore], [ignore])
sleep 1 sleep 1
else else
AT_CHECK([ovsdb-client -vjsonrpc --detach --no-chdir --pidfile="`pwd`"/client-pid --log-file="`pwd`"/ovsdb-client-log -d json monitor --format=csv unix:socket $4 $5 $8 > output], AT_CHECK([ovsdb-client -vjsonrpc --detach --no-chdir --pidfile --log-file="`pwd`"/ovsdb-client-log -d json monitor --format=csv unix:socket $4 $5 $8 > output],
[0], [ignore], [ignore], [kill `cat server-pid`]) [0], [ignore], [ignore])
fi fi
on_exit 'kill `cat ovsdb-client.pid`'
m4_foreach([txn], [$6], m4_foreach([txn], [$6],
[AT_CHECK([ovsdb-client transact unix:socket 'txn'], [0], [AT_CHECK([ovsdb-client transact unix:socket 'txn'], [0],
[ignore], [ignore], [kill `cat server-pid client-pid`])]) [ignore], [ignore])])
AT_CHECK([ovsdb-client transact unix:socket '[["$4"]]'], [0], AT_CHECK([ovsdb-client transact unix:socket '[["$4"]]'], [0],
[ignore], [ignore], [kill `cat server-pid client-pid`]) [ignore], [ignore])
OVS_APP_EXIT_AND_WAIT_BY_TARGET([`pwd`/unixctl], [`pwd`/server-pid]) OVS_APP_EXIT_AND_WAIT_BY_TARGET([ovsdb-server], [ovsdb-server.pid])
OVS_WAIT_UNTIL([test ! -e client-pid]) OVS_WAIT_UNTIL([test ! -e ovsdb-client.pid])
AT_CHECK([${PERL} $srcdir/ovsdb-monitor-sort.pl < output | ${PERL} $srcdir/uuidfilt.pl], [0], [$7], [ignore]) AT_CHECK([${PERL} $srcdir/ovsdb-monitor-sort.pl < output | ${PERL} $srcdir/uuidfilt.pl], [0], [$7], [ignore])
AT_CLEANUP]) AT_CLEANUP])
@ -70,26 +72,20 @@ m4_define([OVSDB_CHECK_MONITOR_COND],
m4_foreach([txn], [$3], m4_foreach([txn], [$3],
[AT_CHECK([ovsdb-tool transact db 'txn'], [0], [ignore], [ignore])]) [AT_CHECK([ovsdb-tool transact db 'txn'], [0], [ignore], [ignore])])
AT_CAPTURE_FILE([ovsdb-server-log]) AT_CAPTURE_FILE([ovsdb-server-log])
AT_CHECK([ovsdb-server --detach --no-chdir --pidfile="`pwd`"/server-pid --remote=punix:socket --unixctl="`pwd`"/unixctl --log-file="`pwd`"/ovsdb-server-log db >/dev/null 2>&1], AT_CHECK([ovsdb-server --detach --no-chdir --pidfile --remote=punix:socket --log-file="`pwd`"/ovsdb-server-log db >/dev/null 2>&1])
[0], [], []) on_exit 'kill `cat ovsdb-server.pid`'
AT_CHECK([ ovsdb-client -vjsonrpc --detach --no-chdir --pidfile="`pwd`"/client-pid -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],
[0], [ignore], [ignore], [kill `cat server-pid`]) [0], [ignore], [ignore])
on_exit 'kill `cat ovsdb-client.pid`'
m4_foreach([txn], [$6], m4_foreach([txn], [$6],
[AT_CHECK([ovsdb-client transact unix:socket 'txn'], [0], [AT_CHECK([ovsdb-client transact unix:socket 'txn'], [0],
[ignore], [ignore], [kill `cat server-pid client-pid`])]) [ignore], [ignore], [kill `cat server-pid client-pid`])])
if test "$IS_WIN32" = "yes"; then
:
m4_foreach([cond], [$10], m4_foreach([cond], [$10],
[AT_CHECK([ovs-appctl -t "`pwd`"/ovsdb-client.ctl ovsdb-client/cond_change $5 'cond'], [0], [ignore], [ignore])]) [AT_CHECK([ovs-appctl -t ovsdb-client ovsdb-client/cond_change $5 'cond'], [0], [ignore], [ignore])])
else
CLIENT_PID=`cat "$OVS_RUNDIR"/client-pid 2>/dev/null`
m4_foreach([cond], [$10],
[AT_CHECK([ovs-appctl -t "`pwd`"/ovsdb-client.$CLIENT_PID.ctl ovsdb-client/cond_change $5 'cond'], [0], [ignore], [ignore])])
fi
AT_CHECK([ovsdb-client transact unix:socket '[["$4"]]'], [0], AT_CHECK([ovsdb-client transact unix:socket '[["$4"]]'], [0],
[ignore], [ignore], [kill `cat server-pid client-pid`]) [ignore], [ignore])
AT_CHECK([ovs-appctl -t "`pwd`"/unixctl -e exit], [0], [ignore], [ignore]) AT_CHECK([ovs-appctl -t ovsdb-server -e exit], [0], [ignore], [ignore])
OVS_WAIT_UNTIL([test ! -e server-pid && test ! -e client-pid]) OVS_WAIT_UNTIL([test ! -e ovsdb-server.pid && test ! -e ovsdb-client.pid])
AT_CHECK([${PERL} $srcdir/ovsdb-monitor-sort.pl < output | ${PERL} $srcdir/uuidfilt.pl], [0], [$7], [ignore]) AT_CHECK([${PERL} $srcdir/ovsdb-monitor-sort.pl < output | ${PERL} $srcdir/uuidfilt.pl], [0], [$7], [ignore])
AT_CLEANUP]) AT_CLEANUP])

View File

@ -1,7 +1,7 @@
AT_BANNER([OVSDB -- ovsdb-server transactions (Unix sockets)]) AT_BANNER([OVSDB -- ovsdb-server transactions (Unix sockets)])
m4_define([OVSDB_SERVER_SHUTDOWN], m4_define([OVSDB_SERVER_SHUTDOWN],
[OVS_APP_EXIT_AND_WAIT_BY_TARGET([`pwd`/unixctl], [`pwd`/pid])]) [OVS_APP_EXIT_AND_WAIT_BY_TARGET([ovsdb-server], [ovsdb-server.pid])])
m4_define([OVSDB_SERVER_SHUTDOWN2], m4_define([OVSDB_SERVER_SHUTDOWN2],
[cp pid2 savepid2 [cp pid2 savepid2
@ -27,7 +27,7 @@ m4_define([OVSDB_CHECK_EXECUTION],
AT_KEYWORDS([ovsdb server positive unix $5]) AT_KEYWORDS([ovsdb server positive unix $5])
$2 > schema $2 > schema
AT_CHECK([ovsdb-tool create db schema], [0], [stdout], [ignore]) AT_CHECK([ovsdb-tool create db schema], [0], [stdout], [ignore])
AT_CHECK([ovsdb-server --detach --no-chdir --pidfile="`pwd`"/pid --remote=punix:socket --unixctl="`pwd`"/unixctl db], [0], [ignore], [ignore]) AT_CHECK([ovsdb-server --detach --no-chdir --pidfile --remote=punix:socket db], [0], [ignore], [ignore])
m4_foreach([txn], [$3], m4_foreach([txn], [$3],
[AT_CHECK([ovsdb-client transact unix:socket 'txn'], [0], [stdout], [ignore], [AT_CHECK([ovsdb-client transact unix:socket 'txn'], [0], [stdout], [ignore],
[test ! -e pid || kill `cat pid`]) [test ! -e pid || kill `cat pid`])
@ -54,7 +54,7 @@ AT_DATA([txnfile], [[ovsdb-client transact unix:socket \
"table": "ordinals", "table": "ordinals",
"row": {"number": 0, "name": "zero"}}]' "row": {"number": 0, "name": "zero"}}]'
]]) ]])
AT_CHECK([ovsdb-server --remote=punix:socket --unixctl="`pwd`"/unixctl db --run="sh txnfile"], [0], [stdout], []) AT_CHECK([ovsdb-server --remote=punix:socket db --run="sh txnfile"], [0], [stdout], [])
cat stdout >> output cat stdout >> output
dnl Add some crap to the database log and run another transaction, which should dnl Add some crap to the database log and run another transaction, which should
dnl ignore the crap and truncate it out of the log. dnl ignore the crap and truncate it out of the log.
@ -65,7 +65,7 @@ AT_DATA([txnfile], [[ovsdb-client transact unix:socket \
"table": "ordinals", "table": "ordinals",
"row": {"number": 1, "name": "one"}}]' "row": {"number": 1, "name": "one"}}]'
]]) ]])
AT_CHECK([ovsdb-server --remote=punix:socket --unixctl="`pwd`"/unixctl db --run="sh txnfile"], [0], [stdout], [stderr]) AT_CHECK([ovsdb-server --remote=punix:socket db --run="sh txnfile"], [0], [stdout], [stderr])
AT_CHECK([grep 'syntax error: db: parse error.* in header line "xxx"' stderr], AT_CHECK([grep 'syntax error: db: parse error.* in header line "xxx"' stderr],
[0], [ignore]) [0], [ignore])
cat stdout >> output cat stdout >> output
@ -79,7 +79,7 @@ AT_DATA([txnfile], [[ovsdb-client transact unix:socket \
"where": [], "where": [],
"sort": ["number"]}]' "sort": ["number"]}]'
]]) ]])
AT_CHECK([ovsdb-server --remote=punix:socket --unixctl="`pwd`"/unixctl db --run="sh txnfile"], [0], [stdout], []) AT_CHECK([ovsdb-server --remote=punix:socket db --run="sh txnfile"], [0], [stdout], [])
cat stdout >> output cat stdout >> output
AT_CHECK([${PERL} $srcdir/uuidfilt.pl output], [0], AT_CHECK([${PERL} $srcdir/uuidfilt.pl output], [0],
[[[{"uuid":["uuid","<0>"]}] [[[{"uuid":["uuid","<0>"]}]
@ -101,7 +101,7 @@ AT_DATA([txnfile], [[ovsdb-client transact unix:socket \
"table": "ordinals", "table": "ordinals",
"row": {"number": 0, "name": "zero"}}]' "row": {"number": 0, "name": "zero"}}]'
]]) ]])
AT_CHECK([ovsdb-server --remote=punix:socket --unixctl="`pwd`"/unixctl db --run="sh txnfile"], [0], [stdout], []) AT_CHECK([ovsdb-server --remote=punix:socket db --run="sh txnfile"], [0], [stdout], [])
cat stdout >> output cat stdout >> output
dnl Add some crap to the database log and run another transaction, which should dnl Add some crap to the database log and run another transaction, which should
dnl ignore the crap and truncate it out of the log. dnl ignore the crap and truncate it out of the log.
@ -113,7 +113,7 @@ AT_DATA([txnfile], [[ovsdb-client transact unix:socket \
"table": "ordinals", "table": "ordinals",
"row": {"number": 1, "name": "one"}}]' "row": {"number": 1, "name": "one"}}]'
]]) ]])
AT_CHECK([ovsdb-server --remote=punix:socket --unixctl="`pwd`"/unixctl db --run="sh txnfile"], [0], [stdout], [stderr]) AT_CHECK([ovsdb-server --remote=punix:socket db --run="sh txnfile"], [0], [stdout], [stderr])
AT_CHECK([grep 'syntax "{"invalid":{}}": unknown table: No table named invalid.' stderr], AT_CHECK([grep 'syntax "{"invalid":{}}": unknown table: No table named invalid.' stderr],
[0], [ignore]) [0], [ignore])
cat stdout >> output cat stdout >> output
@ -127,7 +127,7 @@ AT_DATA([txnfile], [[ovsdb-client transact unix:socket \
"where": [], "where": [],
"sort": ["number"]}]' "sort": ["number"]}]'
]]) ]])
AT_CHECK([ovsdb-server --remote=punix:socket --unixctl="`pwd`"/unixctl db --run="sh txnfile"], [0], [stdout], []) AT_CHECK([ovsdb-server --remote=punix:socket db --run="sh txnfile"], [0], [stdout], [])
cat stdout >> output cat stdout >> output
AT_CHECK([${PERL} $srcdir/uuidfilt.pl output], [0], AT_CHECK([${PERL} $srcdir/uuidfilt.pl output], [0],
[[[{"uuid":["uuid","<0>"]}] [[[{"uuid":["uuid","<0>"]}]
@ -141,7 +141,7 @@ AT_SETUP([ovsdb-client get-schema-version])
AT_KEYWORDS([ovsdb server positive]) AT_KEYWORDS([ovsdb server positive])
ordinal_schema > schema ordinal_schema > schema
AT_CHECK([ovsdb-tool create db schema], [0], [ignore], [ignore]) AT_CHECK([ovsdb-tool create db schema], [0], [ignore], [ignore])
AT_CHECK([ovsdb-server --detach --no-chdir --pidfile="`pwd`"/pid --unixctl="`pwd`"/unixctl --remote=punix:socket db], [0], [ignore], [ignore]) AT_CHECK([ovsdb-server --detach --no-chdir --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-version unix:socket ordinals], [0], [5.1.3
]) ])
OVSDB_SERVER_SHUTDOWN OVSDB_SERVER_SHUTDOWN
@ -153,7 +153,7 @@ ordinal_schema > schema1
constraint_schema > schema2 constraint_schema > schema2
AT_CHECK([ovsdb-tool create db1 schema1], [0], [ignore], [ignore]) AT_CHECK([ovsdb-tool create db1 schema1], [0], [ignore], [ignore])
AT_CHECK([ovsdb-tool create db2 schema2], [0], [ignore], [ignore]) AT_CHECK([ovsdb-tool create db2 schema2], [0], [ignore], [ignore])
AT_CHECK([ovsdb-server --detach --no-chdir --pidfile="`pwd`"/pid --unixctl="`pwd`"/unixctl --remote=punix:socket db1 db2], [0], [ignore], [ignore]) AT_CHECK([ovsdb-server --detach --no-chdir --pidfile --remote=punix:socket db1 db2], [0], [ignore], [ignore])
AT_CHECK( AT_CHECK(
[[ovsdb-client list-dbs unix:socket]], [[ovsdb-client list-dbs unix:socket]],
[0], [constraints [0], [constraints
@ -526,11 +526,11 @@ AT_CHECK(
"ca_cert": "'"$PKIDIR/testpki-cacert.pem"'"}}]']], "ca_cert": "'"$PKIDIR/testpki-cacert.pem"'"}}]']],
[0], [ignore], [ignore]) [0], [ignore], [ignore])
AT_CHECK( AT_CHECK(
[ovsdb-server --log-file --detach --no-chdir --pidfile="`pwd`"/pid \ [ovsdb-server --log-file --detach --no-chdir --pidfile \
--private-key=db:mydb,SSL,private_key \ --private-key=db:mydb,SSL,private_key \
--certificate=db:mydb,SSL,certificate \ --certificate=db:mydb,SSL,certificate \
--ca-cert=db:mydb,SSL,ca_cert \ --ca-cert=db:mydb,SSL,ca_cert \
--remote=pssl:0:127.0.0.1 --unixctl="`pwd`"/unixctl db], --remote=pssl:0:127.0.0.1 db],
[0], [ignore], [ignore]) [0], [ignore], [ignore])
PARSE_LISTENING_PORT([ovsdb-server.log], [SSL_PORT]) PARSE_LISTENING_PORT([ovsdb-server.log], [SSL_PORT])
AT_CHECK( AT_CHECK(
@ -565,7 +565,7 @@ ln -s dir/.db.~lock~ .db.~lock~
AT_SKIP_IF([test ! -h db || test ! -h .db.~lock~]) AT_SKIP_IF([test ! -h db || test ! -h .db.~lock~])
AT_CHECK([ovsdb-tool create db schema], [0], [ignore], [ignore]) AT_CHECK([ovsdb-tool create db schema], [0], [ignore], [ignore])
dnl Start ovsdb-server. dnl Start ovsdb-server.
AT_CHECK([ovsdb-server --detach --no-chdir --pidfile="`pwd`"/pid --unixctl="`pwd`"/unixctl --remote=punix:socket --log-file="`pwd`"/ovsdb-server.log db], [0], [ignore], [ignore]) AT_CHECK([ovsdb-server --detach --no-chdir --pidfile --remote=punix:socket --log-file="`pwd`"/ovsdb-server.log db], [0], [ignore], [ignore])
AT_CAPTURE_FILE([ovsdb-server.log]) AT_CAPTURE_FILE([ovsdb-server.log])
dnl Do a bunch of random transactions that put crap in the database log. dnl Do a bunch of random transactions that put crap in the database log.
AT_CHECK( AT_CHECK(
@ -631,7 +631,7 @@ _uuid name number
<5> zero 0 @&t@ <5> zero 0 @&t@
], [], [test ! -e pid || kill `cat pid`]) ], [], [test ! -e pid || kill `cat pid`])
dnl Now compact the database in-place. dnl Now compact the database in-place.
AT_CHECK([[ovs-appctl -t "`pwd`"/unixctl ovsdb-server/compact]], AT_CHECK([[ovs-appctl -t ovsdb-server ovsdb-server/compact]],
[0], [], [ignore], [test ! -e pid || kill `cat pid`]) [0], [], [ignore], [test ! -e pid || kill `cat pid`])
dnl Make sure that "db" is still a symlink to dir/db instead of getting dnl Make sure that "db" is still a symlink to dir/db instead of getting
dnl replaced by a regular file, ditto for .db.~lock~. dnl replaced by a regular file, ditto for .db.~lock~.
@ -806,7 +806,7 @@ m4_define([OVSDB_CHECK_EXECUTION],
$2 > schema $2 > schema
PKIDIR=$abs_top_builddir/tests PKIDIR=$abs_top_builddir/tests
AT_CHECK([ovsdb-tool create db schema], [0], [stdout], [ignore]) AT_CHECK([ovsdb-tool create db schema], [0], [stdout], [ignore])
AT_CHECK([ovsdb-server --log-file --detach --no-chdir --pidfile="`pwd`"/pid --private-key=$PKIDIR/testpki-privkey2.pem --certificate=$PKIDIR/testpki-cert2.pem --ca-cert=$PKIDIR/testpki-cacert.pem --remote=pssl:0:127.0.0.1 --unixctl="`pwd`"/unixctl db], [0], [ignore], [ignore]) AT_CHECK([ovsdb-server --log-file --detach --no-chdir --pidfile --private-key=$PKIDIR/testpki-privkey2.pem --certificate=$PKIDIR/testpki-cert2.pem --ca-cert=$PKIDIR/testpki-cacert.pem --remote=pssl:0:127.0.0.1 db], [0], [ignore], [ignore])
PARSE_LISTENING_PORT([ovsdb-server.log], [SSL_PORT]) PARSE_LISTENING_PORT([ovsdb-server.log], [SSL_PORT])
m4_foreach([txn], [$3], m4_foreach([txn], [$3],
[AT_CHECK([ovsdb-client --private-key=$PKIDIR/testpki-privkey.pem --certificate=$PKIDIR/testpki-cert.pem --ca-cert=$PKIDIR/testpki-cacert.pem transact ssl:127.0.0.1:$SSL_PORT 'txn'], [0], [stdout], [ignore], [AT_CHECK([ovsdb-client --private-key=$PKIDIR/testpki-privkey.pem --certificate=$PKIDIR/testpki-cert.pem --ca-cert=$PKIDIR/testpki-cacert.pem transact ssl:127.0.0.1:$SSL_PORT 'txn'], [0], [stdout], [ignore],
@ -844,7 +844,7 @@ m4_define([OVSDB_CHECK_EXECUTION],
$2 > schema $2 > schema
PKIDIR=$abs_top_builddir/tests PKIDIR=$abs_top_builddir/tests
AT_CHECK([ovsdb-tool create db schema], [0], [stdout], [ignore]) AT_CHECK([ovsdb-tool create db schema], [0], [stdout], [ignore])
AT_CHECK([ovsdb-server --log-file --detach --no-chdir --pidfile="`pwd`"/pid --private-key=$PKIDIR/testpki-privkey2.pem --certificate=$PKIDIR/testpki-cert2.pem --ca-cert=$PKIDIR/testpki-cacert.pem --remote=pssl:0:[[::1]] --unixctl="`pwd`"/unixctl db], [0], [ignore], [ignore]) AT_CHECK([ovsdb-server --log-file --detach --no-chdir --pidfile --private-key=$PKIDIR/testpki-privkey2.pem --certificate=$PKIDIR/testpki-cert2.pem --ca-cert=$PKIDIR/testpki-cacert.pem --remote=pssl:0:[[::1]] db], [0], [ignore], [ignore])
PARSE_LISTENING_PORT([ovsdb-server.log], [SSL_PORT]) PARSE_LISTENING_PORT([ovsdb-server.log], [SSL_PORT])
m4_foreach([txn], [$3], m4_foreach([txn], [$3],
[AT_CHECK([ovsdb-client --private-key=$PKIDIR/testpki-privkey.pem --certificate=$PKIDIR/testpki-cert.pem --ca-cert=$PKIDIR/testpki-cacert.pem transact ssl:[[::1]]:$SSL_PORT 'txn'], [0], [stdout], [ignore], [AT_CHECK([ovsdb-client --private-key=$PKIDIR/testpki-privkey.pem --certificate=$PKIDIR/testpki-cert.pem --ca-cert=$PKIDIR/testpki-cacert.pem transact ssl:[[::1]]:$SSL_PORT 'txn'], [0], [stdout], [ignore],
@ -864,7 +864,7 @@ AT_SETUP([ovsdb-client get-schema-version - tcp socket])
AT_KEYWORDS([ovsdb server positive tcp]) AT_KEYWORDS([ovsdb server positive tcp])
ordinal_schema > schema ordinal_schema > schema
AT_CHECK([ovsdb-tool create db schema], [0], [ignore], [ignore]) AT_CHECK([ovsdb-tool create db schema], [0], [ignore], [ignore])
AT_CHECK([ovsdb-server --log-file --detach --no-chdir --pidfile="`pwd`"/pid --unixctl="`pwd`"/unixctl --remote=ptcp:0:127.0.0.1 db], [0], [ignore], [ignore]) AT_CHECK([ovsdb-server --log-file --detach --no-chdir --pidfile --remote=ptcp:0:127.0.0.1 db], [0], [ignore], [ignore])
PARSE_LISTENING_PORT([ovsdb-server.log], [TCP_PORT]) PARSE_LISTENING_PORT([ovsdb-server.log], [TCP_PORT])
AT_CHECK([ovsdb-client get-schema-version tcp:127.0.0.1:$TCP_PORT ordinals], [0], [5.1.3 AT_CHECK([ovsdb-client get-schema-version tcp:127.0.0.1:$TCP_PORT ordinals], [0], [5.1.3
]) ])
@ -891,7 +891,7 @@ m4_define([OVSDB_CHECK_EXECUTION],
$2 > schema $2 > schema
PKIDIR=$abs_top_builddir/tests PKIDIR=$abs_top_builddir/tests
AT_CHECK([ovsdb-tool create db schema], [0], [stdout], [ignore]) AT_CHECK([ovsdb-tool create db schema], [0], [stdout], [ignore])
AT_CHECK([ovsdb-server --log-file --detach --no-chdir --pidfile="`pwd`"/pid --remote=ptcp:0:127.0.0.1 --unixctl="`pwd`"/unixctl db], [0], [ignore], [ignore]) AT_CHECK([ovsdb-server --log-file --detach --no-chdir --pidfile --remote=ptcp:0:127.0.0.1 db], [0], [ignore], [ignore])
PARSE_LISTENING_PORT([ovsdb-server.log], [TCP_PORT]) PARSE_LISTENING_PORT([ovsdb-server.log], [TCP_PORT])
m4_foreach([txn], [$3], m4_foreach([txn], [$3],
[AT_CHECK([ovsdb-client transact tcp:127.0.0.1:$TCP_PORT 'txn'], [0], [stdout], [ignore], [AT_CHECK([ovsdb-client transact tcp:127.0.0.1:$TCP_PORT 'txn'], [0], [stdout], [ignore],
@ -928,7 +928,7 @@ m4_define([OVSDB_CHECK_EXECUTION],
$2 > schema $2 > schema
PKIDIR=$abs_top_builddir/tests PKIDIR=$abs_top_builddir/tests
AT_CHECK([ovsdb-tool create db schema], [0], [stdout], [ignore]) AT_CHECK([ovsdb-tool create db schema], [0], [stdout], [ignore])
AT_CHECK([ovsdb-server --log-file --detach --no-chdir --pidfile="`pwd`"/pid --remote=ptcp:0:[[::1]] --unixctl="`pwd`"/unixctl db], [0], [ignore], [ignore]) AT_CHECK([ovsdb-server --log-file --detach --no-chdir --pidfile --remote=ptcp:0:[[::1]] db], [0], [ignore], [ignore])
PARSE_LISTENING_PORT([ovsdb-server.log], [TCP_PORT]) PARSE_LISTENING_PORT([ovsdb-server.log], [TCP_PORT])
m4_foreach([txn], [$3], m4_foreach([txn], [$3],
[AT_CHECK([ovsdb-client transact tcp:[[::1]]:$TCP_PORT 'txn'], [0], [stdout], [ignore], [AT_CHECK([ovsdb-client transact tcp:[[::1]]:$TCP_PORT 'txn'], [0], [stdout], [ignore],
@ -970,7 +970,7 @@ m4_define([OVSDB_CHECK_EXECUTION],
m4_foreach([txn], [$3], m4_foreach([txn], [$3],
[AT_DATA([txnfile], [ovsdb-client transact unix:socket 'txn' [AT_DATA([txnfile], [ovsdb-client transact unix:socket 'txn'
]) ])
AT_CHECK([ovsdb-server --remote=punix:socket --unixctl="`pwd`"/unixctl db --run="sh txnfile"], [0], [stdout], [ignore]) AT_CHECK([ovsdb-server --remote=punix:socket db --run="sh txnfile"], [0], [stdout], [ignore])
cat stdout >> output cat stdout >> output
]) ])
AT_CHECK([${PERL} $srcdir/uuidfilt.pl output], [0], [$4], [ignore]) AT_CHECK([${PERL} $srcdir/uuidfilt.pl output], [0], [$4], [ignore])
@ -998,11 +998,11 @@ m4_define([OVSDB_CHECK_EXECUTION],
AT_CHECK([ovsdb-tool create db1 schema], [0], [stdout], [ignore]) AT_CHECK([ovsdb-tool create db1 schema], [0], [stdout], [ignore])
AT_CHECK([ovsdb-tool create db2 schema], [0], [stdout], [ignore]) AT_CHECK([ovsdb-tool create db2 schema], [0], [stdout], [ignore])
AT_CHECK([ovsdb-server --detach --no-chdir --log-file=ovsdb-server1.log --pidfile="`pwd`"/pid --remote=punix:db.sock --unixctl="`pwd`"/unixctl db1], [0], [ignore], [ignore]) AT_CHECK([ovsdb-server --detach --no-chdir --log-file=ovsdb-server1.log --pidfile --remote=punix:db.sock db1], [0], [ignore], [ignore])
i i
on_exit 'test ! -e pid || kill `cat pid`' on_exit 'test ! -e pid || kill `cat pid`'
AT_CHECK([ovsdb-server --detach --no-chdir --log-file=ovsdb-server2.log --pidfile="`pwd`"/pid2 --remote=punix:db2.sock --unixctl="`pwd`"/unixctl2 --sync-from=unix:db.sock db2], [0], [ignore], [ignore]) AT_CHECK([ovsdb-server --detach --no-chdir --log-file=ovsdb-server2.log --pidfile=pid2 --remote=punix:db2.sock --unixctl=unixctl2 --sync-from=unix:db.sock db2], [0], [ignore], [ignore])
on_exit 'test ! -e pid2 || kill `cat pid2`' on_exit 'test ! -e pid2 || kill `cat pid2`'
m4_foreach([txn], [$3], m4_foreach([txn], [$3],
@ -1043,10 +1043,10 @@ m4_define([OVSDB_CHECK_REPLICATION],
AT_CHECK([ovsdb-tool create db1 schema], [0], [stdout], [ignore]) AT_CHECK([ovsdb-tool create db1 schema], [0], [stdout], [ignore])
AT_CHECK([ovsdb-tool create db2 schema], [0], [stdout], [ignore]) AT_CHECK([ovsdb-tool create db2 schema], [0], [stdout], [ignore])
AT_CHECK([ovsdb-server --detach --no-chdir --log-file=ovsdb-server1.log --pidfile="`pwd`"/pid --remote=punix:db.sock --unixctl="`pwd`"/unixctl db1], [0], [ignore], [ignore]) AT_CHECK([ovsdb-server --detach --no-chdir --log-file=ovsdb-server1.log --pidfile --remote=punix:db.sock db1], [0], [ignore], [ignore])
on_exit 'test ! -e pid || kill `cat pid`' on_exit 'test ! -e pid || kill `cat pid`'
AT_CHECK([ovsdb-server --detach --no-chdir --log-file=ovsdb-server2.log --pidfile="`pwd`"/pid2 --remote=punix:db2.sock --unixctl="`pwd`"/unixctl2 --sync-from=unix:db.sock --sync-exclude-tables=mydb:b db2], [0], [ignore], [ignore]) AT_CHECK([ovsdb-server --detach --no-chdir --log-file=ovsdb-server2.log --pidfile=pid2 --remote=punix:db2.sock --unixctl=unixctl2 --sync-from=unix:db.sock --sync-exclude-tables=mydb:b db2], [0], [ignore], [ignore])
on_exit 'test ! -e pid2 || kill `cat pid2`' on_exit 'test ! -e pid2 || kill `cat pid2`'
m4_foreach([txn], [$3], m4_foreach([txn], [$3],
@ -1120,10 +1120,10 @@ replication_schema > schema
AT_CHECK([ovsdb-tool create db1 schema], [0], [stdout], [ignore]) AT_CHECK([ovsdb-tool create db1 schema], [0], [stdout], [ignore])
AT_CHECK([ovsdb-tool create db2 schema], [0], [stdout], [ignore]) AT_CHECK([ovsdb-tool create db2 schema], [0], [stdout], [ignore])
AT_CHECK([ovsdb-server --detach --no-chdir --log-file=ovsdb-server1.log --pidfile="`pwd`"/pid --remote=punix:db.sock --unixctl="`pwd`"/unixctl db1], [0], [ignore], [ignore]) AT_CHECK([ovsdb-server --detach --no-chdir --log-file=ovsdb-server1.log --pidfile --remote=punix:db.sock db1], [0], [ignore], [ignore])
on_exit 'test ! -e pid || kill `cat pid`' on_exit 'test ! -e pid || kill `cat pid`'
AT_CHECK([ovsdb-server --detach --no-chdir --log-file=ovsdb-server2.log --pidfile="`pwd`"/pid2 --remote=punix:db2.sock --unixctl="`pwd`"/unixctl2 --sync-from=unix:db.sock db2], [0], [ignore], [ignore]) AT_CHECK([ovsdb-server --detach --no-chdir --log-file=ovsdb-server2.log --pidfile=pid2 --remote=punix:db2.sock --unixctl=unixctl2 --sync-from=unix:db.sock db2], [0], [ignore], [ignore])
on_exit 'test ! -e pid2 || kill `cat pid2`' on_exit 'test ! -e pid2 || kill `cat pid2`'
AT_CHECK([ovs-appctl -t "`pwd`"/unixctl2 ovsdb-server/set-sync-exclude-tables mydb:b], [0], [ignore], [ignore], [test ! -e pid || kill `cat pid`; test ! -e pid2 || kill `cat pid2`]) AT_CHECK([ovs-appctl -t "`pwd`"/unixctl2 ovsdb-server/set-sync-exclude-tables mydb:b], [0], [ignore], [ignore], [test ! -e pid || kill `cat pid`; test ! -e pid2 || kill `cat pid2`])
@ -1168,10 +1168,10 @@ replication_schema > schema
AT_CHECK([ovsdb-tool create db1 schema], [0], [stdout], [ignore]) AT_CHECK([ovsdb-tool create db1 schema], [0], [stdout], [ignore])
AT_CHECK([ovsdb-tool create db2 schema], [0], [stdout], [ignore]) AT_CHECK([ovsdb-tool create db2 schema], [0], [stdout], [ignore])
AT_CHECK([ovsdb-server --detach --no-chdir --log-file=ovsdb-server1.log --pidfile="`pwd`"/pid --remote=punix:db.sock --unixctl="`pwd`"/unixctl db1], [0], [ignore], [ignore]) AT_CHECK([ovsdb-server --detach --no-chdir --log-file=ovsdb-server1.log --pidfile --remote=punix:db.sock db1], [0], [ignore], [ignore])
on_exit 'test ! -e pid || kill `cat pid`' on_exit 'test ! -e pid || kill `cat pid`'
AT_CHECK([ovsdb-server --detach --no-chdir --log-file=ovsdb-server2.log --pidfile="`pwd`"/pid2 --remote=punix:db2.sock --unixctl="`pwd`"/unixctl2 db2], [0], [ignore], [ignore]) AT_CHECK([ovsdb-server --detach --no-chdir --log-file=ovsdb-server2.log --pidfile=pid2 --remote=punix:db2.sock --unixctl=unixctl2 db2], [0], [ignore], [ignore])
on_exit 'test ! -e pid2 || kill `cat pid2`' on_exit 'test ! -e pid2 || kill `cat pid2`'
dnl Try to connect without specifying the active server. dnl Try to connect without specifying the active server.
@ -1207,10 +1207,10 @@ replication_schema > schema
AT_CHECK([ovsdb-tool create db1 schema], [0], [stdout], [ignore]) AT_CHECK([ovsdb-tool create db1 schema], [0], [stdout], [ignore])
AT_CHECK([ovsdb-tool create db2 schema], [0], [stdout], [ignore]) AT_CHECK([ovsdb-tool create db2 schema], [0], [stdout], [ignore])
AT_CHECK([ovsdb-server --detach --no-chdir --log-file=ovsdb-server1.log --pidfile="`pwd`"/pid --remote=punix:db.sock --unixctl="`pwd`"/unixctl db1], [0], [ignore], [ignore]) AT_CHECK([ovsdb-server --detach --no-chdir --log-file=ovsdb-server1.log --pidfile --remote=punix:db.sock db1], [0], [ignore], [ignore])
on_exit 'test ! -e pid || kill `cat pid`' on_exit 'test ! -e pid || kill `cat pid`'
AT_CHECK([ovsdb-server --detach --no-chdir --log-file=ovsdb-server2.log --pidfile="`pwd`"/pid2 --remote=punix:db2.sock --unixctl="`pwd`"/unixctl2 --sync-from=unix:db.sock db2], [0], [ignore], [ignore]) AT_CHECK([ovsdb-server --detach --no-chdir --log-file=ovsdb-server2.log --pidfile=pid2 --remote=punix:db2.sock --unixctl=unixctl2 --sync-from=unix:db.sock db2], [0], [ignore], [ignore])
on_exit 'test ! -e pid2 || kill `cat pid2`' on_exit 'test ! -e pid2 || kill `cat pid2`'
AT_CHECK([ovsdb-client transact unix:db.sock \ AT_CHECK([ovsdb-client transact unix:db.sock \

View File

@ -111,7 +111,7 @@ AT_CHECK([[${PERL} $srcdir/uuidfilt.pl db | grep -v ^OVSDB | sed 's/"_date":[0-9
{"_comment":"add back row for five 5","_date":0,"ordinals":{"<11>":{"name":"five","number":5}}} {"_comment":"add back row for five 5","_date":0,"ordinals":{"<11>":{"name":"five","number":5}}}
]]) ]])
dnl Dump out and check the actual database contents. dnl Dump out and check the actual database contents.
AT_CHECK([[ovsdb-server --unixctl="`pwd`"/unixctl --remote=punix:socket --run "ovsdb-client dump unix:socket ordinals" db]], AT_CHECK([[ovsdb-server --remote=punix:socket --run "ovsdb-client dump unix:socket ordinals" db]],
[0], [stdout], [ignore]) [0], [stdout], [ignore])
AT_CHECK([${PERL} $srcdir/uuidfilt.pl stdout], [0], [dnl AT_CHECK([${PERL} $srcdir/uuidfilt.pl stdout], [0], [dnl
ordinals table ordinals table
@ -138,7 +138,7 @@ dnl in it now.
AT_CAPTURE_FILE([db]) AT_CAPTURE_FILE([db])
AT_CHECK([test `wc -l < db` -eq 4]) AT_CHECK([test `wc -l < db` -eq 4])
dnl And check that the dumped data is the same too: dnl And check that the dumped data is the same too:
AT_CHECK([[ovsdb-server --unixctl="`pwd`"/unixctl --remote=punix:socket --run "ovsdb-client dump unix:socket ordinals" db]], AT_CHECK([[ovsdb-server --remote=punix:socket --run "ovsdb-client dump unix:socket ordinals" db]],
[0], [stdout], [ignore]) [0], [stdout], [ignore])
AT_CHECK([${PERL} $srcdir/uuidfilt.pl stdout], [0], [dnl AT_CHECK([${PERL} $srcdir/uuidfilt.pl stdout], [0], [dnl
ordinals table ordinals table

View File

@ -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. dnl an ovsdb-server on it for vtep-ctl to connect to.
m4_define([VTEP_CTL_SETUP], m4_define([VTEP_CTL_SETUP],
[VTEP_OVSDB_INIT([db]) [VTEP_OVSDB_INIT([db])
AT_CHECK([ovsdb-server --detach --no-chdir --pidfile="`pwd`"/pid --remote=punix:socket --unixctl="`pwd`"/unixctl db >/dev/null 2>&1], [0], [ignore], [ignore])]) AT_CHECK([ovsdb-server --detach --no-chdir --pidfile --remote=punix:socket db >/dev/null 2>&1], [0], [ignore], [ignore])])
dnl VTEP_CTL_CLEANUP dnl VTEP_CTL_CLEANUP
dnl dnl