summaryrefslogtreecommitdiff
path: root/test/ruby
diff options
context:
space:
mode:
Diffstat (limited to 'test/ruby')
-rw-r--r--test/ruby/test_io.rb26
1 files changed, 26 insertions, 0 deletions
diff --git a/test/ruby/test_io.rb b/test/ruby/test_io.rb
index 074fdee23a..ad9b80faec 100644
--- a/test/ruby/test_io.rb
+++ b/test/ruby/test_io.rb
@@ -2121,4 +2121,30 @@ End
assert_equal(1, $stdout.fileno)
assert_equal(2, $stderr.fileno)
end
+
+ def test_io_select_with_many_files
+ bug8080 = '[ruby-core:53349]'
+
+ assert_normal_exit %q{
+ require "tempfile"
+
+ # try to raise RLIM_NOFILE to >FD_SETSIZE
+ # Unfortunately, ruby export FD_SETSIZE. then we assume it's 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 = []
+ (0..fd_setsize+1).map {|i|
+ tempfiles << Tempfile.open("test_io_select_with_many_files")
+ }
+
+ IO.select(tempfiles)
+ }, bug8080
+ end
end