summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorusa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-03-28 10:10:00 +0000
committerusa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-03-28 10:10:00 +0000
commitb97e925571e32dff40573af7991d7dfe7fc9c7ce (patch)
treea351603c55aaffc8754d3d323b03a819288cb5cf /test
parentee09f19fdbf047a31ec1c85e6f53ea4a67ded48c (diff)
merge revision(s) 39772,39773,39774,39775,39777,39779,39781,39783: [Backport #8080]
* configure.in: check struct timeval exist or not. * include/ruby/missing.h (struct timeval): check HAVE_STRUCT_TIMEVAL properly. and don't include sys/time.h if struct timeval exist. * file.c: include sys/time.h explicitly. * random.c: ditto. * thread_pthread.c: ditto. * time.c: ditto. * ext/date/date_strftime.c: ditto. * include/ruby/missing.h (struct timespec): include <sys/time.h> * include/ruby/missing.h (__syscall): moved to... * io.c: here. because __syscall() is only used from io.c. * include/ruby/missing.h: move "#include <sys/type.h>" to .... * include/ruby/intern.h: here. because it was introduced for fixing NFDBITS issue. [ruby-core:05179]. * thread.c: disabled _FORTIFY_SOURCE for avoid to hit glibc bug. [Bug #8080] [ruby-core:53349] * test/ruby/test_io.rb (TestIO#test_io_select_with_many_files): test for the above. * include/ruby/missing.h: removed __linux__. it's unnecessary. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_9_3@39985 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test')
-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