aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJames Page <james.page@ubuntu.com>2013-06-20 22:31:52 +0100
committerBen Pfaff <blp@nicira.com>2013-06-20 15:51:59 -0700
commitc0068e4dbd515751a7d8ca94a5fc9c56f3f52de8 (patch)
treef3da15b01285206273f40d6ac0d3d944d0b53062
parent6b54845f8f0f37c74abd61a81f363e208047e364 (diff)
tests: Tolerate init process pid != 1.
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. Instead of checking for pid = 1, check to ensure that the parent pid of the monitor is not the pid of the shell that started it. Signed-off-by: James Page <james.page@ubuntu.com> Signed-off-by: Ben Pfaff <blp@nicira.com>
-rw-r--r--tests/daemon-py.at4
-rw-r--r--tests/daemon.at4
2 files changed, 4 insertions, 4 deletions
diff --git a/tests/daemon-py.at b/tests/daemon-py.at
index 39ab3ccd..9bc78103 100644
--- a/tests/daemon-py.at
+++ b/tests/daemon-py.at
@@ -142,7 +142,7 @@ 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([test `cat init` != $$])
# Kill the daemon process, making it look like a segfault,
# and wait for a new daemon process to get spawned.
CHECK([cp daemon olddaemon])
@@ -159,7 +159,7 @@ 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([test `cat init` != $$])
# Kill the daemon process with SIGTERM, and wait for the daemon
# and the monitor processes to go away and the pidfile to get deleted.
CHECK([kill `cat daemon`], [0], [], [ignore])
diff --git a/tests/daemon.at b/tests/daemon.at
index a80cd3e8..7c30e108 100644
--- a/tests/daemon.at
+++ b/tests/daemon.at
@@ -104,7 +104,7 @@ 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([test `cat init` != $$])
# Kill the daemon process, making it look like a segfault,
# and wait for a new daemon process to get spawned.
CHECK([cp daemon olddaemon])
@@ -121,7 +121,7 @@ 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([test `cat init` != $$])
# Kill the daemon process with SIGTERM, and wait for the daemon
# and the monitor processes to go away and the pidfile to get deleted.
CHECK([kill `cat daemon`], [0], [], [ignore])