From ea5295e8e4dcfaec24efb5030557594aabe645cb Mon Sep 17 00:00:00 2001 From: "bofh@yhbt.net" Date: Sun, 14 Mar 2021 23:17:24 +0000 Subject: tests: force blocking I/O for Ruby 3.x Otherwise we get test failures since we use sysread and syswrite in many places --- test/test_helper.rb | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'test/test_helper.rb') diff --git a/test/test_helper.rb b/test/test_helper.rb index ba5ef16..d86f83b 100644 --- a/test/test_helper.rb +++ b/test/test_helper.rb @@ -28,6 +28,7 @@ require 'tempfile' require 'fileutils' require 'logger' require 'unicorn' +require 'io/nonblock' if ENV['DEBUG'] require 'ruby-debug' @@ -291,3 +292,15 @@ def reset_sig_handlers trap(sig, "DEFAULT") end end + +def tcp_socket(*args) + sock = TCPSocket.new(*args) + sock.nonblock = false + sock +end + +def unix_socket(*args) + sock = UNIXSocket.new(*args) + sock.nonblock = false + sock +end -- cgit v1.2.3-24-ge0c7