diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 6631579..48c6c22 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -51,6 +51,7 @@ jobs: - 3.2 - 3.3 - 3.4 + - "4.0" fail-fast: false @@ -94,6 +95,7 @@ jobs: - 3.2 - 3.3 - 3.4 + - "4.0" fail-fast: false diff --git a/ffi/lib/llhttp.rb b/ffi/lib/llhttp.rb index 236c81e..329b06c 100644 --- a/ffi/lib/llhttp.rb +++ b/ffi/lib/llhttp.rb @@ -10,6 +10,7 @@ module LLHttp require_relative "llhttp/version" extend FFI::Library + ffi_lib(FFI::Compiler::Loader.find("llhttp-ext")) callback :llhttp_data_cb, [:pointer, :size_t], :void diff --git a/spec/acceptance/server_spec.rb b/spec/acceptance/server_spec.rb index 1efedb2..fba55be 100644 --- a/spec/acceptance/server_spec.rb +++ b/spec/acceptance/server_spec.rb @@ -29,9 +29,22 @@ @bound_endpoint&.close end - it "parses" do - Timeout.timeout(1) do - expect(system("curl -v http://localhost:9000")).to be(true) + # The async-based test server requires Ruby >= 3.2: newer async drops 3.1, so + # on older Rubies bundle resolves to a stack that can't serve the request. + # llhttp core is still exercised by the rest of the suite on those versions. + it "parses", skip: RUBY_VERSION < "3.2" && "async test server requires Ruby >= 3.2" do + # Poll until the forked server is accepting and responding rather than + # asserting on a single curl under a tight timeout, so a slow fork + Async + # reactor cold start on a loaded CI runner costs a few retries, not a + # spurious failure. + result = false + + Timeout.timeout(10) do + until (result = system("curl -sf http://localhost:9000", out: File::NULL, err: File::NULL)) + sleep(0.05) + end end + + expect(result).to be(true) end end diff --git a/spec/initialize.rb b/spec/initialize.rb index 2e21c11..b3e73df 100644 --- a/spec/initialize.rb +++ b/spec/initialize.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -require "pathname" +require "pathname" # standard:disable Lint/RedundantRequireStatement -- needed on Ruby < 3.x where Pathname isn't autoloaded initializers = Pathname.new(File.expand_path("../initializers", __FILE__))