formatting fix so I collapse in TM
This commit is contained in:
parent
1100288eba
commit
3b2e7602a0
|
@ -105,30 +105,32 @@ describe Mysql2::Client do
|
||||||
|
|
||||||
# XXX this test is not deterministic (because Unix signal handling is not)
|
# XXX this test is not deterministic (because Unix signal handling is not)
|
||||||
# and may fail on a loaded system
|
# and may fail on a loaded system
|
||||||
it "should run signal handlers while waiting for a response" do
|
if RUBY_PLATFORM !~ /mingw|mswin/
|
||||||
mark = {}
|
it "should run signal handlers while waiting for a response" do
|
||||||
trap(:USR1) { mark[:USR1] = Time.now }
|
mark = {}
|
||||||
begin
|
trap(:USR1) { mark[:USR1] = Time.now }
|
||||||
mark[:START] = Time.now
|
begin
|
||||||
pid = fork do
|
mark[:START] = Time.now
|
||||||
sleep 1 # wait for client "SELECT sleep(2)" query to start
|
pid = fork do
|
||||||
Process.kill(:USR1, Process.ppid)
|
sleep 1 # wait for client "SELECT sleep(2)" query to start
|
||||||
sleep # wait for explicit kill to prevent GC disconnect
|
Process.kill(:USR1, Process.ppid)
|
||||||
|
sleep # wait for explicit kill to prevent GC disconnect
|
||||||
|
end
|
||||||
|
@client.query("SELECT sleep(2)")
|
||||||
|
mark[:END] = Time.now
|
||||||
|
mark.include?(:USR1).should be_true
|
||||||
|
(mark[:USR1] - mark[:START]).should >= 1
|
||||||
|
(mark[:USR1] - mark[:START]).should < 1.1
|
||||||
|
(mark[:END] - mark[:USR1]).should > 0.9
|
||||||
|
(mark[:END] - mark[:START]).should >= 2
|
||||||
|
(mark[:END] - mark[:START]).should < 2.1
|
||||||
|
Process.kill(:TERM, pid)
|
||||||
|
Process.waitpid2(pid)
|
||||||
|
ensure
|
||||||
|
trap(:USR1, 'DEFAULT')
|
||||||
end
|
end
|
||||||
@client.query("SELECT sleep(2)")
|
|
||||||
mark[:END] = Time.now
|
|
||||||
mark.include?(:USR1).should be_true
|
|
||||||
(mark[:USR1] - mark[:START]).should >= 1
|
|
||||||
(mark[:USR1] - mark[:START]).should < 1.1
|
|
||||||
(mark[:END] - mark[:USR1]).should > 0.9
|
|
||||||
(mark[:END] - mark[:START]).should >= 2
|
|
||||||
(mark[:END] - mark[:START]).should < 2.1
|
|
||||||
Process.kill(:TERM, pid)
|
|
||||||
Process.waitpid2(pid)
|
|
||||||
ensure
|
|
||||||
trap(:USR1, 'DEFAULT')
|
|
||||||
end
|
end
|
||||||
end if RUBY_PLATFORM !~ /mingw|mswin/
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
it "should respond to #escape" do
|
it "should respond to #escape" do
|
||||||
|
|
Loading…
Reference in New Issue