aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKazuki Yamaguchi <k@rhe.jp>2021-12-20 23:59:34 +0900
committerKazuki Yamaguchi <k@rhe.jp>2021-12-21 00:05:24 +0900
commit6b67f0631284b1be8e56e20ec133a1b3386fc090 (patch)
treeaf242a6473c2e9b95c93d5b03c2a9f837822a766
parentac757b218c66569be6789144b149d6d798c72d98 (diff)
downloadruby-6b67f0631284b1be8e56e20ec133a1b3386fc090.tar.gz
test/fiber/test_io_buffer.rb: fix file descriptor leaksHEADmaster
I got the warning while running "make test-all": Leaked file descriptor: TestFiberIOBuffer#test_write_nonblock: 9 : #<UNIXSocket:fd 9> Closed file descriptor: TestFiberIOBuffer#test_read_write_blocking: 9 Leaked file descriptor: TestFiberIOBuffer#test_timeout_after: 10 : #<UNIXSocket:fd 10> Closed file descriptor: TestFiberIOBuffer#test_read_nonblock: 10
-rw-r--r--test/fiber/test_io_buffer.rb13
1 files changed, 12 insertions, 1 deletions
diff --git a/test/fiber/test_io_buffer.rb b/test/fiber/test_io_buffer.rb
index e48764242f..5b34a37331 100644
--- a/test/fiber/test_io_buffer.rb
+++ b/test/fiber/test_io_buffer.rb
@@ -36,6 +36,9 @@ class TestFiberIOBuffer < Test::Unit::TestCase
assert_equal MESSAGE, message
assert_predicate(i, :closed?)
assert_predicate(o, :closed?)
+ ensure
+ i&.close
+ o&.close
end
def test_timeout_after
@@ -67,6 +70,9 @@ class TestFiberIOBuffer < Test::Unit::TestCase
assert_nil message
assert_kind_of Timeout::Error, error
+ ensure
+ i&.close
+ o&.close
end
def test_read_nonblock
@@ -89,7 +95,9 @@ class TestFiberIOBuffer < Test::Unit::TestCase
thread.join
assert_equal :wait_readable, message
- o.close
+ ensure
+ i&.close
+ o&.close
end
def test_write_nonblock
@@ -110,5 +118,8 @@ class TestFiberIOBuffer < Test::Unit::TestCase
thread.join
assert_equal MESSAGE, i.read
+ ensure
+ i&.close
+ o&.close
end
end