From 9900a929dfd50f31f8c0fc68c738acf4f9555bd1 Mon Sep 17 00:00:00 2001 From: nick evans Date: Mon, 5 May 2025 15:22:03 -0400 Subject: [PATCH 1/9] =?UTF-8?q?=E2=9C=85=20Run=20CI=20with=20JRuby=20and?= =?UTF-8?q?=20TruffleRuby,=20too?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Using jruby-head to get unreleased parser bugfix. --- .github/workflows/test.yml | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index bc4fde25..0a6b6ba1 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -21,6 +21,13 @@ jobs: os: [ ubuntu-latest, macos-latest, windows-latest ] experimental: [false] include: + exclude: + - { ruby: head, os: windows-latest } + include: + - { ruby: head, os: windows-latest, experimental: true } + # - { ruby: jruby, os: ubuntu-latest, experimental: true } + - { ruby: jruby-head, os: ubuntu-latest, experimental: true } + # - { ruby: truffleruby, os: ubuntu-latest, experimental: true } - { ruby: truffleruby-head, os: ubuntu-latest, experimental: true } runs-on: ${{ matrix.os }} continue-on-error: ${{ matrix.experimental }} From f33fd0bb592a588e29cf39376a4283d5b7edc0c4 Mon Sep 17 00:00:00 2001 From: nick evans Date: Mon, 20 Oct 2025 09:29:02 -0400 Subject: [PATCH 2/9] =?UTF-8?q?=F0=9F=9A=A7=20TODO:=20if=20::Data=20implem?= =?UTF-8?q?entation=20is=20sufficient?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit These tests failed at some point on TruffleRuby or JRuby. We should mark them as pend_if_jruby or pend_if_truffleruby blocks, in order to detect when they are _fixed_ under those implementations. Some bugs related to this (which may have been fixed?): * jruby/jruby#8829 * oracle/truffleruby#3846 * oracle/truffleruby#3847 The JRuby bug is a showstopper. The TruffleRuby bugs are cosmetic (inspect "nil" vs "") or academic (we never create recursive Data). --- test/net/imap/test_data_lite.rb | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/test/net/imap/test_data_lite.rb b/test/net/imap/test_data_lite.rb index 42681a0e..03422aa6 100644 --- a/test/net/imap/test_data_lite.rb +++ b/test/net/imap/test_data_lite.rb @@ -154,6 +154,7 @@ def test_inspect end def test_recursive_inspect + # TODO: TruffleRuby's Data fails this test with a StackOverflowError klass = Data.define(:value, :head, :tail) do def initialize(value:, head: nil, tail: nil) case tail @@ -183,6 +184,7 @@ def initialize(value:, head: nil, tail: nil) " tail=#>>>", + # TODO: JRuby's Data fails on the next line list.inspect ) @@ -196,6 +198,7 @@ def initialize(value:, head: nil, tail: nil) " tail=#>>>", + # TODO: JRuby's Data fails on the next line list.inspect ) ensure @@ -348,6 +351,7 @@ class Inherited < Abstract.define(:foo) end def test_subclass_can_create + # TODO: JRuby's Data fails all of these assert_equal 1, Inherited[1] .foo assert_equal 2, Inherited[foo: 2].foo assert_equal 3, Inherited.new(3).foo @@ -362,6 +366,7 @@ class InheritsClassMethod < AbstractWithClassMethod.define(:foo) end def test_subclass_class_method + # TODO: JRuby's Data fails on the next line assert_equal :ok, InheritsClassMethod.inherited_class_method end @@ -373,6 +378,7 @@ class InheritsOverride < AbstractWithOverride.define(:foo) end def test_subclass_override_deconstruct + # TODO: JRuby's Data fails on the next line data = InheritsOverride[:foo] pend_if_truffleruby do assert_equal %i[ok foo], data.deconstruct From cbf54b69cbbeec3a2047e7d3ef17713f602e2bbc Mon Sep 17 00:00:00 2001 From: nick evans Date: Mon, 5 May 2025 14:05:41 -0400 Subject: [PATCH 3/9] =?UTF-8?q?=E2=9C=85=F0=9F=9A=A7=20Omit=201=20DataLite?= =?UTF-8?q?=20test=20for=20TruffleRuby?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This is a real edge-case... one which I included only for completeness. We _should not_ be making any recursive `Data` objects in `Net::IMAP`. --- test/net/imap/test_data_lite.rb | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/test/net/imap/test_data_lite.rb b/test/net/imap/test_data_lite.rb index 03422aa6..a1f5dca4 100644 --- a/test/net/imap/test_data_lite.rb +++ b/test/net/imap/test_data_lite.rb @@ -154,7 +154,14 @@ def test_inspect end def test_recursive_inspect - # TODO: TruffleRuby's Data fails this test with a StackOverflowError + if Data.superclass == ::Object + omit_if_truffleruby "TruffleRuby: format('%p', nil) returns '': " \ + "https://github.com/oracle/truffleruby/issues/3846" + else + omit_if_truffleruby "TruffleRuby: Data#inspect has stack overflow: " \ + "https://github.com/oracle/truffleruby/issues/3847" + end + klass = Data.define(:value, :head, :tail) do def initialize(value:, head: nil, tail: nil) case tail From c0517734b072d95e4edc1592c59e1b1df8609711 Mon Sep 17 00:00:00 2001 From: nick evans Date: Wed, 7 May 2025 11:31:20 -0400 Subject: [PATCH 4/9] =?UTF-8?q?=E2=9C=85=F0=9F=9A=A7=20Mark=201=20Response?= =?UTF-8?q?Reader=20test=20as=20pending=20for=20TruffleRuby?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- test/net/imap/test_response_reader.rb | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/test/net/imap/test_response_reader.rb b/test/net/imap/test_response_reader.rb index 61ef2984..0869b806 100644 --- a/test/net/imap/test_response_reader.rb +++ b/test/net/imap/test_response_reader.rb @@ -76,9 +76,11 @@ def literal(str) = "{#{str.bytesize}}\r\n#{str}" client.config.max_response_size = 10 io = StringIO.new(barely_over) rcvr = Net::IMAP::ResponseReader.new(client, io) - assert_raise Net::IMAP::ResponseTooLargeError do - result = rcvr.read_response_buffer - flunk "Got result: %p" % [result] + pend_if_truffleruby do + assert_raise Net::IMAP::ResponseTooLargeError do + result = rcvr.read_response_buffer + flunk "Got result: %p" % [result] + end end end From 9a1e15672ae2275ae3db90f786dde305a1e774ab Mon Sep 17 00:00:00 2001 From: nick evans Date: Wed, 7 May 2025 12:25:20 -0400 Subject: [PATCH 5/9] =?UTF-8?q?=E2=9C=85=F0=9F=9A=A7=20Mark=202=20FetchDat?= =?UTF-8?q?a=20tests=20as=20pending=20for=20JRuby?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- test/net/imap/test_fetch_data.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/net/imap/test_fetch_data.rb b/test/net/imap/test_fetch_data.rb index 37c074bb..adb0dea0 100644 --- a/test/net/imap/test_fetch_data.rb +++ b/test/net/imap/test_fetch_data.rb @@ -25,14 +25,14 @@ def fetch_data_class end test "#seqno does not exist" do - data = Net::IMAP::UIDFetchData.new(22222) + data = pend_if_jruby { Net::IMAP::UIDFetchData.new(22222) } or next assert_raise NoMethodError do data.seqno end end test "#uid replaces #seqno" do - data = Net::IMAP::UIDFetchData.new(22222) + data = pend_if_jruby { Net::IMAP::UIDFetchData.new(22222) } or next assert_equal 22222, data.uid end From ec7c9d948fbedc1e8639d5dcda585a2814ea2157 Mon Sep 17 00:00:00 2001 From: nick evans Date: Wed, 7 May 2025 12:25:57 -0400 Subject: [PATCH 6/9] =?UTF-8?q?=E2=9C=85=F0=9F=9A=A7=20Mark=202=20FetchDat?= =?UTF-8?q?a=20tests=20as=20pending=20for=20TruffleRuby?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- test/net/imap/test_fetch_data.rb | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/test/net/imap/test_fetch_data.rb b/test/net/imap/test_fetch_data.rb index adb0dea0..9613ba1c 100644 --- a/test/net/imap/test_fetch_data.rb +++ b/test/net/imap/test_fetch_data.rb @@ -14,8 +14,10 @@ def fetch_data_class end test "#uid" do - data = Net::IMAP::FetchData.new(22222, "UID" => 54_321) - assert_equal 54_321, data.uid + pend_if_truffleruby do + data = Net::IMAP::FetchData.new(22222, "UID" => 54_321) + assert_equal 54_321, data.uid + end end end @@ -37,8 +39,10 @@ def fetch_data_class end test "#initialize warns when uid differs from attr['UID']" do - assert_warn(/UIDs do not match/i) do - Net::IMAP::UIDFetchData.new(22222, "UID" => 54_321) + pend_if_truffleruby do + assert_warn(/UIDs do not match/i) do + Net::IMAP::UIDFetchData.new(22222, "UID" => 54_321) + end end end From 724c1a06676a299986909283b836f88f352c528a Mon Sep 17 00:00:00 2001 From: nick evans Date: Wed, 7 May 2025 13:11:09 -0400 Subject: [PATCH 7/9] =?UTF-8?q?=E2=9C=85=F0=9F=9A=A7=20Mark=202=20Config?= =?UTF-8?q?=20tests=20as=20pending=20for=20TruffleRuby?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- test/net/imap/test_config.rb | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/test/net/imap/test_config.rb b/test/net/imap/test_config.rb index a1b38afd..01cc2200 100644 --- a/test/net/imap/test_config.rb +++ b/test/net/imap/test_config.rb @@ -270,10 +270,15 @@ def duck.to_r = 1/11111 test "#freeze" do config = Config.new(open_timeout: 1) config.freeze - assert_raise FrozenError do - config.open_timeout = 2 + assert config.frozen? + assert config.__send__(:data).frozen? + pend_if_truffleruby "https://github.com/oracle/truffleruby/issues/3850" do + assert_raise FrozenError do + config.open_timeout = 2 + assert_equal 1, config.open_timeout + end + assert_equal 1, config.open_timeout end - assert_same 1, config.open_timeout end test "#dup" do @@ -302,10 +307,14 @@ def duck.to_r = 1/11111 original.freeze copy = original.clone assert copy.frozen? - assert_raise FrozenError do - copy.open_timeout = 2 + assert copy.__send__(:data).frozen? + pend_if_truffleruby "https://github.com/oracle/truffleruby/issues/3850" do + assert_raise FrozenError do + copy.open_timeout = 2 + assert_equal 1, copy.open_timeout + end + assert_equal 1, copy.open_timeout end - assert_equal 1, copy.open_timeout end test "#inherited? and #reset" do From 13606e158018bc03f38de28000b034da3d69712a Mon Sep 17 00:00:00 2001 From: nick evans Date: Wed, 7 May 2025 16:38:05 -0400 Subject: [PATCH 8/9] =?UTF-8?q?=E2=9C=85=F0=9F=9A=A7=20Omit=2015=20SSL=20c?= =?UTF-8?q?onnection=20tests=20for=20JRuby?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- test/net/imap/test_imap.rb | 8 ++++++++ test/net/imap/test_imap_capabilities.rb | 3 +++ test/net/imap/test_imap_deprecated_client_options.rb | 4 ++++ 3 files changed, 15 insertions(+) diff --git a/test/net/imap/test_imap.rb b/test/net/imap/test_imap.rb index 46047a29..95375b18 100644 --- a/test/net/imap/test_imap.rb +++ b/test/net/imap/test_imap.rb @@ -13,6 +13,7 @@ class IMAPTest < Net::IMAP::TestCase if defined?(OpenSSL::SSL::SSLError) def test_imaps_unknown_ca + omit_if_jruby "SSL tests don't work yet" assert_raise(OpenSSL::SSL::SSLError) do imaps_test do |port| begin @@ -27,6 +28,7 @@ def test_imaps_unknown_ca end def test_imaps_with_ca_file + omit_if_jruby "SSL tests don't work yet" # Assert verified *after* the imaps_test and assert_nothing_raised blocks. # Otherwise, failures can't logout and need to wait for the timeout. verified, imap = :unknown, nil @@ -54,6 +56,7 @@ def test_imaps_with_ca_file end def test_imaps_verify_none + omit_if_jruby "SSL tests don't work yet" # Assert verified *after* the imaps_test and assert_nothing_raised blocks. # Otherwise, failures can't logout and need to wait for the timeout. verified, imap = :unknown, nil @@ -81,6 +84,7 @@ def test_imaps_verify_none end def test_imaps_post_connection_check + omit_if_jruby "SSL tests don't work yet" assert_raise(OpenSSL::SSL::SSLError) do imaps_test do |port| # server_addr is different from the hostname in the certificate, @@ -95,6 +99,7 @@ def test_imaps_post_connection_check if defined?(OpenSSL::SSL) def test_starttls_unknown_ca + omit_if_jruby "SSL tests don't work yet" omit "This test is not working with Windows" if RUBY_PLATFORM =~ /mswin|mingw/ imap = nil @@ -115,6 +120,7 @@ def test_starttls_unknown_ca end def test_starttls + omit_if_jruby "SSL tests don't work yet" initial_verified, initial_ctx, initial_params = :unknown, :unknown, :unknown imap = nil starttls_test do |port| @@ -139,6 +145,7 @@ def test_starttls end def test_starttls_stripping + omit_if_jruby "SSL tests don't work yet" imap = nil starttls_stripping_test do |port| imap = Net::IMAP.new("localhost", :port => port) @@ -497,6 +504,7 @@ def test_connection_closed_during_idle end def test_connection_closed_without_greeting + omit_if_jruby "???" server = create_tcp_server port = server.addr[1] h = { diff --git a/test/net/imap/test_imap_capabilities.rb b/test/net/imap/test_imap_capabilities.rb index c2274798..9d605d57 100644 --- a/test/net/imap/test_imap_capabilities.rb +++ b/test/net/imap/test_imap_capabilities.rb @@ -124,6 +124,7 @@ class IMAPCapabilitiesTest < Net::IMAP::TestCase if defined?(OpenSSL::SSL::SSLError) test "#capabilities caches greeting capabilities (implicit TLS)" do + omit_if_jruby with_fake_server(preauth: false, implicit_tls: true) do |server, imap| assert imap.capabilities_cached? assert_equal %w[IMAP4REV1 AUTH=PLAIN], imap.capabilities @@ -136,6 +137,7 @@ class IMAPCapabilitiesTest < Net::IMAP::TestCase test "#capabilities cache is cleared after #starttls" do with_fake_server(preauth: false, cleartext_auth: false) do |server, imap| + omit_if_jruby assert imap.capabilities_cached? assert imap.capable? :IMAP4rev1 refute imap.auth_capable? "plain" @@ -189,6 +191,7 @@ class IMAPCapabilitiesTest < Net::IMAP::TestCase # TODO: should we warn about this? test "#capabilities cache IGNORES tagged OK response to STARTTLS" do + omit_if_jruby with_fake_server(preauth: false) do |server, imap| server.on "STARTTLS" do |cmd| cmd.done_ok code: "[CAPABILITY IMAP4rev1 AUTH=PLAIN fnord]" diff --git a/test/net/imap/test_imap_deprecated_client_options.rb b/test/net/imap/test_imap_deprecated_client_options.rb index 9ff9ad23..b02b49bd 100644 --- a/test/net/imap/test_imap_deprecated_client_options.rb +++ b/test/net/imap/test_imap_deprecated_client_options.rb @@ -42,6 +42,7 @@ class InitializeTests < IMAPDeprecatedClientOptionsTest end test "Convert deprecated usessl (= true) and certs, with warning" do + omit_if_jruby "SSL tests don't work yet" run_fake_server_in_thread(implicit_tls: true) do |server| certs = server.config.tls[:ca_file] assert_deprecated_warning(/Call Net::IMAP\.new with keyword/i) do @@ -58,6 +59,7 @@ class InitializeTests < IMAPDeprecatedClientOptionsTest end test "Convert deprecated usessl (= true) and verify (= false), with warning" do + omit_if_jruby "SSL tests don't work yet" run_fake_server_in_thread(implicit_tls: true) do |server| assert_deprecated_warning(/Call Net::IMAP\.new with keyword/i) do with_client("localhost", server.port, true, nil, false) do |client| @@ -89,6 +91,7 @@ class InitializeTests < IMAPDeprecatedClientOptionsTest class StartTLSTests < IMAPDeprecatedClientOptionsTest test "Convert obsolete options hash to keywords" do + omit_if_jruby "SSL tests don't work yet" with_fake_server(preauth: false) do |server, imap| imap.starttls(ca_file: server.config.tls[:ca_file], min_version: :TLS1_2) assert_equal( @@ -101,6 +104,7 @@ class StartTLSTests < IMAPDeprecatedClientOptionsTest end test "Convert deprecated certs, verify with warning" do + omit_if_jruby "SSL tests don't work yet" with_fake_server(preauth: false) do |server, imap| assert_deprecated_warning(/Call Net::IMAP#starttls with keyword/i) do imap.starttls(server.config.tls[:ca_file], false) From 95aebabb955a514af92ba159e0e78d83abfa7621 Mon Sep 17 00:00:00 2001 From: nick evans Date: Wed, 15 Oct 2025 11:42:15 -0400 Subject: [PATCH 9/9] =?UTF-8?q?=F0=9F=9A=A7=E2=8F=AA=20Revert=20bad=20merg?= =?UTF-8?q?e=20(extra=20"include:"=20in=20GH=20worflow)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/test.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 0a6b6ba1..3f67b2a0 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -20,7 +20,6 @@ jobs: ruby: ${{ fromJson(needs.ruby-versions.outputs.versions) }} os: [ ubuntu-latest, macos-latest, windows-latest ] experimental: [false] - include: exclude: - { ruby: head, os: windows-latest } include: