summaryrefslogtreecommitdiff
path: root/test/ruby
diff options
context:
space:
mode:
authornagachika <nagachika@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-12-20 15:20:15 +0000
committernagachika <nagachika@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-12-20 15:20:15 +0000
commitb20e9ebe5aea57b6f49b0d100f26967165feafca (patch)
tree604bbde5e9b5bef206661cd31e7b5b3891ded57e /test/ruby
parent83b2ba3cfa9d2a3b881b6bc2fcc62072cc923d8b (diff)
merge revision(s) 58146,58150,58156: [Backport #13276]
error.c: refactor warning messages * error.c (with_warning_string): extract building warning message string from variadic arguments. * error.c (syserr_warning): write warning message with the system error message. error.c: warning functions * error.c: define warning functions in all combinations of * no errno, system errno, argument * without/with encoding * enabled/disabled by default dir.c: err at glob failure * dir.c (glob_helper): raise a SystemCallError exception when opendir() failed, except for ENOENT, ENOTDIR, and EACCES. this behavior predates 1.0; the comments in glob.c claimed that glob() returned -1 on error but actualy the pointer to a global variable, then dir_glob() did check only -1 as the comments, and ignored actual errors. [ruby-core:80226] [Bug #13276] dir.c: ruby_glob_funcs_t git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_4@61367 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/ruby')
-rw-r--r--test/ruby/test_dir.rb18
1 files changed, 18 insertions, 0 deletions
diff --git a/test/ruby/test_dir.rb b/test/ruby/test_dir.rb
index d100fd7d59..553f1aef63 100644
--- a/test/ruby/test_dir.rb
+++ b/test/ruby/test_dir.rb
@@ -184,6 +184,24 @@ class TestDir < Test::Unit::TestCase
end
end
+ if Process.const_defined?(:RLIMIT_NOFILE)
+ def test_glob_too_may_open_files
+ assert_separately([], "#{<<-"begin;"}\n#{<<-'end;'}", chdir: @root)
+ begin;
+ n = 16
+ Process.setrlimit(Process::RLIMIT_NOFILE, n)
+ files = []
+ begin
+ n.times {files << File.open('b')}
+ rescue Errno::EMFILE, Errno::ENFILE => e
+ end
+ assert_raise(e.class) {
+ Dir.glob('*')
+ }
+ end;
+ end
+ end
+
def assert_entries(entries)
entries.sort!
assert_equal(%w(. ..) + ("a".."z").to_a, entries)