kgio RubyGem user+dev discussion/patches/pulls/bugs/help
 help / color / mirror / code / Atom feed
* kgio test_signal_close failed
@ 2012-03-04 16:12 375gnu
  2012-03-04 19:17 ` Eric Wong
  0 siblings, 1 reply; 9+ messages in thread
From: 375gnu @ 2012-03-04 16:12 UTC (permalink / raw)
  To: kgio

Sometimes test_signal_close from test_poll.rb fails. Not every time, and only
with ruby1.9 (1.9.3.0 is my current version). With ruby 1.8.7 it's passed.

There is an output:

Failure: <IOError> exception expected but none was thrown.
test_signal_close(TestPoll)
/home/globus/work/pkg-ruby-extras/build-area/ruby-kgio-2.7.2/test/test_poll.rb:61:in
`test_signal_close'
    58:     res = nil
    59:     thr = Thread.new { sleep 0.100; Process.kill(:USR1, $$) }
    60:     t0 = Time.now
 => 61:     assert_raises(IOError) { Kgio.poll({@rd => Kgio::POLLIN}) }
    62:     diff = Time.now - t0
    63:     thr.join
    64:     assert diff >= 0.010, "diff=#{diff}"

-- 
https://375gnu.wordpress.com/
https://launchpad.net/~375gnu/+archive/ppa


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: kgio test_signal_close failed
  2012-03-04 16:12 kgio test_signal_close failed 375gnu
@ 2012-03-04 19:17 ` Eric Wong
  2012-03-05 18:56   ` 375gnu
  0 siblings, 1 reply; 9+ messages in thread
From: Eric Wong @ 2012-03-04 19:17 UTC (permalink / raw)
  To: kgio

375gnu <375gnu@gmail.com> wrote:
> Sometimes test_signal_close from test_poll.rb fails. Not every time, and only
> with ruby1.9 (1.9.3.0 is my current version). With ruby 1.8.7 it's passed.

Is this also on Debian/kfreebsd?  I have a VM for that lying around
somewhere, will investigate as I find time.

> There is an output:
> 
> Failure: <IOError> exception expected but none was thrown.
> test_signal_close(TestPoll)
> /home/globus/work/pkg-ruby-extras/build-area/ruby-kgio-2.7.2/test/test_poll.rb:61:in
> `test_signal_close'
>     58:     res = nil
>     59:     thr = Thread.new { sleep 0.100; Process.kill(:USR1, $$) }

Does increasing the sleep time there help?  It's a potential race
condition :/

>     60:     t0 = Time.now
>  => 61:     assert_raises(IOError) { Kgio.poll({@rd => Kgio::POLLIN}) }
>     62:     diff = Time.now - t0
>     63:     thr.join
>     64:     assert diff >= 0.010, "diff=#{diff}"


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: kgio test_signal_close failed
  2012-03-04 19:17 ` Eric Wong
@ 2012-03-05 18:56   ` 375gnu
  2012-03-05 22:30     ` Eric Wong
  0 siblings, 1 reply; 9+ messages in thread
From: 375gnu @ 2012-03-05 18:56 UTC (permalink / raw)
  To: kgio

On 3/4/12, Eric Wong <normalperson@yhbt.net> wrote:
> 375gnu <375gnu@gmail.com> wrote:
>> Sometimes test_signal_close from test_poll.rb fails. Not every time, and
>> only
>> with ruby1.9 (1.9.3.0 is my current version). With ruby 1.8.7 it's passed.
> Is this also on Debian/kfreebsd?

Not (0 of 25 times). But it runs in kvm, so it's much slower than real linux
box (110 sec for all tests vs. 75).

>>     59:     thr = Thread.new { sleep 0.100; Process.kill(:USR1, $$) }
>
> Does increasing the sleep time there help?  It's a potential race
> condition :/


No, even with "sleep 2" (1 of 10 is failed)

