summaryrefslogtreecommitdiff
path: root/test/rubygems/test_gem_installer.rb
diff options
context:
space:
mode:
authorEloy Espinaco <eloyesp@gmail.com>2022-11-29 23:40:02 -0300
committerHiroshi SHIBATA <hsbt@ruby-lang.org>2022-12-20 13:15:02 +0900
commit0a9544ce4ab86963dde0f3ad0b489b6a354cc8b3 (patch)
tree11f3504747a04d473ae0a77cc66ddc83922145eb /test/rubygems/test_gem_installer.rb
parent9d10b8393e6692d076d79d3b80c6eefb40a65b44 (diff)
[rubygems/rubygems] Cleanup intermediate artifacts after installing built extensions
https://github.com/rubygems/rubygems/commit/98b6a959bd
Notes
Notes: Merged: https://github.com/ruby/ruby/pull/6966
Diffstat (limited to 'test/rubygems/test_gem_installer.rb')
-rw-r--r--test/rubygems/test_gem_installer.rb35
1 files changed, 35 insertions, 0 deletions
diff --git a/test/rubygems/test_gem_installer.rb b/test/rubygems/test_gem_installer.rb
index 5ba64074f9..7265114327 100644
--- a/test/rubygems/test_gem_installer.rb
+++ b/test/rubygems/test_gem_installer.rb
@@ -1584,6 +1584,41 @@ gem 'other', version
end
end
+ def test_install_extension_clean_intermediate_files
+ pend "extensions don't quite work on jruby" if Gem.java_platform?
+ @spec = setup_base_spec
+ @spec.require_paths = ["."]
+ @spec.extensions << "extconf.rb"
+
+ File.write File.join(@tempdir, "extconf.rb"), <<-RUBY
+ require "mkmf"
+ CONFIG['CC'] = '$(TOUCH) $@ ||'
+ CONFIG['LDSHARED'] = '$(TOUCH) $@ ||'
+ $ruby = '#{Gem.ruby}'
+ create_makefile("#{@spec.name}")
+ RUBY
+
+ # empty depend file for no auto dependencies
+ @spec.files += %W[depend #{@spec.name}.c].each do |file|
+ write_file File.join(@tempdir, file)
+ end
+
+ shared_object = "#{@spec.name}.#{RbConfig::CONFIG["DLEXT"]}"
+ extension_file = File.join @spec.extension_dir, shared_object
+ intermediate_file = File.join @spec.gem_dir, shared_object
+
+ assert_path_not_exist extension_file, "no before installing"
+ use_ui @ui do
+ path = Gem::Package.build @spec
+
+ installer = Gem::Installer.at path
+ installer.install
+ end
+
+ assert_path_exist extension_file, "installed"
+ assert_path_not_exist intermediate_file
+ end
+
def test_installation_satisfies_dependency_eh
installer = setup_base_installer