I think it might be sufficient to check that the parent pid changed, rather than being picky about the new parent pid or the name of the process associated with that new parent pid.
On Thu, Jun 20, 2013 at 07:11:51PM +0100, James Page wrote: > Meh - I need to test this better; not working reliably everywhere. > > On 20/06/13 18:44, James Page wrote: > >On Ubuntu Saucy based desktops, upstart runs with user sessions > >enabled which means that the init process under which a daemon > >might run is not always pid = 1. > > > >Check for a process with cmd name of 'init' instead. > > > >Signed-off-by: James Page <james.p...@ubuntu.com> > >--- > > tests/daemon-py.at | 10 ++++++---- > > tests/daemon.at | 10 ++++++---- > > 2 files changed, 12 insertions(+), 8 deletions(-) > > > >diff --git a/tests/daemon-py.at b/tests/daemon-py.at > >index 39ab3cc..ff8592c 100644 > >--- a/tests/daemon-py.at > >+++ b/tests/daemon-py.at > >@@ -141,8 +141,9 @@ AT_CHECK([test -s daemon]) > > CHECK([kill -0 `cat daemon`]) > > CHECK([ps -o ppid= -p `cat daemon` > monitor]) > > CHECK([kill -0 `cat monitor`]) > >-CHECK([ps -o ppid= -p `cat monitor` > init]) > >-CHECK([test `cat init` = 1]) > >+CHECK([ps -o ppid= -p `cat monitor` > init.pid]) > >+CHECK([ps -o cmd= -p `cat init.pid` | awk '{ print $1 }' > init]) > >+CHECK([test `cat init` = init]) > > # Kill the daemon process, making it look like a segfault, > > # and wait for a new daemon process to get spawned. > > CHECK([cp daemon olddaemon]) > >@@ -158,8 +159,9 @@ CHECK([diff olddaemon newdaemon], [1], [ignore]) > > CHECK([ps -o ppid= -p `cat daemon` > newmonitor]) > > CHECK([diff monitor newmonitor]) > > CHECK([kill -0 `cat newmonitor`]) > >-CHECK([ps -o ppid= -p `cat newmonitor` > init]) > >-CHECK([test `cat init` = 1]) > >+CHECK([ps -o ppid= -p `cat monitor` > init.pid]) > >+CHECK([ps -o cmd= -p `cat init.pid` | awk '{ print $1 }' > init]) > >+CHECK([test `cat init` = init]) > > # Kill the daemon process with SIGTERM, and wait for the daemon > > # and the monitor processes to go away and the pidfile to get deleted. > > CHECK([kill `cat daemon`], [0], [], [ignore]) > >diff --git a/tests/daemon.at b/tests/daemon.at > >index a80cd3e..5ff4476 100644 > >--- a/tests/daemon.at > >+++ b/tests/daemon.at > >@@ -103,8 +103,9 @@ AT_CHECK([test -s daemon]) > > CHECK([kill -0 `cat daemon`]) > > CHECK([ps -o ppid= -p `cat daemon` > monitor]) > > CHECK([kill -0 `cat monitor`]) > >-CHECK([ps -o ppid= -p `cat monitor` > init]) > >-CHECK([test `cat init` = 1]) > >+CHECK([ps -o ppid= -p `cat monitor` > init.pid]) > >+CHECK([ps -o cmd= -p `cat init.pid` | awk '{ print $1 }' > init]) > >+CHECK([test `cat init` = init]) > > # Kill the daemon process, making it look like a segfault, > > # and wait for a new daemon process to get spawned. > > CHECK([cp daemon olddaemon]) > >@@ -120,8 +121,9 @@ CHECK([diff olddaemon newdaemon], [1], [ignore]) > > CHECK([ps -o ppid= -p `cat daemon` > newmonitor]) > > CHECK([diff monitor newmonitor]) > > CHECK([kill -0 `cat newmonitor`]) > >-CHECK([ps -o ppid= -p `cat newmonitor` > init]) > >-CHECK([test `cat init` = 1]) > >+CHECK([ps -o ppid= -p `cat monitor` > init.pid]) > >+CHECK([ps -o cmd= -p `cat init.pid` | awk '{ print $1 }' > init]) > >+CHECK([test `cat init` = init]) > > # Kill the daemon process with SIGTERM, and wait for the daemon > > # and the monitor processes to go away and the pidfile to get deleted. > > CHECK([kill `cat daemon`], [0], [], [ignore]) > > > > > -- > James Page > Ubuntu Core Developer > Debian Maintainer > james.p...@ubuntu.com > _______________________________________________ > dev mailing list > dev@openvswitch.org > http://openvswitch.org/mailman/listinfo/dev _______________________________________________ dev mailing list dev@openvswitch.org http://openvswitch.org/mailman/listinfo/dev