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

ruby-changes:41930

From: odaira <ko1@a...>
Date: Sat, 5 Mar 2016 09:29:45 +0900 (JST)
Subject: [ruby-changes:41930] odaira:r54004 (trunk): * test/rinda/test_rinda.rb (test_make_socket_ipv4_multicast):

odaira	2016-03-05 09:29:39 +0900 (Sat, 05 Mar 2016)

  New Revision: 54004

  https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=54004

  Log:
    * test/rinda/test_rinda.rb (test_make_socket_ipv4_multicast):
      The fifth argument to getsockopt(2) should be modified to
      indicate the actual size of the value on return,
      but not in AIX. This is a know bug. Skip related tests.
    * test/rinda/test_rinda.rb (test_ring_server_ipv4_multicast):
      ditto.
    * test/rinda/test_rinda.rb (test_make_socket_unicast): ditto.
    * test/socket/test_basicsocket.rb (test_getsockopt): ditto.
    * test/socket/test_sockopt.rb (test_bool): ditto.

  Modified files:
    trunk/ChangeLog
    trunk/test/rinda/test_rinda.rb
    trunk/test/socket/test_basicsocket.rb
    trunk/test/socket/test_sockopt.rb
Index: test/rinda/test_rinda.rb
===================================================================
--- test/rinda/test_rinda.rb	(revision 54003)
+++ test/rinda/test_rinda.rb	(revision 54004)
@@ -625,10 +625,17 @@ class TestRingServer < Test::Unit::TestC https://github.com/ruby/ruby/blob/trunk/test/rinda/test_rinda.rb#L625
   def test_make_socket_ipv4_multicast
     v4mc = @rs.make_socket('239.0.0.1')
 
-    if Socket.const_defined?(:SO_REUSEPORT) then
-      assert(v4mc.getsockopt(:SOCKET, :SO_REUSEPORT).bool)
-    else
-      assert(v4mc.getsockopt(:SOCKET, :SO_REUSEADDR).bool)
+    begin
+      if Socket.const_defined?(:SO_REUSEPORT) then
+        assert(v4mc.getsockopt(:SOCKET, :SO_REUSEPORT).bool)
+      else
+        assert(v4mc.getsockopt(:SOCKET, :SO_REUSEADDR).bool)
+      end
+    rescue TypeError
+      if /aix/ =~ RUBY_PLATFORM
+        skip "Known bug in getsockopt(2) on AIX"
+      end
+      raise $!
     end
 
     assert_equal('0.0.0.0', v4mc.local_address.ip_address)
@@ -660,10 +667,17 @@ class TestRingServer < Test::Unit::TestC https://github.com/ruby/ruby/blob/trunk/test/rinda/test_rinda.rb#L667
     @rs = Rinda::RingServer.new(@ts, [['239.0.0.1', '0.0.0.0']], @port)
     v4mc = @rs.instance_variable_get('@sockets').first
 
-    if Socket.const_defined?(:SO_REUSEPORT) then
-      assert(v4mc.getsockopt(:SOCKET, :SO_REUSEPORT).bool)
-    else
-      assert(v4mc.getsockopt(:SOCKET, :SO_REUSEADDR).bool)
+    begin
+      if Socket.const_defined?(:SO_REUSEPORT) then
+        assert(v4mc.getsockopt(:SOCKET, :SO_REUSEPORT).bool)
+      else
+        assert(v4mc.getsockopt(:SOCKET, :SO_REUSEADDR).bool)
+      end
+    rescue TypeError
+      if /aix/ =~ RUBY_PLATFORM
+        skip "Known bug in getsockopt(2) on AIX"
+      end
+      raise $!
     end
 
     assert_equal('0.0.0.0', v4mc.local_address.ip_address)
@@ -755,6 +769,11 @@ class TestRingFinger < Test::Unit::TestC https://github.com/ruby/ruby/blob/trunk/test/rinda/test_rinda.rb#L769
     v4 = @rf.make_socket('127.0.0.1')
 
     assert(v4.getsockopt(:SOL_SOCKET, :SO_BROADCAST).bool)
+  rescue TypeError
+    if /aix/ =~ RUBY_PLATFORM
+      skip "Known bug in getsockopt(2) on AIX"
+    end
+    raise $!
   ensure
     v4.close if v4
   end
Index: test/socket/test_basicsocket.rb
===================================================================
--- test/socket/test_basicsocket.rb	(revision 54003)
+++ test/socket/test_basicsocket.rb	(revision 54004)
@@ -16,20 +16,28 @@ class TestSocket_BasicSocket < Test::Uni https://github.com/ruby/ruby/blob/trunk/test/socket/test_basicsocket.rb#L16
 
   def test_getsockopt
     inet_stream do |s|
-      n = s.getsockopt(Socket::SOL_SOCKET, Socket::SO_TYPE)
-      assert_equal([Socket::SOCK_STREAM].pack("i"), n.data)
-
-      n = s.getsockopt("SOL_SOCKET", "SO_TYPE")
-      assert_equal([Socket::SOCK_STREAM].pack("i"), n.data)
-
-      n = s.getsockopt(:SOL_SOCKET, :SO_TYPE)
-      assert_equal([Socket::SOCK_STREAM].pack("i"), n.data)
-
-      n = s.getsockopt(:SOCKET, :TYPE)
-      assert_equal([Socket::SOCK_STREAM].pack("i"), n.data)
-
-      n = s.getsockopt(Socket::SOL_SOCKET, Socket::SO_ERROR)
-      assert_equal([0].pack("i"), n.data)
+      begin
+        n = s.getsockopt(Socket::SOL_SOCKET, Socket::SO_TYPE)
+        assert_equal([Socket::SOCK_STREAM].pack("i"), n.data)
+
+        n = s.getsockopt("SOL_SOCKET", "SO_TYPE")
+        assert_equal([Socket::SOCK_STREAM].pack("i"), n.data)
+
+        n = s.getsockopt(:SOL_SOCKET, :SO_TYPE)
+        assert_equal([Socket::SOCK_STREAM].pack("i"), n.data)
+
+        n = s.getsockopt(:SOCKET, :TYPE)
+        assert_equal([Socket::SOCK_STREAM].pack("i"), n.data)
+
+        n = s.getsockopt(Socket::SOL_SOCKET, Socket::SO_ERROR)
+        assert_equal([0].pack("i"), n.data)
+      rescue Minitest::Assertion
+        s.close
+        if /aix/ =~ RUBY_PLATFORM
+          skip "Known bug in getsockopt(2) on AIX"
+        end
+        raise $!
+      end
 
       val = Object.new
       class << val; self end.send(:define_method, :to_int) {
Index: test/socket/test_sockopt.rb
===================================================================
--- test/socket/test_sockopt.rb	(revision 54003)
+++ test/socket/test_sockopt.rb	(revision 54004)
@@ -25,12 +25,19 @@ class TestSocketOption < Test::Unit::Tes https://github.com/ruby/ruby/blob/trunk/test/socket/test_sockopt.rb#L25
     assert_equal(true, opt.bool)
     opt = Socket::Option.int(:INET, :SOCKET, :KEEPALIVE, 2)
     assert_equal(true, opt.bool)
-    Socket.open(:INET, :STREAM) {|s|
-      s.setsockopt(Socket::Option.bool(:INET, :SOCKET, :KEEPALIVE, true))
-      assert_equal(true, s.getsockopt(Socket::SOL_SOCKET, Socket::SO_KEEPALIVE).bool)
-      s.setsockopt(Socket::Option.bool(:INET, :SOCKET, :KEEPALIVE, false))
-      assert_equal(false, s.getsockopt(Socket::SOL_SOCKET, Socket::SO_KEEPALIVE).bool)
-    }
+    begin
+      Socket.open(:INET, :STREAM) {|s|
+        s.setsockopt(Socket::Option.bool(:INET, :SOCKET, :KEEPALIVE, true))
+        assert_equal(true, s.getsockopt(Socket::SOL_SOCKET, Socket::SO_KEEPALIVE).bool)
+        s.setsockopt(Socket::Option.bool(:INET, :SOCKET, :KEEPALIVE, false))
+        assert_equal(false, s.getsockopt(Socket::SOL_SOCKET, Socket::SO_KEEPALIVE).bool)
+      }
+    rescue TypeError
+      if /aix/ =~ RUBY_PLATFORM
+        skip "Known bug in getsockopt(2) on AIX"
+      end
+      raise $!
+    end
   end
 
   def test_ipv4_multicast_loop
Index: ChangeLog
===================================================================
--- ChangeLog	(revision 54003)
+++ ChangeLog	(revision 54004)
@@ -1,3 +1,15 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1
+Sat Mar  5 09:17:54 2016  Rei Odaira  <Rei.Odaira@g...>
+
+	* test/rinda/test_rinda.rb (test_make_socket_ipv4_multicast):
+	  The fifth argument to getsockopt(2) should be modified to
+	  indicate the actual size of the value on return,
+	  but not in AIX. This is a know bug. Skip related tests.
+	* test/rinda/test_rinda.rb (test_ring_server_ipv4_multicast):
+	  ditto.
+	* test/rinda/test_rinda.rb (test_make_socket_unicast): ditto.
+	* test/socket/test_basicsocket.rb (test_getsockopt): ditto.
+	* test/socket/test_sockopt.rb (test_bool): ditto.
+
 Sat Mar  5 07:36:27 2016  Rei Odaira  <Rei.Odaira@g...>
 
 	* test/-ext-/float/test_nextafter.rb: In AIX,

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

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