diff options
| author | Nobuyoshi Nakada <nobu@ruby-lang.org> | 2024-02-21 22:35:14 +0900 |
|---|---|---|
| committer | Hiroshi SHIBATA <hsbt@ruby-lang.org> | 2024-02-26 15:27:37 +0900 |
| commit | 65f40967d5c2ee2df1755f8a9159553df15e6295 (patch) | |
| tree | 086d7d7186fd8024e58673db84d293b7fc79746f | |
| parent | 91ec1fc4e79d0070a029e6bd006afe04cdf26c9f (diff) | |
[rubygems/rubygems] Get rid of too long paths
This is a fix-up of #7483.
Test method names in Rubygems are often very long, and the path under
the temporary directory generated from them can easily exceed system
limits.
Even without including the method name in the path name, by saving the
method and path name pair, it is possible to find the method from the
remaining path name.
https://github.com/rubygems/rubygems/commit/de55064a3d
| -rw-r--r-- | test/rubygems/helper.rb | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/test/rubygems/helper.rb b/test/rubygems/helper.rb index c33d1bba21..6b4aaa5525 100644 --- a/test/rubygems/helper.rb +++ b/test/rubygems/helper.rb @@ -289,8 +289,8 @@ class Gem::TestCase < Test::Unit::TestCase FileUtils.mkdir_p @tmp - @tempdir = Dir.mktmpdir(method_name.to_s, @tmp) - @@tempdirs << @tempdir + @tempdir = Dir.mktmpdir("test_rubygems_", @tmp) + @@tempdirs << [method_name, @tempdir] ENV["GEM_VENDOR"] = nil ENV["GEMRC"] = nil @@ -475,7 +475,13 @@ class Gem::TestCase < Test::Unit::TestCase @back_ui.close - assert_empty @@tempdirs.select {|tempdir| File.exist?(tempdir) } + ghosts = @@tempdirs.filter_map do |test_name, tempdir| + if File.exist?(tempdir) + FileUtils.rm_rf(tempdir) + test_name + end + end + assert_empty ghosts end def credential_setup |
