Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Run tests on TruffleRuby, all tests pass now #2198

Merged
merged 15 commits into from Mar 24, 2020
Merged
Show file tree
Hide file tree
Changes from 7 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
13 changes: 8 additions & 5 deletions lib/puma/minissl.rb
Expand Up @@ -125,11 +125,14 @@ def flush

def read_and_drop(timeout = 1)
return :timeout unless IO.select([@socket], nil, nil, timeout)
return :eof unless read_nonblock(1024)
:drop
rescue Errno::EAGAIN
# do nothing
:eagain
case @socket.read_nonblock(1024, exception: false)
when nil
:eof
when :wait_readable
:eagain
else
:drop
end
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For the record, this might be related to a bug in OpenSSL, mentioned in ruby/openssl#355 (comment)
Anyway, it seems safer to not call to SSL anymore if we are in such a state, as this commit does.

end

def should_drop_bytes?
Expand Down
15 changes: 5 additions & 10 deletions test/helper.rb
Expand Up @@ -43,15 +43,10 @@ def hit(uris)
end

module UniquePort
@port = 3211
@mutex = Mutex.new

def self.call
@mutex.synchronize {
@port += 1
@port = 3307 if @port == 3306 # MySQL on Actions
@port
}
TCPServer.open('127.0.0.1', 0) do |server|
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👏

server.connect_address.ip_port
end
end
end

Expand All @@ -78,7 +73,7 @@ module TestSkips
# usage: skip NO_FORK_MSG unless HAS_FORK
# windows >= 2.6 fork is not defined, < 2.6 fork raises NotImplementedError
HAS_FORK = ::Process.respond_to? :fork
NO_FORK_MSG = "Kernel.fork isn't available on the #{RUBY_PLATFORM} platform"
NO_FORK_MSG = "Kernel.fork isn't available on #{RUBY_ENGINE} on #{RUBY_PLATFORM}"

# socket is required by puma
# usage: skip UNIX_SKT_MSG unless UNIX_SKT_EXIST
Expand All @@ -99,11 +94,11 @@ def skip_unless_signal_exist?(sig, bt: caller)
# optional suffix kwarg is appended to the skip message
# optional suffix bt should generally not used
def skip_on(*engs, suffix: '', bt: caller)
skip_msg = false
engs.each do |eng|
skip_msg = case eng
when :darwin then "Skipped on darwin#{suffix}" if RUBY_PLATFORM[/darwin/]
when :jruby then "Skipped on JRuby#{suffix}" if Puma.jruby?
when :truffleruby then "Skipped on TruffleRuby#{suffix}" if RUBY_ENGINE == "truffleruby"
when :windows then "Skipped on Windows#{suffix}" if Puma.windows?
when :ci then "Skipped on ENV['CI']#{suffix}" if ENV["CI"]
when :no_bundler then "Skipped w/o Bundler#{suffix}" if !defined?(Bundler)
Expand Down
11 changes: 8 additions & 3 deletions test/test_redirect_io.rb
Expand Up @@ -7,15 +7,20 @@ class TestRedirectIO < TestIntegration
def setup
super

@out_file_path = Tempfile.new('puma-out').path
@err_file_path = Tempfile.new('puma-err').path
# Keep the Tempfile instances alive to avoid being GC'd
@out_file = Tempfile.new('puma-out')
@err_file = Tempfile.new('puma-err')
@out_file_path = @out_file.path
@err_file_path = @err_file.path
end

def teardown
super

paths = [@out_file_path, @err_file_path, @old_out_file_path, @old_err_file_path].compact
File.unlink(*paths)
@out_file = nil
@err_file = nil
end

def test_sighup_redirects_io_single
Expand Down Expand Up @@ -47,7 +52,7 @@ def test_sighup_redirects_io_single
end

def test_sighup_redirects_io_cluster
skip_on :jruby # Server isn't coming up in CI, TODO Fix
skip NO_FORK_MSG unless HAS_FORK
skip_unless_signal_exist? :HUP

cli_args = [
Expand Down