From 561205007e17f699dd552c451f138c7a9c9c01dc Mon Sep 17 00:00:00 2001 From: Ben Pfaff Date: Wed, 5 Oct 2016 20:07:56 -0700 Subject: [PATCH] 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 Acked-by: Andy Zhou --- tests/daemon-py.at | 128 ++++++++++++++++------------------- tests/daemon.at | 120 ++++++++++++++++---------------- tests/jsonrpc-py.at | 41 ++++------- tests/jsonrpc.at | 42 ++++-------- tests/ofproto.at | 10 +-- tests/ovn-controller-vtep.at | 6 +- tests/ovn-sbctl.at | 4 +- tests/ovs-vsctl.at | 27 ++++---- tests/ovs-vswitchd.at | 20 +++--- tests/ovs-xapi-sync.at | 2 +- tests/ovsdb-idl.at | 88 +++++++++--------------- tests/ovsdb-monitor.at | 46 ++++++------- tests/ovsdb-server.at | 62 ++++++++--------- tests/ovsdb-tool.at | 4 +- tests/vtep-ctl.at | 2 +- 15 files changed, 262 insertions(+), 340 deletions(-) diff --git a/tests/daemon-py.at b/tests/daemon-py.at index a32762b412f..d0e65ad6142 100644 --- a/tests/daemon-py.at +++ b/tests/daemon-py.at @@ -10,7 +10,7 @@ m4_define([DAEMON_PYN], AT_CAPTURE_FILE([expected]) # Start the daemon and wait for the pidfile to get created # 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`]) AT_CHECK( [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([newpid]) # 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]) - OVS_WAIT_UNTIL([test -s pid], [kill `cat parent`]) + AT_CHECK([$3 $srcdir/test-daemon.py --pidfile=pid --monitor& echo $! > parent], [0]) + on_exit 'kill `cat parent`' + OVS_WAIT_UNTIL([test -s pid]) # Check that the pidfile names a running 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([parent_pid `cat pid` > parentpid], - [0], [], [], [kill `cat parent`]) + AT_CHECK([kill -0 `cat pid`]) + AT_CHECK([parent_pid `cat pid` > parentpid]) AT_CHECK( [parentpid=`cat parentpid` && parent=`cat parent` && - test $parentpid = $parent], - [0], [], [], [kill `cat parent`]) + test $parentpid = $parent]) # Kill the daemon process, making it look like a segfault, # and wait for a new child process to get spawned. - AT_CHECK([cp pid oldpid], [0], [], [], [kill `cat parent`]) - AT_CHECK([kill -SEGV `cat pid`], [0], [], [ignore], [kill `cat parent`]) - OVS_WAIT_WHILE([kill -0 `cat oldpid`], [kill `cat parent`]) - OVS_WAIT_UNTIL([test -s pid && test `cat pid` != `cat oldpid`], - [kill `cat parent`]) - AT_CHECK([cp pid newpid], [0], [], [], [kill `cat parent`]) + AT_CHECK([cp pid oldpid]) + AT_CHECK([kill -SEGV `cat pid`], [0], [], [ignore]) + OVS_WAIT_WHILE([kill -0 `cat oldpid`]) + OVS_WAIT_UNTIL([test -s pid && test `cat pid` != `cat oldpid`]) + AT_CHECK([cp pid newpid]) # Check that the pidfile names a running process, # and that the parent process of that process is our child process. - AT_CHECK([parent_pid `cat pid` > parentpid], - [0], [], [], [kill `cat parent`]) + AT_CHECK([parent_pid `cat pid` > parentpid]) AT_CHECK( [parentpid=`cat parentpid` && parent=`cat parent` && - test $parentpid = $parent], - [0], [], [], [kill `cat parent`]) + test $parentpid = $parent]) # Kill the daemon process with SIGTERM, and wait for the daemon # and the monitor processes to go away and the pidfile to get deleted. - AT_CHECK([kill `cat pid`], [0], [], [ignore], [kill `cat parent`]) - OVS_WAIT_WHILE([kill -0 `cat parent` || kill -0 `cat newpid` || test -e pid], - [kill `cat parent`]) + AT_CHECK([kill `cat pid`]) + OVS_WAIT_WHILE([kill -0 `cat parent` || kill -0 `cat newpid` || test -e pid]) AT_CLEANUP]) DAEMON_MONITOR_PYN([Python2], [$HAVE_PYTHON], [$PYTHON]) @@ -84,40 +79,35 @@ m4_define([DAEMON_MONITOR_RESTART_PYN], AT_CAPTURE_FILE([parentpid]) AT_CAPTURE_FILE([newpid]) # 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]) - OVS_WAIT_UNTIL([test -s pid], [kill `cat parent`]) + AT_CHECK([$3 $srcdir/test-daemon.py --pidfile=pid --monitor& echo $! > parent], [0]) + on_exit 'kill `cat parent`' + OVS_WAIT_UNTIL([test -s pid]) # Check that the pidfile names a running 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([parent_pid `cat pid` > parentpid], - [0], [], [], [kill `cat parent`]) + AT_CHECK([kill -0 `cat pid`]) + AT_CHECK([parent_pid `cat pid` > parentpid]) AT_CHECK( [parentpid=`cat parentpid` && parent=`cat parent` && - test $parentpid = $parent], - [0], [], [], [kill `cat parent`]) + test $parentpid = $parent]) # HUP the daemon process causing it to throw an exception, # and wait for a new child process to get spawned. - AT_CHECK([cp pid oldpid], [0], [], [], [kill `cat parent`]) - AT_CHECK([kill -HUP `cat pid`], [0], [], [ignore], [kill `cat parent`]) - OVS_WAIT_WHILE([kill -0 `cat oldpid`], [kill `cat parent`]) - OVS_WAIT_UNTIL([test -s pid && test `cat pid` != `cat oldpid`], - [kill `cat parent`]) - AT_CHECK([cp pid newpid], [0], [], [], [kill `cat parent`]) + AT_CHECK([cp pid oldpid]) + AT_CHECK([kill -HUP `cat pid`]) + OVS_WAIT_WHILE([kill -0 `cat oldpid`]) + OVS_WAIT_UNTIL([test -s pid && test `cat pid` != `cat oldpid`]) + AT_CHECK([cp pid newpid]) # Check that the pidfile names a running process, # and that the parent process of that process is our child process. - AT_CHECK([parent_pid `cat pid` > parentpid], - [0], [], [], [kill `cat parent`]) + AT_CHECK([parent_pid `cat pid` > parentpid]) AT_CHECK( [parentpid=`cat parentpid` && parent=`cat parent` && - test $parentpid = $parent], - [0], [], [], [kill `cat parent`]) + test $parentpid = $parent]) # Kill the daemon process with SIGTERM, and wait for the daemon # and the monitor processes to go away and the pidfile to get deleted. - AT_CHECK([kill `cat pid`], [0], [], [ignore], [kill `cat parent`]) - OVS_WAIT_WHILE([kill -0 `cat parent` || kill -0 `cat newpid` || test -e pid], - [kill `cat parent`]) + AT_CHECK([kill `cat pid`], [0], [], [ignore]) + OVS_WAIT_WHILE([kill -0 `cat parent` || kill -0 `cat newpid` || test -e pid]) AT_CLEANUP]) 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. # We don't wait for the pidfile to get created because the daemon is # 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([kill -0 `cat pid`]) # 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([Python3], [$HAVE_PYTHON3], [$PYTHON3]) -m4_define([CHECK], - [AT_CHECK([$1], [$2], [$3], [$4], [kill `cat daemon monitor`])]) m4_define([DAEMON_DETACH_MONITOR_PYN], [AT_SETUP([daemon --detach --monitor - $1]) 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. # We don't wait for the pidfile to get created because the daemon is # 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]) # 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 init. - CHECK([kill -0 `cat daemon`]) - CHECK([parent_pid `cat daemon` > monitor]) - CHECK([kill -0 `cat monitor`]) - CHECK([parent_pid `cat monitor` > init]) - CHECK([test `cat init` != $$]) + AT_CHECK([kill -0 `cat daemon`]) + AT_CHECK([parent_pid `cat daemon` > monitor]) + AT_CHECK([kill -0 `cat monitor`]) + AT_CHECK([parent_pid `cat monitor` > init]) + AT_CHECK([test `cat init` != $$]) # Kill the daemon process, making it look like a segfault, # and wait for a new daemon process to get spawned. - CHECK([cp daemon olddaemon]) - CHECK([kill -SEGV `cat daemon`], [0], [ignore], [ignore]) - OVS_WAIT_WHILE([kill -0 `cat olddaemon`], [kill `cat olddaemon daemon`]) - OVS_WAIT_UNTIL([test -s daemon && test `cat daemon` != `cat olddaemon`], - [kill `cat olddaemon daemon`]) - CHECK([cp daemon newdaemon]) + AT_CHECK([cp daemon olddaemon]) + AT_CHECK([kill -SEGV `cat daemon`], [0], [ignore], [ignore]) + OVS_WAIT_WHILE([kill -0 `cat olddaemon`]) + OVS_WAIT_UNTIL([test -s daemon && test `cat daemon` != `cat olddaemon`]) + AT_CHECK([cp daemon newdaemon]) # Check that the pidfile names a running process, # and that the parent process of that process is our child process. - CHECK([kill -0 `cat daemon`]) - CHECK([diff olddaemon newdaemon], [1], [ignore]) - CHECK([parent_pid `cat daemon` > newmonitor]) - CHECK([diff monitor newmonitor]) - CHECK([kill -0 `cat newmonitor`]) - CHECK([parent_pid `cat newmonitor` > init]) - CHECK([test `cat init` != $$]) + AT_CHECK([kill -0 `cat daemon`]) + AT_CHECK([diff olddaemon newdaemon], [1], [ignore]) + AT_CHECK([parent_pid `cat daemon` > newmonitor]) + AT_CHECK([diff monitor newmonitor]) + AT_CHECK([kill -0 `cat newmonitor`]) + AT_CHECK([parent_pid `cat newmonitor` > init]) + AT_CHECK([test `cat init` != $$]) # Kill the daemon process with SIGTERM, and wait for the daemon # 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( - [kill -0 `cat monitor` || kill -0 `cat newdaemon` || test -e daemon], - [kill `cat monitor newdaemon`]) + [kill -0 `cat monitor` || kill -0 `cat newdaemon` || test -e daemon]) AT_CLEANUP]) DAEMON_DETACH_MONITOR_PYN([Python2], [$HAVE_PYTHON], [$PYTHON]) DAEMON_DETACH_MONITOR_PYN([Python3], [$HAVE_PYTHON3], [$PYTHON3]) -m4_undefine([CHECK]) m4_define([DAEMON_DETACH_ERRORS_PYN], [AT_SETUP([daemon --detach startup errors - $1]) AT_SKIP_IF([test $2 = no]) 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], [0], [ignore], []) 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_SKIP_IF([test $2 = no]) 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], [0], [ignore], []) AT_CHECK([test ! -s pid]) @@ -234,7 +220,7 @@ m4_define([DAEMON_DETACH_CLOSES_FDS_PYN], AT_CAPTURE_FILE([pid]) AT_CAPTURE_FILE([status]) 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([test -s status]) 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([stderr]) 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([test -s status]) if grep '[[bB]]roken pipe' stderr >/dev/null 2>&1; then diff --git a/tests/daemon.at b/tests/daemon.at index 817d9fefc3b..454de37ce50 100644 --- a/tests/daemon.at +++ b/tests/daemon.at @@ -16,16 +16,15 @@ AT_CAPTURE_FILE([pid]) AT_CAPTURE_FILE([expected]) # Start the daemon and wait for the pidfile to get created # 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]) -OVS_WAIT_UNTIL([test -s pid], [kill `cat expected`]) -AT_CHECK( - [pid=`cat pid` && expected=`cat expected` && test "$pid" = "$expected"], - [0], [], [], [kill `cat expected`]) -AT_CHECK([kill -0 `cat pid`], [0], [], [], [kill `cat expected`]) +AT_CHECK([ovsdb-server --pidfile --remote=punix:socket db 2>/dev/null & echo $! > expected], [0]) +on_exit 'kill `cat expected`' +OVS_WAIT_UNTIL([test -s ovsdb-server.pid]) +AT_CHECK([pid=`cat ovsdb-server.pid` && expected=`cat expected` && test "$pid" = "$expected"]) +AT_CHECK([kill -0 `cat ovsdb-server.pid`]) # Kill the daemon and make sure that the pidfile gets deleted. kill `cat expected` OVS_WAIT_WHILE([kill -0 `cat expected`]) -AT_CHECK([test ! -e pid]) +AT_CHECK([test ! -e ovsdb-server.pid]) AT_CLEANUP AT_SETUP([daemon --monitor]) @@ -36,12 +35,12 @@ AT_CAPTURE_FILE([parent]) AT_CAPTURE_FILE([parentpid]) AT_CAPTURE_FILE([newpid]) # 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]) -OVS_WAIT_UNTIL([test -s pid], [kill `cat parent`]) +AT_CHECK([ovsdb-server --monitor --pidfile --remote=punix:socket db 2>/dev/null & echo $! > parent], [0]) +OVS_WAIT_UNTIL([test -s ovsdb-server.pid], [kill `cat parent`]) # Check that the pidfile names a running 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([parent_pid `cat pid` > parentpid], +AT_CHECK([kill -0 `cat ovsdb-server.pid`], [0], [], [], [kill `cat parent`]) +AT_CHECK([parent_pid `cat ovsdb-server.pid` > parentpid], [0], [], [], [kill `cat parent`]) AT_CHECK( [parentpid=`cat parentpid` && @@ -51,19 +50,19 @@ AT_CHECK( # Avoid a race between pidfile creation and notifying the parent, # which can easily trigger if ovsdb-server is slow (e.g. due to valgrind). OVS_WAIT_UNTIL( - [ovs-appctl --timeout=10 -t "`pwd`/unixctl" version], - [kill `cat pid`]) + [ovs-appctl --timeout=10 -t ovsdb-server version], + [kill `cat ovsdb-server.pid`]) # Kill the daemon process, making it look like a segfault, # and wait for a new child process to get spawned. -AT_CHECK([cp pid oldpid], [0], [], [], [kill `cat parent`]) -AT_CHECK([kill -SEGV `cat pid`], [0], [], [ignore], [kill `cat parent`]) +AT_CHECK([cp ovsdb-server.pid oldpid], [0], [], [], [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_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`]) -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, # 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`]) AT_CHECK( [parentpid=`cat parentpid` && @@ -72,8 +71,8 @@ AT_CHECK( [0], [], [], [kill `cat parent`]) # Kill the daemon process with SIGTERM, and wait for the daemon # and the monitor processes to go away and the pidfile to get deleted. -AT_CHECK([kill `cat pid`], [0], [], [ignore], [kill `cat parent`]) -OVS_WAIT_WHILE([kill -0 `cat parent` || kill -0 `cat newpid` || test -e pid], +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 ovsdb-server.pid], [kill `cat parent`]) AT_CLEANUP @@ -83,27 +82,25 @@ OVSDB_INIT([db]) # 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 # 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([test -s pid]) -AT_CHECK([kill -0 `cat pid`]) +AT_CHECK([ovsdb-server --detach --no-chdir --pidfile --remote=punix:socket db], [0]) +AT_CHECK([test -s ovsdb-server.pid]) +AT_CHECK([kill -0 `cat ovsdb-server.pid`]) # 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 # When a 'kill pid' is done on windows (through 'taskkill //F'), # pidfiles are not deleted (because it is force kill), so use # 'ovs-appctl exit' instead - OVS_APP_EXIT_AND_WAIT_BY_TARGET([`pwd`/unixctl], [`pwd`/pid]) + OVS_APP_EXIT_AND_WAIT([ovsdb-server]) else - kill `cat pid` + kill `cat ovsdb-server.pid` fi OVS_WAIT_WHILE([kill -0 `cat saved-pid`]) -AT_CHECK([test ! -e pid]) +AT_CHECK([test ! -e ovsdb-server.pid]) AT_CLEANUP AT_SETUP([daemon --detach --monitor]) AT_SKIP_IF([test "$IS_WIN32" = "yes"]) -m4_define([CHECK], - [AT_CHECK([$1], [$2], [$3], [$4], [kill `cat daemon monitor`])]) OVSDB_INIT([db]) AT_CAPTURE_FILE([daemon]) AT_CAPTURE_FILE([olddaemon]) @@ -114,49 +111,46 @@ AT_CAPTURE_FILE([init]) # 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 # 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([test -s daemon]) +AT_CHECK([ovsdb-server --detach --no-chdir --pidfile --monitor --remote=punix:socket db], [0]) +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, # and that the parent process of that process is a running process, # and that the parent process of that process is init. -CHECK([kill -0 `cat daemon`]) -CHECK([parent_pid `cat daemon` > monitor]) -CHECK([kill -0 `cat monitor`]) -CHECK([parent_pid `cat monitor` > init]) -CHECK([test `cat init` != $$]) +AT_CHECK([kill -0 `cat ovsdb-server.pid`]) +AT_CHECK([parent_pid `cat ovsdb-server.pid` > monitor]) +AT_CHECK([kill -0 `cat monitor`]) +AT_CHECK([parent_pid `cat monitor` > init]) +AT_CHECK([test `cat init` != $$]) # Kill the daemon process, making it look like a segfault, # and wait for a new daemon process to get spawned. -CHECK([cp daemon olddaemon]) -CHECK([kill -SEGV `cat daemon`], [0]) -OVS_WAIT_WHILE([kill -0 `cat olddaemon`], [kill `cat olddaemon daemon`]) -OVS_WAIT_UNTIL([test -s daemon && test `cat daemon` != `cat olddaemon`], - [kill `cat olddaemon daemon`]) -CHECK([cp daemon newdaemon]) +AT_CHECK([cp ovsdb-server.pid olddaemon]) +AT_CHECK([kill -SEGV `cat ovsdb-server.pid`], [0]) +OVS_WAIT_WHILE([kill -0 `cat olddaemon`]) +OVS_WAIT_UNTIL([test -s ovsdb-server.pid && test `cat ovsdb-server.pid` != `cat olddaemon`]) +AT_CHECK([cp ovsdb-server.pid newdaemon]) # Check that the pidfile names a running process, # and that the parent process of that process is our child process. -CHECK([kill -0 `cat daemon`]) -CHECK([diff olddaemon newdaemon], [1], [ignore]) -CHECK([parent_pid `cat daemon` > newmonitor]) -CHECK([diff monitor newmonitor]) -CHECK([kill -0 `cat newmonitor`]) -CHECK([parent_pid `cat newmonitor` > init]) -CHECK([test `cat init` != $$]) +AT_CHECK([kill -0 `cat ovsdb-server.pid`]) +AT_CHECK([diff olddaemon newdaemon], [1], [ignore]) +AT_CHECK([parent_pid `cat ovsdb-server.pid` > newmonitor]) +AT_CHECK([diff monitor newmonitor]) +AT_CHECK([kill -0 `cat newmonitor`]) +AT_CHECK([parent_pid `cat newmonitor` > init]) +AT_CHECK([test `cat init` != $$]) # Kill the daemon process with SIGTERM, and wait for the daemon # 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( - [kill -0 `cat monitor` || kill -0 `cat newdaemon` || test -e daemon], - [kill `cat monitor newdaemon`]) -m4_undefine([CHECK]) + [kill -0 `cat monitor` || kill -0 `cat newdaemon` || test -e ovsdb-server.pid]) AT_CLEANUP AT_SETUP([daemon --detach startup errors]) AT_CAPTURE_FILE([pid]) OVSDB_INIT([db]) -AT_CHECK([ovsdb-server --detach --no-chdir --pidfile="`pwd`"/pid --unixctl="`pwd`"/nonexistent/unixctl db], [1], [], [stderr], - [kill `cat pid`]) +AT_CHECK([ovsdb-server --detach --no-chdir --pidfile --unixctl=nonexistent/unixctl db], [1], [], [stderr]) AT_CHECK([grep 'ovsdb-server: could not initialize control socket' stderr], - [0], [ignore], []) + [0], [ignore]) AT_CHECK([test ! -s pid]) AT_CLEANUP @@ -164,9 +158,9 @@ AT_SETUP([daemon --detach --monitor startup errors]) AT_SKIP_IF([test "$IS_WIN32" = "yes"]) AT_CAPTURE_FILE([pid]) 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], - [0], [ignore], []) + [0], [ignore]) AT_CHECK([test ! -s pid]) AT_CLEANUP @@ -180,19 +174,19 @@ AT_CAPTURE_FILE([pid]) # To create a Windows service, we need the absolute path for the executable. 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 ]) 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]) -AT_CHECK([kill -0 `cat pid`], [0], [ignore]) -AT_CHECK([ovs-appctl -t `pwd`/unixctl ovsdb-server/list-dbs], [0], +AT_CHECK([kill -0 `cat ovsdb-server.pid`], [0], [ignore]) +AT_CHECK([ovs-appctl -t ovsdb-server ovsdb-server/list-dbs], [0], [Open_vSwitch ]) 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 delete ovsdb-server], [0], [[[SC]] DeleteService SUCCESS ]) diff --git a/tests/jsonrpc-py.at b/tests/jsonrpc-py.at index 966741d0ebd..dc1cb45fa32 100644 --- a/tests/jsonrpc-py.at +++ b/tests/jsonrpc-py.at @@ -4,14 +4,12 @@ m4_define([JSONRPC_REQ_REPLY_SUCCESS_PYN], [AT_SETUP([JSON-RPC request and successful reply - $1]) AT_SKIP_IF([test $2 = no]) AT_KEYWORDS([python jsonrpc]) - AT_CHECK([$PYTHON $srcdir/test-jsonrpc.py --detach --pidfile=`pwd`/pid listen punix:socket]) - AT_CHECK([test -s pid]) - AT_CHECK([kill -0 `cat pid`]) + AT_CHECK([$PYTHON $srcdir/test-jsonrpc.py --pidfile --detach listen punix:socket]) + on_exit 'kill `cat test-jsonrpc.py.pid`' AT_CHECK( [[$3 $srcdir/test-jsonrpc.py request unix:socket echo '[{"a": "b", "x": null}]']], [0], [[{"error":null,"id":0,"result":[{"a":"b","x":null}]} -]], [], [test ! -e pid || kill `cat pid`]) - AT_CHECK([kill `cat pid`]) +]]) AT_CLEANUP]) 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_SKIP_IF([test $2 = no]) AT_KEYWORDS([python jsonrpc]) - AT_CHECK([$PYTHON $srcdir/test-jsonrpc.py --detach --pidfile=`pwd`/pid listen punix:socket]) - AT_CHECK([test -s pid]) - AT_CHECK([kill -0 `cat pid`]) + AT_CHECK([$PYTHON $srcdir/test-jsonrpc.py --pidfile --detach listen punix:socket]) + on_exit 'kill `cat test-jsonrpc.py.pid`' AT_CHECK( [[$3 $srcdir/test-jsonrpc.py request unix:socket bad-request '[]']], [0], [[{"error":{"error":"unknown method"},"id":0,"result":null} -]], [], [test ! -e pid || kill `cat pid`]) - AT_CHECK([kill `cat pid`]) +]]) AT_CLEANUP]) 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_SKIP_IF([test $2 = no]) AT_KEYWORDS([python jsonrpc]) - AT_CHECK([$3 $srcdir/test-jsonrpc.py --detach --pidfile=`pwd`/pid listen punix:socket]) - AT_CHECK([test -s pid]) - # When a daemon dies it deletes its pidfile, so make a copy. - AT_CHECK([cp pid pid2]) - AT_CHECK([kill -0 `cat pid2`]) - AT_CHECK([[$3 $srcdir/test-jsonrpc.py notify unix:socket shutdown '[]']], [0], [], - [], [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_CHECK([$3 $srcdir/test-jsonrpc.py --pidfile --detach listen punix:socket]) + on_exit 'kill `cat test-jsonrpc.py.pid`' + AT_CHECK([test -e test-jsonrpc.py.pid]) + AT_CHECK([[$3 $srcdir/test-jsonrpc.py notify unix:socket shutdown '[]']]) + # Wait for test-jsonrpc to die, based on its pidfile disappearing + OVS_WAIT_WHILE([test -e test-jsonrpc.py.pid]) AT_CLEANUP]) JSONRPC_NOTIFICATION_PYN([Python2], [$HAVE_PYTHON], [$PYTHON]) diff --git a/tests/jsonrpc.at b/tests/jsonrpc.at index ab16594644c..c84174eed54 100644 --- a/tests/jsonrpc.at +++ b/tests/jsonrpc.at @@ -1,45 +1,29 @@ AT_BANNER([JSON-RPC - C]) AT_SETUP([JSON-RPC request and successful reply]) -AT_CHECK([ovstest test-jsonrpc --detach --no-chdir --pidfile="`pwd`"/pid listen punix:socket]) -AT_CHECK([test -s pid]) -AT_CHECK([kill -0 `cat pid`]) +AT_CHECK([ovstest test-jsonrpc --detach --no-chdir --pidfile listen punix:socket]) +on_exit 'kill `cat test-jsonrpc.pid`' AT_CHECK( [[ovstest test-jsonrpc request unix:socket echo '[{"a": "b", "x": null}]']], [0], [[{"error":null,"id":0,"result":[{"a":"b","x":null}]} -]], [], [test ! -e pid || kill `cat pid`]) -AT_CHECK([kill `cat pid`]) +]]) AT_CLEANUP AT_SETUP([JSON-RPC request and error reply]) -AT_CHECK([ovstest test-jsonrpc --detach --no-chdir --pidfile="`pwd`"/pid listen punix:socket]) -AT_CHECK([test -s pid]) -AT_CHECK([kill -0 `cat pid`]) +AT_CHECK([ovstest test-jsonrpc --detach --no-chdir --pidfile listen punix:socket]) +on_exit 'kill `cat test-jsonrpc.pid`' AT_CHECK( [[ovstest test-jsonrpc request unix:socket bad-request '[]']], [0], [[{"error":{"error":"unknown method"},"id":0,"result":null} -]], [], [test ! -e pid || kill `cat pid`]) -AT_CHECK([kill `cat pid`]) +]]) AT_CLEANUP AT_SETUP([JSON-RPC notification]) -AT_CHECK([ovstest test-jsonrpc --detach --no-chdir --pidfile="`pwd`"/pid listen punix:socket]) -AT_CHECK([test -s pid]) -# When a daemon dies it deletes its pidfile, so make a copy. -AT_CHECK([cp pid pid2]) -AT_CHECK([kill -0 `cat pid2`]) -AT_CHECK([[ovstest test-jsonrpc notify unix:socket shutdown '[]']], [0], [], - [], [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_CHECK([ovstest test-jsonrpc --detach --no-chdir --pidfile listen punix:socket]) +on_exit 'kill `cat test-jsonrpc.pid`' +# Check that the pidfile got created. +AT_CHECK([test -e test-jsonrpc.pid]) +AT_CHECK([[ovstest test-jsonrpc notify unix:socket shutdown '[]']]) +# Wait for test-jsonrpc to die, based on its pidfile disappearing +OVS_WAIT_WHILE([test -e test-jsonrpc.pid]) AT_CLEANUP diff --git a/tests/ofproto.at b/tests/ofproto.at index 5a2ff19753c..3964f1cd466 100644 --- a/tests/ofproto.at +++ b/tests/ofproto.at @@ -3683,7 +3683,7 @@ AT_CAPTURE_FILE([monitor2.log]) AT_CAPTURE_FILE([expout2]) AT_CAPTURE_FILE([experr2]) 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/set-output-file monitor$i.log : > expout$i @@ -3748,7 +3748,7 @@ AT_CAPTURE_FILE([monitor2.log]) AT_CAPTURE_FILE([expout2]) AT_CAPTURE_FILE([experr2]) 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/set-output-file monitor$i.log : > expout$i @@ -3813,9 +3813,9 @@ AT_CAPTURE_FILE([expout2]) AT_CAPTURE_FILE([monitor3.log]) AT_CAPTURE_FILE([expout3]) -ovs-ofctl -O OpenFlow15 monitor br0 --detach --no-chdir --pidfile=`pwd`/c1.pid --unixctl=`pwd`/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=`pwd`/c3.pid --unixctl=`pwd`/c3 +ovs-ofctl -O OpenFlow15 monitor br0 --detach --no-chdir --pidfile=c1.pid --unixctl=c1 +ovs-ofctl -O OpenFlow14 monitor br0 --detach --no-chdir --pidfile=c2.pid --unixctl=c2 +ovs-ofctl -O OpenFlow14 monitor br0 --detach --no-chdir --pidfile=c3.pid --unixctl=c3 check_async () { for i in 1 3; do diff --git a/tests/ovn-controller-vtep.at b/tests/ovn-controller-vtep.at index aeb1ec18d45..9b9e4211567 100644 --- a/tests/ovn-controller-vtep.at +++ b/tests/ovn-controller-vtep.at @@ -24,9 +24,9 @@ m4_define([OVN_CONTROLLER_VTEP_START], done 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=$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=$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 --log-file --remote=punix:$OVS_RUNDIR/db.sock vswitchd.db vtep.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=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`" AT_CHECK([[sed < stderr ' /vlog|INFO|opened log file/d diff --git a/tests/ovn-sbctl.at b/tests/ovn-sbctl.at index 26b05af95c7..9374b5fef21 100644 --- a/tests/ovn-sbctl.at +++ b/tests/ovn-sbctl.at @@ -9,8 +9,8 @@ m4_define([OVN_SBCTL_TEST_START], done 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=$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=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=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`" AT_CHECK([[sed < stderr ' /vlog|INFO|opened log file/d diff --git a/tests/ovs-vsctl.at b/tests/ovs-vsctl.at index 51717869b57..9737589c77b 100644 --- a/tests/ovs-vsctl.at +++ b/tests/ovs-vsctl.at @@ -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. m4_define([OVS_VSCTL_SETUP], [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 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 @@ -669,21 +670,21 @@ sflow : [] status : {} stp_enable : false <0> -]], [ignore], [test ! -e pid || kill `cat pid`]) +]], [ignore]) AT_CHECK( [RUN_OVS_VSCTL([--columns=fail_mode,name,datapath_type list bridge])], [0], [[fail_mode : [] name : "br0" datapath_type : "" -]], [ignore], [test ! -e pid || kill `cat pid`]) +]], [ignore]) AT_CHECK( [RUN_OVS_VSCTL([--columns=fail_mode,name,datapath_type find bridge])], [0], [[fail_mode : [] name : "br0" datapath_type : "" -]], [ignore], [test ! -e pid || kill `cat pid`]) +]], [ignore]) AT_CHECK([ RUN_OVS_VSCTL_TOGETHER([--id=@br1 create bridge name=br1 datapath_type="foo"], [--id=@br2 create bridge name=br2 external-ids:bar=quux], @@ -691,7 +692,7 @@ AT_CHECK([ [0], [stdout], [], [OVS_VSCTL_CLEANUP]) AT_CHECK( [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], [[name : "br0" name : "br2" @@ -779,7 +780,7 @@ engine_id : [] engine_type : [] external_ids : {} targets : ["1.2.3.4:567"] -]], [ignore], [test ! -e pid || kill `cat pid`]) +]], [ignore]) AT_CHECK([RUN_OVS_VSCTL([list interx x])], [1], [], [ovs-vsctl: unknown table "interx" ], [OVS_VSCTL_CLEANUP]) @@ -869,7 +870,6 @@ AT_CLEANUP AT_SETUP([database commands -- conditions]) AT_KEYWORDS([ovs-vsctl]) -on_exit 'kill `cat pid`' OVS_VSCTL_SETUP AT_CHECK( [RUN_OVS_VSCTL_TOGETHER( @@ -1168,7 +1168,7 @@ rstp_status : {} sflow : [] status : {} stp_enable : false -]], [ignore], [test ! -e pid || kill `cat pid`]) +]], [ignore]) OVS_VSCTL_CLEANUP AT_CLEANUP @@ -1291,6 +1291,7 @@ OVS_VSWITCHD_STOP AT_CLEANUP AT_SETUP([naming in db commands]) +AT_KEYWORDS([ovs-vsctl]) OVS_VSCTL_SETUP 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. 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]) -on_exit "kill `cat pid`" +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 ovsdb-server.pid`" PARSE_LISTENING_PORT([ovsdb-server.log], [SSL_PORT]) # 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. 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]) -on_exit "kill `cat pid`" +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 ovsdb-server.pid`" PARSE_LISTENING_PORT([ovsdb-server.log], [SSL_PORT]) # During bootstrap, the connection gets torn down. So the o/p of ovs-vsctl is error. diff --git a/tests/ovs-vswitchd.at b/tests/ovs-vswitchd.at index a4e6a596052..b7c5a1747a7 100644 --- a/tests/ovs-vswitchd.at +++ b/tests/ovs-vswitchd.at @@ -70,14 +70,14 @@ AT_SETUP([ovs-vswitchd -- start additional ovs-vswitchd process]) OVS_VSWITCHD_START # 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`' # sleep for a while sleep 5 # 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 # the existing ovs-vswitchd process. @@ -95,7 +95,7 @@ AT_SETUP([ovs-vswitchd -- switch over to another ovs-vswitchd process]) OVS_VSWITCHD_START # 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`' # sleep for a while. @@ -114,7 +114,7 @@ bridge br0: using datapath ID ]) # 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 # for reporting the existing ovs-vswitchd process and the one for killing @@ -134,23 +134,23 @@ dnl ---------------------------------------------------------------------- AT_SETUP([ovs-vswitchd -- invalid database 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 & -on_exit 'kill `cat ovs-vswitchd-2.pid`' +ovs-vswitchd unix:invalid.db.sock --log-file --enable-dummy --pidfile & +on_exit 'kill `cat ovs-vswitchd.pid`' # sleep for a while. sleep 10 # 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). -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 " /|WARN|/p /|ERR|/p -/|EMER|/p" fakelog +/|EMER|/p" ovs-vswitchd.log ]) AT_CLEANUP diff --git a/tests/ovs-xapi-sync.at b/tests/ovs-xapi-sync.at index 69aae6749f0..189c48d944d 100644 --- a/tests/ovs-xapi-sync.at +++ b/tests/ovs-xapi-sync.at @@ -26,7 +26,7 @@ ovs_vsctl () { OVS_VSCTL_SETUP # 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 &]) AT_CAPTURE_FILE([log]) diff --git a/tests/ovsdb-idl.at b/tests/ovsdb-idl.at index e57a3a46863..a8a51816f29 100644 --- a/tests/ovsdb-idl.at +++ b/tests/ovsdb-idl.at @@ -1,5 +1,18 @@ 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], # [FILTER]) # @@ -19,10 +32,7 @@ AT_BANNER([OVSDB -- interface description language (IDL)]) m4_define([OVSDB_CHECK_IDL_C], [AT_SETUP([$1 - C]) AT_KEYWORDS([ovsdb server idl positive $5]) - AT_CHECK([ovsdb-tool create db $abs_srcdir/idltest.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([ovsdb_start_idltest]) m4_if([$2], [], [], [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], @@ -37,10 +47,7 @@ m4_define([OVSDB_CHECK_IDL_PYN], [AT_SETUP([$1]) AT_SKIP_IF([test $7 = no]) AT_KEYWORDS([ovsdb server idl positive Python $5]) - AT_CHECK([ovsdb-tool create db $abs_srcdir/idltest.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([ovsdb_start_idltest]) m4_if([$2], [], [], [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], @@ -60,10 +67,7 @@ m4_define([OVSDB_CHECK_IDL_REGISTER_COLUMNS_PYN], [AT_SETUP([$1 - register_columns]) AT_SKIP_IF([test $7 = no]) AT_KEYWORDS([ovsdb server idl positive Python register_columns $5]) - AT_CHECK([ovsdb-tool create db $abs_srcdir/idltest.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([ovsdb_start_idltest]) m4_if([$2], [], [], [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], @@ -84,10 +88,7 @@ m4_define([OVSDB_CHECK_IDL_TCP_PYN], [AT_SETUP([$1 - tcp]) AT_SKIP_IF([test $7 = no]) AT_KEYWORDS([ovsdb server idl positive Python with tcp socket $5]) - AT_CHECK([ovsdb-tool create db $abs_srcdir/idltest.ovsschema], - [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`' + AT_CHECK([ovsdb_start_idltest "ptcp:0:127.0.0.1"]) PARSE_LISTENING_PORT([ovsdb-server.log], [TCP_PORT]) 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 $HAVE_IPV6 = no]) AT_KEYWORDS([ovsdb server idl positive Python with tcp6 socket $5]) - AT_CHECK([ovsdb-tool create db $abs_srcdir/idltest.ovsschema], - [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`' + AT_CHECK([ovsdb_start_idltest "ptcp:0:[[::1]]"]) PARSE_LISTENING_PORT([ovsdb-server.log], [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_SKIP_IF([test $HAVE_PYTHON = no]) 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 - 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]) - on_exit 'kill `cat pid`' + AT_CHECK([ovsdb_start_idltest "ptcp:0:127.0.0.1"]) PARSE_LISTENING_PORT([ovsdb-server.log], [TCP_PORT]) OVSDB_SERVER_SHUTDOWN + rm -f db # 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], [0], [stdout], [ignore]) 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 # expects them to be there, so this test checks that it properly # tolerates them being missing. -AT_CHECK([ovsdb-tool create db $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([ovsdb_start_idltest "" "$abs_srcdir/idltest2.ovsschema"]) AT_CHECK([test-ovsdb '-vPATTERN:console:test-ovsdb|%c|%m' -vjsonrpc -t10 idl unix:socket ['["idltest", {"op": "insert", "table": "link1", @@ -801,10 +794,7 @@ m4_define([OVSDB_CHECK_IDL_FETCH_COLUMNS_PY], [AT_SETUP([$1 - Python fetch]) AT_SKIP_IF([test $HAVE_PYTHON = no]) AT_KEYWORDS([ovsdb server idl positive Python increment fetch $6]) - AT_CHECK([ovsdb-tool create db $abs_srcdir/idltest.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([ovsdb_start_idltest]) m4_if([$2], [], [], [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], @@ -849,10 +839,8 @@ m4_define([OVSDB_CHECK_IDL_WO_MONITOR_COND_PY], [AT_SETUP([$1 - Python]) AT_SKIP_IF([test $HAVE_PYTHON = no]) AT_KEYWORDS([ovsdb server idl Python monitor $4]) - AT_CHECK([ovsdb-tool create db $abs_srcdir/idltest.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]) - AT_CHECK([ovs-appctl -t "`pwd`"/unixctl ovsdb-server/disable-monitor-cond]) + AT_CHECK([ovsdb_start_idltest]) + AT_CHECK([ovs-appctl -t ovsdb-server ovsdb-server/disable-monitor-cond]) AT_CHECK([$PYTHON $srcdir/test-ovsdb.py -t10 idl $srcdir/idltest.ovsschema unix:socket $2], [0], [stdout], [ignore], [kill `cat pid`]) 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], [AT_SETUP([$1 - C]) AT_KEYWORDS([ovsdb server idl tracking positive $5]) - AT_CHECK([ovsdb-tool create db $abs_srcdir/idltest.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([ovsdb_start_idltest]) m4_if([$2], [], [], [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], @@ -1077,10 +1062,7 @@ OVSDB_CHECK_IDL_TRACK([track, simple idl, initially empty, various ops], m4_define([OVSDB_CHECK_IDL_PARTIAL_UPDATE_MAP_COLUMN], [AT_SETUP([$1 - C]) AT_KEYWORDS([ovsdb server idl partial update map column positive $5]) - AT_CHECK([ovsdb-tool create db $abs_srcdir/idltest.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([ovsdb_start_idltest]) m4_if([$2], [], [], [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], @@ -1126,10 +1108,7 @@ OVSDB_CHECK_IDL_PY([partial-map idl], m4_define([OVSDB_CHECK_IDL_PARTIAL_UPDATE_SET_COLUMN], [AT_SETUP([$1 - C]) AT_KEYWORDS([ovsdb server idl partial update set column positive $5]) - AT_CHECK([ovsdb-tool create db $abs_srcdir/idltest.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([ovsdb_start_idltest]) m4_if([$2], [], [], [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], @@ -1188,9 +1167,7 @@ m4_define([OVSDB_CHECK_IDL_NOTIFY_PY], [AT_SETUP([$1 - Python]) AT_SKIP_IF([test $HAVE_PYTHON = no]) AT_KEYWORDS([ovsdb server idl Python notify $4]) - AT_CHECK([ovsdb-tool create db $abs_srcdir/idltest.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]) + AT_CHECK([ovsdb_start_idltest]) AT_CHECK([$PYTHON $srcdir/test-ovsdb.py -t10 idl $srcdir/idltest.ovsschema unix:socket $2], [0], [stdout], [ignore], [kill `cat pid`]) 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], [0], [stdout], [ignore]) PKIDIR=$abs_top_builddir/tests - AT_CHECK([ovsdb-server --log-file '-vPATTERN:console:ovsdb-server|%c|%m' \ - --detach --no-chdir --pidfile="`pwd`"/pid \ + AT_CHECK([ovsdb-server -vconsole:warn --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 --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]) AT_CHECK([$PYTHON $srcdir/test-ovsdb.py -t10 idl $srcdir/idltest.ovsschema \ ssl:127.0.0.1:$TCP_PORT $PKIDIR/testpki-privkey.pem \ diff --git a/tests/ovsdb-monitor.at b/tests/ovsdb-monitor.at index ff9d178eaef..256868b0248 100644 --- a/tests/ovsdb-monitor.at +++ b/tests/ovsdb-monitor.at @@ -24,24 +24,26 @@ m4_define([OVSDB_CHECK_MONITOR], m4_foreach([txn], [$3], [AT_CHECK([ovsdb-tool transact db 'txn'], [0], [ignore], [ignore])]) 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_CAPTURE_FILE([ovsdb-client-log]) 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 &], - [0], [ignore], [ignore], [kill `cat server-pid`]) + 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]) sleep 1 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], - [0], [ignore], [ignore], [kill `cat server-pid`]) + 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]) fi + on_exit 'kill `cat ovsdb-client.pid`' m4_foreach([txn], [$6], [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], - [ignore], [ignore], [kill `cat server-pid client-pid`]) - OVS_APP_EXIT_AND_WAIT_BY_TARGET([`pwd`/unixctl], [`pwd`/server-pid]) - OVS_WAIT_UNTIL([test ! -e client-pid]) + [ignore], [ignore]) + OVS_APP_EXIT_AND_WAIT_BY_TARGET([ovsdb-server], [ovsdb-server.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_CLEANUP]) @@ -70,26 +72,20 @@ m4_define([OVSDB_CHECK_MONITOR_COND], m4_foreach([txn], [$3], [AT_CHECK([ovsdb-tool transact db 'txn'], [0], [ignore], [ignore])]) 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], - [0], [], []) - 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], - [0], [ignore], [ignore], [kill `cat server-pid`]) + AT_CHECK([ovsdb-server --detach --no-chdir --pidfile --remote=punix:socket --log-file="`pwd`"/ovsdb-server-log db >/dev/null 2>&1]) + on_exit 'kill `cat ovsdb-server.pid`' + AT_CHECK([ovsdb-client -vjsonrpc --pidfile --detach --no-chdir -d json monitor-cond --format=csv unix:socket $4 '[$8]' $5 $9 > output], + [0], [ignore], [ignore]) + on_exit 'kill `cat ovsdb-client.pid`' m4_foreach([txn], [$6], [AT_CHECK([ovsdb-client transact unix:socket 'txn'], [0], [ignore], [ignore], [kill `cat server-pid client-pid`])]) - if test "$IS_WIN32" = "yes"; then - : - m4_foreach([cond], [$10], - [AT_CHECK([ovs-appctl -t "`pwd`"/ovsdb-client.ctl 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 + m4_foreach([cond], [$10], + [AT_CHECK([ovs-appctl -t ovsdb-client ovsdb-client/cond_change $5 'cond'], [0], [ignore], [ignore])]) AT_CHECK([ovsdb-client transact unix:socket '[["$4"]]'], [0], - [ignore], [ignore], [kill `cat server-pid client-pid`]) - AT_CHECK([ovs-appctl -t "`pwd`"/unixctl -e exit], [0], [ignore], [ignore]) - OVS_WAIT_UNTIL([test ! -e server-pid && test ! -e client-pid]) + [ignore], [ignore]) + AT_CHECK([ovs-appctl -t ovsdb-server -e exit], [0], [ignore], [ignore]) + 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_CLEANUP]) diff --git a/tests/ovsdb-server.at b/tests/ovsdb-server.at index 89a5bf9d61e..d04941bc618 100644 --- a/tests/ovsdb-server.at +++ b/tests/ovsdb-server.at @@ -1,7 +1,7 @@ AT_BANNER([OVSDB -- ovsdb-server transactions (Unix sockets)]) -m4_define([OVSDB_SERVER_SHUTDOWN], - [OVS_APP_EXIT_AND_WAIT_BY_TARGET([`pwd`/unixctl], [`pwd`/pid])]) +m4_define([OVSDB_SERVER_SHUTDOWN], + [OVS_APP_EXIT_AND_WAIT_BY_TARGET([ovsdb-server], [ovsdb-server.pid])]) m4_define([OVSDB_SERVER_SHUTDOWN2], [cp pid2 savepid2 @@ -27,7 +27,7 @@ m4_define([OVSDB_CHECK_EXECUTION], AT_KEYWORDS([ovsdb server positive unix $5]) $2 > schema 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], [AT_CHECK([ovsdb-client transact unix:socket 'txn'], [0], [stdout], [ignore], [test ! -e pid || kill `cat pid`]) @@ -54,7 +54,7 @@ AT_DATA([txnfile], [[ovsdb-client transact unix:socket \ "table": "ordinals", "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 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. @@ -65,7 +65,7 @@ AT_DATA([txnfile], [[ovsdb-client transact unix:socket \ "table": "ordinals", "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], [0], [ignore]) cat stdout >> output @@ -79,7 +79,7 @@ AT_DATA([txnfile], [[ovsdb-client transact unix:socket \ "where": [], "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 AT_CHECK([${PERL} $srcdir/uuidfilt.pl output], [0], [[[{"uuid":["uuid","<0>"]}] @@ -101,7 +101,7 @@ AT_DATA([txnfile], [[ovsdb-client transact unix:socket \ "table": "ordinals", "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 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. @@ -113,7 +113,7 @@ AT_DATA([txnfile], [[ovsdb-client transact unix:socket \ "table": "ordinals", "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], [0], [ignore]) cat stdout >> output @@ -127,7 +127,7 @@ AT_DATA([txnfile], [[ovsdb-client transact unix:socket \ "where": [], "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 AT_CHECK([${PERL} $srcdir/uuidfilt.pl output], [0], [[[{"uuid":["uuid","<0>"]}] @@ -141,7 +141,7 @@ AT_SETUP([ovsdb-client get-schema-version]) AT_KEYWORDS([ovsdb server positive]) ordinal_schema > schema 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 ]) OVSDB_SERVER_SHUTDOWN @@ -153,7 +153,7 @@ ordinal_schema > schema1 constraint_schema > schema2 AT_CHECK([ovsdb-tool create db1 schema1], [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( [[ovsdb-client list-dbs unix:socket]], [0], [constraints @@ -526,11 +526,11 @@ AT_CHECK( "ca_cert": "'"$PKIDIR/testpki-cacert.pem"'"}}]']], [0], [ignore], [ignore]) 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 \ --certificate=db:mydb,SSL,certificate \ --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]) PARSE_LISTENING_PORT([ovsdb-server.log], [SSL_PORT]) AT_CHECK( @@ -565,7 +565,7 @@ ln -s dir/.db.~lock~ .db.~lock~ AT_SKIP_IF([test ! -h db || test ! -h .db.~lock~]) AT_CHECK([ovsdb-tool create db schema], [0], [ignore], [ignore]) 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]) dnl Do a bunch of random transactions that put crap in the database log. AT_CHECK( @@ -631,7 +631,7 @@ _uuid name number <5> zero 0 @&t@ ], [], [test ! -e pid || kill `cat pid`]) 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`]) 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~. @@ -806,7 +806,7 @@ m4_define([OVSDB_CHECK_EXECUTION], $2 > schema PKIDIR=$abs_top_builddir/tests 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]) 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], @@ -844,7 +844,7 @@ m4_define([OVSDB_CHECK_EXECUTION], $2 > schema PKIDIR=$abs_top_builddir/tests 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]) 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], @@ -864,7 +864,7 @@ AT_SETUP([ovsdb-client get-schema-version - tcp socket]) AT_KEYWORDS([ovsdb server positive tcp]) ordinal_schema > schema 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]) 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 PKIDIR=$abs_top_builddir/tests 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]) m4_foreach([txn], [$3], [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 PKIDIR=$abs_top_builddir/tests 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]) m4_foreach([txn], [$3], [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], [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 ]) 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 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 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`' 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 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`' - 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`' 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 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`' -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`' 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 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`' -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`' 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 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`' -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`' AT_CHECK([ovsdb-client transact unix:db.sock \ diff --git a/tests/ovsdb-tool.at b/tests/ovsdb-tool.at index 3c2e6280864..dfac888394c 100644 --- a/tests/ovsdb-tool.at +++ b/tests/ovsdb-tool.at @@ -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}}} ]]) 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]) AT_CHECK([${PERL} $srcdir/uuidfilt.pl stdout], [0], [dnl ordinals table @@ -138,7 +138,7 @@ dnl in it now. AT_CAPTURE_FILE([db]) AT_CHECK([test `wc -l < db` -eq 4]) dnl And check that the dumped data is the same too: -AT_CHECK([[ovsdb-server --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]) AT_CHECK([${PERL} $srcdir/uuidfilt.pl stdout], [0], [dnl ordinals table diff --git a/tests/vtep-ctl.at b/tests/vtep-ctl.at index f0511ad7151..2b0df67c17f 100644 --- a/tests/vtep-ctl.at +++ b/tests/vtep-ctl.at @@ -19,7 +19,7 @@ dnl Creates an empty database in the current directory and then starts dnl an ovsdb-server on it for vtep-ctl to connect to. m4_define([VTEP_CTL_SETUP], [VTEP_OVSDB_INIT([db]) - AT_CHECK([ovsdb-server --detach --no-chdir --pidfile="`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