From: <pj...@us...> - 2008-11-17 20:06:56
|
Revision: 5584 http://jython.svn.sourceforge.net/jython/?rev=5584&view=rev Author: pjenvey Date: 2008-11-17 20:06:51 +0000 (Mon, 17 Nov 2008) Log Message: ----------- relax the test ensuring SO_{RCV,SND}BUF matches the *exact* value we set it to after a connection was established. only for the BSDs, but we may not want to assume this anywhere Modified Paths: -------------- trunk/jython/Lib/test/test_socket.py Modified: trunk/jython/Lib/test/test_socket.py =================================================================== --- trunk/jython/Lib/test/test_socket.py 2008-11-17 20:05:55 UTC (rev 5583) +++ trunk/jython/Lib/test/test_socket.py 2008-11-17 20:06:51 UTC (rev 5584) @@ -7,6 +7,7 @@ import errno import Queue +import platform import select import socket import struct @@ -20,6 +21,8 @@ HOST = 'localhost' MSG = 'Michael Gilfix was here\n' EIGHT_BIT_MSG = 'Bh\xed Al\xe1in \xd3 Cinn\xe9ide anseo\n' +os_name = platform.java_ver()[3][0] +is_bsd = os_name == 'Mac OS X' or 'BSD' in os_name try: True @@ -548,6 +551,7 @@ sock.close() def _testTCPClientOption(self, option, values): + sock = None try: # First listen on a server socket, so that the connection won't be refused. server_sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) @@ -560,12 +564,21 @@ # First bind, so that the SO_REUSEADDR setting propagates sock.bind( (HOST, PORT+1) ) sock.connect( (HOST, PORT) ) - self.failUnlessEqual(sock.getsockopt(socket.SOL_SOCKET, option), values[-1], \ - "Option value '%s'='%s' did not propagate to implementation socket" % (option, values[-1])) + msg = "Option value '%s'='%s' did not propagate to implementation socket" % (option, values[-1]) + if is_bsd and option in (socket.SO_RCVBUF, socket.SO_SNDBUF): + # XXX: there's no guarantee that bufsize will be the + # exact setsockopt value, particularly after + # establishing a connection. seems it will be *at least* + # the values we test (which are rather small) on + # BSDs. may need to relax this on other platforms also + self.assert_(sock.getsockopt(socket.SOL_SOCKET, option) >= values[-1], msg) + else: + self.failUnlessEqual(sock.getsockopt(socket.SOL_SOCKET, option), values[-1], msg) self._testSetAndGetOption(sock, option, values) finally: server_sock.close() - sock.close() + if sock: + sock.close() def _testTCPServerOption(self, option, values): try: This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <am...@us...> - 2009-07-07 11:05:26
|
Revision: 6519 http://jython.svn.sourceforge.net/jython/?rev=6519&view=rev Author: amak Date: 2009-07-07 11:05:16 +0000 (Tue, 07 Jul 2009) Log Message: ----------- Commenting out a single test that gives varying results across platforms, and thus cannot be reliably tested. Also some whitespace cleanup. Modified Paths: -------------- trunk/jython/Lib/test/test_socket.py Modified: trunk/jython/Lib/test/test_socket.py =================================================================== --- trunk/jython/Lib/test/test_socket.py 2009-07-07 04:49:12 UTC (rev 6518) +++ trunk/jython/Lib/test/test_socket.py 2009-07-07 11:05:16 UTC (rev 6519) @@ -1448,18 +1448,17 @@ local_ip_address = java.net.InetAddress.getLocalHost().getHostAddress() for flags, host_param, expected_canonname, expected_sockaddr in [ # First passive flag - (socket.AI_PASSIVE, None, "", socket.INADDR_ANY), - (socket.AI_PASSIVE, "", "", local_ip_address), - (socket.AI_PASSIVE, "localhost", "", IPV4_LOOPBACK), - (socket.AI_PASSIVE, local_hostname, "", local_ip_address), - # Now passive flag AND canonname flag - (socket.AI_PASSIVE|socket.AI_CANONNAME, None, "127.0.0.1", "127.0.0.1"), - (socket.AI_PASSIVE|socket.AI_CANONNAME, "", local_hostname, local_ip_address), - # The following result seems peculiar to me, and may be to do with my local machine setup - # Also may be caused by a security permission failure. - # If you have problems with the following result, just comment it out. - (socket.AI_PASSIVE|socket.AI_CANONNAME, "localhost", IPV4_LOOPBACK, IPV4_LOOPBACK), - (socket.AI_PASSIVE|socket.AI_CANONNAME, local_hostname, local_hostname, local_ip_address), + (socket.AI_PASSIVE, None, "", socket.INADDR_ANY), + (socket.AI_PASSIVE, "", "", local_ip_address), + (socket.AI_PASSIVE, "localhost", "", IPV4_LOOPBACK), + (socket.AI_PASSIVE, local_hostname, "", local_ip_address), + # Now passive flag AND canonname flag + (socket.AI_PASSIVE|socket.AI_CANONNAME, None, "127.0.0.1", "127.0.0.1"), + (socket.AI_PASSIVE|socket.AI_CANONNAME, "", local_hostname, local_ip_address), + # The following gives varying results across platforms and configurations: commenting out for now. + # Javadoc: http://java.sun.com/j2se/1.5.0/docs/api/java/net/InetAddress.html#getCanonicalHostName() + #(socket.AI_PASSIVE|socket.AI_CANONNAME, "localhost", local_hostname, IPV4_LOOPBACK), + (socket.AI_PASSIVE|socket.AI_CANONNAME, local_hostname, local_hostname, local_ip_address), ]: addrinfos = socket.getaddrinfo(host_param, 0, socket.AF_INET, socket.SOCK_STREAM, 0, flags) for family, socktype, proto, canonname, sockaddr in addrinfos: This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <am...@us...> - 2009-07-07 11:36:36
|
Revision: 6520 http://jython.svn.sourceforge.net/jython/?rev=6520&view=rev Author: amak Date: 2009-07-07 11:36:34 +0000 (Tue, 07 Jul 2009) Log Message: ----------- Commenting out all AI_CANONNAME tests for now. Much further research needed; may never be cross-platform testable. Modified Paths: -------------- trunk/jython/Lib/test/test_socket.py Modified: trunk/jython/Lib/test/test_socket.py =================================================================== --- trunk/jython/Lib/test/test_socket.py 2009-07-07 11:05:16 UTC (rev 6519) +++ trunk/jython/Lib/test/test_socket.py 2009-07-07 11:36:34 UTC (rev 6520) @@ -1453,12 +1453,13 @@ (socket.AI_PASSIVE, "localhost", "", IPV4_LOOPBACK), (socket.AI_PASSIVE, local_hostname, "", local_ip_address), # Now passive flag AND canonname flag - (socket.AI_PASSIVE|socket.AI_CANONNAME, None, "127.0.0.1", "127.0.0.1"), - (socket.AI_PASSIVE|socket.AI_CANONNAME, "", local_hostname, local_ip_address), + # Commenting out all AI_CANONNAME tests, results too dependent on system config + #(socket.AI_PASSIVE|socket.AI_CANONNAME, None, "127.0.0.1", "127.0.0.1"), + #(socket.AI_PASSIVE|socket.AI_CANONNAME, "", local_hostname, local_ip_address), # The following gives varying results across platforms and configurations: commenting out for now. # Javadoc: http://java.sun.com/j2se/1.5.0/docs/api/java/net/InetAddress.html#getCanonicalHostName() #(socket.AI_PASSIVE|socket.AI_CANONNAME, "localhost", local_hostname, IPV4_LOOPBACK), - (socket.AI_PASSIVE|socket.AI_CANONNAME, local_hostname, local_hostname, local_ip_address), + #(socket.AI_PASSIVE|socket.AI_CANONNAME, local_hostname, local_hostname, local_ip_address), ]: addrinfos = socket.getaddrinfo(host_param, 0, socket.AF_INET, socket.SOCK_STREAM, 0, flags) for family, socktype, proto, canonname, sockaddr in addrinfos: This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <pj...@us...> - 2010-04-09 01:32:50
|
Revision: 7003 http://jython.svn.sourceforge.net/jython/?rev=7003&view=rev Author: pjenvey Date: 2010-04-09 01:32:44 +0000 (Fri, 09 Apr 2010) Log Message: ----------- workaround harmless failure on FreeBSD Modified Paths: -------------- trunk/jython/Lib/test/test_socket.py Modified: trunk/jython/Lib/test/test_socket.py =================================================================== --- trunk/jython/Lib/test/test_socket.py 2010-04-06 02:02:34 UTC (rev 7002) +++ trunk/jython/Lib/test/test_socket.py 2010-04-09 01:32:44 UTC (rev 7003) @@ -354,7 +354,7 @@ # I've ordered this by protocols that have both a tcp and udp # protocol, at least for modern Linuxes. if sys.platform in ('linux2', 'freebsd4', 'freebsd5', 'freebsd6', - 'darwin'): + 'darwin') or is_bsd: # avoid the 'echo' service on this platform, as there is an # assumption breaking non-standard port/protocol entry services = ('daytime', 'qotd', 'domain') This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <am...@us...> - 2010-04-09 17:18:38
|
Revision: 7010 http://jython.svn.sourceforge.net/jython/?rev=7010&view=rev Author: amak Date: 2010-04-09 17:18:31 +0000 (Fri, 09 Apr 2010) Log Message: ----------- Disabling the AI_PASSIVE test. It cannot be written in way that is portable between systems. The only way around this is to configure expected results, on a per-system basis, outside of the test suite. Modified Paths: -------------- trunk/jython/Lib/test/test_socket.py Modified: trunk/jython/Lib/test/test_socket.py =================================================================== --- trunk/jython/Lib/test/test_socket.py 2010-04-09 05:06:08 UTC (rev 7009) +++ trunk/jython/Lib/test/test_socket.py 2010-04-09 17:18:31 UTC (rev 7010) @@ -1464,6 +1464,12 @@ self.assert_(isinstance(sockaddr[0], str)) def testAI_PASSIVE(self): + # Disabling this test for now; it's expectations are not portable. + # Expected results are too dependent on system config to be made portable between systems. + # And the only way to determine what configuration to test is to use the + # java.net.InetAddress.getAllByName() method, which is what is used to + # implement the getaddrinfo() function. Therefore, no real point in the test. + return IPV4_LOOPBACK = "127.0.0.1" local_hostname = java.net.InetAddress.getLocalHost().getHostName() local_ip_address = java.net.InetAddress.getLocalHost().getHostAddress() This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <pj...@us...> - 2011-03-11 21:23:58
|
Revision: 7210 http://jython.svn.sourceforge.net/jython/?rev=7210&view=rev Author: pjenvey Date: 2011-03-11 21:23:50 +0000 (Fri, 11 Mar 2011) Log Message: ----------- skip these on our older FreeBSD 6.2 buildbot as it has spotty IPV6 support Modified Paths: -------------- trunk/jython/Lib/test/test_socket.py Modified: trunk/jython/Lib/test/test_socket.py =================================================================== --- trunk/jython/Lib/test/test_socket.py 2011-03-11 20:40:07 UTC (rev 7209) +++ trunk/jython/Lib/test/test_socket.py 2011-03-11 21:23:50 UTC (rev 7210) @@ -1510,7 +1510,12 @@ self.failUnlessEqual(str(ipv4_address_tuple), "('127.0.0.1', 80)") self.failUnlessEqual(repr(ipv4_address_tuple), "('127.0.0.1', 80)") - ipv6_address_tuple = socket.getaddrinfo("localhost", 80, socket.AF_INET6, socket.SOCK_STREAM, 0, 0)[0][4] + addrinfo = socket.getaddrinfo("localhost", 80, socket.AF_INET6, socket.SOCK_STREAM, 0, 0) + if not addrinfo and is_bsd: + # older FreeBSDs may have spotty IPV6 Java support (at least + # our FreeBSD 6.2 buildbot does) + return + ipv6_address_tuple = addrinfo[0][4] self.failUnless (ipv6_address_tuple[0] in ["::1", "0:0:0:0:0:0:0:1"]) self.failUnlessEqual(ipv6_address_tuple[1], 80) self.failUnlessEqual(ipv6_address_tuple[2], 0) @@ -1536,7 +1541,11 @@ self.failUnlessEqual(sockaddr.port, 80) def testIPV6AddressesFromGetAddrInfo(self): - local_addr = socket.getaddrinfo("localhost", 80, socket.AF_INET6, socket.SOCK_STREAM, 0, 0)[0][4] + addrinfo = socket.getaddrinfo("localhost", 80, socket.AF_INET6, socket.SOCK_STREAM, 0, 0) + if not addrinfo and is_bsd: + # older FreeBSDs may have spotty IPV6 Java support + return + local_addr = addrinfo[0][4] sockaddr = socket._get_jsockaddr(local_addr) self.failUnless(isinstance(sockaddr, java.net.InetSocketAddress), "_get_jsockaddr returned wrong type: '%s'" % str(type(sockaddr))) self.failUnless(sockaddr.address.hostAddress in ["::1", "0:0:0:0:0:0:0:1"]) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |