diff mbox

[ovs-dev,v2,01/14] tests: Automatically initialize OVS_*DIR vars when tests begin.

Message ID 1441237451-17940-1-git-send-email-blp@nicira.com
State Accepted
Headers show

Commit Message

Ben Pfaff Sept. 2, 2015, 11:43 p.m. UTC
A lot of tests need to initialize the OVS_RUNDIR, OVS_LOGDIR, etc.
variables to point to the directory in which the tests run.  Until now,
each of them has had to do this individually, which is redundant.  This
commit starts to do this automatically.

Signed-off-by: Ben Pfaff <blp@nicira.com>
---
 tests/jsonrpc-py.at          |  3 ---
 tests/jsonrpc.at             |  3 ---
 tests/library.at             |  1 -
 tests/ofproto-macros.at      |  8 +-------
 tests/ovn-controller-vtep.at |  5 -----
 tests/ovn-sbctl.at           |  7 +------
 tests/ovs-macros.at          | 18 ++++++++++++++++++
 tests/ovs-monitor-ipsec.at   |  3 ---
 tests/ovs-vsctl.at           |  2 --
 tests/ovs-vswitchd.at        |  4 ----
 tests/ovs-xapi-sync.at       |  3 ---
 tests/ovsdb-execution.at     |  1 -
 tests/ovsdb-idl.at           |  8 --------
 tests/ovsdb-macros.at        |  3 +--
 tests/ovsdb-monitor.at       |  1 -
 tests/ovsdb-server.at        | 33 ---------------------------------
 tests/ovsdb-tool.at          |  4 ----
 tests/unixctl-py.at          |  6 ------
 tests/vconn.at               |  1 -
 tests/vlog.at                | 24 ------------------------
 tests/vtep-ctl.at            |  3 +--
 21 files changed, 22 insertions(+), 119 deletions(-)

Comments

Andy Zhou Sept. 8, 2015, 11:50 p.m. UTC | #1
Nice!

Acked-by: Andy Zhou <azhou@nicira.com>

