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

ruby-changes:29550

From: shirosaki <ko1@a...>
Date: Mon, 24 Jun 2013 22:39:31 +0900 (JST)
Subject: [ruby-changes:29550] shirosaki:r41602 (trunk): test_rinda.rb: fix for unimplemented ifindex()

shirosaki	2013-06-24 22:39:17 +0900 (Mon, 24 Jun 2013)

  New Revision: 41602

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

  Log:
    test_rinda.rb: fix for unimplemented ifindex()
    
    * test/rinda/test_rinda.rb (RingIPv6#prepare_ipv6):
      ifindex() function may not be implemented on Windows. We use another
      check for the case.

  Modified files:
    trunk/ChangeLog
    trunk/test/rinda/test_rinda.rb

Index: ChangeLog
===================================================================
--- ChangeLog	(revision 41601)
+++ ChangeLog	(revision 41602)
@@ -1,3 +1,9 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1
+Mon Jun 24 22:26:31 2013  Hiroshi Shirosaki  <h.shirosaki@g...>
+
+	* test/rinda/test_rinda.rb (RingIPv6#prepare_ipv6):
+	  ifindex() function may not be implemented on Windows. We use another
+	  check for the case.
+
 Mon Jun 24 22:11:37 2013  Hiroshi Shirosaki  <h.shirosaki@g...>
 
 	* test/gdbm/test_gdbm.rb (TestGDBM#test_s_open_nolock):
Index: test/rinda/test_rinda.rb
===================================================================
--- test/rinda/test_rinda.rb	(revision 41601)
+++ test/rinda/test_rinda.rb	(revision 41602)
@@ -527,12 +527,18 @@ end https://github.com/ruby/ruby/blob/trunk/test/rinda/test_rinda.rb#L527
 
 module RingIPv6
   def prepare_ipv6(r)
-    Socket.getifaddrs.each do |ifaddr|
-      next unless ifaddr.addr
-      next unless ifaddr.addr.ipv6_linklocal?
-      next if ifaddr.name[0, 2] == "lo"
-      r.multicast_interface = ifaddr.ifindex
-      return
+    begin
+      Socket.getifaddrs.each do |ifaddr|
+        next unless ifaddr.addr
+        next unless ifaddr.addr.ipv6_linklocal?
+        next if ifaddr.name[0, 2] == "lo"
+        r.multicast_interface = ifaddr.ifindex
+        return
+      end
+    rescue NotImplementedError
+      # ifindex() function may not be implemented on Windows.
+      return if
+        Socket.ip_address_list.any? { |addrinfo| addrinfo.ipv6? }
     end
     skip 'IPv6 not available'
   end

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

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