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

ruby-changes:49232

From: ko1 <ko1@a...>
Date: Wed, 20 Dec 2017 09:24:25 +0900 (JST)
Subject: [ruby-changes:49232] ko1:r61347 (trunk): extend timeout limit.

ko1	2017-12-20 09:24:19 +0900 (Wed, 20 Dec 2017)

  New Revision: 61347

  https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=61347

  Log:
    extend timeout limit.
    
    * test/ruby/test_process.rb (test_threading_works_after_exec_fail):
      extend timeout limit from 30 to 90 because some test nodes fails
      with timeout error.
    
      Also use a Queue instead of a local variable to communicate with
      threads.

  Modified files:
    trunk/test/ruby/test_process.rb
Index: test/ruby/test_process.rb
===================================================================
--- test/ruby/test_process.rb	(revision 61346)
+++ test/ruby/test_process.rb	(revision 61347)
@@ -2281,7 +2281,7 @@ EOS https://github.com/ruby/ruby/blob/trunk/test/ruby/test_process.rb#L2281
   def test_threading_works_after_exec_fail
     r, w = IO.pipe
     pid = status = nil
-    Timeout.timeout(30) do
+    Timeout.timeout(90) do
       pid = fork do
         r.close
         begin
@@ -2289,11 +2289,12 @@ EOS https://github.com/ruby/ruby/blob/trunk/test/ruby/test_process.rb#L2289
         rescue SystemCallError
           w.syswrite("exec failed\n")
         end
+        q = Queue.new
         run = true
-        th1 = Thread.new { i = 0; i += 1 while run; i }
-        th2 = Thread.new { j = 0; j += 1 while run && Thread.pass.nil?; j }
+        th1 = Thread.new { i = 0; i += 1 while q.empty?; i }
+        th2 = Thread.new { j = 0; j += 1 while q.empty? && Thread.pass.nil?; j }
         sleep 0.5
-        run = false
+        q << true
         w.syswrite "#{th1.value} #{th2.value}\n"
       end
       w.close

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

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