diff options
author | ko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2013-06-23 06:41:37 +0000 |
---|---|---|
committer | ko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2013-06-23 06:41:37 +0000 |
commit | 4ab37a13ceb5338c98ba16e5b59ed6b7b51840ee (patch) | |
tree | 536c62bdb47f9dfbd4ed892bc6bb9dc891ce0b0f /bootstraptest/test_thread.rb | |
parent | 698359593547bbd71b9a600bac6bd6ab4c5545d8 (diff) | |
download | ruby-4ab37a13ceb5338c98ba16e5b59ed6b7b51840ee.tar.gz |
* 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
Diffstat (limited to 'bootstraptest/test_thread.rb')
-rw-r--r-- | bootstraptest/test_thread.rb | 16 |
1 files changed, 12 insertions, 4 deletions
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{ |