-- 
https://375gnu.wordpress.com/
https://launchpad.net/~375gnu/+archive/ppa


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: kgio test_signal_close failed
  2012-03-05 18:56   ` 375gnu
@ 2012-03-05 22:30     ` Eric Wong
  2012-03-06 16:34       ` 375gnu
  0 siblings, 1 reply; 9+ messages in thread
From: Eric Wong @ 2012-03-05 22:30 UTC (permalink / raw)
  To: kgio

375gnu <375gnu@gmail.com> wrote:
> On 3/4/12, Eric Wong <normalperson@yhbt.net> wrote:
> > 375gnu <375gnu@gmail.com> wrote:
> >> Sometimes test_signal_close from test_poll.rb fails. Not every time, and
> >> only
> >> with ruby1.9 (1.9.3.0 is my current version). With ruby 1.8.7 it's passed.
> > Is this also on Debian/kfreebsd?
> 
> Not (0 of 25 times). But it runs in kvm, so it's much slower than real linux
> box (110 sec for all tests vs. 75).

Odd, I can't reproduce under kvm (Debian wheezy + custom 3.3.0-rc4
kernel).  Are you on 2.6.38 kernel by any chance?  Some versions of that
had weird signal issues.

Also, this test is just skipped under Matz Ruby 1.8 (can't safely
support poll() w/o native threads + GVL release).

> >>     59:     thr = Thread.new { sleep 0.100; Process.kill(:USR1, $$) }
> >
> > Does increasing the sleep time there help?  It's a potential race
> > condition :/
> 
> No, even with "sleep 2" (1 of 10 is failed)

Perhaps this makes the test less bad?

diff --git a/test/test_poll.rb b/test/test_poll.rb
index ba0e561..df59354 100644
--- a/test/test_poll.rb
+++ b/test/test_poll.rb
@@ -58,7 +58,10 @@ class TestPoll < Test::Unit::TestCase
     res = nil
     thr = Thread.new { sleep 0.100; Process.kill(:USR1, $$) }
     t0 = Time.now
-    assert_raises(IOError) { Kgio.poll({@rd => Kgio::POLLIN}) }
+    assert_raises(IOError) do
+      result = Kgio.poll({@rd => Kgio::POLLIN})
+      result.each_key { |io| io.read_nonblock(1) }
+    end
     diff = Time.now - t0
     thr.join
     assert diff >= 0.010, "diff=#{diff}"


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* Re: kgio test_signal_close failed
  2012-03-05 22:30     ` Eric Wong
@ 2012-03-06 16:34       ` 375gnu
  2012-03-07  9:17         ` Eric Wong
  0 siblings, 1 reply; 9+ messages in thread
From: 375gnu @ 2012-03-06 16:34 UTC (permalink / raw)
  To: kgio

On 3/6/12, Eric Wong <normalperson@yhbt.net> wrote:
> Odd, I can't reproduce under kvm (Debian wheezy + custom 3.3.0-rc4
> kernel).  Are you on 2.6.38 kernel by any chance?  Some versions of that
> had weird signal issues.

No, I'm using kernel 3.2.*

> Perhaps this makes the test less bad?
> -    assert_raises(IOError) { Kgio.poll({@rd => Kgio::POLLIN}) }
> +    assert_raises(IOError) do
> +      result = Kgio.poll({@rd => Kgio::POLLIN})
> +      result.each_key { |io| io.read_nonblock(1) }
> +    end

Yes! It works! I've run test 50 times and everyone's passed!


-- 
https://375gnu.wordpress.com/
https://launchpad.net/~375gnu/+archive/ppa


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: kgio test_signal_close failed
  2012-03-06 16:34       ` 375gnu
@ 2012-03-07  9:17         ` Eric Wong
  2012-03-07  9:51           ` Iñaki Baz Castillo
  0 siblings, 1 reply; 9+ messages in thread
From: Eric Wong @ 2012-03-07  9:17 UTC (permalink / raw)
  To: kgio

375gnu <375gnu@gmail.com> wrote:
> Yes! It works! I've run test 50 times and everyone's passed!

Awesome, thanks for the confirmation.  Anything else?

I'm hoping out 2.7.3 before the end of the week.


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: kgio test_signal_close failed
  2012-03-07  9:17         ` Eric Wong
