Test/rinda/test_rinda.rb fails occasionally

e$BIMCO$G$9!#e(B

e$B$J$s$+BN46$Ge(B 1/5 e$B$/$i$$$N3NN($Ge(B test_rinda.rb e$B$,e(B

  1. Failure:
    test_core_03_notify(Rinda::TupleSpaceTest)
    [/home/i/src/ruby_orig/test/rinda/test_rinda.rb:396]:
    <[0, 3]> expected but was
    <[0, 1]>.

e$B$J$I$H8@$C$F%3%1$k$N$G!">/$7D/$a$F$_$^$7$?!#e(B
e$B$h$/$o$+$C$F$^$;$s$,e(B MockClock e$B$,e(B mock e$B$7$-$l$F$J$/$Fe(B
e$B$A$g$C$H$:$l$F$k$s$8$c$J$$$+$H;W$$$^$9!#e(B
expire e$B$9$ke(B timeout e$B$r$A$g$C$H$f$H$j$r2C$($F$d$k$He(B
100e$B2s$d$C$Fe(B100e$B2sDL$C$?$N$G$^$!%^%7$K$J$C$F$O$$$k$N$G$J$$$+$H!#e(B

e$B$5$i$K%l%"$Je(B

  1. Failure:
    test_core_03_notify(Rinda::TupleSpaceTest)
    [/home/i/src/ruby/test/rinda/test_rin
    da.rb:408]:
    <[“delete”, {“message”=>“second”, “name”=>“1”}]> expected but was
    <[“close”]>.

e$B$NJ}$G$9$,e(B(e$B?t==2s$Ke(B1e$B2s=P$kDxEYe(B?)e$B!"$3$l$be(B notify3
e$B$Ne(B
timeout e$B$K$f$H$j$r;}$?$;$?$i=P$J$/$J$C$?$h$&$K;W$$$^$9!#e(B

e$B$D$$$G$Ke(B sleep e$B$N0U?^$,$h$/$o$+$i$J$+$C$?$N$Ge(B
e$B%3%a%s%H$rB-$7$F$$$$?$N$H!"e(B listener1 e$B$He(B listener2 e$B$Ge(B
e$B%9%?%$%k$,0c$&$3$H$K0UL#$r8+=P$;$J$+$C$?$N$G$$$8$C$F$
$-$^$7$?!#e(B

e$B%^%8%a$K=$@5$9$k$J$i$*$=$i$/e(B MockClock e$B$re(B
deterministic e$B$J7A$K=q$-D>$9$Y$-$J$N$+$J!“e(B
e$B$H;W$$$^$9$,3N?.$O$”$j$^$;$s!#e(B

Index: test/rinda/test_rinda.rb

— test/rinda/test_rinda.rb (revision 20267)
+++ test/rinda/test_rinda.rb (working copy)
@@ -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))

e$B31$H$$$$$^$9!#e(B

On 2008/11/19, at 2:15, shinichiro.h wrote:

e$B$NJ}$G$9$,e(B(e$B?t==2s$Ke(B1e$B2s=P$kDxEYe(B?)e$B!"$3$l$be(B
notify3 e$B$Ne(B
timeout e$B$K$f$H$j$r;}$?$;$?$i=P$J$/$J$C$?$h$&$K;W$$$^$9!#e(B

e$B$D$$$G$Ke(B sleep e$B$N0U?^$,$h$/$o$+$i$J$+$C$?$N$Ge(B
e$B%3%a%s%H$rB-$7$F$$$$?$N$H!"e(B listener1 e$B$He(B
listener2 e$B$Ge(B
e$B%9%?%$%k$,0c$&$3$H$K0UL#$r8+=P$;$J$+$C$?$N$G$$$8$C$F$
$-$^$7$?!#e(B

e$B$"$j$,$H$&$4$6$$$^$9!#e(B
e$B@h$[$Ie(Bcie$B$7$^$7$?!#e(B

e$B5-21$,$"$d$7$$$s$G$9$,!"e(B
timeoute$B$K$f$H$j$,$J$$$N$Oe(BMockClocke$B$8$c$J$+$C$?$H$-$Ne(B
e$BL>;D$j$+$b$7$l$^$;$s!#e(B

e$B%^%8%a$K=$@5$9$k$J$i$*$=$i$/e(B MockClock e$B$re(B
deterministic e$B$J7A$K=q$-D>$9$Y$-$J$N$+$J!“e(B
e$B$H;W$$$^$9$,3N?.$O$”$j$^$;$s!#e(B

e$B$=$&;W$$$^$9!#e(B
e$B$G$b6qBNE*$K$I$&$7$?$i$h$$$+;W$$$D$+$J$$$s$G$9$h$M!#e(B