64-bit port
On a 64-bit OS, pointer return values needed to be marked as c_void_p instead of a user-defined type, which would result in the transfer of 32 bits only. In order to still return an instance of the user-defined type to the caller, imported functions are now marked with the return type, and the return value is converted to that type by a new error checking function used only with imported functions that create and return user-defined types. On 64-bit Linux, the long type becomes 8 bytes, whereas the int type remains 4 bytes. The various sockaddr_* fields therefore needed to be changed from long to int, as did the type signatures of the packed string to array conversion functions. On an Ubuntu server installation, it was found that the name "localhost" does not resolve to an ipv6 address. A name search has therefore been added to the unit test driver, along with an ip number fallback. Tested on Ubuntu Server 12.04.1 LTS 64-bit. Regression tested on Ubuntu 12.04.1 LTS 32-bit.
This commit is contained in:
1 parent
77a50c7382
commit
7c6a512f94
4 files changed
+60
-21
No files matched your search
@@ -1333,6 +1333,22 @@ class ThreadedTests(unittest.TestCase):
|
||||
server.close()
|
||||
|
||||
|
||||
def hostname_for_protocol(protocol):
|
||||
global HOST
|
||||
# We can't quite predict the content of the hosts file, but we prefer names
|
||||
# to numbers in order to test name resolution; if we can't find a name,
|
||||
# then fall back to a number for the given protocol
|
||||
for name in HOST, "localhost", "ip6-localhost", "127.0.0.1", "::1":
|
||||
try:
|
||||
socket.getaddrinfo(name, 0, protocol)
|
||||
except socket.error:
|
||||
pass
|
||||
else:
|
||||
HOST = name
|
||||
return
|
||||
# Is the loopback interface enabled along with ipv6 for that interface?
|
||||
raise Exception("Failed to select hostname for protocol %d" % protocol)
|
||||
|
||||
def test_main(verbose=True):
|
||||
global CERTFILE, ISSUER_CERTFILE, OTHER_CERTFILE, AF_INET4_6
|
||||
CERTFILE = os.path.join(os.path.dirname(__file__) or os.curdir,
|
||||
@@ -1352,6 +1368,7 @@ def test_main(verbose=True):
|
||||
for demux in "platform-native", "routing":
|
||||
for AF_INET4_6 in socket.AF_INET, socket.AF_INET6:
|
||||
print "Suite run: demux: %s, protocol: %d" % (demux, AF_INET4_6)
|
||||
hostname_for_protocol(AF_INET4_6)
|
||||
res = unittest.main(exit=False).result.wasSuccessful()
|
||||
if not res:
|
||||
print "Suite run failed: demux: %s, protocol: %d" % (
|
||||
|
||||
Reference in new issue
Block a user