diff options
author | Eric Wong <normalperson@yhbt.net> | 2010-06-17 06:46:43 +0000 |
---|---|---|
committer | Eric Wong <normalperson@yhbt.net> | 2010-06-17 06:49:43 +0000 |
commit | b64099a18c7a353d2b6f34ad84da8afafd6f873d (patch) | |
tree | 5256d651d2261a61dd241124be8e15a864b1ab09 /t/t0007-working_directory_no_embed_cli.sh | |
parent | 5c804c89093378c67db56474ce1da1a0e0f08a7d (diff) | |
download | unicorn-b64099a18c7a353d2b6f34ad84da8afafd6f873d.tar.gz |
Our fugly code can't handle embedded command-line options in config.ru when using Rubinius yet. So add some related tests to the ones marked RBX_SKIP that don't rely on embedded command-line options.
Diffstat (limited to 't/t0007-working_directory_no_embed_cli.sh')
-rwxr-xr-x | t/t0007-working_directory_no_embed_cli.sh | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/t/t0007-working_directory_no_embed_cli.sh b/t/t0007-working_directory_no_embed_cli.sh new file mode 100755 index 0000000..77d6707 --- /dev/null +++ b/t/t0007-working_directory_no_embed_cli.sh @@ -0,0 +1,44 @@ +#!/bin/sh +. ./test-lib.sh + +t_plan 4 "config.ru inside alt working_directory (no embedded switches)" + +t_begin "setup and start" && { + unicorn_setup + rm -rf $t_pfx.app + mkdir $t_pfx.app + + cat > $t_pfx.app/config.ru <<EOF +use Rack::ContentLength +use Rack::ContentType, "text/plain" +run lambda { |env| [ 200, {}, [ "#{\$master_ppid}\\n" ] ] } +EOF + # the whole point of this exercise + echo "working_directory '$t_pfx.app'" >> $unicorn_config + + # allows ppid to be 1 in before_fork + echo "preload_app true" >> $unicorn_config + cat >> $unicorn_config <<\EOF +before_fork do |server,worker| + $master_ppid = Process.ppid # should be zero to detect daemonization +end +EOF + + cd / + unicorn -D -c $unicorn_config + unicorn_wait_start +} + +t_begin "hit with curl" && { + body=$(curl -sSf http://$listen/) +} + +t_begin "killing succeeds" && { + kill $unicorn_pid +} + +t_begin "response body ppid == 1 (daemonized)" && { + test "$body" -eq 1 +} + +t_done |