[pypy-svn] r72978 - in pypy/trunk/pypy/rlib: . test

getxsick at codespeak.net getxsick at codespeak.net
Sat Mar 27 22:12:28 CET 2010


Author: getxsick
Date: Sat Mar 27 22:12:27 2010
New Revision: 72978

Modified:
   pypy/trunk/pypy/rlib/_rsocket_rffi.py
   pypy/trunk/pypy/rlib/test/test_rsocket.py
Log:
Correct the order of sockaddr_in6. Add extra tests.


Modified: pypy/trunk/pypy/rlib/_rsocket_rffi.py
==============================================================================
--- pypy/trunk/pypy/rlib/_rsocket_rffi.py	(original)
+++ pypy/trunk/pypy/rlib/_rsocket_rffi.py	Sat Mar 27 22:12:27 2010
@@ -259,8 +259,8 @@
 CConfig.sockaddr_in6 = platform.Struct('struct sockaddr_in6',
                                               [('sin6_family', rffi.INT),
                                                ('sin6_port',   rffi.USHORT),
-                                               ('sin6_addr', CConfig.in6_addr),
                                                ('sin6_flowinfo', rffi.INT),
+                                               ('sin6_addr', CConfig.in6_addr),
                                                ('sin6_scope_id', rffi.INT)])
 
 CConfig.sockaddr_un = platform.Struct('struct sockaddr_un',

Modified: pypy/trunk/pypy/rlib/test/test_rsocket.py
==============================================================================
--- pypy/trunk/pypy/rlib/test/test_rsocket.py	(original)
+++ pypy/trunk/pypy/rlib/test/test_rsocket.py	Sat Mar 27 22:12:27 2010
@@ -78,6 +78,19 @@
         py.test.fail("could not find the 127.0.0.1 IPv4 address in %r"
                      % (address_list,))
 
+        name, aliases, address_list = gethostbyaddr('localhost')
+        allnames = [name] + aliases
+        for n in allnames:
+            assert isinstance(n, str)
+        if sys.platform != 'win32':
+            assert 'localhost' in allnames
+        for a in address_list:
+            if isinstance(a, INET6Address) and a.get_host() == "::1":
+                break  # ok
+        else:
+            py.test.fail("could not find the ::1 IPv6 address in %r"
+                         % (address_list,))
+
 def test_getservbyname():
     assert getservbyname('http') == 80
     assert getservbyname('http', 'tcp') == 80



More information about the Pypy-commit mailing list