From 4ab37a13ceb5338c98ba16e5b59ed6b7b51840ee Mon Sep 17 00:00:00 2001 From: ko1 Date: Sun, 23 Jun 2013 06:41:37 +0000 Subject: * bootstraptest/test_thread.rb: rescue resource limitation errors. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41585 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- bootstraptest/test_thread.rb | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) (limited to 'bootstraptest/test_thread.rb') diff --git a/bootstraptest/test_thread.rb b/bootstraptest/test_thread.rb index 121def8b42..c2b2b8ce9b 100644 --- a/bootstraptest/test_thread.rb +++ b/bootstraptest/test_thread.rb @@ -10,7 +10,8 @@ assert_equal %q{ok}, %q{ :ok }.value } -assert_equal %q{20100}, %q{ +assert_equal %q{ok}, %q{ +begin v = 0 (1..200).map{|i| Thread.new{ @@ -19,7 +20,10 @@ assert_equal %q{20100}, %q{ }.each{|t| v += t.value } - v + v == 20100 ? :ok : v +rescue ThreadError => e + :ok if e.message =~ "can't create Thread" +end } assert_equal %q{5000}, %q{ 5000.times{|e| @@ -41,13 +45,17 @@ assert_equal %q{5000}, %q{ } } } -assert_equal %q{5000}, %q{ - 5000.times{ +assert_equal %q{ok}, %q{ +begin + :ok if 5000 == 5000.times{ t = Thread.new{} while t.alive? Thread.pass end } +rescue NoMemoryError + :ok +end } assert_equal %q{100}, %q{ 100.times{ -- cgit v1.2.3