use spawn's option to shorten the code
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52375 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
a666e9b5f2
commit
89d0720ef9
@ -1136,11 +1136,9 @@ class TestIO < Test::Unit::TestCase
|
|||||||
end
|
end
|
||||||
|
|
||||||
def test_dup_many
|
def test_dup_many
|
||||||
assert_separately([], <<-'End')
|
opts = {}
|
||||||
if defined?(Process::RLIMIT_NOFILE)
|
opts[:rlimit_nofile] = 1024 if defined?(Process::RLIMIT_NOFILE)
|
||||||
lim = Process.getrlimit(Process::RLIMIT_NOFILE)[0]
|
assert_separately([], <<-'End', opts)
|
||||||
Process.setrlimit(Process::RLIMIT_NOFILE, [lim, 1024].min)
|
|
||||||
end
|
|
||||||
a = []
|
a = []
|
||||||
assert_raise(Errno::EMFILE, Errno::ENFILE, Errno::ENOMEM) do
|
assert_raise(Errno::EMFILE, Errno::ENFILE, Errno::ENOMEM) do
|
||||||
loop {a << IO.pipe}
|
loop {a << IO.pipe}
|
||||||
@ -3066,25 +3064,17 @@ End
|
|||||||
assert_normal_exit %q{
|
assert_normal_exit %q{
|
||||||
require "tempfile"
|
require "tempfile"
|
||||||
|
|
||||||
# try to raise RLIM_NOFILE to >FD_SETSIZE
|
# Unfortunately, ruby doesn't export FD_SETSIZE. then we assume it's 1024.
|
||||||
# Unfortunately, ruby export FD_SETSIZE. then we assume it's 1024.
|
|
||||||
fd_setsize = 1024
|
fd_setsize = 1024
|
||||||
|
|
||||||
begin
|
|
||||||
Process.setrlimit(Process::RLIMIT_NOFILE, fd_setsize+10)
|
|
||||||
rescue =>e
|
|
||||||
# Process::RLIMIT_NOFILE couldn't be raised. skip the test
|
|
||||||
exit 0
|
|
||||||
end
|
|
||||||
|
|
||||||
tempfiles = []
|
tempfiles = []
|
||||||
(0..fd_setsize+1).map {|i|
|
(0..fd_setsize+1).map {|i|
|
||||||
tempfiles << Tempfile.open("test_io_select_with_many_files")
|
tempfiles << Tempfile.open("test_io_select_with_many_files")
|
||||||
}
|
}
|
||||||
|
|
||||||
IO.select(tempfiles)
|
IO.select(tempfiles)
|
||||||
}, bug8080, timeout: 30
|
}, bug8080, timeout: 30, rlimit_nofile: 1024+10
|
||||||
end
|
end if defined?(Process::RLIMIT_NOFILE)
|
||||||
|
|
||||||
def test_read_32bit_boundary
|
def test_read_32bit_boundary
|
||||||
bug8431 = '[ruby-core:55098] [Bug #8431]'
|
bug8431 = '[ruby-core:55098] [Bug #8431]'
|
||||||
|
Loading…
x
Reference in New Issue
Block a user