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  4% 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 4%]

* Re: [PATCH] Create own directory for every unix socket in unit tests
  2013-09-04 12:07  4% [PATCH] Create own directory for every unix socket in unit tests Hleb Valoshka
@ 2013-09-04 17:33  7% ` Eric Wong
  0 siblings, 0 replies; 3+ results
From: Eric Wong @ 2013-09-04 17:33 UTC (permalink / raw)
  To: kgio

Thanks, pushed out to master on git://bogomips.org/kgio.git

I amended the commit message slightly (I always try to document
the reasoning behind all commits):


[ew: this avoids a TOCTOU issue for multiple test invocations]

Signed-off-by: Eric Wong <normalperson@yhbt.net>


^ permalink raw reply	[relevance 7%]

* [PATCH] Create own directory for every unix socket in unit tests
@ 2013-09-04 12:07  4% Hleb Valoshka
  2013-09-04 17:33  7% ` Eric Wong
  0 siblings, 1 reply; 3+ results
From: Hleb Valoshka @ 2013-09-04 12:07 UTC (permalink / raw)
  To: kgio

---
 test/lib_read_write.rb                     |    2 ++
 test/lib_server_accept.rb                  |    2 ++
 test/test_unix_client_read_server_write.rb |    4 +++-
 test/test_unix_connect.rb                  |    5 ++++-
 test/test_unix_server.rb                   |    4 +++-
 test/test_unix_server_read_client_write.rb |    4 +++-
 6 files changed, 17 insertions(+), 4 deletions(-)

diff --git a/test/lib_read_write.rb b/test/lib_read_write.rb
index 5034db8..cac87b7 100644
--- a/test/lib_read_write.rb
+++ b/test/lib_read_write.rb
@@ -2,6 +2,7 @@
 require 'test/unit'
 require 'io/nonblock'
 require 'digest/sha1'
+require 'fileutils'
 $-w = true
 require 'kgio'
 
@@ -11,6 +12,7 @@ module LibReadWriteTest
   def teardown
     @rd.close if defined?(@rd) && ! @rd.closed?
     @wr.close if defined?(@wr) && ! @wr.closed?
+    FileUtils.remove_entry_secure(@tmpdir) if defined?(@tmpdir)
   end
 
   def test_write_empty
diff --git a/test/lib_server_accept.rb b/test/lib_server_accept.rb
index ff0f733..db0d120 100644
--- a/test/lib_server_accept.rb
+++ b/test/lib_server_accept.rb
@@ -1,6 +1,7 @@
 require 'test/unit'
 require 'fcntl'
 require 'io/nonblock'
+require 'fileutils'
 $-w = true
 require 'kgio'
 
@@ -8,6 +9,7 @@ module LibServerAccept
 
   def teardown
     @srv.close unless @srv.closed?
+    FileUtils.remove_entry_secure(@tmpdir) if defined?(@tmpdir)
     Kgio.accept_cloexec = true
     Kgio.accept_nonblock = false
   end
diff --git a/test/test_unix_client_read_server_write.rb b/test/test_unix_client_read_server_write.rb
index f5d481a..2f2b7b9 100644
--- a/test/test_unix_client_read_server_write.rb
+++ b/test/test_unix_client_read_server_write.rb
@@ -1,9 +1,11 @@
 require './test/lib_read_write'
 require 'tempfile'
+require 'tmpdir'
 
 class TestUnixClientReadServerWrite < Test::Unit::TestCase
   def setup
-    tmp = Tempfile.new('kgio_unix_0')
+    @tmpdir = Dir.mktmpdir('kgio_unix_0')
+    tmp = Tempfile.new('kgio_unix_0', @tmpdir)
     @path = tmp.path
     File.unlink(@path)
     tmp.close rescue nil
diff --git a/test/test_unix_connect.rb b/test/test_unix_connect.rb
index 007f422..60cb8c0 100644
--- a/test/test_unix_connect.rb
+++ b/test/test_unix_connect.rb
@@ -3,6 +3,7 @@ require 'io/nonblock'
 $-w = true
 require 'kgio'
 require 'tempfile'
+require 'tmpdir'
 
 class SubSocket < Kgio::Socket
   attr_accessor :foo
@@ -14,7 +15,8 @@ end
 class TestKgioUnixConnect < Test::Unit::TestCase
 
   def setup
-    tmp = Tempfile.new('kgio_unix_1')
+    @tmpdir = Dir.mktmpdir('kgio_unix_1')
+    tmp = Tempfile.new('kgio_unix_1', @tmpdir)
     @path = tmp.path
     File.unlink(@path)
     tmp.close rescue nil
@@ -25,6 +27,7 @@ class TestKgioUnixConnect < Test::Unit::TestCase
   def teardown
     @srv.close unless @srv.closed?
     File.unlink(@path)
+    FileUtils.remove_entry_secure(@tmpdir)
     Kgio.accept_cloexec = true
   end
 
diff --git a/test/test_unix_server.rb b/test/test_unix_server.rb
index b15d9ec..02e4d8d 100644
--- a/test/test_unix_server.rb
+++ b/test/test_unix_server.rb
@@ -1,10 +1,12 @@
 require 'tempfile'
+require 'tmpdir'
 require './test/lib_server_accept'
 
 class TestKgioUNIXServer < Test::Unit::TestCase
 
   def setup
-    tmp = Tempfile.new('kgio_unix_2')
+    @tmpdir = Dir.mktmpdir('kgio_unix_2')
+    tmp = Tempfile.new('kgio_unix_2', @tmpdir)
     @path = tmp.path
     File.unlink(@path)
     tmp.close rescue nil
diff --git a/test/test_unix_server_read_client_write.rb b/test/test_unix_server_read_client_write.rb
index 0f57bfe..a994e01 100644
--- a/test/test_unix_server_read_client_write.rb
+++ b/test/test_unix_server_read_client_write.rb
@@ -1,9 +1,11 @@
 require './test/lib_read_write'
 require 'tempfile'
+require 'tmpdir'
 
 class TestUnixServerReadClientWrite < Test::Unit::TestCase
   def setup
-    tmp = Tempfile.new('kgio_unix_3')
+    @tmpdir = Dir.mktmpdir('kgio_unix_3')
+    tmp = Tempfile.new('kgio_unix_3', @tmpdir)
     @path = tmp.path
     File.unlink(@path)
     tmp.close rescue nil
-- 
1.7.10.4



^ permalink raw reply related	[relevance 4%]

Results 1-3 of 3 | reverse | options above
-- pct% links below jump to the message on this page, permalinks otherwise --
2013-09-04 12:07  4% [PATCH] Create own directory for every unix socket in unit tests Hleb Valoshka
2013-09-04 17:33  7% ` Eric Wong
2013-09-11  0:29  4% [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).