kgio RubyGem user+dev discussion/patches/pulls/bugs/help
 help / color / mirror / code / Atom feed
Search results ordered by [date|relevance]  view[summary|nested|Atom feed]
thread overview below | download mbox.gz: |
* [ANN] kgio 2.8.1 - minor improvements and test fixes
@ 2013-09-11  0:29  6% Eric Wong
  0 siblings, 0 replies; 3+ results
From: Eric Wong @ 2013-09-11  0:29 UTC (permalink / raw)
  To: kgio

Changes:

Improved error reporting for kgio_accept/kgio_tryaccept.
Minor size reduction throughout.  There are also several
test case fixes for race conditions.

Thanks to Hleb Valoshka and the Debian project for all the
help with this release!

Eric Wong (7):
      check syscall returns against < 0 instead of == -1
      accept: more informative exception on unknown family
      test_tryopen: skip EACCES test when euid == 0
      test/lib_read_write: account for larger-than-normal pipes
      test_poll: avoid potentially thread-unsafe test
      test_poll: preserve original trap(:USR1) handler
      test_poll: be less dependent on signal handler ordering

Hleb Valoshka (4):
      Change prefix of temporary sockets to prevent races
      Don't dump 20M in case of failure
      Create own directory for every unix socket in unit tests
      Close tempfile and unlink it immediately.

* http://bogomips.org/kgio/
* kgio@librelist.org
* git://bogomips.org/kgio.git
* http://bogomips.org/kgio/NEWS.atom.xml


^ permalink raw reply	[relevance 6%]

* test fixes pushed to master on kgio.git
@ 2013-09-04  0:12  6% Eric Wong
  0 siblings, 0 replies; 3+ results
From: Eric Wong @ 2013-09-04  0:12 UTC (permalink / raw)
  To: kgio

All should be pretty obvious, full diff below:

Eric Wong (4):
      test_tryopen: skip EACCES test when euid == 0
      test/lib_read_write: account for larger-than-normal pipes
      test_poll: avoid potentially thread-unsafe test
      test_poll: preserve original trap(:USR1) handler

 test/lib_read_write.rb | 10 ++++++----
 test/test_poll.rb      | 10 ++++++----
 test/test_tryopen.rb   |  7 ++++++-
 3 files changed, 18 insertions(+), 9 deletions(-)

diff --git a/test/lib_read_write.rb b/test/lib_read_write.rb
index 7df9a79..5034db8 100644
--- a/test/lib_read_write.rb
+++ b/test/lib_read_write.rb
@@ -456,10 +456,12 @@ def test_trywrite_wait_readable_method
     def @wr.kgio_wait_writable
       raise "Hello"
     end
-    tmp = []
-    buf = "." * 1024
-    10000.times { tmp << @wr.kgio_trywrite(buf) }
-    assert_equal :wait_writable, tmp.pop
+    buf = "." * 4096
+    rv = nil
+    until rv == :wait_writable
+      rv = @wr.kgio_trywrite(buf)
+    end
+    assert_equal :wait_writable, rv
   end
 
   def test_wait_writable_method
diff --git a/test/test_poll.rb b/test/test_poll.rb
index 3aa8c1f..5bfc70b 100644
--- a/test/test_poll.rb
+++ b/test/test_poll.rb
@@ -89,11 +89,13 @@ def test_poll_EINTR
 
   def test_poll_EINTR_changed
     ok = false
-    orig = trap(:USR1) { ok = true }
     pollset = { @rd => Kgio::POLLIN }
+    orig = trap(:USR1) do
+      pollset[@wr] = Kgio::POLLOUT
+      ok = true
+    end
     thr = Thread.new do
       sleep 0.100
-      pollset[@wr] = Kgio::POLLOUT
       Process.kill(:USR1, $$)
     end
     t0 = Time.now
