summaryrefslogtreecommitdiff
path: root/test/ruby/test_array.rb
diff options
context:
space:
mode:
authorYusuke Endoh <[email protected]>2019-06-26 16:01:45 +0900
committerYusuke Endoh <[email protected]>2019-06-26 16:04:07 +0900
commita84a99ffabf04d90be64ff28cf2e11766f6cce52 (patch)
treea8d099822f47374463d9943259faf0c78e6c7978 /test/ruby/test_array.rb
parent04bc4c0662344238a556aa92f5f8f6d42586bab3 (diff)
test/ruby/test_array.rb (test_sort_with_replace): run in a subprocess
This test invokes GC.start 100 times, which takes approx. six minutes in Solaris. This change runs the test in a separated process, which makes GC.start faster.
Diffstat (limited to 'test/ruby/test_array.rb')
-rw-r--r--test/ruby/test_array.rb22
1 files changed, 15 insertions, 7 deletions
diff --git a/test/ruby/test_array.rb b/test/ruby/test_array.rb
index b1778d191c..6cb96ebe7a 100644
--- a/test/ruby/test_array.rb
+++ b/test/ruby/test_array.rb
@@ -1610,13 +1610,21 @@ class TestArray < Test::Unit::TestCase
end
def test_sort_with_replace
- xary = (1..100).to_a
- 100.times do
- ary = (1..100).to_a
- ary.sort! {|a,b| ary.replace(xary); a <=> b}
- GC.start
- assert_equal(xary, ary, '[ruby-dev:34732]')
- end
+ bug = '[ruby-core:34732]'
+ assert_separately([], "#{<<~"begin;"}\n#{<<~'end;'}", timeout: 30)
+ bug = "#{bug}"
+ begin;
+ xary = (1..100).to_a
+ 100.times do
+ ary = (1..100).to_a
+ ary.sort! {|a,b| ary.replace(xary); a <=> b}
+ GC.start
+ assert_equal(xary, ary, '[ruby-dev:34732]')
+ end
+ assert_nothing_raised(SystemStackError, bug) do
+ assert_equal(:ok, Array.new(100_000, nil).permutation {break :ok})
+ end
+ end;
end
def test_sort_bang_with_freeze