Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F103014414
D47005.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
D47005.diff
View Options
diff --git a/usr.sbin/daemon/tests/daemon_test.sh b/usr.sbin/daemon/tests/daemon_test.sh
--- a/usr.sbin/daemon/tests/daemon_test.sh
+++ b/usr.sbin/daemon/tests/daemon_test.sh
@@ -154,6 +154,43 @@
[ -f daemon.pid ] && kill `cat daemon.pid`
}
+atf_test_case restart_hang cleanup
+restart_hang_head() {
+ atf_set "descr" "daemon should terminate with SIGTERM even pending child restart"
+}
+restart_hang_body() {
+ daemon -rP daemon.pid -R 10 -p sleep.pid sleep 300
+ atf_check -s exit:0 test -f daemon.pid
+ atf_check -s exit:0 test -f sleep.pid
+ read sleep_pid < sleep.pid
+ 1>&2 echo "$sleep_pid"
+ kill "$sleep_pid"
+
+ # Wait up to 5s for the child to exit
+ for t in `seq 0 0.1 5`; do
+ [ ! -s "sleep.pid" ] && break
+ sleep 0.1
+ done
+
+ atf_check test ! -s "sleep.pid"
+
+ read daemon_pid < daemon.pid
+ kill -TERM "$daemon_pid"
+
+ # Wait up to 10s for the daemon to terminate
+ for t in `seq 0 0.1 10`; do
+ [ ! -f "daemon.pid" ] && break
+ sleep 0.1
+ done
+
+ atf_check test ! -f "daemon.pid"
+ atf_check test ! -f "sleep.pid"
+}
+restart_hang_cleanup() {
+ [ -s daemon.pid ] && kill -9 `cat daemon.pid`
+ true
+}
+
atf_test_case supervisor_pidfile cleanup
supervisor_pidfile_head() {
atf_set "descr" "daemon should write its own pid to a pidfile"
@@ -218,6 +255,7 @@
atf_add_test_case newsyslog
atf_add_test_case output_file
atf_add_test_case restart_child
+ atf_add_test_case restart_hang
atf_add_test_case supervisor_pidfile
atf_add_test_case supervisor_pidfile_lock
atf_add_test_case title
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Wed, Nov 20, 8:27 PM (18 h, 38 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
13852614
Default Alt Text
D47005.diff (1 KB)
Attached To
Mode
D47005: daemon: tests: add a test for missed SIGTERM
Attached
Detach File
Event Timeline
Log In to Comment