From: Eric Wong <bofh@yhbt.net>
To: yahns-public@yhbt.net
Subject: [PATCH] tests: use IO.pipe directly
Date: Thu, 29 Dec 2022 00:26:45 +0000 [thread overview]
Message-ID: <20221229002645.2326431-1-bofh@yhbt.net> (raw)
No need for a wrapper, since we've been Ruby 2.0+ for a while, now.
---
test/helper.rb | 4 ----
test/test_bin.rb | 2 +-
test/test_server.rb | 2 +-
test/test_wbuf.rb | 6 +++---
4 files changed, 5 insertions(+), 9 deletions(-)
diff --git a/test/helper.rb b/test/helper.rb
index f9370a4..c4403dd 100644
--- a/test/helper.rb
+++ b/test/helper.rb
@@ -124,10 +124,6 @@ def nread
end
end if ! IO.method_defined?(:nread) && RUBY_PLATFORM =~ /linux/
-def cloexec_pipe
- IO.pipe
-end
-
def require_exec(cmd)
ENV["PATH"].split(/:/).each do |path|
return true if File.executable?("#{path}/#{cmd}")
diff --git a/test/test_bin.rb b/test/test_bin.rb
index fc85992..e7c55ad 100644
--- a/test/test_bin.rb
+++ b/test/test_bin.rb
@@ -76,7 +76,7 @@ def bin_daemon(worker, inherit)
cfg.puts " listen ENV['YAHNS_TEST_LISTEN']"
cfg.puts "end"
@cmd.concat(%W(-D -c #{cfg.path}))
- addr = cloexec_pipe
+ addr = IO.pipe
pid = xfork do
opts = { close_others: true }
addr[0].close
diff --git a/test/test_server.rb b/test/test_server.rb
index 75e1857..29803fb 100644
--- a/test/test_server.rb
+++ b/test/test_server.rb
@@ -185,7 +185,7 @@ def test_check_client_connection
msgs = %w(ZZ zz)
err = @err
cfg = Yahns::Config.new
- bpipe = cloexec_pipe
+ bpipe = IO.pipe
cfg.instance_eval do
ru = lambda { |e|
case e['PATH_INFO']
diff --git a/test/test_wbuf.rb b/test/test_wbuf.rb
index 0135958..101f6c5 100644
--- a/test/test_wbuf.rb
+++ b/test/test_wbuf.rb
@@ -34,7 +34,7 @@ def test_wbuf
assert_equal "HIHI", b.read(4)
nr.times { wbuf.wbuf_write(a, buf) }
assert_equal :wait_writable, wbuf.wbuf_flush(a)
- done = cloexec_pipe
+ done = IO.pipe
thr = Thread.new do
rv = []
until rv[-1] == persist
@@ -109,7 +109,7 @@ def test_wbuf_blocked
end
def test_wbuf_flush_close
- pipe = cloexec_pipe
+ pipe = IO.pipe
persist = true
wbuf = Yahns::Wbuf.new(pipe[0], persist)
refute wbuf.respond_to?(:close) # we don't want this for HttpResponse body
@@ -126,7 +126,7 @@ def test_wbuf_flush_close
assert_equal thr, thr.join(5)
assert_equal :wait_writable, rv
- done = cloexec_pipe
+ done = IO.pipe
thr = Thread.new do
rv = []
until rv[-1] == persist
reply other threads:[~2022-12-29 0:26 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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/yahns/README
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20221229002645.2326431-1-bofh@yhbt.net \
--to=bofh@yhbt.net \
--cc=yahns-public@yhbt.net \
/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/yahns.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).