[前][次][番号順一覧][スレッド一覧]

ruby-changes:56226

From: Yusuke <ko1@a...>
Date: Wed, 26 Jun 2019 16:04:22 +0900 (JST)
Subject: [ruby-changes:56226] Yusuke Endoh: a84a99ffab (trunk): test/ruby/test_array.rb (test_sort_with_replace): run in a subprocess

https://git.ruby-lang.org/ruby.git/commit/?id=a84a99ffab

From a84a99ffabf04d90be64ff28cf2e11766f6cce52 Mon Sep 17 00:00:00 2001
From: Yusuke Endoh <mame@r...>
Date: Wed, 26 Jun 2019 16:01:45 +0900
Subject: 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.

diff --git a/test/ruby/test_array.rb b/test/ruby/test_array.rb
index b1778d1..6cb96eb 100644
--- a/test/ruby/test_array.rb
+++ b/test/ruby/test_array.rb
@@ -1610,13 +1610,21 @@ class TestArray < Test::Unit::TestCase https://github.com/ruby/ruby/blob/trunk/test/ruby/test_array.rb#L1610
   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
-- 
cgit v0.10.2


--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]