summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichał Górny <mgorny@gentoo.org>2020-05-29 09:07:17 +0200
committerJakub Stasiak <jakub@stasiak.at>2020-07-01 23:04:14 +0200
commit6508a38cfcaf3c65591e00b5a58175939fb1bc63 (patch)
tree2593060357759faa205bd386c67fb62bb516a63e
parent5846e1c597602b9b4435be48a460c3049f9f1bef (diff)
downloadeventlet-6508a38cfcaf3c65591e00b5a58175939fb1bc63.tar.gz
tests: Unset O_NONBLOCK|O_NDELAY to fix SPARC
Fix TestGreenSocket.test_skip_nonblocking() to unset both O_NONBLOCK and O_NDELAY. This is necessary to fix tests on SPARC where both flags are used simultaneously, and unsetting one is ineffective (flags remain the same). This should not affect other platforms where O_NDELAY is an alias for O_NONBLOCK.
-rw-r--r--tests/greenio_test.py8
1 files changed, 5 insertions, 3 deletions
diff --git a/tests/greenio_test.py b/tests/greenio_test.py
index 593444d..886476d 100644
--- a/tests/greenio_test.py
+++ b/tests/greenio_test.py
@@ -634,13 +634,15 @@ class TestGreenSocket(tests.LimitedTestCase):
sock1 = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
fd = sock1.fd.fileno()
flags = fcntl.fcntl(fd, fcntl.F_GETFL)
- fcntl.fcntl(fd, fcntl.F_SETFL, flags & ~os.O_NONBLOCK)
+ # on SPARC, nonblocking mode sets O_NDELAY as well
+ fcntl.fcntl(fd, fcntl.F_SETFL, flags & ~(os.O_NONBLOCK
+ | os.O_NDELAY))
flags = fcntl.fcntl(fd, fcntl.F_GETFL)
- assert flags & os.O_NONBLOCK == 0
+ assert flags & (os.O_NONBLOCK | os.O_NDELAY) == 0
sock2 = socket.socket(sock1.fd, set_nonblocking=False)
flags = fcntl.fcntl(sock2.fd.fileno(), fcntl.F_GETFL)
- assert flags & os.O_NONBLOCK == 0
+ assert flags & (os.O_NONBLOCK | os.O_NDELAY) == 0
def test_sockopt_interface(self):
sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)