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

ruby-changes:12497

From: usa <ko1@a...>
Date: Sun, 19 Jul 2009 09:48:58 +0900 (JST)
Subject: [ruby-changes:12497] Ruby:r24199 (trunk): * test_socket.rb (test_udp_server): cannot check the existance of sendmsg by

usa	2009-07-19 09:48:40 +0900 (Sun, 19 Jul 2009)

  New Revision: 24199

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

  Log:
    * test_socket.rb (test_udp_server): cannot check the existance of sendmsg by
      respond_to?.

  Modified files:
    trunk/test/socket/test_socket.rb

Index: test/socket/test_socket.rb
===================================================================
--- test/socket/test_socket.rb	(revision 24198)
+++ test/socket/test_socket.rb	(revision 24199)
@@ -261,10 +261,10 @@
     end
 
     Socket.udp_server_sockets(0) {|sockets|
-      skip "need sendmsg and recvmsg" unless sockets[0].respond_to?(:sendmsg)
       famlies = {}
       sockets.each {|s| famlies[s.local_address.afamily] = true }
       ip_addrs.reject! {|ai| !famlies[ai.afamily] }
+      skipped = false
       begin
         port = sockets.first.local_address.ip_port
 
@@ -289,13 +289,20 @@
             assert_equal(ai.ip_address, addr.ip_address)
           }
         }
+      rescue NotImplementedError
+        skipped = true
+        skip "need sendmsg and recvmsg"
       ensure
         if th
-          Addrinfo.udp("127.0.0.1", port).connect {|s| s.sendmsg "exit" }
-          unless th.join(10)
-            Thread.kill th
-            th.join(10)
-            raise "thread killed"
+          if skipped
+            Thread.kill th unless th.join(10)
+          else
+            Addrinfo.udp("127.0.0.1", port).connect {|s| s.sendmsg "exit" }
+            unless th.join(10)
+              Thread.kill th
+              th.join(10)
+              raise "thread killed"
+            end
           end
         end
       end

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

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