From 593deb92e8ebd4e77e482c567d97b6ee496ac378 Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Thu, 16 Jun 2011 23:57:31 +0000 Subject: ensure at_exit handlers run on graceful shutdown rescuing from SystemExit and exit()-ing again is ugly, but changes made to lower stack depth positively affect _everyone_ so we'll tolerate some ugliness here. We'll need to disable graceful exit for some tests, too... --- t/t0020-at_exit-handler.sh | 49 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) create mode 100644 t/t0020-at_exit-handler.sh (limited to 't') diff --git a/t/t0020-at_exit-handler.sh b/t/t0020-at_exit-handler.sh new file mode 100644 index 0000000..fda14b5 --- /dev/null +++ b/t/t0020-at_exit-handler.sh @@ -0,0 +1,49 @@ +#!/bin/sh +. ./test-lib.sh + +t_plan 5 "at_exit/END handlers work as expected" + +t_begin "setup and startup" && { + unicorn_setup + cat >> $unicorn_config </dev/null 2>&1 + do + sleep 1 + done +} + +t_begin "check stderr" && check_stderr + +dbgcat r_err +dbgcat r_out + +t_begin "all at_exit handlers ran" && { + grep "$worker_pid BOTH" $r_out + grep "$unicorn_pid BOTH" $r_out + grep "$worker_pid END BOTH" $r_out + grep "$unicorn_pid END BOTH" $r_out + grep "$worker_pid WORKER ONLY" $r_out + grep "$worker_pid END WORKER ONLY" $r_out +} + +t_done -- cgit v1.2.3-24-ge0c7