@@ -781,18 +781,18 @@ def cextc(cext_dir, *clang_opts)
781
781
name = File . basename ( cext_dir )
782
782
ext_dir = "#{ cext_dir } /ext/#{ name } "
783
783
target = "#{ cext_dir } /lib/#{ name } /#{ name } .su"
784
- compile_cext ( name , ext_dir , target , * clang_opts )
784
+ compile_cext ( name , ext_dir , target , clang_opts )
785
785
end
786
786
787
- def compile_cext ( name , ext_dir , target , * clang_opts )
787
+ def compile_cext ( name , ext_dir , target , clang_opts , env : { } )
788
788
extconf = "#{ ext_dir } /extconf.rb"
789
789
raise "#{ extconf } does not exist" unless File . exist? ( extconf )
790
790
791
791
# Make sure ruby.su is built
792
792
build ( "cexts" )
793
793
794
794
chdir ( ext_dir ) do
795
- run_ruby ( '-rmkmf' , "#{ ext_dir } /extconf.rb" ) # -rmkmf is required for C ext tests
795
+ run_ruby ( env , '-rmkmf' , "#{ ext_dir } /extconf.rb" ) # -rmkmf is required for C ext tests
796
796
if File . exists? ( 'Makefile' )
797
797
raw_sh ( "make" )
798
798
FileUtils ::Verbose . cp ( "#{ name } .su" , target ) if target
@@ -1026,6 +1026,11 @@ def run_mri_tests(extra_args, test_files, runner_args, run_options)
1026
1026
"RUBYOPT" => [ *ENV [ 'RUBYOPT' ] , '--disable-gems' ] . join ( ' ' ) ,
1027
1027
"TRUFFLERUBY_RESILIENT_GEM_HOME" => nil ,
1028
1028
}
1029
+ compile_env = {
1030
+ # MRI C-ext tests expect to be built with $extmk = true.
1031
+ "MKMF_SET_EXTMK_TO_TRUE" => "true" ,
1032
+ }
1033
+
1029
1034
cext_tests = test_files . select do |f |
1030
1035
f . include? ( "cext-ruby" ) ||
1031
1036
f == "ruby/test_file_exhaustive.rb"
@@ -1058,7 +1063,7 @@ def run_mri_tests(extra_args, test_files, runner_args, run_options)
1058
1063
end
1059
1064
dest_dir = File . join ( MRI_TEST_CEXT_LIB_DIR , target_dir )
1060
1065
FileUtils ::Verbose . mkdir_p ( dest_dir )
1061
- compile_cext ( name , compile_dir , dest_dir )
1066
+ compile_cext ( name , compile_dir , dest_dir , [ ] , env : compile_env )
1062
1067
else
1063
1068
puts "c require not found for cext test: #{ test_path } "
1064
1069
end
@@ -1193,7 +1198,7 @@ def test_cexts(*args)
1193
1198
gem_root = "#{ TRUFFLERUBY_DIR } /test/truffle/cexts/#{ gem_name } "
1194
1199
ext_dir = Dir . glob ( "#{ gem_home } /gems/#{ gem_name } */" ) [ 0 ] + "ext/#{ gem_name } "
1195
1200
1196
- compile_cext gem_name , ext_dir , "#{ gem_root } /lib/#{ gem_name } /#{ gem_name } .su" , '-Werror=implicit-function-declaration'
1201
+ compile_cext gem_name , ext_dir , "#{ gem_root } /lib/#{ gem_name } /#{ gem_name } .su" , [ '-Werror=implicit-function-declaration' ]
1197
1202
1198
1203
next if gem_name == 'psd_native' # psd_native is excluded just for running
1199
1204
run_ruby *dependencies . map { |d | "-I#{ gem_home } /gems/#{ d } /lib" } ,
0 commit comments