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

ruby-changes:29533

From: ko1 <ko1@a...>
Date: Sun, 23 Jun 2013 15:42:24 +0900 (JST)
Subject: [ruby-changes:29533] ko1:r41585 (trunk): * bootstraptest/test_thread.rb: rescue resource limitation errors.

ko1	2013-06-23 15:41:37 +0900 (Sun, 23 Jun 2013)

  New Revision: 41585

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=41585

  Log:
    * bootstraptest/test_thread.rb: rescue resource limitation errors.

  Modified files:
    trunk/ChangeLog
    trunk/bootstraptest/test_thread.rb

Index: ChangeLog
===================================================================
--- ChangeLog	(revision 41584)
+++ ChangeLog	(revision 41585)
@@ -1,3 +1,7 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1
+Sun Jun 23 15:38:07 2013  Koichi Sasada  <ko1@a...>
+
+	* bootstraptest/test_thread.rb: rescue resource limitation errors.
+
 Sun Jun 23 08:19:27 2013  Tanaka Akira  <akr@f...>
 
 	* bignum.c (integer_unpack_single_bdigit): Extracted from
Index: bootstraptest/test_thread.rb
===================================================================
--- bootstraptest/test_thread.rb	(revision 41584)
+++ bootstraptest/test_thread.rb	(revision 41585)
@@ -10,7 +10,8 @@ assert_equal %q{ok}, %q{ https://github.com/ruby/ruby/blob/trunk/bootstraptest/test_thread.rb#L10
     :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{ https://github.com/ruby/ruby/blob/trunk/bootstraptest/test_thread.rb#L20
   }.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{ https://github.com/ruby/ruby/blob/trunk/bootstraptest/test_thread.rb#L45
     }
   }
 }
-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{

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

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