Skip to content

Commit

Permalink
Align patches
Browse files Browse the repository at this point in the history
  • Loading branch information
MSP-Greg committed Sep 13, 2023
1 parent c716886 commit a6807cf
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 31 deletions.
10 changes: 5 additions & 5 deletions patches_test/irb-test_cmd.rb.patch
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
diff --git a/test/irb/test_cmd.rb b/test/irb/test_cmd.rb
index 670078679f..b011b8bfac 100644
index e8c959ec39..877798a184 100644
--- a/test/irb/test_cmd.rb
+++ b/test/irb/test_cmd.rb
@@ -902,6 +902,10 @@ def test_show_doc_without_rdoc
@@ -896,6 +896,10 @@ def test_show_doc_without_rdoc
end

class EditTest < CommandTestCase
Expand All @@ -13,7 +13,7 @@ index 670078679f..b011b8bfac 100644
def setup
@original_visual = ENV["VISUAL"]
@original_editor = ENV["EDITOR"]
@@ -951,7 +955,7 @@ def test_edit_with_constant
@@ -945,7 +949,7 @@ def test_edit_with_constant
)

assert_empty err
Expand All @@ -22,7 +22,7 @@ index 670078679f..b011b8bfac 100644
assert_match("command: ': code'", out)
end

@@ -961,7 +965,7 @@ def test_edit_with_class_method
@@ -955,7 +959,7 @@ def test_edit_with_class_method
)

assert_empty err
Expand All @@ -31,7 +31,7 @@ index 670078679f..b011b8bfac 100644
assert_match("command: ': code'", out)
end

@@ -971,7 +975,7 @@ def test_edit_with_instance_method
@@ -965,7 +969,7 @@ def test_edit_with_instance_method
)

assert_empty err
Expand Down
36 changes: 10 additions & 26 deletions patches_test/ruby-test_require_lib.rb.patch
Original file line number Diff line number Diff line change
@@ -1,34 +1,18 @@
# load files from install, not src
diff --git a/test/ruby/test_require_lib.rb b/test/ruby/test_require_lib.rb
index 95fa3f29e1..3530014740 100644
index a88279727e..92f67f453d 100644
--- a/test/ruby/test_require_lib.rb
+++ b/test/ruby/test_require_lib.rb
@@ -1,14 +1,25 @@
# frozen_string_literal: false
@@ -1,8 +1,11 @@
# frozen_string_literal: true
require 'test/unit'
+require 'rbconfig'

class TestRequireLib < Test::Unit::TestCase
TEST_RATIO = ENV["TEST_REQUIRE_THREAD_RATIO"]&.tap {|s|break s.to_f} || 0.05 # testing all files needs too long time...

- Dir.glob(File.expand_path('../../lib/**/*.rb', __dir__)).each do |lib|
- libdir = __dir__ + '/../../lib'
+
+ temp = RbConfig::CONFIG['rubylibdir']
+ files = if Dir.exist? temp
+ re_lib = ''
+ Dir.glob('**/*.rb', base: temp)
+ else
+ re_lib = '/lib/'
+ Dir.glob(File.expand_path('../../lib/**/*.rb', __dir__))
+ end
+
+ files.each do |lib|
# skip some problems
- next if %r!/lib/(?:bundler|rubygems)\b! =~ lib
- next if %r!/lib/(?:debug|mkmf)\.rb\z! =~ lib
- next if %r!/lib/irb/ext/tracer\.rb\z! =~ lib
+ next if %r!#{re_lib}(?:bundler|rubygems)\b! =~ lib
+ next if %r!#{re_lib}(?:debug|mkmf)\.rb\z! =~ lib
+ next if %r!#{re_lib}irb/ext/tracer\.rb\z! =~ lib
+
# skip many files that almost use no threads
next if TEST_RATIO < rand(0.0..1.0)
define_method "test_thread_size:#{lib}" do
+ libdir = Dir.exist?(temp) ? temp : (__dir__ + '/../../lib')

# .rb files at lib
scripts = Dir.glob('*.rb', base: libdir).map {|f| f.chomp('.rb')}

0 comments on commit a6807cf

Please sign in to comment.