@@ -112,7 +114,7 @@ def test_poll_signal_torture
     empty = 0
     nr = 100
     set = { @rd => Kgio::POLLIN }
-    trap(:USR1) { usr1 += 1 }
+    orig = trap(:USR1) { usr1 += 1 }
     pid = fork do
       trap(:USR1, "DEFAULT")
       sleep 0.1
@@ -127,6 +129,6 @@ def test_poll_signal_torture
     assert status.success?, status.inspect
     assert usr1 > 0, "usr1: #{usr1}"
   ensure
-    trap(:USR1, "DEFAULT")
+    trap(:USR1, orig)
   end unless RUBY_PLATFORM =~ /kfreebsd-gnu/
 end if Kgio.respond_to?(:poll)
diff --git a/test/test_tryopen.rb b/test/test_tryopen.rb
index 8a8278c..abcbd37 100644
--- a/test/test_tryopen.rb
+++ b/test/test_tryopen.rb
@@ -30,7 +30,12 @@ def test_tryopen_EACCES
     tmp = Tempfile.new "tryopen"
     File.chmod 0000, tmp.path
     tmp = Kgio::File.tryopen(tmp.path)
-    assert_equal(:EACCES, tmp)
+    if Process.euid == 0
+      assert_kind_of Kgio::File, tmp
+      warn "cannot test EACCES when euid == 0"
+    else
+      assert_equal(:EACCES, tmp)
+    end
   end
 
   def test_tryopen_readwrite
-- 
Eric Wong


^ permalink raw reply related	[relevance 6%]

* Re: Concurrency issue in TestKgioUnixConnect?
  @ 2013-09-03 20:05  7%           ` Eric Wong
  0 siblings, 0 replies; 3+ results
From: Eric Wong @ 2013-09-03 20:05 UTC (permalink / raw)
  To: kgio

Hleb Valoshka <375gnu@gmail.com> wrote:
> On 9/3/13, Eric Wong <normalperson@yhbt.net> wrote:
> > I haven't looked closely at your fakeroot workaround.
> 
> It's a Debian specific patch.

Its problematic when run as root, too (which may affect some
folks).  I'll push out the following:

Subject: [PATCH] test_tryopen: skip EACCES test when euid == 0

This fails when the test is run as root (which may be the case
of some Ruby installations) or fakeroot (which is the case of
Debian build systems).
---
 test/test_tryopen.rb | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/test/test_tryopen.rb b/test/test_tryopen.rb
index 8a8278c..abcbd37 100644
--- a/test/test_tryopen.rb
+++ b/test/test_tryopen.rb
@@ -30,7 +30,12 @@ def test_tryopen_EACCES
     tmp = Tempfile.new "tryopen"
     File.chmod 0000, tmp.path
     tmp = Kgio::File.tryopen(tmp.path)
-    assert_equal(:EACCES, tmp)
+    if Process.euid == 0
+      assert_kind_of Kgio::File, tmp
+      warn "cannot test EACCES when euid == 0"
+    else
+      assert_equal(:EACCES, tmp)
+    end
   end
 
   def test_tryopen_readwrite
-- 
Eric Wong


^ permalink raw reply related	[relevance 7%]

Results 1-3 of 3 | reverse | options above
-- pct% links below jump to the message on this page, permalinks otherwise --
2013-09-01 14:03     Concurrency issue in TestKgioUnixConnect? Jérémy Bobbio
2013-09-01 16:57     ` Hleb Valoshka
2013-09-01 19:58       ` Eric Wong
2013-09-02 12:57         ` Hleb Valoshka
2013-09-02 21:24           ` Eric Wong
2013-09-03  8:50             ` Hleb Valoshka
2013-09-03 20:05  7%           ` Eric Wong
2013-09-04  0:12  6% test fixes pushed to master on kgio.git Eric Wong
2013-09-11  0:29  6% [ANN] kgio 2.8.1 - minor improvements and test fixes Eric Wong

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).