From: Ben Pfaff Date: Tue, 14 Aug 2012 20:18:03 +0000 (-0700) Subject: tests: Invoke daemons with --no-chdir so core files appear in test dir. X-Git-Tag: sliver-openvswitch-1.8.90-0~48^2~31 X-Git-Url: http://git.onelab.eu/?p=sliver-openvswitch.git;a=commitdiff_plain;h=77a922c7e53c3e9a2618d1f1a622bb2442f535b0 tests: Invoke daemons with --no-chdir so core files appear in test dir. The OVS daemons "cd" to / as a normal part of their startup, since this is traditional for daemons under Unix. But this also means that, if the daemons happen to terminate with a core in the unit tests, then the core file won't be written because / has too-restrictive permissions. (Unless you run the unit tests as root, or you've got cores configured to go to a non-standard location.) This commit fixes the problem by invoking most daemons with --no-chdir so that the core files go to a test-specific directory. I didn't change invocations of the Python daemons, since Python doesn't normally terminate with a core. Signed-off-by: Ben Pfaff Acked-by: Kyle Mestery --- diff --git a/tests/daemon.at b/tests/daemon.at index 3f6c269d8..a80cd3e84 100644 --- a/tests/daemon.at +++ b/tests/daemon.at @@ -72,7 +72,7 @@ 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 --pidfile="`pwd`"/pid --remote=punix:socket --unixctl="`pwd`"/unixctl db], [0]) +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`]) # Kill the daemon and make sure that the pidfile gets deleted. @@ -95,7 +95,7 @@ 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 --pidfile="`pwd`"/daemon --monitor --remote=punix:socket --unixctl="`pwd`"/unixctl db], [0]) +AT_CHECK([ovsdb-server --detach --no-chdir --pidfile="`pwd`"/daemon --monitor --remote=punix:socket --unixctl="`pwd`"/unixctl db], [0]) 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, @@ -134,7 +134,7 @@ AT_CLEANUP AT_SETUP([daemon --detach startup errors]) AT_CAPTURE_FILE([pid]) OVSDB_INIT([db]) -AT_CHECK([ovsdb-server --detach --pidfile="`pwd`"/pid --unixctl="`pwd`"/nonexistent/unixctl db], [1], [], [stderr]) +AT_CHECK([ovsdb-server --detach --no-chdir --pidfile="`pwd`"/pid --unixctl="`pwd`"/nonexistent/unixctl db], [1], [], [stderr]) AT_CHECK([grep 'ovsdb-server: could not initialize control socket' stderr], [0], [ignore], []) AT_CHECK([test ! -s pid]) @@ -143,7 +143,7 @@ AT_CLEANUP AT_SETUP([daemon --detach --monitor startup errors]) AT_CAPTURE_FILE([pid]) OVSDB_INIT([db]) -AT_CHECK([ovsdb-server --detach --pidfile="`pwd`"/pid --monitor --unixctl="`pwd`"/nonexistent/unixctl db], [1], [], [stderr]) +AT_CHECK([ovsdb-server --detach --no-chdir --pidfile="`pwd`"/pid --monitor --unixctl="`pwd`"/nonexistent/unixctl db], [1], [], [stderr]) AT_CHECK([grep 'ovsdb-server: could not initialize control socket' stderr], [0], [ignore], []) AT_CHECK([test ! -s pid]) diff --git a/tests/jsonrpc.at b/tests/jsonrpc.at index b6aa27d00..2a7f91b4f 100644 --- a/tests/jsonrpc.at +++ b/tests/jsonrpc.at @@ -1,7 +1,7 @@ AT_BANNER([JSON-RPC - C]) AT_SETUP([JSON-RPC request and successful reply]) -AT_CHECK([test-jsonrpc --detach --pidfile="`pwd`"/pid listen punix:socket]) +AT_CHECK([test-jsonrpc --detach --no-chdir --pidfile="`pwd`"/pid listen punix:socket]) AT_CHECK([test -s pid]) AT_CHECK([kill -0 `cat pid`]) AT_CHECK( @@ -12,7 +12,7 @@ AT_CHECK([kill `cat pid`]) AT_CLEANUP AT_SETUP([JSON-RPC request and error reply]) -AT_CHECK([test-jsonrpc --detach --pidfile="`pwd`"/pid listen punix:socket]) +AT_CHECK([test-jsonrpc --detach --no-chdir --pidfile="`pwd`"/pid listen punix:socket]) AT_CHECK([test -s pid]) AT_CHECK([kill -0 `cat pid`]) AT_CHECK( @@ -23,7 +23,7 @@ AT_CHECK([kill `cat pid`]) AT_CLEANUP AT_SETUP([JSON-RPC notification]) -AT_CHECK([test-jsonrpc --detach --pidfile="`pwd`"/pid listen punix:socket]) +AT_CHECK([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]) diff --git a/tests/ofproto-dpif.at b/tests/ofproto-dpif.at index 881831648..4fcf7e727 100644 --- a/tests/ofproto-dpif.at +++ b/tests/ofproto-dpif.at @@ -93,7 +93,7 @@ AT_CHECK([tail -1 stdout], [0], ]) AT_CAPTURE_FILE([ofctl_monitor.log]) -AT_CHECK([ovs-ofctl monitor br0 65534 invalid_ttl --detach --pidfile 2> ofctl_monitor.log]) +AT_CHECK([ovs-ofctl monitor br0 65534 invalid_ttl --detach --no-chdir --pidfile 2> ofctl_monitor.log]) AT_CHECK([ovs-appctl ofproto/trace br0 'in_port(1),eth(src=50:54:00:00:00:05,dst=50:54:00:00:00:07),eth_type(0x0800),ipv4(src=192.168.0.1,dst=192.168.0.2,proto=1,tos=0,ttl=2,frag=no)' -generate], [0], [stdout]) OVS_WAIT_UNTIL([ovs-appctl -t ovs-ofctl exit]) AT_CHECK([cat ofctl_monitor.log], [0], [dnl @@ -254,7 +254,7 @@ cookie=0x9 table=7 in_port=86 actions=mod_tp_dst:86,controller,controller AT_CHECK([ovs-ofctl add-flows br0 flows.txt]) dnl Flow miss. -AT_CHECK([ovs-ofctl monitor -P openflow10 br0 65534 --detach --pidfile 2> ofctl_monitor.log]) +AT_CHECK([ovs-ofctl monitor -P openflow10 br0 65534 --detach --no-chdir --pidfile 2> ofctl_monitor.log]) for i in 1 2 3 ; do ovs-appctl netdev-dummy/receive p1 'in_port(1),eth(src=50:54:00:00:00:05,dst=50:54:00:00:00:07),eth_type(0x0800),ipv4(src=192.168.0.1,dst=192.168.0.2,proto=6,tos=0,ttl=64,frag=no),tcp(src=8,dst=9)' @@ -273,7 +273,7 @@ priority:0,tunnel:0,metadata:0,in_port:0000,tci(0) mac(50:54:00:00:00:05->50:54: ]) dnl Singleton controller action. -AT_CHECK([ovs-ofctl monitor -P openflow10 br0 65534 --detach --pidfile 2> ofctl_monitor.log]) +AT_CHECK([ovs-ofctl monitor -P openflow10 br0 65534 --detach --no-chdir --pidfile 2> ofctl_monitor.log]) for i in 1 2 3 ; do ovs-appctl netdev-dummy/receive p1 'in_port(1),eth(src=10:11:11:11:11:11,dst=50:54:00:00:00:07),eth_type(0x0800),ipv4(src=192.168.0.1,dst=192.168.0.2,proto=6,tos=0,ttl=64,frag=no),tcp(src=8,dst=10)' @@ -292,7 +292,7 @@ priority:0,tunnel:0,metadata:0,in_port:0000,tci(0) mac(10:11:11:11:11:11->50:54: ]) dnl Modified controller action. -AT_CHECK([ovs-ofctl monitor -P openflow10 br0 65534 --detach --pidfile 2> ofctl_monitor.log]) +AT_CHECK([ovs-ofctl monitor -P openflow10 br0 65534 --detach --no-chdir --pidfile 2> ofctl_monitor.log]) for i in 1 2 3 ; do ovs-appctl netdev-dummy/receive p1 'in_port(1),eth(src=30:33:33:33:33:33,dst=50:54:00:00:00:07),eth_type(0x0800),ipv4(src=192.168.0.1,dst=192.168.0.2,proto=6,tos=0,ttl=64,frag=no),tcp(src=8,dst=10)' @@ -311,7 +311,7 @@ priority:0,tunnel:0,metadata:0,in_port:0000,tci(vlan:15,pcp:0) mac(30:33:33:33:3 ]) dnl Checksum TCP. -AT_CHECK([ovs-ofctl monitor br0 65534 -P nxm --detach --pidfile 2> ofctl_monitor.log]) +AT_CHECK([ovs-ofctl monitor br0 65534 -P nxm --detach --no-chdir --pidfile 2> ofctl_monitor.log]) for i in 1 ; do ovs-appctl netdev-dummy/receive p1 'in_port(1),eth(src=20:22:22:22:22:22,dst=50:54:00:00:00:07),eth_type(0x0800),ipv4(src=192.168.0.1,dst=192.168.0.2,proto=6,tos=0,ttl=64,frag=no),tcp(src=8,dst=11)' @@ -348,7 +348,7 @@ priority:0,tunnel:0,metadata:0,in_port:0000,tci(vlan:80,pcp:0) mac(80:81:81:81:8 ]) dnl Checksum UDP. -AT_CHECK([ovs-ofctl monitor br0 65534 --detach --pidfile 2> ofctl_monitor.log]) +AT_CHECK([ovs-ofctl monitor br0 65534 --detach --no-chdir --pidfile 2> ofctl_monitor.log]) for i in 1 ; do ovs-appctl netdev-dummy/receive p1 '50 54 00 00 00 07 20 22 22 22 22 22 08 00 45 00 00 1C 00 00 00 00 00 11 00 00 C0 A8 00 01 C0 A8 00 02 00 08 00 0B 00 00 12 34 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00' @@ -949,7 +949,7 @@ OVS_VSWITCHD_START( add-id-to-interface=false], [<0> ]) -AT_CHECK([test-netflow --detach --pidfile $NETFLOW_PORT:127.0.0.1 > netflow.log])AT_CAPTURE_FILE([netflow.log]) +AT_CHECK([test-netflow --detach --no-chdir --pidfile $NETFLOW_PORT:127.0.0.1 > netflow.log])AT_CAPTURE_FILE([netflow.log]) for delay in 1000 30000; do ovs-appctl netdev-dummy/receive p1 'in_port(2),eth(src=50:54:00:00:00:05,dst=50:54:00:00:00:07),eth_type(0x0800),ipv4(src=192.168.0.1,dst=192.168.0.2,proto=1,tos=0,ttl=64,frag=no),icmp(type=8,code=0)' @@ -992,7 +992,7 @@ OVS_VSWITCHD_START( add-id-to-interface=false], [<0> ]) -AT_CHECK([test-netflow --detach --pidfile $NETFLOW_PORT:127.0.0.1 > netflow.log])AT_CAPTURE_FILE([netflow.log]) +AT_CHECK([test-netflow --detach --no-chdir --pidfile $NETFLOW_PORT:127.0.0.1 > netflow.log])AT_CAPTURE_FILE([netflow.log]) AT_CHECK([ovs-appctl time/stop]) n=1 diff --git a/tests/ofproto-macros.at b/tests/ofproto-macros.at index 1d5a7cfc6..944fbac07 100644 --- a/tests/ofproto-macros.at +++ b/tests/ofproto-macros.at @@ -40,7 +40,7 @@ m4_define([OVS_VSWITCHD_START], AT_CHECK([ovsdb-tool create conf.db $abs_top_srcdir/vswitchd/vswitch.ovsschema]) dnl Start ovsdb-server. - AT_CHECK([ovsdb-server --detach --pidfile --log-file --remote=punix:$OVS_RUNDIR/db.sock], [0], [], [stderr]) + AT_CHECK([ovsdb-server --detach --no-chdir --pidfile --log-file --remote=punix:$OVS_RUNDIR/db.sock], [0], [], [stderr]) AT_CHECK([[sed < stderr ' /vlog|INFO|opened log file/d /ovsdb_server|INFO|ovsdb-server (Open vSwitch)/d']]) @@ -50,7 +50,7 @@ m4_define([OVS_VSWITCHD_START], AT_CHECK([ovs-vsctl --no-wait init]) dnl Start ovs-vswitchd. - AT_CHECK([ovs-vswitchd --detach --pidfile --enable-dummy --disable-system --log-file -vvconn], [0], [], [stderr]) + AT_CHECK([ovs-vswitchd --detach --no-chdir --pidfile --enable-dummy --disable-system --log-file -vvconn -vofproto_dpif], [0], [], [stderr]) AT_CAPTURE_FILE([ovs-vswitchd.log]) AT_CHECK([[sed < stderr ' /vlog|INFO|opened log file/d diff --git a/tests/ovs-vsctl.at b/tests/ovs-vsctl.at index a6c674981..ef2c0c095 100644 --- a/tests/ovs-vsctl.at +++ b/tests/ovs-vsctl.at @@ -4,7 +4,7 @@ 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 --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="`pwd`"/pid --remote=punix:socket --unixctl="`pwd`"/unixctl db >/dev/null 2>&1], [0], [ignore], [ignore])]) dnl OVS_VSCTL_CLEANUP dnl diff --git a/tests/ovsdb-idl.at b/tests/ovsdb-idl.at index 91f167197..48e74899e 100644 --- a/tests/ovsdb-idl.at +++ b/tests/ovsdb-idl.at @@ -21,7 +21,7 @@ m4_define([OVSDB_CHECK_IDL_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 --pidfile="`pwd`"/pid --remote=punix:socket --unixctl="`pwd`"/unixctl db], [0], [ignore], [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]) m4_if([$2], [], [], [AT_CHECK([ovsdb-client transact unix:socket $2], [0], [ignore], [ignore], [kill `cat pid`])]) AT_CHECK([test-ovsdb '-vPATTERN:console:test-ovsdb|%c|%m' -vjsonrpc -t10 idl unix:socket $3], @@ -38,7 +38,7 @@ m4_define([OVSDB_CHECK_IDL_PY], 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 --pidfile="`pwd`"/pid --remote=punix:socket --unixctl="`pwd`"/unixctl db], [0], [ignore], [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]) m4_if([$2], [], [], [AT_CHECK([ovsdb-client transact unix:socket $2], [0], [ignore], [ignore], [kill `cat pid`])]) AT_CHECK([$PYTHON $srcdir/test-ovsdb.py -t10 idl $srcdir/idltest.ovsschema unix:socket $3], diff --git a/tests/ovsdb-monitor.at b/tests/ovsdb-monitor.at index 1e319dd21..167b44c35 100644 --- a/tests/ovsdb-monitor.at +++ b/tests/ovsdb-monitor.at @@ -24,9 +24,9 @@ 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 --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="`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 --pidfile="`pwd`"/client-pid -d json monitor --format=csv unix:socket $4 $5 $8 > output], + AT_CHECK([ovsdb-client -vjsonrpc --detach --no-chdir --pidfile="`pwd`"/client-pid -d json monitor --format=csv unix:socket $4 $5 $8 > output], [0], [ignore], [ignore], [kill `cat server-pid`]) m4_foreach([txn], [$6], [AT_CHECK([ovsdb-client transact unix:socket 'txn'], [0], diff --git a/tests/ovsdb-server.at b/tests/ovsdb-server.at index 9d64ef7d1..b0a3377bb 100644 --- a/tests/ovsdb-server.at +++ b/tests/ovsdb-server.at @@ -24,7 +24,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 --pidfile="`pwd`"/pid --remote=punix:socket --unixctl="`pwd`"/unixctl db], [0], [ignore], [ignore]) + AT_CHECK([ovsdb-server --detach --no-chdir --pidfile="`pwd`"/pid --remote=punix:socket --unixctl="`pwd`"/unixctl 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`]) @@ -134,7 +134,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 --pidfile="`pwd`"/pid --unixctl="`pwd`"/unixctl --remote=punix:socket db], [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-client get-schema-version unix:socket ordinals], [0], [5.1.3 ]) OVSDB_SERVER_SHUTDOWN @@ -144,7 +144,7 @@ AT_SETUP([database multiplexing implementation]) AT_KEYWORDS([ovsdb server positive]) ordinal_schema > schema AT_CHECK([ovsdb-tool create db schema], [0], [ignore], [ignore]) -AT_CHECK([ovsdb-server --detach --pidfile="`pwd`"/pid --unixctl="`pwd`"/unixctl --remote=punix:socket db], [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-client list-dbs unix:socket]], [0], [ordinals @@ -172,7 +172,7 @@ AT_CHECK( {"op": "insert", "table": "Manager", "row": {"manager": "punix:socket"}}]']], [0], [ignore], [ignore]) -AT_CHECK([ovsdb-server --detach --pidfile="`pwd`"/pid --remote=db:Manager,manager --unixctl="`pwd`"/unixctl db], [0], [ignore], [ignore]) +AT_CHECK([ovsdb-server --detach --no-chdir --pidfile="`pwd`"/pid --remote=db:Manager,manager --unixctl="`pwd`"/unixctl db], [0], [ignore], [ignore]) AT_CHECK( [[ovsdb-client transact unix:socket \ '["mydb", @@ -219,7 +219,7 @@ AT_CHECK( AT_CHECK([perl $srcdir/choose-port.pl], [0], [stdout]) SSL_PORT=`cat stdout` AT_CHECK( - [ovsdb-server --detach --pidfile="`pwd`"/pid \ + [ovsdb-server --detach --no-chdir --pidfile="`pwd`"/pid \ --private-key=db:SSL,private_key \ --certificate=db:SSL,certificate \ --ca-cert=db:SSL,ca_cert \ @@ -257,7 +257,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 --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="`pwd`"/pid --unixctl="`pwd`"/unixctl --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( @@ -402,7 +402,7 @@ m4_define([OVSDB_CHECK_EXECUTION], SSL_PORT=`cat stdout` PKIDIR=$abs_top_builddir/tests AT_CHECK([ovsdb-tool create db schema], [0], [stdout], [ignore]) - AT_CHECK([ovsdb-server --detach --pidfile="`pwd`"/pid --private-key=$PKIDIR/testpki-privkey2.pem --certificate=$PKIDIR/testpki-cert2.pem --ca-cert=$PKIDIR/testpki-cacert.pem --remote=pssl:$SSL_PORT:127.0.0.1 --unixctl="`pwd`"/unixctl db], [0], [ignore], [ignore]) + AT_CHECK([ovsdb-server --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:$SSL_PORT:127.0.0.1 --unixctl="`pwd`"/unixctl db], [0], [ignore], [ignore]) 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], [test ! -e pid || kill `cat pid`])