On Wed, Sep 2, 2015 at 4:43 PM, Ben Pfaff <blp@nicira.com> wrote:
> A lot of tests need to initialize the OVS_RUNDIR, OVS_LOGDIR, etc.
> variables to point to the directory in which the tests run.  Until now,
> each of them has had to do this individually, which is redundant.  This
> commit starts to do this automatically.
>
> Signed-off-by: Ben Pfaff <blp@nicira.com>
> ---
>  tests/jsonrpc-py.at          |  3 ---
>  tests/jsonrpc.at             |  3 ---
>  tests/library.at             |  1 -
>  tests/ofproto-macros.at      |  8 +-------
>  tests/ovn-controller-vtep.at |  5 -----
>  tests/ovn-sbctl.at           |  7 +------
>  tests/ovs-macros.at          | 18 ++++++++++++++++++
>  tests/ovs-monitor-ipsec.at   |  3 ---
>  tests/ovs-vsctl.at           |  2 --
>  tests/ovs-vswitchd.at        |  4 ----
>  tests/ovs-xapi-sync.at       |  3 ---
>  tests/ovsdb-execution.at     |  1 -
>  tests/ovsdb-idl.at           |  8 --------
>  tests/ovsdb-macros.at        |  3 +--
>  tests/ovsdb-monitor.at       |  1 -
>  tests/ovsdb-server.at        | 33 ---------------------------------
>  tests/ovsdb-tool.at          |  4 ----
>  tests/unixctl-py.at          |  6 ------
>  tests/vconn.at               |  1 -
>  tests/vlog.at                | 24 ------------------------
>  tests/vtep-ctl.at            |  3 +--
>  21 files changed, 22 insertions(+), 119 deletions(-)
>
> diff --git a/tests/jsonrpc-py.at b/tests/jsonrpc-py.at
> index 026d49a..3d3bd3b 100644
> --- a/tests/jsonrpc-py.at
> +++ b/tests/jsonrpc-py.at
> @@ -2,7 +2,6 @@ AT_BANNER([JSON-RPC - Python])
>
>  AT_SETUP([JSON-RPC request and successful reply - Python])
>  AT_SKIP_IF([test $HAVE_PYTHON = no])
> -OVS_RUNDIR=`pwd`; export OVS_RUNDIR
>  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`])
> @@ -15,7 +14,6 @@ AT_CLEANUP
>
>  AT_SETUP([JSON-RPC request and error reply - Python])
>  AT_SKIP_IF([test $HAVE_PYTHON = no])
> -OVS_RUNDIR=`pwd`; export OVS_RUNDIR
>  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`])
> @@ -28,7 +26,6 @@ AT_CLEANUP
>
>  AT_SETUP([JSON-RPC notification - Python])
>  AT_SKIP_IF([test $HAVE_PYTHON = no])
> -OVS_RUNDIR=`pwd`; export OVS_RUNDIR
>  AT_CHECK([$PYTHON $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.
> diff --git a/tests/jsonrpc.at b/tests/jsonrpc.at
> index e06b5b6..ab16594 100644
> --- a/tests/jsonrpc.at
> +++ b/tests/jsonrpc.at
> @@ -1,7 +1,6 @@
>  AT_BANNER([JSON-RPC - C])
>
>  AT_SETUP([JSON-RPC request and successful reply])
> -OVS_RUNDIR=`pwd`; export OVS_RUNDIR
>  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`])
> @@ -13,7 +12,6 @@ AT_CHECK([kill `cat pid`])
>  AT_CLEANUP
>
>  AT_SETUP([JSON-RPC request and error reply])
> -OVS_RUNDIR=`pwd`; export OVS_RUNDIR
>  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`])
> @@ -25,7 +23,6 @@ AT_CHECK([kill `cat pid`])
>  AT_CLEANUP
>
>  AT_SETUP([JSON-RPC notification])
> -OVS_RUNDIR=`pwd`; export OVS_RUNDIR
>  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.
> diff --git a/tests/library.at b/tests/library.at
> index 6e04991..d5dcb12 100644
> --- a/tests/library.at
> +++ b/tests/library.at
> @@ -174,7 +174,6 @@ AT_CHECK([$PYTHON $abs_srcdir/test-unix-socket.py ../$longname/socket socket])
>  AT_CLEANUP
>
>  AT_SETUP([ovs_assert])
> -OVS_LOGDIR=`pwd`; export OVS_LOGDIR
>  if test "$IS_WIN32" = "yes"; then
>    exit_status=9
>  else
> diff --git a/tests/ofproto-macros.at b/tests/ofproto-macros.at
> index 0dc208e..a21887a 100644
> --- a/tests/ofproto-macros.at
> +++ b/tests/ofproto-macros.at
> @@ -42,7 +42,6 @@ s/No error/Success/
>  #
>  # Here's an example of how to use this with ovsdb-server:
>  #
> -#    OVS_LOGDIR=`pwd`; export OVS_LOGDIR
>  #    ovsdb-server --log-file --remote=ptcp:0:127.0.0.1 ...
>  #    TCP_PORT=`parse_listening_port < ovsdb-server.log`
>  parse_listening_port () {
> @@ -62,12 +61,7 @@ m4_define([TESTABLE_LOG], [-vPATTERN:ANY:'%c|%p|%m'])
>  # Starts ovs-vswitchd, with additional arguments 'vswitchd-aux-args'.
>  #
>  m4_define([_OVS_VSWITCHD_START],
> -  [OVS_RUNDIR=`pwd`; export OVS_RUNDIR
> -   OVS_LOGDIR=`pwd`; export OVS_LOGDIR
> -   OVS_DBDIR=`pwd`; export OVS_DBDIR
> -   OVS_SYSCONFDIR=`pwd`; export OVS_SYSCONFDIR
> -
> -   dnl Create database.
> +  [dnl Create database.
>     touch .conf.db.~lock~
>     AT_CHECK([ovsdb-tool create conf.db $abs_top_srcdir/vswitchd/vswitch.ovsschema])
>
> diff --git a/tests/ovn-controller-vtep.at b/tests/ovn-controller-vtep.at
> index 063feeb..83badf9 100644
> --- a/tests/ovn-controller-vtep.at
> +++ b/tests/ovn-controller-vtep.at
> @@ -16,11 +16,6 @@ m4_define([OVN_CONTROLLER_VTEP_START],
>     # this will cause skip when 'make check' using Windows setup.
>     AT_SKIP_IF([test $HAVE_PYTHON = no])
>
> -   OVS_RUNDIR=`pwd`; export OVS_RUNDIR
> -   OVS_LOGDIR=`pwd`; export OVS_LOGDIR
> -   OVS_DBDIR=`pwd`; export OVS_DBDIR
> -   OVS_SYSCONFDIR=`pwd`; export OVS_SYSCONFDIR
> -
>     dnl Create databases (ovn-nb, ovn-sb, vtep).
>     AT_CHECK([ovsdb-tool create vswitchd.db $abs_top_srcdir/vswitchd/vswitch.ovsschema])
>     for daemon in ovn-nb ovn-sb vtep; do
> diff --git a/tests/ovn-sbctl.at b/tests/ovn-sbctl.at
> index 16968fd..32e34bd 100644
> --- a/tests/ovn-sbctl.at
> +++ b/tests/ovn-sbctl.at
> @@ -2,12 +2,7 @@ AT_BANNER([ovn_controller_gw])
>
>  # OVN_SBCTL_TEST_START
>  m4_define([OVN_SBCTL_TEST_START],
> -  [OVS_RUNDIR=`pwd`; export OVS_RUNDIR
> -   OVS_LOGDIR=`pwd`; export OVS_LOGDIR
> -   OVS_DBDIR=`pwd`; export OVS_DBDIR
> -   OVS_SYSCONFDIR=`pwd`; export OVS_SYSCONFDIR
> -
> -   dnl Create databases (ovn-nb, ovn-sb).
> +  [dnl Create databases (ovn-nb, ovn-sb).
>     for daemon in ovn-nb ovn-sb; do
>        AT_CHECK([ovsdb-tool create $daemon.db $abs_top_srcdir/${daemon%%-*}/${daemon}.ovsschema])
>     done
> diff --git a/tests/ovs-macros.at b/tests/ovs-macros.at
> index d550204..c36ad06 100644
> --- a/tests/ovs-macros.at
> +++ b/tests/ovs-macros.at
> @@ -4,8 +4,26 @@ AT_TESTED([perl])
>
>  m4_include([m4/compat.at])
>
> +dnl Make AT_SETUP automatically run the ovs_init() shell function
> +dnl as the first step in every test.
> +m4_rename([AT_SETUP], [OVS_AT_SETUP])
> +m4_define([AT_SETUP], [OVS_AT_SETUP($@)
> +ovs_init
> +])
>  m4_divert_push([PREPARE_TESTS])
>  [
> +# Set ovs_base to the base directory in which the test is running and
> +# initialize the OVS_*DIR environment variables to point to this
> +# directory.
> +ovs_init() {
> +    ovs_base=`pwd`
> +    OVS_RUNDIR=$ovs_base; export OVS_RUNDIR
> +    OVS_LOGDIR=$ovs_base; export OVS_LOGDIR
> +    OVS_DBDIR=$ovs_base; export OVS_DBDIR
> +    OVS_SYSCONFDIR=$ovs_base; export OVS_SYSCONFDIR
> +    OVS_PKGDATADIR=$ovs_base; export OVS_PKGDATADIR
> +}
> +
>  ovs_wait () {
>      # First try a quick sleep, so that the test completes very quickly
>      # in the normal case.  POSIX doesn't require fractional times to
> diff --git a/tests/ovs-monitor-ipsec.at b/tests/ovs-monitor-ipsec.at
> index 67705fa..16f11cf 100644
> --- a/tests/ovs-monitor-ipsec.at
> +++ b/tests/ovs-monitor-ipsec.at
> @@ -4,9 +4,6 @@ AT_SETUP([ovs-monitor-ipsec])
>  AT_SKIP_IF([test $HAVE_PYTHON = no])
>  AT_SKIP_IF([$non_ascii_cwd])
>
> -OVS_RUNDIR=`pwd`; export OVS_RUNDIR
> -OVS_DBDIR=`pwd`; export OVS_DBDIR
> -OVS_PKGDATADIR=`pwd`; export OVS_PKGDATADIR
>  cp "$top_srcdir/vswitchd/vswitch.ovsschema" .
>
>  ON_EXIT([kill `cat pid ovs-monitor-ipsec.pid`])
> diff --git a/tests/ovs-vsctl.at b/tests/ovs-vsctl.at
> index fef7b88..d88ea27 100644
> --- a/tests/ovs-vsctl.at
> +++ b/tests/ovs-vsctl.at
> @@ -143,8 +143,6 @@ dnl ----------------------------------------------------------------------
>  AT_BANNER([ovs-vsctl unit tests])
>
>  AT_SETUP([ovs-vsctl connection retry])
> -OVS_RUNDIR=$PWD; export OVS_RUNDIR
> -
>  dnl Without --retry, there should be no retry for active connections.
>  AT_CHECK([ovs-vsctl --db=unix:foo --timeout=10 -vreconnect:emer -- init],
>    [1], [], [stderr])
> diff --git a/tests/ovs-vswitchd.at b/tests/ovs-vswitchd.at
> index 912354f..12a179a 100644
> --- a/tests/ovs-vswitchd.at
> +++ b/tests/ovs-vswitchd.at
> @@ -5,10 +5,6 @@ dnl Open_vSwitch record) visible to ovs-vswitchd, but hand-rolled scripts
>  dnl sometimes do.  At one point, "ovs-vswitchd --detach" would never detach
>  dnl and use 100% CPU if this happened, so this test checks for regression.
>  AT_SETUP([ovs-vswitchd detaches correctly with empty db])
> -OVS_RUNDIR=`pwd`; export OVS_RUNDIR
> -OVS_LOGDIR=`pwd`; export OVS_LOGDIR
> -OVS_DBDIR=`pwd`; export OVS_DBDIR
> -OVS_SYSCONFDIR=`pwd`; export OVS_SYSCONFDIR
>  ON_EXIT([kill `cat ovsdb-server.pid ovs-vswitchd.pid`])
>
>  dnl Create database.
> diff --git a/tests/ovs-xapi-sync.at b/tests/ovs-xapi-sync.at
> index b55eecd..08e32e2 100644
> --- a/tests/ovs-xapi-sync.at
> +++ b/tests/ovs-xapi-sync.at
> @@ -8,9 +8,6 @@ cp "$top_srcdir/tests/MockXenAPI.py" XenAPI.py
>  PYTHONPATH=`pwd`:$PYTHONPATH
>  export PYTHONPATH
>
> -OVS_RUNDIR=`pwd`; export OVS_RUNDIR
> -OVS_DBDIR=`pwd`; export OVS_DBDIR
> -OVS_PKGDATADIR=`pwd`; export OVS_PKGDATADIR
>  cp "$top_srcdir/vswitchd/vswitch.ovsschema" .
>
>  cp "$top_srcdir/xenserver/usr_share_openvswitch_scripts_ovs-xapi-sync" \
> diff --git a/tests/ovsdb-execution.at b/tests/ovsdb-execution.at
> index 949ed59..94630bd 100644
> --- a/tests/ovsdb-execution.at
> +++ b/tests/ovsdb-execution.at
> @@ -138,7 +138,6 @@ m4_divert_pop([PREPARE_TESTS])
>  m4_define([OVSDB_CHECK_EXECUTION],
>    [AT_SETUP([$1])
>     AT_KEYWORDS([ovsdb execute execution positive $5])
> -   OVS_RUNDIR=`pwd`; export OVS_RUNDIR
>     AT_CHECK([test-ovsdb execute "`$2`" m4_foreach([txn], [$3], [ 'txn'])],
>       [0], [stdout], [])
>     AT_CHECK([${PERL} $srcdir/uuidfilt.pl stdout], [0], [$4])
> diff --git a/tests/ovsdb-idl.at b/tests/ovsdb-idl.at
> index 11b8b36..f4d03f8 100644
> --- a/tests/ovsdb-idl.at
> +++ b/tests/ovsdb-idl.at
> @@ -1,6 +1,5 @@
>  AT_BANNER([OVSDB -- interface description language (IDL)])
>
> -OVS_RUNDIR=`pwd`; export OVS_RUNDIR
>  # OVSDB_CHECK_IDL_C(TITLE, [PRE-IDL-TXN], TRANSACTIONS, OUTPUT, [KEYWORDS],
>  #                   [FILTER])
>  #
> @@ -20,7 +19,6 @@ OVS_RUNDIR=`pwd`; export OVS_RUNDIR
>  m4_define([OVSDB_CHECK_IDL_C],
>    [AT_SETUP([$1 - C])
>     AT_KEYWORDS([ovsdb server idl positive $5])
> -   OVS_RUNDIR=`pwd`; export OVS_RUNDIR
>     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])
> @@ -38,7 +36,6 @@ m4_define([OVSDB_CHECK_IDL_PY],
>    [AT_SETUP([$1 - Python])
>     AT_SKIP_IF([test $HAVE_PYTHON = no])
>     AT_KEYWORDS([ovsdb server idl positive Python $5])
> -   OVS_RUNDIR=`pwd`; export OVS_RUNDIR
>     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])
> @@ -56,8 +53,6 @@ m4_define([OVSDB_CHECK_IDL_TCP_PY],
>    [AT_SETUP([$1 - Python tcp])
>     AT_SKIP_IF([test $HAVE_PYTHON = no])
>     AT_KEYWORDS([ovsdb server idl positive Python with tcp socket $5])
> -   OVS_RUNDIR=`pwd`; export OVS_RUNDIR
> -   OVS_LOGDIR=`pwd`; export OVS_LOGDIR
>     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])
> @@ -78,8 +73,6 @@ m4_define([OVSDB_CHECK_IDL_TCP6_PY],
>     AT_SKIP_IF([test $HAVE_PYTHON = no])
>     AT_SKIP_IF([test $HAVE_IPV6 = no])
>     AT_KEYWORDS([ovsdb server idl positive Python with tcp6 socket $5])
> -   OVS_RUNDIR=`pwd`; export OVS_RUNDIR
> -   OVS_LOGDIR=`pwd`; export OVS_LOGDIR
>     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])
> @@ -517,7 +510,6 @@ OVSDB_CHECK_IDL_PY([row-from-json idl, whats this],
>
>  AT_SETUP([idl handling of missing tables and columns - C])
>  AT_KEYWORDS([ovsdb server idl positive])
> -OVS_RUNDIR=`pwd`; export OVS_RUNDIR
>
>  # idltest2.ovsschema is the same as idltest.ovsschema, except that
>  # table link2 and column l2 have been deleted.  But the IDL still
> diff --git a/tests/ovsdb-macros.at b/tests/ovsdb-macros.at
> index 2aa752b..c1aa619 100644
> --- a/tests/ovsdb-macros.at
> +++ b/tests/ovsdb-macros.at
> @@ -2,8 +2,7 @@ dnl OVSDB_INIT([$1])
>  dnl
>  dnl Creates an empty database named $1.
>  m4_define([OVSDB_INIT],
> -  [OVS_RUNDIR=`pwd`; export OVS_RUNDIR
> -   AT_CHECK(
> +  [AT_CHECK(
>       [ovsdb-tool create $1 $abs_top_srcdir/vswitchd/vswitch.ovsschema],
>       [0], [stdout], [ignore])
>     AT_CHECK(
> diff --git a/tests/ovsdb-monitor.at b/tests/ovsdb-monitor.at
> index 016aa2c..0dbf5b0 100644
> --- a/tests/ovsdb-monitor.at
> +++ b/tests/ovsdb-monitor.at
> @@ -19,7 +19,6 @@ AT_BANNER([OVSDB -- ovsdb-server monitors])
>  m4_define([OVSDB_CHECK_MONITOR],
>    [AT_SETUP([$1])
>     AT_KEYWORDS([ovsdb server monitor positive $9])
> -   OVS_RUNDIR=`pwd`; export OVS_RUNDIR
>     $2 > schema
>     AT_CHECK([ovsdb-tool create db schema], [0], [stdout], [ignore])
>     m4_foreach([txn], [$3],
> diff --git a/tests/ovsdb-server.at b/tests/ovsdb-server.at
> index 8fce70e..a447e79 100644
> --- a/tests/ovsdb-server.at
> +++ b/tests/ovsdb-server.at
> @@ -21,7 +21,6 @@ m4_define([OVSDB_SERVER_SHUTDOWN],
>  # TITLE is provided to AT_SETUP and KEYWORDS to AT_KEYWORDS.
>  m4_define([OVSDB_CHECK_EXECUTION],
>    [AT_SETUP([$1])
> -  OVS_RUNDIR=`pwd`; export OVS_RUNDIR
>     AT_KEYWORDS([ovsdb server positive unix $5])
>     $2 > schema
>     AT_CHECK([ovsdb-tool create db schema], [0], [stdout], [ignore])
> @@ -43,7 +42,6 @@ AT_BANNER([ovsdb-server miscellaneous features])
>  AT_SETUP([truncating corrupted database log])
>  AT_KEYWORDS([ovsdb server positive unix])
>  AT_SKIP_IF([test "$IS_WIN32" = "yes"])
> -OVS_RUNDIR=`pwd`; export OVS_RUNDIR
>  ordinal_schema > schema
>  AT_CHECK([ovsdb-tool create db schema], [0], [stdout], [ignore])
>  dnl Do one transaction and save the output.
> @@ -91,7 +89,6 @@ AT_CLEANUP
>  AT_SETUP([truncating database log with bad transaction])
>  AT_KEYWORDS([ovsdb server positive unix])
>  AT_SKIP_IF([test "$IS_WIN32" = "yes"])
> -OVS_RUNDIR=`pwd`; export OVS_RUNDIR
>  ordinal_schema > schema
>  AT_CHECK([ovsdb-tool create db schema], [0], [stdout], [ignore])
>  dnl Do one transaction and save the output.
> @@ -139,7 +136,6 @@ AT_CLEANUP
>
>  AT_SETUP([ovsdb-client get-schema-version])
>  AT_KEYWORDS([ovsdb server positive])
> -OVS_RUNDIR=`pwd`; export OVS_RUNDIR
>  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])
> @@ -150,7 +146,6 @@ AT_CLEANUP
>
>  AT_SETUP([database multiplexing implementation])
>  AT_KEYWORDS([ovsdb server positive])
> -OVS_RUNDIR=`pwd`; export OVS_RUNDIR
>  ordinal_schema > schema1
>  constraint_schema > schema2
>  AT_CHECK([ovsdb-tool create db1 schema1], [0], [ignore], [ignore])
> @@ -171,8 +166,6 @@ AT_CLEANUP
>  AT_SETUP([ovsdb-server/add-db and remove-db])
>  AT_KEYWORDS([ovsdb server positive])
>  ON_EXIT([kill `cat ovsdb-server.pid`])
> -OVS_RUNDIR=`pwd`; export OVS_RUNDIR
> -OVS_LOGDIR=`pwd`; export OVS_LOGDIR
>  ordinal_schema > schema1
>  constraint_schema > schema2
>  AT_CHECK([ovsdb-tool create db1 schema1], [0], [ignore], [ignore])
> @@ -257,8 +250,6 @@ AT_SETUP([ovsdb-server/add-db with --monitor])
>  AT_KEYWORDS([ovsdb server positive])
>  AT_SKIP_IF([test "$IS_WIN32" = "yes"])
>  # Start ovsdb-server, initially with one db.
> -OVS_RUNDIR=`pwd`; export OVS_RUNDIR
> -OVS_LOGDIR=`pwd`; export OVS_LOGDIR
>  ordinal_schema > schema
>  AT_CHECK([ovsdb-tool create db1 schema], [0], [ignore], [ignore])
>  ON_EXIT([kill `cat *.pid`])
> @@ -290,8 +281,6 @@ AT_SETUP([ovsdb-server/add-db and remove-db with --monitor])
>  AT_KEYWORDS([ovsdb server positive])
>  AT_SKIP_IF([test "$IS_WIN32" = "yes"])
>  # Start ovsdb-server, initially with one db.
> -OVS_RUNDIR=`pwd`; export OVS_RUNDIR
> -OVS_LOGDIR=`pwd`; export OVS_LOGDIR
>  ordinal_schema > schema
>  AT_CHECK([ovsdb-tool create db1 schema], [0], [ignore], [ignore])
>  constraint_schema > schema2
> @@ -319,8 +308,6 @@ AT_CLEANUP
>
>  AT_SETUP([--remote=db: implementation])
>  AT_KEYWORDS([ovsdb server positive])
> -OVS_RUNDIR=`pwd`; export OVS_RUNDIR
> -OVS_LOGDIR=`pwd`; export OVS_LOGDIR
>  AT_DATA([schema],
>    [[{"name": "mydb",
>       "tables": {
> @@ -384,8 +371,6 @@ AT_CLEANUP
>
>  AT_SETUP([ovsdb-server/add-remote and remove-remote])
>  AT_KEYWORDS([ovsdb server positive])
> -OVS_RUNDIR=`pwd`; export OVS_RUNDIR
> -OVS_LOGDIR=`pwd`; export OVS_LOGDIR
>  ordinal_schema > schema
>  AT_CHECK([ovsdb-tool create db schema], [0], [ignore], [ignore])
>  ON_EXIT([kill `cat *.pid`])
> @@ -440,8 +425,6 @@ AT_SETUP([ovsdb-server/add-remote with --monitor])
>  AT_KEYWORDS([ovsdb server positive])
>  AT_SKIP_IF([test "$IS_WIN32" = "yes"])
>  # Start ovsdb-server, initially with no remotes.
> -OVS_RUNDIR=`pwd`; export OVS_RUNDIR
> -OVS_LOGDIR=`pwd`; export OVS_LOGDIR
>  ordinal_schema > schema
>  AT_CHECK([ovsdb-tool create db schema], [0], [ignore], [ignore])
>  ON_EXIT([kill `cat *.pid`])
> @@ -471,8 +454,6 @@ AT_SETUP([ovsdb-server/add-remote and remove-remote with --monitor])
>  AT_KEYWORDS([ovsdb server positive])
>  AT_SKIP_IF([test "$IS_WIN32" = "yes"])
>  # Start ovsdb-server, initially with no remotes.
> -OVS_RUNDIR=`pwd`; export OVS_RUNDIR
> -OVS_LOGDIR=`pwd`; export OVS_LOGDIR
>  ordinal_schema > schema
>  AT_CHECK([ovsdb-tool create db schema], [0], [ignore], [ignore])
>  ON_EXIT([kill `cat *.pid`])
> @@ -530,7 +511,6 @@ AT_CHECK(
>                  "certificate": "'"$PKIDIR/testpki-cert2.pem"'",
>                  "ca_cert": "'"$PKIDIR/testpki-cacert.pem"'"}}]']],
>    [0], [ignore], [ignore])
> -OVS_LOGDIR=`pwd`; export OVS_LOGDIR
>  AT_CHECK(
>    [ovsdb-server --log-file --detach --no-chdir --pidfile="`pwd`"/pid \
>          --private-key=db:mydb,SSL,private_key \
> @@ -561,7 +541,6 @@ AT_CLEANUP
>
>  AT_SETUP([compacting online])
>  AT_KEYWORDS([ovsdb server compact])
> -OVS_RUNDIR=`pwd`; export OVS_RUNDIR
>  ordinal_schema > schema
>  dnl Make sure that "ovsdb-tool create" works with a dangling symlink for
>  dnl the database and the lockfile, creating the target of each symlink rather
> @@ -693,8 +672,6 @@ OVSDB_SERVER_SHUTDOWN
>  AT_CLEANUP
>
>  AT_SETUP([ovsdb-server combines updates on backlogged connections])
> -OVS_LOGDIR=`pwd`; export OVS_LOGDIR
> -OVS_RUNDIR=`pwd`; export OVS_RUNDIR
>  ON_EXIT([kill `cat *.pid`])
>
>  # The maximum socket receive buffer size is important for this test, which
> @@ -812,8 +789,6 @@ m4_define([OVSDB_CHECK_EXECUTION],
>    [AT_SETUP([$1])
>     AT_KEYWORDS([ovsdb server positive ssl $5])
>     AT_SKIP_IF([test "$HAVE_OPENSSL" = no])
> -   OVS_RUNDIR=`pwd`; export OVS_RUNDIR
> -   OVS_LOGDIR=`pwd`; export OVS_LOGDIR
>     $2 > schema
>     PKIDIR=$abs_top_builddir/tests
>     AT_CHECK([ovsdb-tool create db schema], [0], [stdout], [ignore])
> @@ -852,8 +827,6 @@ m4_define([OVSDB_CHECK_EXECUTION],
>     AT_KEYWORDS([ovsdb server positive ssl6 $5])
>     AT_SKIP_IF([test "$HAVE_OPENSSL" = no])
>     AT_SKIP_IF([test $HAVE_IPV6 = no])
> -   OVS_RUNDIR=`pwd`; export OVS_RUNDIR
> -   OVS_LOGDIR=`pwd`; export OVS_LOGDIR
>     $2 > schema
>     PKIDIR=$abs_top_builddir/tests
>     AT_CHECK([ovsdb-tool create db schema], [0], [stdout], [ignore])
> @@ -877,7 +850,6 @@ 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])
> -OVS_LOGDIR=`pwd`; export OVS_LOGDIR
>  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])
>  TCP_PORT=`parse_listening_port < ovsdb-server.log`
>  AT_CHECK([ovsdb-client get-schema-version tcp:127.0.0.1:$TCP_PORT ordinals], [0], [5.1.3
> @@ -902,8 +874,6 @@ AT_CLEANUP])
>  m4_define([OVSDB_CHECK_EXECUTION],
>    [AT_SETUP([$1])
>     AT_KEYWORDS([ovsdb server positive tcp $5])
> -   OVS_RUNDIR=`pwd`; export OVS_RUNDIR
> -   OVS_LOGDIR=`pwd`; export OVS_LOGDIR
>     $2 > schema
>     PKIDIR=$abs_top_builddir/tests
>     AT_CHECK([ovsdb-tool create db schema], [0], [stdout], [ignore])
> @@ -941,8 +911,6 @@ m4_define([OVSDB_CHECK_EXECUTION],
>    [AT_SETUP([$1])
>     AT_KEYWORDS([ovsdb server positive tcp6 $5])
>     AT_SKIP_IF([test $HAVE_IPV6 = no])
> -   OVS_RUNDIR=`pwd`; export OVS_RUNDIR
> -   OVS_LOGDIR=`pwd`; export OVS_LOGDIR
>     $2 > schema
>     PKIDIR=$abs_top_builddir/tests
>     AT_CHECK([ovsdb-tool create db schema], [0], [stdout], [ignore])
> @@ -983,7 +951,6 @@ m4_define([OVSDB_CHECK_EXECUTION],
>    [AT_SETUP([$1])
>     AT_SKIP_IF([test "$IS_WIN32" = "yes"])
>     AT_KEYWORDS([ovsdb server positive transient $5])
> -   OVS_RUNDIR=`pwd`; export OVS_RUNDIR
>     $2 > schema
>     AT_CHECK([ovsdb-tool create db schema], [0], [stdout], [ignore])
>     m4_foreach([txn], [$3],
> diff --git a/tests/ovsdb-tool.at b/tests/ovsdb-tool.at
> index 0d3219b..3c2e628 100644
> --- a/tests/ovsdb-tool.at
> +++ b/tests/ovsdb-tool.at
> @@ -16,7 +16,6 @@ AT_BANNER([OVSDB -- ovsdb-tool])
>  m4_define([OVSDB_CHECK_EXECUTION],
>    [AT_SETUP([$1])
>     AT_KEYWORDS([ovsdb file positive $5])
> -   OVS_RUNDIR=`pwd`; export OVS_RUNDIR
>     $2 > schema
>     touch .db.~lock~
>     AT_CHECK([ovsdb-tool create db schema], [0], [stdout], [ignore])
> @@ -49,7 +48,6 @@ AT_CLEANUP
>
>  AT_SETUP([ovsdb-tool compact])
>  AT_KEYWORDS([ovsdb file positive])
> -OVS_RUNDIR=`pwd`; export OVS_RUNDIR
>  ordinal_schema > schema
>  dnl Make sure that "ovsdb-tool create" works with a dangling symlink,
>  dnl creating the target of the symlink rather than replacing the symlink
> @@ -157,7 +155,6 @@ AT_CLEANUP
>
>  AT_SETUP([ovsdb-tool convert -- removing a column])
>  AT_KEYWORDS([ovsdb file positive])
> -OVS_RUNDIR=`pwd`; export OVS_RUNDIR
>  ordinal_schema > schema
>  AT_DATA([new-schema],
>    [[{"name": "ordinals",
> @@ -225,7 +222,6 @@ AT_CLEANUP
>
>  AT_SETUP([ovsdb-tool convert -- adding a column])
>  AT_KEYWORDS([ovsdb file positive])
> -OVS_RUNDIR=`pwd`; export OVS_RUNDIR
>  AT_DATA([schema],
>    [[{"name": "ordinals",
>       "tables": {
> diff --git a/tests/unixctl-py.at b/tests/unixctl-py.at
> index 2fb7ee9..cd0ac23 100644
> --- a/tests/unixctl-py.at
> +++ b/tests/unixctl-py.at
> @@ -72,8 +72,6 @@ OVS_VSWITCHD_STOP
>  AT_CLEANUP
>
>  AT_SETUP([unixctl bad target - Python])
> -OVS_RUNDIR=`pwd`; export OVS_RUNDIR
> -OVS_DBDIR=`pwd`; export OVS_DBDIR
>  AT_SKIP_IF([test $HAVE_PYTHON = no])
>
>  AT_CHECK([PYAPPCTL -t bogus doit], [1], [], [stderr])
> @@ -90,10 +88,6 @@ AT_CLEANUP
>
>  AT_SETUP([unixctl server - Python])
>  AT_SKIP_IF([test $HAVE_PYTHON = no])
> -OVS_RUNDIR=`pwd`; export OVS_RUNDIR
> -OVS_LOGDIR=`pwd`; export OVS_LOGDIR
> -OVS_DBDIR=`pwd`; export OVS_DBDIR
> -OVS_SYSCONFDIR=`pwd`; export OVS_SYSCONFDIR
>  ON_EXIT([kill `cat test-unixctl.py.pid`])
>  AT_CAPTURE_FILE([`pwd`/test-unixctl.py.log])
>  AT_CHECK([$PYTHON $srcdir/test-unixctl.py --log-file --pidfile --detach])
> diff --git a/tests/vconn.at b/tests/vconn.at
> index 4e91ed8..397725d 100644
> --- a/tests/vconn.at
> +++ b/tests/vconn.at
> @@ -11,7 +11,6 @@ m4_define([TEST_VCONN_CLASS],
>        [send-short-hello],
>        [send-invalid-version-hello]],
>       [AT_SETUP([$1 vconn - m4_bpatsubst(testname, [-], [ ])])
> -     OVS_RUNDIR=`pwd`; export OVS_RUNDIR
>        m4_if([$1], [ssl], [
>          AT_SKIP_IF([test "$HAVE_OPENSSL" = no])
>          AT_CHECK([cp $abs_top_builddir/tests/testpki*.pem .])])
> diff --git a/tests/vlog.at b/tests/vlog.at
> index fdd6732..321ef2d 100644
> --- a/tests/vlog.at
> +++ b/tests/vlog.at
> @@ -103,10 +103,6 @@ AT_CLEANUP
>
>  AT_SETUP([vlog - vlog/reopen - Python])
>  AT_SKIP_IF([test $HAVE_PYTHON = no])
> -OVS_RUNDIR=`pwd`; export OVS_RUNDIR
> -OVS_LOGDIR=`pwd`; export OVS_LOGDIR
> -OVS_DBDIR=`pwd`; export OVS_DBDIR
> -OVS_SYSCONFDIR=`pwd`; export OVS_SYSCONFDIR
>  ON_EXIT([kill `cat test-unixctl.py.pid`])
>
>  AT_CAPTURE_FILE([log])
> @@ -132,10 +128,6 @@ AT_CLEANUP
>
>  AT_SETUP([vlog - vlog/reopen without log file - Python])
>  AT_SKIP_IF([test $HAVE_PYTHON = no])
> -OVS_RUNDIR=`pwd`; export OVS_RUNDIR
> -OVS_LOGDIR=`pwd`; export OVS_LOGDIR
> -OVS_DBDIR=`pwd`; export OVS_DBDIR
> -OVS_SYSCONFDIR=`pwd`; export OVS_SYSCONFDIR
>  ON_EXIT([kill `cat test-unixctl.py.pid`])
>
>  AT_CHECK([$PYTHON $srcdir/test-unixctl.py --pidfile --detach])
> @@ -155,10 +147,6 @@ AT_SKIP_IF([test $HAVE_PYTHON = no])
>  AT_SKIP_IF([test ! -c /dev/full])
>  AT_SKIP_IF([echo > /dev/full])
>
> -OVS_RUNDIR=`pwd`; export OVS_RUNDIR
> -OVS_LOGDIR=`pwd`; export OVS_LOGDIR
> -OVS_DBDIR=`pwd`; export OVS_DBDIR
> -OVS_SYSCONFDIR=`pwd`; export OVS_SYSCONFDIR
>  ON_EXIT([kill `cat test-unixctl.py.pid`])
>
>  AT_CHECK([$PYTHON $srcdir/test-unixctl.py --log-file=`pwd`/log --pidfile --detach])
> @@ -182,10 +170,6 @@ AT_CLEANUP
>
>  AT_SETUP([vlog - vlog/set and vlog/list - Python])
>  AT_SKIP_IF([test $HAVE_PYTHON = no])
> -OVS_RUNDIR=`pwd`; export OVS_RUNDIR
> -OVS_LOGDIR=`pwd`; export OVS_LOGDIR
> -OVS_DBDIR=`pwd`; export OVS_DBDIR
> -OVS_SYSCONFDIR=`pwd`; export OVS_SYSCONFDIR
>  ON_EXIT([kill `cat test-unixctl.py.pid`])
>
>  AT_CAPTURE_FILE([log])
> @@ -236,10 +220,6 @@ AT_CHECK([grep -q 'I<3OVS' log])
>  AT_CLEANUP
>
>  AT_SETUP([vlog - RFC5424 facility])
> -OVS_RUNDIR=`pwd`; export OVS_RUNDIR
> -OVS_LOGDIR=`pwd`; export OVS_LOGDIR
> -OVS_DBDIR=`pwd`; export OVS_DBDIR
> -OVS_SYSCONFDIR=`pwd`; export OVS_SYSCONFDIR
>  ON_EXIT([kill `cat ovsdb-server.pid`])
>
>  dnl Create database.
> @@ -278,10 +258,6 @@ AT_CLEANUP
>
>  AT_SETUP([vlog - RFC5424 facility - Python])
>  AT_SKIP_IF([test $HAVE_PYTHON = no])
> -OVS_RUNDIR=`pwd`; export OVS_RUNDIR
> -OVS_LOGDIR=`pwd`; export OVS_LOGDIR
> -OVS_DBDIR=`pwd`; export OVS_DBDIR
> -OVS_SYSCONFDIR=`pwd`; export OVS_SYSCONFDIR
>  ON_EXIT([kill `cat test-unixctl.py.pid`])
>
>  AT_CHECK([$PYTHON $srcdir/test-unixctl.py --log-file=`pwd`/log --pidfile \
> diff --git a/tests/vtep-ctl.at b/tests/vtep-ctl.at
> index bb2df4f..f4a7edf 100644
> --- a/tests/vtep-ctl.at
> +++ b/tests/vtep-ctl.at
> @@ -2,8 +2,7 @@ dnl VTEP_OVSDB_INIT([$1])
>  dnl
>  dnl Creates an empty database named $1.
>  m4_define([VTEP_OVSDB_INIT],
> -  [OVS_RUNDIR=`pwd`; export OVS_RUNDIR
> -   AT_CHECK(
> +  [AT_CHECK(
>       [ovsdb-tool create $1 $abs_top_srcdir/vtep/vtep.ovsschema],
>       [0], [stdout], [ignore])
>     AT_CHECK(
> --
> 2.1.3
>
> _______________________________________________
> dev mailing list
> dev@openvswitch.org
> http://openvswitch.org/mailman/listinfo/dev
Ben Pfaff Sept. 9, 2015, 5:24 p.m. UTC | #2
Thanks Andy, I applied this to master.

On Tue, Sep 08, 2015 at 04:50:03PM -0700, Andy Zhou wrote:
> Nice!
> 
> Acked-by: Andy Zhou <azhou@nicira.com>
> 
> On Wed, Sep 2, 2015 at 4:43 PM, Ben Pfaff <blp@nicira.com> wrote:
> > A lot of tests need to initialize the OVS_RUNDIR, OVS_LOGDIR, etc.
> > variables to point to the directory in which the tests run.  Until now,
> > each of them has had to do this individually, which is redundant.  This
> > commit starts to do this automatically.
> >
> > Signed-off-by: Ben Pfaff <blp@nicira.com>
> > ---
> >  tests/jsonrpc-py.at          |  3 ---
> >  tests/jsonrpc.at             |  3 ---
> >  tests/library.at             |  1 -
> >  tests/ofproto-macros.at      |  8 +-------
> >  tests/ovn-controller-vtep.at |  5 -----
> >  tests/ovn-sbctl.at           |  7 +------
> >  tests/ovs-macros.at          | 18 ++++++++++++++++++
> >  tests/ovs-monitor-ipsec.at   |  3 ---
> >  tests/ovs-vsctl.at           |  2 --
> >  tests/ovs-vswitchd.at        |  4 ----
> >  tests/ovs-xapi-sync.at       |  3 ---
> >  tests/ovsdb-execution.at     |  1 -
> >  tests/ovsdb-idl.at           |  8 --------
> >  tests/ovsdb-macros.at        |  3 +--
> >  tests/ovsdb-monitor.at       |  1 -
> >  tests/ovsdb-server.at        | 33 ---------------------------------
> >  tests/ovsdb-tool.at          |  4 ----
> >  tests/unixctl-py.at          |  6 ------
> >  tests/vconn.at               |  1 -
> >  tests/vlog.at                | 24 ------------------------
> >  tests/vtep-ctl.at            |  3 +--
> >  21 files changed, 22 insertions(+), 119 deletions(-)
> >
> > diff --git a/tests/jsonrpc-py.at b/tests/jsonrpc-py.at
> > index 026d49a..3d3bd3b 100644
> > --- a/tests/jsonrpc-py.at
> > +++ b/tests/jsonrpc-py.at
> > @@ -2,7 +2,6 @@ AT_BANNER([JSON-RPC - Python])
> >
> >  AT_SETUP([JSON-RPC request and successful reply - Python])
> >  AT_SKIP_IF([test $HAVE_PYTHON = no])
> > -OVS_RUNDIR=`pwd`; export OVS_RUNDIR
> >  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`])
> > @@ -15,7 +14,6 @@ AT_CLEANUP
> >
> >  AT_SETUP([JSON-RPC request and error reply - Python])
> >  AT_SKIP_IF([test $HAVE_PYTHON = no])
> > -OVS_RUNDIR=`pwd`; export OVS_RUNDIR
> >  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`])
> > @@ -28,7 +26,6 @@ AT_CLEANUP
> >
> >  AT_SETUP([JSON-RPC notification - Python])
> >  AT_SKIP_IF([test $HAVE_PYTHON = no])
> > -OVS_RUNDIR=`pwd`; export OVS_RUNDIR
> >  AT_CHECK([$PYTHON $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.
> > diff --git a/tests/jsonrpc.at b/tests/jsonrpc.at
> > index e06b5b6..ab16594 100644
> > --- a/tests/jsonrpc.at
> > +++ b/tests/jsonrpc.at
> > @@ -1,7 +1,6 @@
> >  AT_BANNER([JSON-RPC - C])
> >
> >  AT_SETUP([JSON-RPC request and successful reply])
> > -OVS_RUNDIR=`pwd`; export OVS_RUNDIR
> >  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`])
> > @@ -13,7 +12,6 @@ AT_CHECK([kill `cat pid`])
> >  AT_CLEANUP
> >
> >  AT_SETUP([JSON-RPC request and error reply])
> > -OVS_RUNDIR=`pwd`; export OVS_RUNDIR
> >  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`])
> > @@ -25,7 +23,6 @@ AT_CHECK([kill `cat pid`])
> >  AT_CLEANUP
> >
> >  AT_SETUP([JSON-RPC notification])
> > -OVS_RUNDIR=`pwd`; export OVS_RUNDIR
> >  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.
> > diff --git a/tests/library.at b/tests/library.at
> > index 6e04991..d5dcb12 100644
> > --- a/tests/library.at
> > +++ b/tests/library.at
> > @@ -174,7 +174,6 @@ AT_CHECK([$PYTHON $abs_srcdir/test-unix-socket.py ../$longname/socket socket])
> >  AT_CLEANUP
> >
> >  AT_SETUP([ovs_assert])
> > -OVS_LOGDIR=`pwd`; export OVS_LOGDIR
> >  if test "$IS_WIN32" = "yes"; then
> >    exit_status=9
> >  else
> > diff --git a/tests/ofproto-macros.at b/tests/ofproto-macros.at
> > index 0dc208e..a21887a 100644
> > --- a/tests/ofproto-macros.at
> > +++ b/tests/ofproto-macros.at
> > @@ -42,7 +42,6 @@ s/No error/Success/
> >  #
> >  # Here's an example of how to use this with ovsdb-server:
> >  #
> > -#    OVS_LOGDIR=`pwd`; export OVS_LOGDIR
> >  #    ovsdb-server --log-file --remote=ptcp:0:127.0.0.1 ...
> >  #    TCP_PORT=`parse_listening_port < ovsdb-server.log`
> >  parse_listening_port () {
> > @@ -62,12 +61,7 @@ m4_define([TESTABLE_LOG], [-vPATTERN:ANY:'%c|%p|%m'])
> >  # Starts ovs-vswitchd, with additional arguments 'vswitchd-aux-args'.
> >  #
> >  m4_define([_OVS_VSWITCHD_START],
> > -  [OVS_RUNDIR=`pwd`; export OVS_RUNDIR
> > -   OVS_LOGDIR=`pwd`; export OVS_LOGDIR
> > -   OVS_DBDIR=`pwd`; export OVS_DBDIR
> > -   OVS_SYSCONFDIR=`pwd`; export OVS_SYSCONFDIR
> > -
> > -   dnl Create database.
> > +  [dnl Create database.
> >     touch .conf.db.~lock~
> >     AT_CHECK([ovsdb-tool create conf.db $abs_top_srcdir/vswitchd/vswitch.ovsschema])
> >
> > diff --git a/tests/ovn-controller-vtep.at b/tests/ovn-controller-vtep.at
> > index 063feeb..83badf9 100644
> > --- a/tests/ovn-controller-vtep.at
> > +++ b/tests/ovn-controller-vtep.at
> > @@ -16,11 +16,6 @@ m4_define([OVN_CONTROLLER_VTEP_START],
> >     # this will cause skip when 'make check' using Windows setup.
> >     AT_SKIP_IF([test $HAVE_PYTHON = no])
> >
> > -   OVS_RUNDIR=`pwd`; export OVS_RUNDIR
> > -   OVS_LOGDIR=`pwd`; export OVS_LOGDIR
> > -   OVS_DBDIR=`pwd`; export OVS_DBDIR
> > -   OVS_SYSCONFDIR=`pwd`; export OVS_SYSCONFDIR
> > -
> >     dnl Create databases (ovn-nb, ovn-sb, vtep).
> >     AT_CHECK([ovsdb-tool create vswitchd.db $abs_top_srcdir/vswitchd/vswitch.ovsschema])
> >     for daemon in ovn-nb ovn-sb vtep; do
> > diff --git a/tests/ovn-sbctl.at b/tests/ovn-sbctl.at
> > index 16968fd..32e34bd 100644
> > --- a/tests/ovn-sbctl.at
> > +++ b/tests/ovn-sbctl.at
> > @@ -2,12 +2,7 @@ AT_BANNER([ovn_controller_gw])
> >
> >  # OVN_SBCTL_TEST_START
> >  m4_define([OVN_SBCTL_TEST_START],
> > -  [OVS_RUNDIR=`pwd`; export OVS_RUNDIR
> > -   OVS_LOGDIR=`pwd`; export OVS_LOGDIR
> > -   OVS_DBDIR=`pwd`; export OVS_DBDIR
> > -   OVS_SYSCONFDIR=`pwd`; export OVS_SYSCONFDIR
> > -
> > -   dnl Create databases (ovn-nb, ovn-sb).
> > +  [dnl Create databases (ovn-nb, ovn-sb).
> >     for daemon in ovn-nb ovn-sb; do
> >        AT_CHECK([ovsdb-tool create $daemon.db $abs_top_srcdir/${daemon%%-*}/${daemon}.ovsschema])
> >     done
> > diff --git a/tests/ovs-macros.at b/tests/ovs-macros.at
> > index d550204..c36ad06 100644
> > --- a/tests/ovs-macros.at
> > +++ b/tests/ovs-macros.at
> > @@ -4,8 +4,26 @@ AT_TESTED([perl])
> >
> >  m4_include([m4/compat.at])
> >
> > +dnl Make AT_SETUP automatically run the ovs_init() shell function
> > +dnl as the first step in every test.
> > +m4_rename([AT_SETUP], [OVS_AT_SETUP])
> > +m4_define([AT_SETUP], [OVS_AT_SETUP($@)
> > +ovs_init
> > +])
> >  m4_divert_push([PREPARE_TESTS])
> >  [
> > +# Set ovs_base to the base directory in which the test is running and
> > +# initialize the OVS_*DIR environment variables to point to this
> > +# directory.
> > +ovs_init() {
> > +    ovs_base=`pwd`
> > +    OVS_RUNDIR=$ovs_base; export OVS_RUNDIR
> > +    OVS_LOGDIR=$ovs_base; export OVS_LOGDIR
> > +    OVS_DBDIR=$ovs_base; export OVS_DBDIR
> > +    OVS_SYSCONFDIR=$ovs_base; export OVS_SYSCONFDIR
> > +    OVS_PKGDATADIR=$ovs_base; export OVS_PKGDATADIR
> > +}
> > +
> >  ovs_wait () {
> >      # First try a quick sleep, so that the test completes very quickly
> >      # in the normal case.  POSIX doesn't require fractional times to
> > diff --git a/tests/ovs-monitor-ipsec.at b/tests/ovs-monitor-ipsec.at
> > index 67705fa..16f11cf 100644
> > --- a/tests/ovs-monitor-ipsec.at
> > +++ b/tests/ovs-monitor-ipsec.at
> > @@ -4,9 +4,6 @@ AT_SETUP([ovs-monitor-ipsec])
> >  AT_SKIP_IF([test $HAVE_PYTHON = no])
> >  AT_SKIP_IF([$non_ascii_cwd])
> >
> > -OVS_RUNDIR=`pwd`; export OVS_RUNDIR
> > -OVS_DBDIR=`pwd`; export OVS_DBDIR
> > -OVS_PKGDATADIR=`pwd`; export OVS_PKGDATADIR
> >  cp "$top_srcdir/vswitchd/vswitch.ovsschema" .
> >
> >  ON_EXIT([kill `cat pid ovs-monitor-ipsec.pid`])
> > diff --git a/tests/ovs-vsctl.at b/tests/ovs-vsctl.at
> > index fef7b88..d88ea27 100644
> > --- a/tests/ovs-vsctl.at
> > +++ b/tests/ovs-vsctl.at
> > @@ -143,8 +143,6 @@ dnl ----------------------------------------------------------------------
> >  AT_BANNER([ovs-vsctl unit tests])
> >
> >  AT_SETUP([ovs-vsctl connection retry])
> > -OVS_RUNDIR=$PWD; export OVS_RUNDIR
> > -
> >  dnl Without --retry, there should be no retry for active connections.
> >  AT_CHECK([ovs-vsctl --db=unix:foo --timeout=10 -vreconnect:emer -- init],
> >    [1], [], [stderr])
> > diff --git a/tests/ovs-vswitchd.at b/tests/ovs-vswitchd.at
> > index 912354f..12a179a 100644
> > --- a/tests/ovs-vswitchd.at
> > +++ b/tests/ovs-vswitchd.at
> > @@ -5,10 +5,6 @@ dnl Open_vSwitch record) visible to ovs-vswitchd, but hand-rolled scripts
> >  dnl sometimes do.  At one point, "ovs-vswitchd --detach" would never detach
> >  dnl and use 100% CPU if this happened, so this test checks for regression.
> >  AT_SETUP([ovs-vswitchd detaches correctly with empty db])
> > -OVS_RUNDIR=`pwd`; export OVS_RUNDIR
> > -OVS_LOGDIR=`pwd`; export OVS_LOGDIR
> > -OVS_DBDIR=`pwd`; export OVS_DBDIR
> > -OVS_SYSCONFDIR=`pwd`; export OVS_SYSCONFDIR
> >  ON_EXIT([kill `cat ovsdb-server.pid ovs-vswitchd.pid`])
> >
> >  dnl Create database.
> > diff --git a/tests/ovs-xapi-sync.at b/tests/ovs-xapi-sync.at
> > index b55eecd..08e32e2 100644
> > --- a/tests/ovs-xapi-sync.at
> > +++ b/tests/ovs-xapi-sync.at
> > @@ -8,9 +8,6 @@ cp "$top_srcdir/tests/MockXenAPI.py" XenAPI.py
> >  PYTHONPATH=`pwd`:$PYTHONPATH
> >  export PYTHONPATH
> >
> > -OVS_RUNDIR=`pwd`; export OVS_RUNDIR
> > -OVS_DBDIR=`pwd`; export OVS_DBDIR
> > -OVS_PKGDATADIR=`pwd`; export OVS_PKGDATADIR
> >  cp "$top_srcdir/vswitchd/vswitch.ovsschema" .
> >
> >  cp "$top_srcdir/xenserver/usr_share_openvswitch_scripts_ovs-xapi-sync" \
> > diff --git a/tests/ovsdb-execution.at b/tests/ovsdb-execution.at
> > index 949ed59..94630bd 100644
> > --- a/tests/ovsdb-execution.at
> > +++ b/tests/ovsdb-execution.at
> > @@ -138,7 +138,6 @@ m4_divert_pop([PREPARE_TESTS])
> >  m4_define([OVSDB_CHECK_EXECUTION],
> >    [AT_SETUP([$1])
> >     AT_KEYWORDS([ovsdb execute execution positive $5])
> > -   OVS_RUNDIR=`pwd`; export OVS_RUNDIR
> >     AT_CHECK([test-ovsdb execute "`$2`" m4_foreach([txn], [$3], [ 'txn'])],
> >       [0], [stdout], [])
> >     AT_CHECK([${PERL} $srcdir/uuidfilt.pl stdout], [0], [$4])
> > diff --git a/tests/ovsdb-idl.at b/tests/ovsdb-idl.at
> > index 11b8b36..f4d03f8 100644
> > --- a/tests/ovsdb-idl.at
> > +++ b/tests/ovsdb-idl.at
> > @@ -1,6 +1,5 @@
> >  AT_BANNER([OVSDB -- interface description language (IDL)])
> >
> > -OVS_RUNDIR=`pwd`; export OVS_RUNDIR
> >  # OVSDB_CHECK_IDL_C(TITLE, [PRE-IDL-TXN], TRANSACTIONS, OUTPUT, [KEYWORDS],
> >  #                   [FILTER])
> >  #
> > @@ -20,7 +19,6 @@ OVS_RUNDIR=`pwd`; export OVS_RUNDIR
> >  m4_define([OVSDB_CHECK_IDL_C],
> >    [AT_SETUP([$1 - C])
> >     AT_KEYWORDS([ovsdb server idl positive $5])
> > -   OVS_RUNDIR=`pwd`; export OVS_RUNDIR
> >     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])
> > @@ -38,7 +36,6 @@ m4_define([OVSDB_CHECK_IDL_PY],
> >    [AT_SETUP([$1 - Python])
> >     AT_SKIP_IF([test $HAVE_PYTHON = no])
> >     AT_KEYWORDS([ovsdb server idl positive Python $5])
> > -   OVS_RUNDIR=`pwd`; export OVS_RUNDIR
> >     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])
> > @@ -56,8 +53,6 @@ m4_define([OVSDB_CHECK_IDL_TCP_PY],
> >    [AT_SETUP([$1 - Python tcp])
> >     AT_SKIP_IF([test $HAVE_PYTHON = no])
> >     AT_KEYWORDS([ovsdb server idl positive Python with tcp socket $5])
> > -   OVS_RUNDIR=`pwd`; export OVS_RUNDIR
> > -   OVS_LOGDIR=`pwd`; export OVS_LOGDIR
> >     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])
> > @@ -78,8 +73,6 @@ m4_define([OVSDB_CHECK_IDL_TCP6_PY],
> >     AT_SKIP_IF([test $HAVE_PYTHON = no])
> >     AT_SKIP_IF([test $HAVE_IPV6 = no])
> >     AT_KEYWORDS([ovsdb server idl positive Python with tcp6 socket $5])
> > -   OVS_RUNDIR=`pwd`; export OVS_RUNDIR
> > -   OVS_LOGDIR=`pwd`; export OVS_LOGDIR
> >     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])
> > @@ -517,7 +510,6 @@ OVSDB_CHECK_IDL_PY([row-from-json idl, whats this],
> >
> >  AT_SETUP([idl handling of missing tables and columns - C])
> >  AT_KEYWORDS([ovsdb server idl positive])
> > -OVS_RUNDIR=`pwd`; export OVS_RUNDIR
> >
> >  # idltest2.ovsschema is the same as idltest.ovsschema, except that
> >  # table link2 and column l2 have been deleted.  But the IDL still
> > diff --git a/tests/ovsdb-macros.at b/tests/ovsdb-macros.at
> > index 2aa752b..c1aa619 100644
> > --- a/tests/ovsdb-macros.at
> > +++ b/tests/ovsdb-macros.at
> > @@ -2,8 +2,7 @@ dnl OVSDB_INIT([$1])
> >  dnl
> >  dnl Creates an empty database named $1.
> >  m4_define([OVSDB_INIT],
> > -  [OVS_RUNDIR=`pwd`; export OVS_RUNDIR
> > -   AT_CHECK(
> > +  [AT_CHECK(
> >       [ovsdb-tool create $1 $abs_top_srcdir/vswitchd/vswitch.ovsschema],
> >       [0], [stdout], [ignore])
> >     AT_CHECK(
> > diff --git a/tests/ovsdb-monitor.at b/tests/ovsdb-monitor.at
> > index 016aa2c..0dbf5b0 100644
> > --- a/tests/ovsdb-monitor.at
> > +++ b/tests/ovsdb-monitor.at
> > @@ -19,7 +19,6 @@ AT_BANNER([OVSDB -- ovsdb-server monitors])
> >  m4_define([OVSDB_CHECK_MONITOR],
> >    [AT_SETUP([$1])
> >     AT_KEYWORDS([ovsdb server monitor positive $9])
> > -   OVS_RUNDIR=`pwd`; export OVS_RUNDIR
> >     $2 > schema
> >     AT_CHECK([ovsdb-tool create db schema], [0], [stdout], [ignore])
> >     m4_foreach([txn], [$3],
> > diff --git a/tests/ovsdb-server.at b/tests/ovsdb-server.at
> > index 8fce70e..a447e79 100644
> > --- a/tests/ovsdb-server.at
> > +++ b/tests/ovsdb-server.at
> > @@ -21,7 +21,6 @@ m4_define([OVSDB_SERVER_SHUTDOWN],
> >  # TITLE is provided to AT_SETUP and KEYWORDS to AT_KEYWORDS.
> >  m4_define([OVSDB_CHECK_EXECUTION],
> >    [AT_SETUP([$1])
> > -  OVS_RUNDIR=`pwd`; export OVS_RUNDIR
> >     AT_KEYWORDS([ovsdb server positive unix $5])
> >     $2 > schema
> >     AT_CHECK([ovsdb-tool create db schema], [0], [stdout], [ignore])
> > @@ -43,7 +42,6 @@ AT_BANNER([ovsdb-server miscellaneous features])
> >  AT_SETUP([truncating corrupted database log])
> >  AT_KEYWORDS([ovsdb server positive unix])
> >  AT_SKIP_IF([test "$IS_WIN32" = "yes"])
> > -OVS_RUNDIR=`pwd`; export OVS_RUNDIR
> >  ordinal_schema > schema
> >  AT_CHECK([ovsdb-tool create db schema], [0], [stdout], [ignore])
> >  dnl Do one transaction and save the output.
> > @@ -91,7 +89,6 @@ AT_CLEANUP
> >  AT_SETUP([truncating database log with bad transaction])
> >  AT_KEYWORDS([ovsdb server positive unix])
> >  AT_SKIP_IF([test "$IS_WIN32" = "yes"])
> > -OVS_RUNDIR=`pwd`; export OVS_RUNDIR
> >  ordinal_schema > schema
> >  AT_CHECK([ovsdb-tool create db schema], [0], [stdout], [ignore])
> >  dnl Do one transaction and save the output.
> > @@ -139,7 +136,6 @@ AT_CLEANUP
> >
> >  AT_SETUP([ovsdb-client get-schema-version])
> >  AT_KEYWORDS([ovsdb server positive])
> > -OVS_RUNDIR=`pwd`; export OVS_RUNDIR
> >  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])
> > @@ -150,7 +146,6 @@ AT_CLEANUP
> >
> >  AT_SETUP([database multiplexing implementation])
> >  AT_KEYWORDS([ovsdb server positive])
> > -OVS_RUNDIR=`pwd`; export OVS_RUNDIR
> >  ordinal_schema > schema1
> >  constraint_schema > schema2
> >  AT_CHECK([ovsdb-tool create db1 schema1], [0], [ignore], [ignore])
> > @@ -171,8 +166,6 @@ AT_CLEANUP
> >  AT_SETUP([ovsdb-server/add-db and remove-db])
> >  AT_KEYWORDS([ovsdb server positive])
> >  ON_EXIT([kill `cat ovsdb-server.pid`])
> > -OVS_RUNDIR=`pwd`; export OVS_RUNDIR
> > -OVS_LOGDIR=`pwd`; export OVS_LOGDIR
> >  ordinal_schema > schema1
> >  constraint_schema > schema2
> >  AT_CHECK([ovsdb-tool create db1 schema1], [0], [ignore], [ignore])
> > @@ -257,8 +250,6 @@ AT_SETUP([ovsdb-server/add-db with --monitor])
> >  AT_KEYWORDS([ovsdb server positive])
> >  AT_SKIP_IF([test "$IS_WIN32" = "yes"])
> >  # Start ovsdb-server, initially with one db.
> > -OVS_RUNDIR=`pwd`; export OVS_RUNDIR
> > -OVS_LOGDIR=`pwd`; export OVS_LOGDIR
> >  ordinal_schema > schema
> >  AT_CHECK([ovsdb-tool create db1 schema], [0], [ignore], [ignore])
> >  ON_EXIT([kill `cat *.pid`])
> > @@ -290,8 +281,6 @@ AT_SETUP([ovsdb-server/add-db and remove-db with --monitor])
> >  AT_KEYWORDS([ovsdb server positive])
> >  AT_SKIP_IF([test "$IS_WIN32" = "yes"])
> >  # Start ovsdb-server, initially with one db.
> > -OVS_RUNDIR=`pwd`; export OVS_RUNDIR
> > -OVS_LOGDIR=`pwd`; export OVS_LOGDIR
> >  ordinal_schema > schema
> >  AT_CHECK([ovsdb-tool create db1 schema], [0], [ignore], [ignore])
> >  constraint_schema > schema2
> > @@ -319,8 +308,6 @@ AT_CLEANUP
> >
> >  AT_SETUP([--remote=db: implementation])
> >  AT_KEYWORDS([ovsdb server positive])
> > -OVS_RUNDIR=`pwd`; export OVS_RUNDIR
> > -OVS_LOGDIR=`pwd`; export OVS_LOGDIR
> >  AT_DATA([schema],
> >    [[{"name": "mydb",
> >       "tables": {
> > @@ -384,8 +371,6 @@ AT_CLEANUP
> >
> >  AT_SETUP([ovsdb-server/add-remote and remove-remote])
> >  AT_KEYWORDS([ovsdb server positive])
> > -OVS_RUNDIR=`pwd`; export OVS_RUNDIR
> > -OVS_LOGDIR=`pwd`; export OVS_LOGDIR
> >  ordinal_schema > schema
> >  AT_CHECK([ovsdb-tool create db schema], [0], [ignore], [ignore])
> >  ON_EXIT([kill `cat *.pid`])
> > @@ -440,8 +425,6 @@ AT_SETUP([ovsdb-server/add-remote with --monitor])
> >  AT_KEYWORDS([ovsdb server positive])
> >  AT_SKIP_IF([test "$IS_WIN32" = "yes"])
> >  # Start ovsdb-server, initially with no remotes.
> > -OVS_RUNDIR=`pwd`; export OVS_RUNDIR
> > -OVS_LOGDIR=`pwd`; export OVS_LOGDIR
> >  ordinal_schema > schema
> >  AT_CHECK([ovsdb-tool create db schema], [0], [ignore], [ignore])
> >  ON_EXIT([kill `cat *.pid`])
> > @@ -471,8 +454,6 @@ AT_SETUP([ovsdb-server/add-remote and remove-remote with --monitor])
> >  AT_KEYWORDS([ovsdb server positive])
> >  AT_SKIP_IF([test "$IS_WIN32" = "yes"])
> >  # Start ovsdb-server, initially with no remotes.
> > -OVS_RUNDIR=`pwd`; export OVS_RUNDIR
> > -OVS_LOGDIR=`pwd`; export OVS_LOGDIR
> >  ordinal_schema > schema
> >  AT_CHECK([ovsdb-tool create db schema], [0], [ignore], [ignore])
> >  ON_EXIT([kill `cat *.pid`])
> > @@ -530,7 +511,6 @@ AT_CHECK(
> >                  "certificate": "'"$PKIDIR/testpki-cert2.pem"'",
> >                  "ca_cert": "'"$PKIDIR/testpki-cacert.pem"'"}}]']],
> >    [0], [ignore], [ignore])
> > -OVS_LOGDIR=`pwd`; export OVS_LOGDIR
> >  AT_CHECK(
> >    [ovsdb-server --log-file --detach --no-chdir --pidfile="`pwd`"/pid \
> >          --private-key=db:mydb,SSL,private_key \
> > @@ -561,7 +541,6 @@ AT_CLEANUP
> >
> >  AT_SETUP([compacting online])
> >  AT_KEYWORDS([ovsdb server compact])
> > -OVS_RUNDIR=`pwd`; export OVS_RUNDIR
> >  ordinal_schema > schema
> >  dnl Make sure that "ovsdb-tool create" works with a dangling symlink for
> >  dnl the database and the lockfile, creating the target of each symlink rather
> > @@ -693,8 +672,6 @@ OVSDB_SERVER_SHUTDOWN
> >  AT_CLEANUP
> >
> >  AT_SETUP([ovsdb-server combines updates on backlogged connections])
> > -OVS_LOGDIR=`pwd`; export OVS_LOGDIR
> > -OVS_RUNDIR=`pwd`; export OVS_RUNDIR
> >  ON_EXIT([kill `cat *.pid`])
> >
> >  # The maximum socket receive buffer size is important for this test, which
> > @@ -812,8 +789,6 @@ m4_define([OVSDB_CHECK_EXECUTION],
> >    [AT_SETUP([$1])
> >     AT_KEYWORDS([ovsdb server positive ssl $5])
> >     AT_SKIP_IF([test "$HAVE_OPENSSL" = no])
> > -   OVS_RUNDIR=`pwd`; export OVS_RUNDIR
> > -   OVS_LOGDIR=`pwd`; export OVS_LOGDIR
> >     $2 > schema
> >     PKIDIR=$abs_top_builddir/tests
> >     AT_CHECK([ovsdb-tool create db schema], [0], [stdout], [ignore])
> > @@ -852,8 +827,6 @@ m4_define([OVSDB_CHECK_EXECUTION],
> >     AT_KEYWORDS([ovsdb server positive ssl6 $5])
> >     AT_SKIP_IF([test "$HAVE_OPENSSL" = no])
> >     AT_SKIP_IF([test $HAVE_IPV6 = no])
> > -   OVS_RUNDIR=`pwd`; export OVS_RUNDIR
> > -   OVS_LOGDIR=`pwd`; export OVS_LOGDIR
> >     $2 > schema
> >     PKIDIR=$abs_top_builddir/tests
> >     AT_CHECK([ovsdb-tool create db schema], [0], [stdout], [ignore])
> > @@ -877,7 +850,6 @@ 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])
> > -OVS_LOGDIR=`pwd`; export OVS_LOGDIR
> >  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])
> >  TCP_PORT=`parse_listening_port < ovsdb-server.log`
> >  AT_CHECK([ovsdb-client get-schema-version tcp:127.0.0.1:$TCP_PORT ordinals], [0], [5.1.3
> > @@ -902,8 +874,6 @@ AT_CLEANUP])
> >  m4_define([OVSDB_CHECK_EXECUTION],
> >    [AT_SETUP([$1])
> >     AT_KEYWORDS([ovsdb server positive tcp $5])
> > -   OVS_RUNDIR=`pwd`; export OVS_RUNDIR
> > -   OVS_LOGDIR=`pwd`; export OVS_LOGDIR
> >     $2 > schema
> >     PKIDIR=$abs_top_builddir/tests
> >     AT_CHECK([ovsdb-tool create db schema], [0], [stdout], [ignore])
> > @@ -941,8 +911,6 @@ m4_define([OVSDB_CHECK_EXECUTION],
> >    [AT_SETUP([$1])
> >     AT_KEYWORDS([ovsdb server positive tcp6 $5])
> >     AT_SKIP_IF([test $HAVE_IPV6 = no])
> > -   OVS_RUNDIR=`pwd`; export OVS_RUNDIR
> > -   OVS_LOGDIR=`pwd`; export OVS_LOGDIR
> >     $2 > schema
> >     PKIDIR=$abs_top_builddir/tests
> >     AT_CHECK([ovsdb-tool create db schema], [0], [stdout], [ignore])
> > @@ -983,7 +951,6 @@ m4_define([OVSDB_CHECK_EXECUTION],
> >    [AT_SETUP([$1])
> >     AT_SKIP_IF([test "$IS_WIN32" = "yes"])
> >     AT_KEYWORDS([ovsdb server positive transient $5])
> > -   OVS_RUNDIR=`pwd`; export OVS_RUNDIR
> >     $2 > schema
> >     AT_CHECK([ovsdb-tool create db schema], [0], [stdout], [ignore])
> >     m4_foreach([txn], [$3],
> > diff --git a/tests/ovsdb-tool.at b/tests/ovsdb-tool.at
> > index 0d3219b..3c2e628 100644
> > --- a/tests/ovsdb-tool.at
> > +++ b/tests/ovsdb-tool.at
> > @@ -16,7 +16,6 @@ AT_BANNER([OVSDB -- ovsdb-tool])
> >  m4_define([OVSDB_CHECK_EXECUTION],
> >    [AT_SETUP([$1])
> >     AT_KEYWORDS([ovsdb file positive $5])
> > -   OVS_RUNDIR=`pwd`; export OVS_RUNDIR
> >     $2 > schema
> >     touch .db.~lock~
> >     AT_CHECK([ovsdb-tool create db schema], [0], [stdout], [ignore])
> > @@ -49,7 +48,6 @@ AT_CLEANUP
> >
> >  AT_SETUP([ovsdb-tool compact])
> >  AT_KEYWORDS([ovsdb file positive])
> > -OVS_RUNDIR=`pwd`; export OVS_RUNDIR
> >  ordinal_schema > schema
> >  dnl Make sure that "ovsdb-tool create" works with a dangling symlink,
> >  dnl creating the target of the symlink rather than replacing the symlink
> > @@ -157,7 +155,6 @@ AT_CLEANUP
> >
> >  AT_SETUP([ovsdb-tool convert -- removing a column])
> >  AT_KEYWORDS([ovsdb file positive])
> > -OVS_RUNDIR=`pwd`; export OVS_RUNDIR
> >  ordinal_schema > schema
> >  AT_DATA([new-schema],
> >    [[{"name": "ordinals",
> > @@ -225,7 +222,6 @@ AT_CLEANUP
> >
> >  AT_SETUP([ovsdb-tool convert -- adding a column])
> >  AT_KEYWORDS([ovsdb file positive])
> > -OVS_RUNDIR=`pwd`; export OVS_RUNDIR
> >  AT_DATA([schema],
> >    [[{"name": "ordinals",
> >       "tables": {
> > diff --git a/tests/unixctl-py.at b/tests/unixctl-py.at
> > index 2fb7ee9..cd0ac23 100644
> > --- a/tests/unixctl-py.at
> > +++ b/tests/unixctl-py.at
> > @@ -72,8 +72,6 @@ OVS_VSWITCHD_STOP
> >  AT_CLEANUP
> >
> >  AT_SETUP([unixctl bad target - Python])
> > -OVS_RUNDIR=`pwd`; export OVS_RUNDIR
> > -OVS_DBDIR=`pwd`; export OVS_DBDIR
> >  AT_SKIP_IF([test $HAVE_PYTHON = no])
> >
> >  AT_CHECK([PYAPPCTL -t bogus doit], [1], [], [stderr])
> > @@ -90,10 +88,6 @@ AT_CLEANUP
> >
> >  AT_SETUP([unixctl server - Python])
> >  AT_SKIP_IF([test $HAVE_PYTHON = no])
> > -OVS_RUNDIR=`pwd`; export OVS_RUNDIR
> > -OVS_LOGDIR=`pwd`; export OVS_LOGDIR
> > -OVS_DBDIR=`pwd`; export OVS_DBDIR
> > -OVS_SYSCONFDIR=`pwd`; export OVS_SYSCONFDIR
> >  ON_EXIT([kill `cat test-unixctl.py.pid`])
> >  AT_CAPTURE_FILE([`pwd`/test-unixctl.py.log])
> >  AT_CHECK([$PYTHON $srcdir/test-unixctl.py --log-file --pidfile --detach])
> > diff --git a/tests/vconn.at b/tests/vconn.at
> > index 4e91ed8..397725d 100644
> > --- a/tests/vconn.at
> > +++ b/tests/vconn.at
> > @@ -11,7 +11,6 @@ m4_define([TEST_VCONN_CLASS],
> >        [send-short-hello],
> >        [send-invalid-version-hello]],
> >       [AT_SETUP([$1 vconn - m4_bpatsubst(testname, [-], [ ])])
> > -     OVS_RUNDIR=`pwd`; export OVS_RUNDIR
> >        m4_if([$1], [ssl], [
> >          AT_SKIP_IF([test "$HAVE_OPENSSL" = no])
> >          AT_CHECK([cp $abs_top_builddir/tests/testpki*.pem .])])
> > diff --git a/tests/vlog.at b/tests/vlog.at
> > index fdd6732..321ef2d 100644
> > --- a/tests/vlog.at
> > +++ b/tests/vlog.at
> > @@ -103,10 +103,6 @@ AT_CLEANUP
> >
> >  AT_SETUP([vlog - vlog/reopen - Python])
> >  AT_SKIP_IF([test $HAVE_PYTHON = no])
> > -OVS_RUNDIR=`pwd`; export OVS_RUNDIR
> > -OVS_LOGDIR=`pwd`; export OVS_LOGDIR
> > -OVS_DBDIR=`pwd`; export OVS_DBDIR
> > -OVS_SYSCONFDIR=`pwd`; export OVS_SYSCONFDIR
> >  ON_EXIT([kill `cat test-unixctl.py.pid`])
> >
> >  AT_CAPTURE_FILE([log])
> > @@ -132,10 +128,6 @@ AT_CLEANUP
> >
> >  AT_SETUP([vlog - vlog/reopen without log file - Python])
> >  AT_SKIP_IF([test $HAVE_PYTHON = no])
> > -OVS_RUNDIR=`pwd`; export OVS_RUNDIR
> > -OVS_LOGDIR=`pwd`; export OVS_LOGDIR
> > -OVS_DBDIR=`pwd`; export OVS_DBDIR
> > -OVS_SYSCONFDIR=`pwd`; export OVS_SYSCONFDIR
> >  ON_EXIT([kill `cat test-unixctl.py.pid`])
> >
> >  AT_CHECK([$PYTHON $srcdir/test-unixctl.py --pidfile --detach])
> > @@ -155,10 +147,6 @@ AT_SKIP_IF([test $HAVE_PYTHON = no])
> >  AT_SKIP_IF([test ! -c /dev/full])
> >  AT_SKIP_IF([echo > /dev/full])
> >
> > -OVS_RUNDIR=`pwd`; export OVS_RUNDIR
> > -OVS_LOGDIR=`pwd`; export OVS_LOGDIR
> > -OVS_DBDIR=`pwd`; export OVS_DBDIR
> > -OVS_SYSCONFDIR=`pwd`; export OVS_SYSCONFDIR
> >  ON_EXIT([kill `cat test-unixctl.py.pid`])
> >
> >  AT_CHECK([$PYTHON $srcdir/test-unixctl.py --log-file=`pwd`/log --pidfile --detach])
> > @@ -182,10 +170,6 @@ AT_CLEANUP
> >
> >  AT_SETUP([vlog - vlog/set and vlog/list - Python])
> >  AT_SKIP_IF([test $HAVE_PYTHON = no])
> > -OVS_RUNDIR=`pwd`; export OVS_RUNDIR
> > -OVS_LOGDIR=`pwd`; export OVS_LOGDIR
> > -OVS_DBDIR=`pwd`; export OVS_DBDIR
> > -OVS_SYSCONFDIR=`pwd`; export OVS_SYSCONFDIR
> >  ON_EXIT([kill `cat test-unixctl.py.pid`])
> >
> >  AT_CAPTURE_FILE([log])
> > @@ -236,10 +220,6 @@ AT_CHECK([grep -q 'I<3OVS' log])
> >  AT_CLEANUP
> >
> >  AT_SETUP([vlog - RFC5424 facility])
> > -OVS_RUNDIR=`pwd`; export OVS_RUNDIR
> > -OVS_LOGDIR=`pwd`; export OVS_LOGDIR
> > -OVS_DBDIR=`pwd`; export OVS_DBDIR
> > -OVS_SYSCONFDIR=`pwd`; export OVS_SYSCONFDIR
> >  ON_EXIT([kill `cat ovsdb-server.pid`])
> >
> >  dnl Create database.
> > @@ -278,10 +258,6 @@ AT_CLEANUP
> >
> >  AT_SETUP([vlog - RFC5424 facility - Python])
> >  AT_SKIP_IF([test $HAVE_PYTHON = no])
> > -OVS_RUNDIR=`pwd`; export OVS_RUNDIR
> > -OVS_LOGDIR=`pwd`; export OVS_LOGDIR
> > -OVS_DBDIR=`pwd`; export OVS_DBDIR
> > -OVS_SYSCONFDIR=`pwd`; export OVS_SYSCONFDIR
> >  ON_EXIT([kill `cat test-unixctl.py.pid`])
> >
> >  AT_CHECK([$PYTHON $srcdir/test-unixctl.py --log-file=`pwd`/log --pidfile \
> > diff --git a/tests/vtep-ctl.at b/tests/vtep-ctl.at
> > index bb2df4f..f4a7edf 100644
> > --- a/tests/vtep-ctl.at
> > +++ b/tests/vtep-ctl.at
> > @@ -2,8 +2,7 @@ dnl VTEP_OVSDB_INIT([$1])
> >  dnl
> >  dnl Creates an empty database named $1.
> >  m4_define([VTEP_OVSDB_INIT],
> > -  [OVS_RUNDIR=`pwd`; export OVS_RUNDIR
> > -   AT_CHECK(
> > +  [AT_CHECK(
> >       [ovsdb-tool create $1 $abs_top_srcdir/vtep/vtep.ovsschema],
> >       [0], [stdout], [ignore])
> >     AT_CHECK(
> > --
> > 2.1.3
> >
> > _______________________________________________
> > dev mailing list
> > dev@openvswitch.org
> > http://openvswitch.org/mailman/listinfo/dev
diff mbox

Patch

diff --git a/tests/jsonrpc-py.at b/tests/jsonrpc-py.at
index 026d49a..3d3bd3b 100644
--- a/tests/jsonrpc-py.at
+++ b/tests/jsonrpc-py.at
@@ -2,7 +2,6 @@  AT_BANNER([JSON-RPC - Python])
 
 AT_SETUP([JSON-RPC request and successful reply - Python])
 AT_SKIP_IF([test $HAVE_PYTHON = no])
-OVS_RUNDIR=`pwd`; export OVS_RUNDIR
 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`])
@@ -15,7 +14,6 @@  AT_CLEANUP
 
 AT_SETUP([JSON-RPC request and error reply - Python])
 AT_SKIP_IF([test $HAVE_PYTHON = no])
-OVS_RUNDIR=`pwd`; export OVS_RUNDIR
 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`])
@@ -28,7 +26,6 @@  AT_CLEANUP
 
 AT_SETUP([JSON-RPC notification - Python])
 AT_SKIP_IF([test $HAVE_PYTHON = no])
-OVS_RUNDIR=`pwd`; export OVS_RUNDIR
 AT_CHECK([$PYTHON $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.
diff --git a/tests/jsonrpc.at b/tests/jsonrpc.at
index e06b5b6..ab16594 100644
--- a/tests/jsonrpc.at
+++ b/tests/jsonrpc.at
@@ -1,7 +1,6 @@ 
 AT_BANNER([JSON-RPC - C])
 
 AT_SETUP([JSON-RPC request and successful reply])
-OVS_RUNDIR=`pwd`; export OVS_RUNDIR
 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`])
@@ -13,7 +12,6 @@  AT_CHECK([kill `cat pid`])
 AT_CLEANUP
 
 AT_SETUP([JSON-RPC request and error reply])
-OVS_RUNDIR=`pwd`; export OVS_RUNDIR
 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`])
@@ -25,7 +23,6 @@  AT_CHECK([kill `cat pid`])
 AT_CLEANUP
 
 AT_SETUP([JSON-RPC notification])
-OVS_RUNDIR=`pwd`; export OVS_RUNDIR
 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.
diff --git a/tests/library.at b/tests/library.at
index 6e04991..d5dcb12 100644
--- a/tests/library.at
+++ b/tests/library.at
@@ -174,7 +174,6 @@  AT_CHECK([$PYTHON $abs_srcdir/test-unix-socket.py ../$longname/socket socket])
 AT_CLEANUP
 
 AT_SETUP([ovs_assert])
-OVS_LOGDIR=`pwd`; export OVS_LOGDIR
 if test "$IS_WIN32" = "yes"; then
   exit_status=9
 else
diff --git a/tests/ofproto-macros.at b/tests/ofproto-macros.at
index 0dc208e..a21887a 100644
--- a/tests/ofproto-macros.at
+++ b/tests/ofproto-macros.at
@@ -42,7 +42,6 @@  s/No error/Success/
 #
 # Here's an example of how to use this with ovsdb-server:
 #
-#    OVS_LOGDIR=`pwd`; export OVS_LOGDIR
 #    ovsdb-server --log-file --remote=ptcp:0:127.0.0.1 ...
 #    TCP_PORT=`parse_listening_port < ovsdb-server.log`
 parse_listening_port () {
@@ -62,12 +61,7 @@  m4_define([TESTABLE_LOG], [-vPATTERN:ANY:'%c|%p|%m'])
 # Starts ovs-vswitchd, with additional arguments 'vswitchd-aux-args'.
 #
 m4_define([_OVS_VSWITCHD_START],
-  [OVS_RUNDIR=`pwd`; export OVS_RUNDIR
-   OVS_LOGDIR=`pwd`; export OVS_LOGDIR
-   OVS_DBDIR=`pwd`; export OVS_DBDIR
-   OVS_SYSCONFDIR=`pwd`; export OVS_SYSCONFDIR
-
-   dnl Create database.
+  [dnl Create database.
    touch .conf.db.~lock~
    AT_CHECK([ovsdb-tool create conf.db $abs_top_srcdir/vswitchd/vswitch.ovsschema])
 
diff --git a/tests/ovn-controller-vtep.at b/tests/ovn-controller-vtep.at
index 063feeb..83badf9 100644
--- a/tests/ovn-controller-vtep.at
+++ b/tests/ovn-controller-vtep.at
@@ -16,11 +16,6 @@  m4_define([OVN_CONTROLLER_VTEP_START],
    # this will cause skip when 'make check' using Windows setup.
    AT_SKIP_IF([test $HAVE_PYTHON = no])
 
-   OVS_RUNDIR=`pwd`; export OVS_RUNDIR
-   OVS_LOGDIR=`pwd`; export OVS_LOGDIR
-   OVS_DBDIR=`pwd`; export OVS_DBDIR
-   OVS_SYSCONFDIR=`pwd`; export OVS_SYSCONFDIR
-
    dnl Create databases (ovn-nb, ovn-sb, vtep).
    AT_CHECK([ovsdb-tool create vswitchd.db $abs_top_srcdir/vswitchd/vswitch.ovsschema])
    for daemon in ovn-nb ovn-sb vtep; do
diff --git a/tests/ovn-sbctl.at b/tests/ovn-sbctl.at
index 16968fd..32e34bd 100644
--- a/tests/ovn-sbctl.at
+++ b/tests/ovn-sbctl.at
@@ -2,12 +2,7 @@  AT_BANNER([ovn_controller_gw])
 
 # OVN_SBCTL_TEST_START
 m4_define([OVN_SBCTL_TEST_START],
-  [OVS_RUNDIR=`pwd`; export OVS_RUNDIR
-   OVS_LOGDIR=`pwd`; export OVS_LOGDIR
-   OVS_DBDIR=`pwd`; export OVS_DBDIR
-   OVS_SYSCONFDIR=`pwd`; export OVS_SYSCONFDIR
-
-   dnl Create databases (ovn-nb, ovn-sb).
+  [dnl Create databases (ovn-nb, ovn-sb).
    for daemon in ovn-nb ovn-sb; do
       AT_CHECK([ovsdb-tool create $daemon.db $abs_top_srcdir/${daemon%%-*}/${daemon}.ovsschema])
    done
diff --git a/tests/ovs-macros.at b/tests/ovs-macros.at
index d550204..c36ad06 100644
--- a/tests/ovs-macros.at
+++ b/tests/ovs-macros.at
@@ -4,8 +4,26 @@  AT_TESTED([perl])
 
 m4_include([m4/compat.at])
 
+dnl Make AT_SETUP automatically run the ovs_init() shell function
+dnl as the first step in every test.
+m4_rename([AT_SETUP], [OVS_AT_SETUP])
+m4_define([AT_SETUP], [OVS_AT_SETUP($@)
+ovs_init
+])
 m4_divert_push([PREPARE_TESTS])
 [
+# Set ovs_base to the base directory in which the test is running and
+# initialize the OVS_*DIR environment variables to point to this
+# directory.
+ovs_init() {
+    ovs_base=`pwd`
+    OVS_RUNDIR=$ovs_base; export OVS_RUNDIR
+    OVS_LOGDIR=$ovs_base; export OVS_LOGDIR
+    OVS_DBDIR=$ovs_base; export OVS_DBDIR
+    OVS_SYSCONFDIR=$ovs_base; export OVS_SYSCONFDIR
+    OVS_PKGDATADIR=$ovs_base; export OVS_PKGDATADIR
+}
+
 ovs_wait () {
     # First try a quick sleep, so that the test completes very quickly
     # in the normal case.  POSIX doesn't require fractional times to
diff --git a/tests/ovs-monitor-ipsec.at b/tests/ovs-monitor-ipsec.at
index 67705fa..16f11cf 100644
--- a/tests/ovs-monitor-ipsec.at
+++ b/tests/ovs-monitor-ipsec.at
@@ -4,9 +4,6 @@  AT_SETUP([ovs-monitor-ipsec])
 AT_SKIP_IF([test $HAVE_PYTHON = no])
 AT_SKIP_IF([$non_ascii_cwd])
 
-OVS_RUNDIR=`pwd`; export OVS_RUNDIR
-OVS_DBDIR=`pwd`; export OVS_DBDIR
-OVS_PKGDATADIR=`pwd`; export OVS_PKGDATADIR
 cp "$top_srcdir/vswitchd/vswitch.ovsschema" .
 
 ON_EXIT([kill `cat pid ovs-monitor-ipsec.pid`])
diff --git a/tests/ovs-vsctl.at b/tests/ovs-vsctl.at
index fef7b88..d88ea27 100644
--- a/tests/ovs-vsctl.at
+++ b/tests/ovs-vsctl.at
@@ -143,8 +143,6 @@  dnl ----------------------------------------------------------------------
 AT_BANNER([ovs-vsctl unit tests])
 
 AT_SETUP([ovs-vsctl connection retry])
-OVS_RUNDIR=$PWD; export OVS_RUNDIR
-
 dnl Without --retry, there should be no retry for active connections.
 AT_CHECK([ovs-vsctl --db=unix:foo --timeout=10 -vreconnect:emer -- init],
   [1], [], [stderr])
diff --git a/tests/ovs-vswitchd.at b/tests/ovs-vswitchd.at
index 912354f..12a179a 100644
--- a/tests/ovs-vswitchd.at
+++ b/tests/ovs-vswitchd.at
@@ -5,10 +5,6 @@  dnl Open_vSwitch record) visible to ovs-vswitchd, but hand-rolled scripts
 dnl sometimes do.  At one point, "ovs-vswitchd --detach" would never detach
 dnl and use 100% CPU if this happened, so this test checks for regression.
 AT_SETUP([ovs-vswitchd detaches correctly with empty db])
-OVS_RUNDIR=`pwd`; export OVS_RUNDIR
-OVS_LOGDIR=`pwd`; export OVS_LOGDIR
-OVS_DBDIR=`pwd`; export OVS_DBDIR
-OVS_SYSCONFDIR=`pwd`; export OVS_SYSCONFDIR
 ON_EXIT([kill `cat ovsdb-server.pid ovs-vswitchd.pid`])
 
 dnl Create database.
diff --git a/tests/ovs-xapi-sync.at b/tests/ovs-xapi-sync.at
index b55eecd..08e32e2 100644
--- a/tests/ovs-xapi-sync.at
+++ b/tests/ovs-xapi-sync.at
@@ -8,9 +8,6 @@  cp "$top_srcdir/tests/MockXenAPI.py" XenAPI.py
 PYTHONPATH=`pwd`:$PYTHONPATH
 export PYTHONPATH
 
-OVS_RUNDIR=`pwd`; export OVS_RUNDIR
-OVS_DBDIR=`pwd`; export OVS_DBDIR
-OVS_PKGDATADIR=`pwd`; export OVS_PKGDATADIR
 cp "$top_srcdir/vswitchd/vswitch.ovsschema" .
 
 cp "$top_srcdir/xenserver/usr_share_openvswitch_scripts_ovs-xapi-sync" \
diff --git a/tests/ovsdb-execution.at b/tests/ovsdb-execution.at
index 949ed59..94630bd 100644
--- a/tests/ovsdb-execution.at
+++ b/tests/ovsdb-execution.at
@@ -138,7 +138,6 @@  m4_divert_pop([PREPARE_TESTS])
 m4_define([OVSDB_CHECK_EXECUTION],
   [AT_SETUP([$1])
    AT_KEYWORDS([ovsdb execute execution positive $5])
-   OVS_RUNDIR=`pwd`; export OVS_RUNDIR
    AT_CHECK([test-ovsdb execute "`$2`" m4_foreach([txn], [$3], [ 'txn'])],
      [0], [stdout], [])
    AT_CHECK([${PERL} $srcdir/uuidfilt.pl stdout], [0], [$4])
diff --git a/tests/ovsdb-idl.at b/tests/ovsdb-idl.at
index 11b8b36..f4d03f8 100644
--- a/tests/ovsdb-idl.at
+++ b/tests/ovsdb-idl.at
@@ -1,6 +1,5 @@ 
 AT_BANNER([OVSDB -- interface description language (IDL)])
 
-OVS_RUNDIR=`pwd`; export OVS_RUNDIR
 # OVSDB_CHECK_IDL_C(TITLE, [PRE-IDL-TXN], TRANSACTIONS, OUTPUT, [KEYWORDS],
 #                   [FILTER])
 #
@@ -20,7 +19,6 @@  OVS_RUNDIR=`pwd`; export OVS_RUNDIR
 m4_define([OVSDB_CHECK_IDL_C],
   [AT_SETUP([$1 - C])
    AT_KEYWORDS([ovsdb server idl positive $5])
-   OVS_RUNDIR=`pwd`; export OVS_RUNDIR
    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])
@@ -38,7 +36,6 @@  m4_define([OVSDB_CHECK_IDL_PY],
   [AT_SETUP([$1 - Python])
    AT_SKIP_IF([test $HAVE_PYTHON = no])
    AT_KEYWORDS([ovsdb server idl positive Python $5])
-   OVS_RUNDIR=`pwd`; export OVS_RUNDIR
    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])
@@ -56,8 +53,6 @@  m4_define([OVSDB_CHECK_IDL_TCP_PY],
   [AT_SETUP([$1 - Python tcp])
    AT_SKIP_IF([test $HAVE_PYTHON = no])
    AT_KEYWORDS([ovsdb server idl positive Python with tcp socket $5])
-   OVS_RUNDIR=`pwd`; export OVS_RUNDIR
-   OVS_LOGDIR=`pwd`; export OVS_LOGDIR
    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])
@@ -78,8 +73,6 @@  m4_define([OVSDB_CHECK_IDL_TCP6_PY],
    AT_SKIP_IF([test $HAVE_PYTHON = no])
    AT_SKIP_IF([test $HAVE_IPV6 = no])
    AT_KEYWORDS([ovsdb server idl positive Python with tcp6 socket $5])
-   OVS_RUNDIR=`pwd`; export OVS_RUNDIR
-   OVS_LOGDIR=`pwd`; export OVS_LOGDIR
    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])
@@ -517,7 +510,6 @@  OVSDB_CHECK_IDL_PY([row-from-json idl, whats this],
 
 AT_SETUP([idl handling of missing tables and columns - C])
 AT_KEYWORDS([ovsdb server idl positive])
-OVS_RUNDIR=`pwd`; export OVS_RUNDIR
 
 # idltest2.ovsschema is the same as idltest.ovsschema, except that
 # table link2 and column l2 have been deleted.  But the IDL still
diff --git a/tests/ovsdb-macros.at b/tests/ovsdb-macros.at
index 2aa752b..c1aa619 100644
--- a/tests/ovsdb-macros.at
+++ b/tests/ovsdb-macros.at
@@ -2,8 +2,7 @@  dnl OVSDB_INIT([$1])
 dnl
 dnl Creates an empty database named $1.
 m4_define([OVSDB_INIT],
-  [OVS_RUNDIR=`pwd`; export OVS_RUNDIR
-   AT_CHECK(
+  [AT_CHECK(
      [ovsdb-tool create $1 $abs_top_srcdir/vswitchd/vswitch.ovsschema],
      [0], [stdout], [ignore])
    AT_CHECK(
diff --git a/tests/ovsdb-monitor.at b/tests/ovsdb-monitor.at
index 016aa2c..0dbf5b0 100644
--- a/tests/ovsdb-monitor.at
+++ b/tests/ovsdb-monitor.at
@@ -19,7 +19,6 @@  AT_BANNER([OVSDB -- ovsdb-server monitors])
 m4_define([OVSDB_CHECK_MONITOR], 
   [AT_SETUP([$1])
    AT_KEYWORDS([ovsdb server monitor positive $9])
-   OVS_RUNDIR=`pwd`; export OVS_RUNDIR
    $2 > schema
    AT_CHECK([ovsdb-tool create db schema], [0], [stdout], [ignore])
    m4_foreach([txn], [$3],
diff --git a/tests/ovsdb-server.at b/tests/ovsdb-server.at
index 8fce70e..a447e79 100644
--- a/tests/ovsdb-server.at
+++ b/tests/ovsdb-server.at
@@ -21,7 +21,6 @@  m4_define([OVSDB_SERVER_SHUTDOWN],
 # TITLE is provided to AT_SETUP and KEYWORDS to AT_KEYWORDS.
 m4_define([OVSDB_CHECK_EXECUTION], 
   [AT_SETUP([$1])
-  OVS_RUNDIR=`pwd`; export OVS_RUNDIR
    AT_KEYWORDS([ovsdb server positive unix $5])
    $2 > schema
    AT_CHECK([ovsdb-tool create db schema], [0], [stdout], [ignore])
@@ -43,7 +42,6 @@  AT_BANNER([ovsdb-server miscellaneous features])
 AT_SETUP([truncating corrupted database log])
 AT_KEYWORDS([ovsdb server positive unix])
 AT_SKIP_IF([test "$IS_WIN32" = "yes"])
-OVS_RUNDIR=`pwd`; export OVS_RUNDIR
 ordinal_schema > schema
 AT_CHECK([ovsdb-tool create db schema], [0], [stdout], [ignore])
 dnl Do one transaction and save the output.
@@ -91,7 +89,6 @@  AT_CLEANUP
 AT_SETUP([truncating database log with bad transaction])
 AT_KEYWORDS([ovsdb server positive unix])
 AT_SKIP_IF([test "$IS_WIN32" = "yes"])
-OVS_RUNDIR=`pwd`; export OVS_RUNDIR
 ordinal_schema > schema
 AT_CHECK([ovsdb-tool create db schema], [0], [stdout], [ignore])
 dnl Do one transaction and save the output.
@@ -139,7 +136,6 @@  AT_CLEANUP
 
 AT_SETUP([ovsdb-client get-schema-version])
 AT_KEYWORDS([ovsdb server positive])
-OVS_RUNDIR=`pwd`; export OVS_RUNDIR
 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])
@@ -150,7 +146,6 @@  AT_CLEANUP
 
 AT_SETUP([database multiplexing implementation])
 AT_KEYWORDS([ovsdb server positive])
-OVS_RUNDIR=`pwd`; export OVS_RUNDIR
 ordinal_schema > schema1
 constraint_schema > schema2
 AT_CHECK([ovsdb-tool create db1 schema1], [0], [ignore], [ignore])
@@ -171,8 +166,6 @@  AT_CLEANUP
 AT_SETUP([ovsdb-server/add-db and remove-db])
 AT_KEYWORDS([ovsdb server positive])
 ON_EXIT([kill `cat ovsdb-server.pid`])
-OVS_RUNDIR=`pwd`; export OVS_RUNDIR
-OVS_LOGDIR=`pwd`; export OVS_LOGDIR
 ordinal_schema > schema1
 constraint_schema > schema2
 AT_CHECK([ovsdb-tool create db1 schema1], [0], [ignore], [ignore])
@@ -257,8 +250,6 @@  AT_SETUP([ovsdb-server/add-db with --monitor])
 AT_KEYWORDS([ovsdb server positive])
 AT_SKIP_IF([test "$IS_WIN32" = "yes"])
 # Start ovsdb-server, initially with one db.
-OVS_RUNDIR=`pwd`; export OVS_RUNDIR
-OVS_LOGDIR=`pwd`; export OVS_LOGDIR
 ordinal_schema > schema
 AT_CHECK([ovsdb-tool create db1 schema], [0], [ignore], [ignore])
 ON_EXIT([kill `cat *.pid`])
@@ -290,8 +281,6 @@  AT_SETUP([ovsdb-server/add-db and remove-db with --monitor])
 AT_KEYWORDS([ovsdb server positive])
 AT_SKIP_IF([test "$IS_WIN32" = "yes"])
 # Start ovsdb-server, initially with one db.
-OVS_RUNDIR=`pwd`; export OVS_RUNDIR
-OVS_LOGDIR=`pwd`; export OVS_LOGDIR
 ordinal_schema > schema
 AT_CHECK([ovsdb-tool create db1 schema], [0], [ignore], [ignore])
 constraint_schema > schema2
@@ -319,8 +308,6 @@  AT_CLEANUP
 
 AT_SETUP([--remote=db: implementation])
 AT_KEYWORDS([ovsdb server positive])
-OVS_RUNDIR=`pwd`; export OVS_RUNDIR
-OVS_LOGDIR=`pwd`; export OVS_LOGDIR
 AT_DATA([schema],
   [[{"name": "mydb",
      "tables": {
@@ -384,8 +371,6 @@  AT_CLEANUP
 
 AT_SETUP([ovsdb-server/add-remote and remove-remote])
 AT_KEYWORDS([ovsdb server positive])
-OVS_RUNDIR=`pwd`; export OVS_RUNDIR
-OVS_LOGDIR=`pwd`; export OVS_LOGDIR
 ordinal_schema > schema
 AT_CHECK([ovsdb-tool create db schema], [0], [ignore], [ignore])
 ON_EXIT([kill `cat *.pid`])
@@ -440,8 +425,6 @@  AT_SETUP([ovsdb-server/add-remote with --monitor])
 AT_KEYWORDS([ovsdb server positive])
 AT_SKIP_IF([test "$IS_WIN32" = "yes"])
 # Start ovsdb-server, initially with no remotes.
-OVS_RUNDIR=`pwd`; export OVS_RUNDIR
-OVS_LOGDIR=`pwd`; export OVS_LOGDIR
 ordinal_schema > schema
 AT_CHECK([ovsdb-tool create db schema], [0], [ignore], [ignore])
 ON_EXIT([kill `cat *.pid`])
@@ -471,8 +454,6 @@  AT_SETUP([ovsdb-server/add-remote and remove-remote with --monitor])
 AT_KEYWORDS([ovsdb server positive])
 AT_SKIP_IF([test "$IS_WIN32" = "yes"])
 # Start ovsdb-server, initially with no remotes.
-OVS_RUNDIR=`pwd`; export OVS_RUNDIR
-OVS_LOGDIR=`pwd`; export OVS_LOGDIR
 ordinal_schema > schema
 AT_CHECK([ovsdb-tool create db schema], [0], [ignore], [ignore])
 ON_EXIT([kill `cat *.pid`])
@@ -530,7 +511,6 @@  AT_CHECK(
                 "certificate": "'"$PKIDIR/testpki-cert2.pem"'",
                 "ca_cert": "'"$PKIDIR/testpki-cacert.pem"'"}}]']],
   [0], [ignore], [ignore])
-OVS_LOGDIR=`pwd`; export OVS_LOGDIR
 AT_CHECK(
   [ovsdb-server --log-file --detach --no-chdir --pidfile="`pwd`"/pid \
         --private-key=db:mydb,SSL,private_key \
@@ -561,7 +541,6 @@  AT_CLEANUP
 
 AT_SETUP([compacting online])
 AT_KEYWORDS([ovsdb server compact])
-OVS_RUNDIR=`pwd`; export OVS_RUNDIR
 ordinal_schema > schema
 dnl Make sure that "ovsdb-tool create" works with a dangling symlink for
 dnl the database and the lockfile, creating the target of each symlink rather
@@ -693,8 +672,6 @@  OVSDB_SERVER_SHUTDOWN
 AT_CLEANUP
 
 AT_SETUP([ovsdb-server combines updates on backlogged connections])
-OVS_LOGDIR=`pwd`; export OVS_LOGDIR
-OVS_RUNDIR=`pwd`; export OVS_RUNDIR
 ON_EXIT([kill `cat *.pid`])
 
 # The maximum socket receive buffer size is important for this test, which
@@ -812,8 +789,6 @@  m4_define([OVSDB_CHECK_EXECUTION],
   [AT_SETUP([$1])
    AT_KEYWORDS([ovsdb server positive ssl $5])
    AT_SKIP_IF([test "$HAVE_OPENSSL" = no])
-   OVS_RUNDIR=`pwd`; export OVS_RUNDIR
-   OVS_LOGDIR=`pwd`; export OVS_LOGDIR
    $2 > schema
    PKIDIR=$abs_top_builddir/tests
    AT_CHECK([ovsdb-tool create db schema], [0], [stdout], [ignore])
@@ -852,8 +827,6 @@  m4_define([OVSDB_CHECK_EXECUTION],
    AT_KEYWORDS([ovsdb server positive ssl6 $5])
    AT_SKIP_IF([test "$HAVE_OPENSSL" = no])
    AT_SKIP_IF([test $HAVE_IPV6 = no])
-   OVS_RUNDIR=`pwd`; export OVS_RUNDIR
-   OVS_LOGDIR=`pwd`; export OVS_LOGDIR
    $2 > schema
    PKIDIR=$abs_top_builddir/tests
    AT_CHECK([ovsdb-tool create db schema], [0], [stdout], [ignore])
@@ -877,7 +850,6 @@  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])
-OVS_LOGDIR=`pwd`; export OVS_LOGDIR
 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])
 TCP_PORT=`parse_listening_port < ovsdb-server.log`
 AT_CHECK([ovsdb-client get-schema-version tcp:127.0.0.1:$TCP_PORT ordinals], [0], [5.1.3
@@ -902,8 +874,6 @@  AT_CLEANUP])
 m4_define([OVSDB_CHECK_EXECUTION],
   [AT_SETUP([$1])
    AT_KEYWORDS([ovsdb server positive tcp $5])
-   OVS_RUNDIR=`pwd`; export OVS_RUNDIR
-   OVS_LOGDIR=`pwd`; export OVS_LOGDIR
    $2 > schema
    PKIDIR=$abs_top_builddir/tests
    AT_CHECK([ovsdb-tool create db schema], [0], [stdout], [ignore])
@@ -941,8 +911,6 @@  m4_define([OVSDB_CHECK_EXECUTION],
   [AT_SETUP([$1])
    AT_KEYWORDS([ovsdb server positive tcp6 $5])
    AT_SKIP_IF([test $HAVE_IPV6 = no])
-   OVS_RUNDIR=`pwd`; export OVS_RUNDIR
-   OVS_LOGDIR=`pwd`; export OVS_LOGDIR
    $2 > schema
    PKIDIR=$abs_top_builddir/tests
    AT_CHECK([ovsdb-tool create db schema], [0], [stdout], [ignore])
@@ -983,7 +951,6 @@  m4_define([OVSDB_CHECK_EXECUTION],
   [AT_SETUP([$1])
    AT_SKIP_IF([test "$IS_WIN32" = "yes"])
    AT_KEYWORDS([ovsdb server positive transient $5])
-   OVS_RUNDIR=`pwd`; export OVS_RUNDIR
    $2 > schema
    AT_CHECK([ovsdb-tool create db schema], [0], [stdout], [ignore])
    m4_foreach([txn], [$3], 
diff --git a/tests/ovsdb-tool.at b/tests/ovsdb-tool.at
index 0d3219b..3c2e628 100644
--- a/tests/ovsdb-tool.at
+++ b/tests/ovsdb-tool.at
@@ -16,7 +16,6 @@  AT_BANNER([OVSDB -- ovsdb-tool])
 m4_define([OVSDB_CHECK_EXECUTION], 
   [AT_SETUP([$1])
    AT_KEYWORDS([ovsdb file positive $5])
-   OVS_RUNDIR=`pwd`; export OVS_RUNDIR
    $2 > schema
    touch .db.~lock~
    AT_CHECK([ovsdb-tool create db schema], [0], [stdout], [ignore])
@@ -49,7 +48,6 @@  AT_CLEANUP
 
 AT_SETUP([ovsdb-tool compact])
 AT_KEYWORDS([ovsdb file positive])
-OVS_RUNDIR=`pwd`; export OVS_RUNDIR
 ordinal_schema > schema
 dnl Make sure that "ovsdb-tool create" works with a dangling symlink,
 dnl creating the target of the symlink rather than replacing the symlink
@@ -157,7 +155,6 @@  AT_CLEANUP
 
 AT_SETUP([ovsdb-tool convert -- removing a column])
 AT_KEYWORDS([ovsdb file positive])
-OVS_RUNDIR=`pwd`; export OVS_RUNDIR
 ordinal_schema > schema
 AT_DATA([new-schema], 
   [[{"name": "ordinals",
@@ -225,7 +222,6 @@  AT_CLEANUP
 
 AT_SETUP([ovsdb-tool convert -- adding a column])
 AT_KEYWORDS([ovsdb file positive])
-OVS_RUNDIR=`pwd`; export OVS_RUNDIR
 AT_DATA([schema], 
   [[{"name": "ordinals",
      "tables": {
diff --git a/tests/unixctl-py.at b/tests/unixctl-py.at
index 2fb7ee9..cd0ac23 100644
--- a/tests/unixctl-py.at
+++ b/tests/unixctl-py.at
@@ -72,8 +72,6 @@  OVS_VSWITCHD_STOP
 AT_CLEANUP
 
 AT_SETUP([unixctl bad target - Python])
-OVS_RUNDIR=`pwd`; export OVS_RUNDIR
-OVS_DBDIR=`pwd`; export OVS_DBDIR
 AT_SKIP_IF([test $HAVE_PYTHON = no])
 
 AT_CHECK([PYAPPCTL -t bogus doit], [1], [], [stderr])
@@ -90,10 +88,6 @@  AT_CLEANUP
 
 AT_SETUP([unixctl server - Python])
 AT_SKIP_IF([test $HAVE_PYTHON = no])
-OVS_RUNDIR=`pwd`; export OVS_RUNDIR
-OVS_LOGDIR=`pwd`; export OVS_LOGDIR
-OVS_DBDIR=`pwd`; export OVS_DBDIR
-OVS_SYSCONFDIR=`pwd`; export OVS_SYSCONFDIR
 ON_EXIT([kill `cat test-unixctl.py.pid`])
 AT_CAPTURE_FILE([`pwd`/test-unixctl.py.log])
 AT_CHECK([$PYTHON $srcdir/test-unixctl.py --log-file --pidfile --detach])
diff --git a/tests/vconn.at b/tests/vconn.at
index 4e91ed8..397725d 100644
--- a/tests/vconn.at
+++ b/tests/vconn.at
@@ -11,7 +11,6 @@  m4_define([TEST_VCONN_CLASS],
       [send-short-hello],
       [send-invalid-version-hello]],
      [AT_SETUP([$1 vconn - m4_bpatsubst(testname, [-], [ ])])
-     OVS_RUNDIR=`pwd`; export OVS_RUNDIR
       m4_if([$1], [ssl], [
         AT_SKIP_IF([test "$HAVE_OPENSSL" = no])
         AT_CHECK([cp $abs_top_builddir/tests/testpki*.pem .])])
diff --git a/tests/vlog.at b/tests/vlog.at
index fdd6732..321ef2d 100644
--- a/tests/vlog.at
+++ b/tests/vlog.at
@@ -103,10 +103,6 @@  AT_CLEANUP
 
 AT_SETUP([vlog - vlog/reopen - Python])
 AT_SKIP_IF([test $HAVE_PYTHON = no])
-OVS_RUNDIR=`pwd`; export OVS_RUNDIR
-OVS_LOGDIR=`pwd`; export OVS_LOGDIR
-OVS_DBDIR=`pwd`; export OVS_DBDIR
-OVS_SYSCONFDIR=`pwd`; export OVS_SYSCONFDIR
 ON_EXIT([kill `cat test-unixctl.py.pid`])
 
 AT_CAPTURE_FILE([log])
@@ -132,10 +128,6 @@  AT_CLEANUP
 
 AT_SETUP([vlog - vlog/reopen without log file - Python])
 AT_SKIP_IF([test $HAVE_PYTHON = no])
-OVS_RUNDIR=`pwd`; export OVS_RUNDIR
-OVS_LOGDIR=`pwd`; export OVS_LOGDIR
-OVS_DBDIR=`pwd`; export OVS_DBDIR
-OVS_SYSCONFDIR=`pwd`; export OVS_SYSCONFDIR
 ON_EXIT([kill `cat test-unixctl.py.pid`])
 
 AT_CHECK([$PYTHON $srcdir/test-unixctl.py --pidfile --detach])
@@ -155,10 +147,6 @@  AT_SKIP_IF([test $HAVE_PYTHON = no])
 AT_SKIP_IF([test ! -c /dev/full])
 AT_SKIP_IF([echo > /dev/full])
 
-OVS_RUNDIR=`pwd`; export OVS_RUNDIR
-OVS_LOGDIR=`pwd`; export OVS_LOGDIR
-OVS_DBDIR=`pwd`; export OVS_DBDIR
-OVS_SYSCONFDIR=`pwd`; export OVS_SYSCONFDIR
 ON_EXIT([kill `cat test-unixctl.py.pid`])
 
 AT_CHECK([$PYTHON $srcdir/test-unixctl.py --log-file=`pwd`/log --pidfile --detach])
@@ -182,10 +170,6 @@  AT_CLEANUP
 
 AT_SETUP([vlog - vlog/set and vlog/list - Python])
 AT_SKIP_IF([test $HAVE_PYTHON = no])
-OVS_RUNDIR=`pwd`; export OVS_RUNDIR
-OVS_LOGDIR=`pwd`; export OVS_LOGDIR
-OVS_DBDIR=`pwd`; export OVS_DBDIR
-OVS_SYSCONFDIR=`pwd`; export OVS_SYSCONFDIR
 ON_EXIT([kill `cat test-unixctl.py.pid`])
 
 AT_CAPTURE_FILE([log])
@@ -236,10 +220,6 @@  AT_CHECK([grep -q 'I<3OVS' log])
 AT_CLEANUP
 
 AT_SETUP([vlog - RFC5424 facility])
-OVS_RUNDIR=`pwd`; export OVS_RUNDIR
-OVS_LOGDIR=`pwd`; export OVS_LOGDIR
-OVS_DBDIR=`pwd`; export OVS_DBDIR
-OVS_SYSCONFDIR=`pwd`; export OVS_SYSCONFDIR
 ON_EXIT([kill `cat ovsdb-server.pid`])
 
 dnl Create database.
@@ -278,10 +258,6 @@  AT_CLEANUP
 
 AT_SETUP([vlog - RFC5424 facility - Python])
 AT_SKIP_IF([test $HAVE_PYTHON = no])
-OVS_RUNDIR=`pwd`; export OVS_RUNDIR
-OVS_LOGDIR=`pwd`; export OVS_LOGDIR
-OVS_DBDIR=`pwd`; export OVS_DBDIR
-OVS_SYSCONFDIR=`pwd`; export OVS_SYSCONFDIR
 ON_EXIT([kill `cat test-unixctl.py.pid`])
 
 AT_CHECK([$PYTHON $srcdir/test-unixctl.py --log-file=`pwd`/log --pidfile \
diff --git a/tests/vtep-ctl.at b/tests/vtep-ctl.at
index bb2df4f..f4a7edf 100644
--- a/tests/vtep-ctl.at
+++ b/tests/vtep-ctl.at
@@ -2,8 +2,7 @@  dnl VTEP_OVSDB_INIT([$1])
 dnl
 dnl Creates an empty database named $1.
 m4_define([VTEP_OVSDB_INIT],
-  [OVS_RUNDIR=`pwd`; export OVS_RUNDIR
-   AT_CHECK(
+  [AT_CHECK(
      [ovsdb-tool create $1 $abs_top_srcdir/vtep/vtep.ovsschema],
      [0], [stdout], [ignore])
    AT_CHECK(