From: Eric Wong <e@80x24.org>
To: kgio-public@bogomips.org
Subject: [PATCH 1/2] test: fix warnings with RUBYOPT=-w
Date: Wed, 30 Oct 2019 09:26:27 +0000 [thread overview]
Message-ID: <20191030092628.31661-2-e@80x24.org> (raw)
In-Reply-To: <20191030092628.31661-1-e@80x24.org>
---
test/lib_read_write.rb | 2 ++
test/lib_server_accept.rb | 11 +++++++----
test/test_tryopen.rb | 5 +++--
3 files changed, 12 insertions(+), 6 deletions(-)
diff --git a/test/lib_read_write.rb b/test/lib_read_write.rb
index 5f70964..a32919f 100644
--- a/test/lib_read_write.rb
+++ b/test/lib_read_write.rb
@@ -166,6 +166,7 @@ module LibReadWriteTest
rescue EOFError
break
rescue => e
+ warn "#{e.message} (#{e.class})"
end while true
dig.hexdigest
end
@@ -203,6 +204,7 @@ module LibReadWriteTest
rescue EOFError
break
rescue => e
+ warn "#{e.message} (#{e.class})"
end while true
dig.hexdigest
end
diff --git a/test/lib_server_accept.rb b/test/lib_server_accept.rb
index db0d120..fcf9c87 100644
--- a/test/lib_server_accept.rb
+++ b/test/lib_server_accept.rb
@@ -20,6 +20,7 @@ module LibServerAccept
b = @srv.kgio_tryaccept
assert_kind_of Kgio::Socket, b
assert_equal @host, b.kgio_addr
+ a.close
end
def test_tryaccept_flags
@@ -28,6 +29,7 @@ module LibServerAccept
b = @srv.kgio_tryaccept nil, 0
assert_kind_of Kgio::Socket, b
assert_equal 0, b.fcntl(Fcntl::F_GETFD)
+ a.close
end
def test_blocking_accept_flags
@@ -36,6 +38,7 @@ module LibServerAccept
b = @srv.kgio_accept nil, 0
assert_kind_of Kgio::Socket, b
assert_equal 0, b.fcntl(Fcntl::F_GETFD)
+ a.close
end
def test_tryaccept_fail
@@ -44,7 +47,7 @@ module LibServerAccept
def test_blocking_accept
t0 = Time.now
- pid = fork { sleep 1; a = client_connect; sleep }
+ pid = fork { sleep 1; a = client_connect; sleep; a.close }
b = @srv.kgio_accept
elapsed = Time.now - t0
assert_kind_of Kgio::Socket, b
@@ -57,7 +60,7 @@ module LibServerAccept
def test_blocking_accept_with_nonblock_socket
@srv.nonblock = true
t0 = Time.now
- pid = fork { sleep 1; a = client_connect; sleep }
+ pid = fork { sleep 1; a = client_connect; sleep; a.close }
b = @srv.kgio_accept
elapsed = Time.now - t0
assert_kind_of Kgio::Socket, b
@@ -67,7 +70,7 @@ module LibServerAccept
assert elapsed >= 1, "elapsed: #{elapsed}"
t0 = Time.now
- pid = fork { sleep 6; a = client_connect; sleep }
+ pid = fork { sleep 6; a = client_connect; sleep; a.close }
b = @srv.kgio_accept
elapsed = Time.now - t0
assert_kind_of Kgio::Socket, b
@@ -77,7 +80,7 @@ module LibServerAccept
assert elapsed >= 6, "elapsed: #{elapsed}"
t0 = Time.now
- pid = fork { sleep 1; a = client_connect; sleep }
+ pid = fork { sleep 1; a = client_connect; sleep; a.close }
b = @srv.kgio_accept
elapsed = Time.now - t0
assert_kind_of Kgio::Socket, b
diff --git a/test/test_tryopen.rb b/test/test_tryopen.rb
index abcbd37..2bbbc51 100644
--- a/test/test_tryopen.rb
+++ b/test/test_tryopen.rb
@@ -59,8 +59,9 @@ class TestTryopen < Test::Unit::TestCase
tmp.close!
file = Kgio::File.tryopen(path, IO::RDWR|IO::CREAT, 0000)
assert_equal 0100000, File.stat(path).mode
- ensure
- File.unlink path
+ file.close
+ ensure
+ File.unlink path
end
require "benchmark"
next prev parent reply other threads:[~2019-10-30 9:26 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-10-30 9:26 [PATCH 0/2] Ruby warning fixes Eric Wong
2019-10-30 9:26 ` Eric Wong [this message]
2019-10-30 9:26 ` [PATCH 2/2] tests: fix unused variable warnings from newer Rubies Eric Wong
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://yhbt.net/kgio/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20191030092628.31661-2-e@80x24.org \
--to=e@80x24.org \
--cc=kgio-public@bogomips.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://yhbt.net/kgio.git/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).