summaryrefslogtreecommitdiff
path: root/tests/ovs-vsctl.at
diff options
context:
space:
mode:
authorBen Pfaff <blp@ovn.org>2016-10-05 20:07:56 -0700
committerBen Pfaff <blp@ovn.org>2016-10-12 12:22:11 -0700
commit561205007e17f699dd552c451f138c7a9c9c01dc (patch)
treeba8e579690d428bb9fa213a078b839781796d092 /tests/ovs-vsctl.at
parenta8cb456227b01106154726147ac52a5e3cec8860 (diff)
downloadopenvswitch-561205007e17f699dd552c451f138c7a9c9c01dc.tar.gz
tests: Get rid of overly specific --pidfile and --unixctl options.
At an early point in OVS development, OVS was built with fixed default directories for pidfiles and sockets. This meant that it was necessary to use lots of --pidfile and --unixctl options in the testsuite, to point the daemons to where they should put these files (since the testsuite cannot and generally should not touch the real system /var/run). Later on, the environment variables OVS_RUNDIR, OVS_LOGDIR, etc. were introduced to override these defaults, and even later the testsuite was changed to always set these variables correctly in every test. Thus, these days it isn't usually necessary to specify a filename on --pidfile or to specify --unixctl at all. However, many of the tests are built by cut-and-paste, so they tended to keep appearing anyhow. This commit drops most of them, making the testsuite easier to read and understand. This commit also sweeps away some other historical detritus. In particular, in early days of the testsuite there was no way to automatically kill daemons when a test failed (or otherwise ended). This meant that some tests were littered with calls to "kill `cat pidfile`" on almost every line (or m4 macros that expanded to the same thing) so that if a test failed partway through the testsuite would not hang waiting for a daemon to die that was never going to die without manual intervention. However, a long time ago we introduced the "on_exit" mechanism that obsoletes this. This commit eliminates a lot of the old litter of kill invocations, which also makes those tests easier to read. Signed-off-by: Ben Pfaff <blp@ovn.org> Acked-by: Andy Zhou <azhou@ovn.org>
Diffstat (limited to 'tests/ovs-vsctl.at')
-rw-r--r--tests/ovs-vsctl.at27
1 files changed, 14 insertions, 13 deletions
diff --git a/tests/ovs-vsctl.at b/tests/ovs-vsctl.at
index 51717869b..9737589c7 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.