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

ruby-changes:8775

From: yugui <ko1@a...>
Date: Sat, 22 Nov 2008 21:13:07 +0900 (JST)
Subject: [ruby-changes:8775] Ruby:r20311 (ruby_1_9_1): merges r20276 and r20278 from trunk into ruby_1_9_1.

yugui	2008-11-22 21:12:50 +0900 (Sat, 22 Nov 2008)

  New Revision: 20311

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

  Log:
    merges r20276 and r20278 from trunk into ruby_1_9_1.
    fixed fails occasionally [ruby-dev:37119]. thanks, shinichiro.h.

  Modified files:
    branches/ruby_1_9_1/ChangeLog
    branches/ruby_1_9_1/test/rinda/test_rinda.rb

Index: ruby_1_9_1/ChangeLog
===================================================================
--- ruby_1_9_1/ChangeLog	(revision 20310)
+++ ruby_1_9_1/ChangeLog	(revision 20311)
@@ -1,3 +1,8 @@
+Wed Nov 19 03:01:04 2008  Masatoshi SEKI  <m_seki@m...>
+
+	* test/rinda/test_rinda.rb: fixed fails occasionally [ruby-dev:37119].
+	  thanks, shinichiro.h.
+
 Wed Nov 19 02:39:31 2008  Nobuyoshi Nakada  <nobu@r...>
 
 	* error.c (Init_syserr): moved function definition itself from
@@ -1100,7 +1105,7 @@
 
 Wed Oct 22 00:29:13 2008  Masatoshi SEKI  <m_seki@m...>
 
-	* test/rinda/test_rinda.c (test_core_03_notify): Fixed test failures
+	* test/rinda/test_rinda.rb (test_core_03_notify): Fixed test failures
 	  [ruby-dev:36837].
 
 Wed Oct 22 00:22:06 2008  Yukihiro Matsumoto  <matz@r...>
Index: ruby_1_9_1/test/rinda/test_rinda.rb
===================================================================
--- ruby_1_9_1/test/rinda/test_rinda.rb	(revision 20310)
+++ ruby_1_9_1/test/rinda/test_rinda.rb	(revision 20311)
@@ -317,8 +317,8 @@
   
   def test_core_03_notify
     notify1 = @ts.notify(nil, [:req, Integer])
-    notify2 = @ts.notify(nil, [:ans, Integer], 5)
-    notify3 = @ts.notify(nil, {"message"=>String, "name"=>String}, 5)
+    notify2 = @ts.notify(nil, [:ans, Integer], 8)
+    notify3 = @ts.notify(nil, {"message"=>String, "name"=>String}, 8)
 
     @ts.write({"message"=>"first", "name"=>"3"}, 3)
     @ts.write({"message"=>"second", "name"=>"1"}, 1)
@@ -347,18 +347,18 @@
       result = nil
       lv = 0
       n = 0
-      notify2.each  do |ev|
+      notify2.each do |ev, tuple|
 	n += 1
-	if ev[0] == 'write'
+	if ev == 'write'
 	  lv = lv + 1
-	elsif ev[0] == 'take'
+	elsif ev == 'take'
 	  lv = lv - 1
-	elsif ev[0] == 'close'
+	elsif ev == 'close'
 	  result = [lv, n]
 	  break
 	end
 	assert(lv >= 0)
-	assert_equal([:ans, 10], ev[1])
+	assert_equal([:ans, 10], tuple)
       end
       result
     end
@@ -385,13 +385,15 @@
 
     sleep(4)
     assert_equal(10, thread_join(taker))
+    # notify2 must not expire until this @ts.take.
+    # sleep(4) might be short enough for the timeout of notify2 (8 secs)
     tuple = @ts.take([:ans, nil])
     assert_equal(10, tuple[1])
     assert_equal([], @ts.read_all([nil, nil]))
-    
+
     notify1.cancel
-    sleep(3) # notify2 expired
-    
+    sleep(7) # notify2 expired (sleep(4)+sleep(7) > 8)
+
     assert_equal([0, 11], thread_join(listener1))
     assert_equal([0, 3], thread_join(listener2))
 

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

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