[前][次][番号順一覧][スレッド一覧]

ruby-changes:16180

From: nobu <ko1@a...>
Date: Thu, 3 Jun 2010 13:05:43 +0900 (JST)
Subject: [ruby-changes:16180] Ruby:r28143 (trunk, ruby_1_9_2): * test/io/nonblock/test_flush.rb (test_flush): try pipe and

nobu	2010-06-03 13:05:20 +0900 (Thu, 03 Jun 2010)

  New Revision: 28143

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=28143

  Log:
    * test/io/nonblock/test_flush.rb (test_flush): try pipe and
      socketpair.  [ruby-dev:41517]

  Modified files:
    branches/ruby_1_9_2/ChangeLog
    branches/ruby_1_9_2/test/io/nonblock/test_flush.rb
    trunk/ChangeLog
    trunk/test/io/nonblock/test_flush.rb

Index: ChangeLog
===================================================================
--- ChangeLog	(revision 28142)
+++ ChangeLog	(revision 28143)
@@ -1,3 +1,8 @@
+Thu Jun  3 13:05:15 2010  Nobuyoshi Nakada  <nobu@r...>
+
+	* test/io/nonblock/test_flush.rb (test_flush): try pipe and
+	  socketpair.  [ruby-dev:41517]
+
 Thu Jun  3 09:36:43 2010  NAKAMURA Usaku  <usa@r...>
 
 	* ext/dl/dl.h (DLSTACK_TYPE): type of stack is same as VALUE.
Index: test/io/nonblock/test_flush.rb
===================================================================
--- test/io/nonblock/test_flush.rb	(revision 28142)
+++ test/io/nonblock/test_flush.rb	(revision 28143)
@@ -7,8 +7,17 @@
 
 class TestIONonblock < Test::Unit::TestCase
   def test_flush
-    r,w = IO.pipe
-    w.nonblock = true
+    flush_test(*IO.pipe) or
+      (require 'socket'; flush_test(*Socket.pair(:INET, :STREAM))) or
+      skip "nonblocking IO did not work"
+  end
+
+  def flush_test(r, w)
+    begin
+      w.nonblock = true
+    rescue Errno::EBADF
+      return false
+    end
     w.sync = false
     w << "b"
     w.flush
Index: ruby_1_9_2/ChangeLog
===================================================================
--- ruby_1_9_2/ChangeLog	(revision 28142)
+++ ruby_1_9_2/ChangeLog	(revision 28143)
@@ -1,3 +1,8 @@
+Thu Jun  3 13:05:15 2010  Nobuyoshi Nakada  <nobu@r...>
+
+	* test/io/nonblock/test_flush.rb (test_flush): try pipe and
+	  socketpair.  [ruby-dev:41517]
+
 Thu Jun  3 09:39:54 2010  NAKAMURA Usaku  <usa@r...>
 
 	* ext/dl/dl.h (DLSTACK_TYPE): type of stack is same as VALUE.
Index: ruby_1_9_2/test/io/nonblock/test_flush.rb
===================================================================
--- ruby_1_9_2/test/io/nonblock/test_flush.rb	(revision 28142)
+++ ruby_1_9_2/test/io/nonblock/test_flush.rb	(revision 28143)
@@ -7,8 +7,17 @@
 
 class TestIONonblock < Test::Unit::TestCase
   def test_flush
-    r,w = IO.pipe
-    w.nonblock = true
+    flush_test(*IO.pipe) or
+      (require 'socket'; flush_test(*Socket.pair(:INET, :STREAM))) or
+      skip "nonblocking IO did not work"
+  end
+
+  def flush_test(r, w)
+    begin
+      w.nonblock = true
+    rescue Errno::EBADF
+      return false
+    end
     w.sync = false
     w << "b"
     w.flush

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]