@ 2012-03-07  9:51           ` Iñaki Baz Castillo
  2012-03-07 10:16             ` Eric Wong
  0 siblings, 1 reply; 9+ messages in thread
From: Iñaki Baz Castillo @ 2012-03-07  9:51 UTC (permalink / raw)
  To: kgio

2012/3/7 Eric Wong <normalperson@yhbt.net>:
>> Yes! It works! I've run test 50 times and everyone's passed!
>
> Awesome, thanks for the confirmation.  Anything else?
>
> I'm hoping out 2.7.3 before the end of the week.

Hi Eric, how to test the test files? "rake test" does nothing.

-- 
Iñaki Baz Castillo
<ibc@aliax.net>

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: kgio test_signal_close failed
  2012-03-07  9:51           ` Iñaki Baz Castillo
@ 2012-03-07 10:16             ` Eric Wong
  2012-03-07 10:23               ` Iñaki Baz Castillo
  0 siblings, 1 reply; 9+ messages in thread
From: Eric Wong @ 2012-03-07 10:16 UTC (permalink / raw)
  To: kgio

Iñaki Baz Castillo <ibc@aliax.net> wrote:
> Hi Eric, how to test the test files? "rake test" does nothing.

GNU make.  I just pushed the following out:

Thanks for testing :>

From 2c2befb1caa47fe3bf2e6d31dd0733956d178c87 Mon Sep 17 00:00:00 2001
From: Eric Wong <normalperson@yhbt.net>
Date: Wed, 7 Mar 2012 10:14:17 +0000
Subject: [PATCH] HACKING: add instructions for running tests

Unlike most Rubyists, I prefer GNU make to Rake.
---
 HACKING |   15 +++++++++++++++
 1 file changed, 15 insertions(+)

diff --git a/HACKING b/HACKING
index 004bcbb..5d485be 100644
--- a/HACKING
+++ b/HACKING
@@ -61,3 +61,18 @@ Without RubyGems (via setup.rb):
 
 It is not at all recommended to mix a RubyGems installation with an
 installation done without RubyGems, however.
+
+=== Tests
+
+We use GNU make to run tests in parallel.  test/unit/parallel didn't
+exist for old versions of Ruby before 1.9.3.  Users of GNU-based systems
+(such as GNU/Linux) usually have GNU make installed as "make" instead of
+"gmake".
+
+Running the entire test suite with 4 tests in parallel:
+
+  gmake -j4 test
+
+Running just one unit test:
+
+  gmake test/test_poll.rb

^ permalink raw reply related	[flat|nested] 9+ messages in thread

* Re: kgio test_signal_close failed
  2012-03-07 10:16             ` Eric Wong
@ 2012-03-07 10:23               ` Iñaki Baz Castillo
  0 siblings, 0 replies; 9+ messages in thread
From: Iñaki Baz Castillo @ 2012-03-07 10:23 UTC (permalink / raw)
  To: kgio

2012/3/7 Eric Wong <normalperson@yhbt.net>:
> Iñaki Baz Castillo <ibc@aliax.net> wrote:
>> Hi Eric, how to test the test files? "rake test" does nothing.
>
> GNU make.  I just pushed the following out:
>
> Thanks for testing :>

No errors:

- Ubuntu 3.0.0-15-generic 64 bits
- Ruby 1.9.2p290

-- 
Iñaki Baz Castillo
<ibc@aliax.net>

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2012-03-07 10:24 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-03-04 16:12 kgio test_signal_close failed 375gnu
2012-03-04 19:17 ` Eric Wong
2012-03-05 18:56   ` 375gnu
2012-03-05 22:30     ` Eric Wong
2012-03-06 16:34       ` 375gnu
2012-03-07  9:17         ` Eric Wong
2012-03-07  9:51           ` Iñaki Baz Castillo
2012-03-07 10:16             ` Eric Wong
2012-03-07 10:23               ` Iñaki Baz Castillo

Code repositories for project(s) associated with this public inbox

	https://yhbt.net/kgio.git/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).