librelist archives

« back to archive

[PATCH 0/3] test fixes for GNU/kFreeBSD (and possibly other *BSDs)

[PATCH 0/3] test fixes for GNU/kFreeBSD (and possibly other *BSDs)

From:
Eric Wong
Date:
2012-07-11 @ 22:34
Pushed to "master" of git://bogomips.org/kgio
(commit f020550fc802f299fdcdec695ac80d53ef3d24d9)

     1	test_poll: skip signal torture on Debian GNU/kfreebsd
     2	test/lib_read_write: wait for readability before tryread
     3	test workaround for platforms with unreliable signals

 test/lib_read_write.rb    | 1 +
 test/lib_server_accept.rb | 8 ++++----
 test/test_poll.rb         | 8 +++-----
 3 files changed, 8 insertions(+), 9 deletions(-)

[PATCH 1/3] test_poll: skip signal torture on Debian GNU/kfreebsd

From:
Eric Wong
Date:
2012-07-11 @ 22:34
From: Eric Wong <ew@debkfreebsd.(none)>

This cascades test failures on a platform with questionable
signal/fork handling.

Tested on: Debian GNU/kFreeBSD 6.0
---
 test/test_poll.rb |    8 +++-----
 1 files changed, 3 insertions(+), 5 deletions(-)

diff --git a/test/test_poll.rb b/test/test_poll.rb
index 40092cf..3aa8c1f 100644
--- a/test/test_poll.rb
+++ b/test/test_poll.rb
@@ -126,9 +126,7 @@ class TestPoll < Test::Unit::TestCase
     _, status = Process.waitpid2(pid)
     assert status.success?, status.inspect
     assert usr1 > 0, "usr1: #{usr1}"
-    rescue Object => err
-      p [ :err, err ]
-    ensure
-      trap(:USR1, "DEFAULT")
-  end
+  ensure
+    trap(:USR1, "DEFAULT")
+  end unless RUBY_PLATFORM =~ /kfreebsd-gnu/
 end if Kgio.respond_to?(:poll)
-- 
1.7.2.5

[PATCH 2/3] test/lib_read_write: wait for readability before tryread

From:
Eric Wong
Date:
2012-07-11 @ 22:34
From: Eric Wong <ew@debkfreebsd.(none)>

On FreeBSD, writing to a loopback TCP socket does not guarantee
immediate readability on the other end.

Tested on Debian GNU/kFreeBSD 6.0
---
 test/lib_read_write.rb |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/test/lib_read_write.rb b/test/lib_read_write.rb
index 04d6fc6..586e826 100644
--- a/test/lib_read_write.rb
+++ b/test/lib_read_write.rb
@@ -242,6 +242,7 @@ module LibReadWriteTest
 
   def test_tryread_too_much
     assert_equal nil, @wr.kgio_trywrite("hi")
+    assert_equal @rd, @rd.kgio_wait_readable
     assert_equal "hi", @rd.kgio_tryread(4)
   end
 
-- 
1.7.2.5

[PATCH 3/3] test workaround for platforms with unreliable signals

From:
Eric Wong
Date:
2012-07-11 @ 22:34
From: Eric Wong <ew@debkfreebsd.(none)>

Ruby may not respond well to signals on all platforms, especially not
after fork()-ing in the face of a running pthread (timer thread on
1.9.2).  SIGKILL bypasses Ruby (and all userspace) signal handling on
Debian GNU/kFreeBSD.
---
 test/lib_server_accept.rb |    8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/test/lib_server_accept.rb b/test/lib_server_accept.rb
index ccf89d8..ff0f733 100644
--- a/test/lib_server_accept.rb
+++ b/test/lib_server_accept.rb
@@ -47,7 +47,7 @@ module LibServerAccept
     elapsed = Time.now - t0
     assert_kind_of Kgio::Socket, b
     assert_equal @host, b.kgio_addr
-    Process.kill(:TERM, pid)
+    Process.kill(:KILL, pid)
     Process.waitpid(pid)
     assert elapsed >= 1, "elapsed: #{elapsed}"
   end
@@ -60,7 +60,7 @@ module LibServerAccept
     elapsed = Time.now - t0
     assert_kind_of Kgio::Socket, b
     assert_equal @host, b.kgio_addr
-    Process.kill(:TERM, pid)
+    Process.kill(:KILL, pid)
     Process.waitpid(pid)
     assert elapsed >= 1, "elapsed: #{elapsed}"
 
@@ -70,7 +70,7 @@ module LibServerAccept
     elapsed = Time.now - t0
     assert_kind_of Kgio::Socket, b
     assert_equal @host, b.kgio_addr
-    Process.kill(:TERM, pid)
+    Process.kill(:KILL, pid)
     Process.waitpid(pid)
     assert elapsed >= 6, "elapsed: #{elapsed}"
 
@@ -80,7 +80,7 @@ module LibServerAccept
     elapsed = Time.now - t0
     assert_kind_of Kgio::Socket, b
     assert_equal @host, b.kgio_addr
-    Process.kill(:TERM, pid)
+    Process.kill(:KILL, pid)
     Process.waitpid(pid)
     assert elapsed >= 1, "elapsed: #{elapsed}"
   end
-- 
1.7.2.5