about summary refs log tree commit homepage
diff options
context:
space:
mode:
authorEric Wong <e@80x24.org>2015-07-15 08:18:15 +0000
committerEric Wong <e@80x24.org>2015-07-15 08:18:15 +0000
commit5aec4a87bd571c5525eb7ffaada29eab607214f1 (patch)
treea3ae34e0bac12994c30fa12a2794dc6b0e494b73
parent602784e227c3d792c492ffd45df81182eb0fa9dc (diff)
downloadyahns-5aec4a87bd571c5525eb7ffaada29eab607214f1.tar.gz
We need to wait for the hijacked process to run and write to the
log before we check it.  Since we may not have inotify, try to
trigger a sched_yield() syscall instead.
-rw-r--r--test/test_rack_hijack.rb4
1 files changed, 4 insertions, 0 deletions
diff --git a/test/test_rack_hijack.rb b/test/test_rack_hijack.rb
index 5bfc31f..2a9f23e 100644
--- a/test/test_rack_hijack.rb
+++ b/test/test_rack_hijack.rb
@@ -62,6 +62,10 @@ class TestRackHijack < Testcase
     assert_equal "zzz", res["X-Test"]
     assert_equal "1.1", res.http_version
 
+    # hope this calls sched_yield() so the forked process runs and writes
+    # to the log.
+    Thread.new { Thread.pass }.join
+
     errs = File.readlines(err.path).grep(/DieIfUsed/)
     assert_equal([ "INFO #{pid} closed DieIfUsed 1\n",
                    "INFO #{pid} closed DieIfUsed 2\n" ], errs)