Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Select an option

  • Save takano32/236800 to your computer and use it in GitHub Desktop.

Select an option

Save takano32/236800 to your computer and use it in GitHub Desktop.
test_thread.rb .........................F....................
#228 test_io.rb:
begin
require "io/nonblock"
r, w = IO.pipe
w.nonblock = true
w.write_nonblock("a" * 100000)
w.nonblock = false
t1 = Thread.new { w.write("b" * 4096) }
t2 = Thread.new { w.write("c" * 4096) }
sleep 0.5
r.sysread(4096).length
sleep 0.5
r.sysread(4096).length
t1.join
t2.join
rescue LoadError
end
#=> not finished in 10 seconds [ruby-dev:32566]
#233 test_io.rb:
at_exit { p :foo }
megacontent = "abc" * 12345678
#File.open("megasrc", "w") {|f| f << megacontent }
Thread.new { sleep rand*0.2; Process.kill(:INT, $$) }
r1, w1 = IO.pipe
r2, w2 = IO.pipe
t1 = Thread.new { w1 << megacontent; w1.close }
t2 = Thread.new { r2.read }
IO.copy_stream(r1, w2) rescue nil
r2.close; w2.close
r1.close; w1.close
#=> killed by SIGABRT (signal 6)
| bootstraptest.tmp.rb:12: [BUG] Segmentation fault
| ruby 1.9.1p339 (2009-11-17 revision 25816) [i386-cygwin]
|
| -- control frame ----------
| c:0001 p:0000 s:0002 b:0002 l:0018ec d:0018ec TOP
| ---------------------------
| -- Ruby level backtrace information-----------------------------------------
|
| [NOTE]
| You may encounter a bug of Ruby interpreter. Bug reports are welcome.
| For details: http://www.ruby-lang.org/bugreport.html
|
#871 test_thread.rb:
require 'timeout'
th = Thread.new {sleep 2}
begin
Timeout.timeout(1) {th.join}
rescue Timeout::Error
end
th.join
#=> not finished in 3 seconds
FAIL 3/891 tests failed
make: *** [btest-ruby] Error 1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment