Repository navigation
Ignore warnings with spec different platforms #8508
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||
|---|---|---|---|---|
|
|
@@ -140,6 +140,7 @@ def raw_require_paths # :nodoc: | |||
| end | ||||
|
|
||||
| def missing_extensions? | ||||
| return false if RUBY_ENGINE == "jruby" | ||||
|
||||
| return false if RUBY_ENGINE == "jruby" |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -1304,10 +1304,14 @@ def test_self_try_activate_missing_extensions | |
| refute Gem.try_activate "nonexistent" | ||
| end | ||
|
|
||
| expected = "Ignoring ext-1 because its extensions are not built. " \ | ||
| "Try: gem pristine ext --version 1\n" | ||
| if RUBY_ENGINE == "jruby" | ||
| assert_equal "", err | ||
| else | ||
| expected = "Ignoring ext-1 because its extensions are not built. " \ | ||
| "Try: gem pristine ext --version 1\n" | ||
|
|
||
| assert_equal expected, err | ||
| assert_equal expected, err | ||
| end | ||
|
Comment on lines
+1307
to
+1314
|
||
| end | ||
|
|
||
| def test_self_use_paths_with_nils | ||
|
|
||
| Original file line number | Diff line number | Diff line change | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -1578,13 +1578,21 @@ def test_contains_requirable_file_eh_extension | |||||||||||||
| ext_spec | ||||||||||||||
|
|
||||||||||||||
| _, err = capture_output do | ||||||||||||||
| refute @ext.contains_requirable_file? "nonexistent" | ||||||||||||||
| if RUBY_ENGINE == "jruby" | ||||||||||||||
| refute @ext.ignored? | ||||||||||||||
| else | ||||||||||||||
| refute @ext.contains_requirable_file? "nonexistent" | ||||||||||||||
| end | ||||||||||||||
|
Comment on lines
+1581
to
+1585
|
||||||||||||||
| if RUBY_ENGINE == "jruby" | |
| refute @ext.ignored? | |
| else | |
| refute @ext.contains_requirable_file? "nonexistent" | |
| end | |
| refute @ext.contains_requirable_file? "nonexistent" |
Copilot
AI
Apr 1, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Making missing_extensions? return false on JRuby changes core behavior and this test now codifies that change. If the desired behavior is “still ignore specs missing extensions, but don’t warn when those specs are effectively for another platform/engine”, adjust the warning logic and keep missing_extensions? consistent across engines; then this test should continue to expect @ext.missing_extensions? to be true before build_extensions.
| if RUBY_ENGINE == "jruby" | |
| refute @ext.missing_extensions? | |
| else | |
| assert @ext.missing_extensions? | |
| end | |
| assert @ext.missing_extensions? |
| Original file line number | Diff line number | Diff line change | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -68,13 +68,21 @@ def test_contains_requirable_file_eh | |||||||||||||
| def test_contains_requirable_file_eh_extension | ||||||||||||||
| stub_with_extension do |stub| | ||||||||||||||
| _, err = capture_output do | ||||||||||||||
| refute stub.contains_requirable_file? "nonexistent" | ||||||||||||||
| if RUBY_ENGINE == "jruby" | ||||||||||||||
| refute stub.ignored? | ||||||||||||||
| else | ||||||||||||||
| refute stub.contains_requirable_file? "nonexistent" | ||||||||||||||
| end | ||||||||||||||
|
Comment on lines
69
to
+75
|
||||||||||||||
| end | ||||||||||||||
|
|
||||||||||||||
| expected = "Ignoring stub_e-2 because its extensions are not built. " \ | ||||||||||||||
| "Try: gem pristine stub_e --version 2\n" | ||||||||||||||
| if RUBY_ENGINE == "jruby" | ||||||||||||||
| assert_equal "", err | ||||||||||||||
| else | ||||||||||||||
| expected = "Ignoring stub_e-2 because its extensions are not built. " \ | ||||||||||||||
| "Try: gem pristine stub_e --version 2\n" | ||||||||||||||
|
|
||||||||||||||
| assert_equal expected, err | ||||||||||||||
| assert_equal expected, err | ||||||||||||||
| end | ||||||||||||||
| end | ||||||||||||||
| end | ||||||||||||||
|
|
||||||||||||||
|
|
@@ -137,7 +145,11 @@ def test_missing_extensions_eh | |||||||||||||
| end | ||||||||||||||
| end | ||||||||||||||
|
|
||||||||||||||
| assert stub.missing_extensions? | ||||||||||||||
| if RUBY_ENGINE == "jruby" | ||||||||||||||
| refute stub.missing_extensions? | ||||||||||||||
| else | ||||||||||||||
| assert stub.missing_extensions? | ||||||||||||||
| end | ||||||||||||||
|
Comment on lines
+148
to
+152
|
||||||||||||||
| if RUBY_ENGINE == "jruby" | |
| refute stub.missing_extensions? | |
| else | |
| assert stub.missing_extensions? | |
| end | |
| assert stub.missing_extensions? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
missing_extensions?returningfalseunconditionally on JRuby changes behavior beyond silencing warnings: specs with unbuilt extensions will no longer be marked ignored, so they can be selected for activation/resolution even though their native bits are unavailable for the current platform/ABI (and commands likegem pristine --only-missing-extensionswill stop working). Instead of short-circuitingmissing_extensions?by engine, keep the missing-extension detection intact and suppress the warning in the caller(s) when the spec is for a different platform (or when running on non-CRuby engines).