summaryrefslogtreecommitdiff
path: root/test/ruby/test_dir.rb
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2016-10-21 07:44:46 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2016-10-21 07:44:46 +0000
commit5d20d347c772a64a1dab362dbfae765a8d687f43 (patch)
tree8b77794c595208096addc3b60351e2324f80cb82 /test/ruby/test_dir.rb
parent9590e99031c434a2ac481d62e4bc921a91a2481c (diff)
dir.c: retry glob with GC
* dir.c (do_opendir): retry after GC when the limit for open file descriptors reached. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56467 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/ruby/test_dir.rb')
-rw-r--r--test/ruby/test_dir.rb14
1 files changed, 14 insertions, 0 deletions
diff --git a/test/ruby/test_dir.rb b/test/ruby/test_dir.rb
index b188f4da60..ed0d084528 100644
--- a/test/ruby/test_dir.rb
+++ b/test/ruby/test_dir.rb
@@ -354,4 +354,18 @@ class TestDir < Test::Unit::TestCase
assert_raise(Errno::ENOENT) {Dir.empty?(@nodir)}
assert_not_send([Dir, :empty?, File.join(@root, "b")])
end
+
+ def test_glob_gc_for_fd
+ assert_separately(["-C", @root], "#{<<-"begin;"}\n#{<<-"end;"}", timeout: 3)
+ begin;
+ Process.setrlimit(Process::RLIMIT_NOFILE, 50)
+ begin
+ tap {tap {tap {(0..100).map {open(IO::NULL)}}}}
+ rescue Errno::EMFILE
+ end
+ list = Dir.glob("*").sort
+ assert_not_empty(list)
+ assert_equal([*"a".."z"], list)
+ end;
+ end
end