Skip to content

Commit 5b2d117

Browse files
committed
Skip the Rust newgem cargo test where magnus cannot build
Ruby master added `handle_weak_references` to `rb_data_type_struct`, and no released `magnus` compiles against it, so the generated crate fails to build on `ruby-head`. Key the skip on that field being present in `rtypeddata.h` rather than on a hardcoded Ruby version.
1 parent a443fab commit 5b2d117

1 file changed

Lines changed: 7 additions & 0 deletions

File tree

spec/commands/newgem_options_spec.rb

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1106,6 +1106,7 @@ def installed_go?
11061106

11071107
def setup_rust_env
11081108
skip "rust toolchain of mingw is broken" if RUBY_PLATFORM.match?("mingw")
1109+
skip "magnus has no release supporting the extended rb_data_type_struct yet (https://github.com/matsadler/magnus/issues/173)" if rb_data_type_struct_extended?
11091110

11101111
env = {
11111112
"CARGO_HOME" => ENV.fetch("CARGO_HOME", File.join(ENV["HOME"], ".cargo")),
@@ -1119,6 +1120,12 @@ def setup_rust_env
11191120
RbConfig::CONFIG.each {|k, v| env["RBCONFIG_#{k}"] = v }
11201121
env
11211122
end
1123+
1124+
def rb_data_type_struct_extended?
1125+
rtypeddata_h = File.join(RbConfig::CONFIG["rubyhdrdir"], "ruby", "internal", "core", "rtypeddata.h")
1126+
1127+
File.exist?(rtypeddata_h) && File.read(rtypeddata_h).include?("handle_weak_references")
1128+
end
11221129
end
11231130

11241131
context "--ext parameter set with go" do

0 commit comments

Comments
 (0)