1 |
commit: b7574fb8cd61e2454615ccfc19383c7ff0633aec |
2 |
Author: Michał Górny <mgorny <AT> gentoo <DOT> org> |
3 |
AuthorDate: Fri May 29 07:30:58 2020 +0000 |
4 |
Commit: Michał Górny <mgorny <AT> gentoo <DOT> org> |
5 |
CommitDate: Fri May 29 07:44:33 2020 +0000 |
6 |
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=b7574fb8 |
7 |
|
8 |
dev-python/eventlet: Fix test failures on SPARC |
9 |
|
10 |
Reported by Dakon. |
11 |
|
12 |
Signed-off-by: Michał Górny <mgorny <AT> gentoo.org> |
13 |
|
14 |
dev-python/eventlet/eventlet-0.25.1-r1.ebuild | 1 + |
15 |
.../eventlet/files/eventlet-0.25.1-sparc.patch | 118 +++++++++++++++++++++ |
16 |
2 files changed, 119 insertions(+) |
17 |
|
18 |
diff --git a/dev-python/eventlet/eventlet-0.25.1-r1.ebuild b/dev-python/eventlet/eventlet-0.25.1-r1.ebuild |
19 |
index 10c950a9b76..3055e3ca809 100644 |
20 |
--- a/dev-python/eventlet/eventlet-0.25.1-r1.ebuild |
21 |
+++ b/dev-python/eventlet/eventlet-0.25.1-r1.ebuild |
22 |
@@ -26,6 +26,7 @@ DEPEND="doc? ( >=dev-python/python-docs-2.7.6-r1:2.7 ) |
23 |
dev-python/nose[${PYTHON_USEDEP}] )" |
24 |
|
25 |
PATCHES=( |
26 |
+ "${FILESDIR}/eventlet-0.25.1-sparc.patch" |
27 |
"${FILESDIR}/eventlet-0.25.1-tests.patch" |
28 |
) |
29 |
|
30 |
|
31 |
diff --git a/dev-python/eventlet/files/eventlet-0.25.1-sparc.patch b/dev-python/eventlet/files/eventlet-0.25.1-sparc.patch |
32 |
new file mode 100644 |
33 |
index 00000000000..c7f6a75b4f3 |
34 |
--- /dev/null |
35 |
+++ b/dev-python/eventlet/files/eventlet-0.25.1-sparc.patch |
36 |
@@ -0,0 +1,118 @@ |
37 |
+From b288e969b6a0ed24913114b7b7eaad5010db5ce1 Mon Sep 17 00:00:00 2001 |
38 |
+From: =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?= <mgorny@g.o> |
39 |
+Date: Fri, 29 May 2020 09:04:37 +0200 |
40 |
+Subject: [PATCH 1/4] tests: F_SETFL does not return flags, use F_GETFL again |
41 |
+ |
42 |
+Fix TestGreenSocket.test_skip_nonblocking() to call F_GETFL again |
43 |
+to get the flags for the socket. Previously, the code wrongly assumed |
44 |
+F_SETFL will return flags while it always returns 0 (see fcntl(2)). |
45 |
+--- |
46 |
+ tests/greenio_test.py | 3 ++- |
47 |
+ 1 file changed, 2 insertions(+), 1 deletion(-) |
48 |
+ |
49 |
+diff --git a/tests/greenio_test.py b/tests/greenio_test.py |
50 |
+index 39d77737b..593444d07 100644 |
51 |
+--- a/tests/greenio_test.py |
52 |
++++ b/tests/greenio_test.py |
53 |
+@@ -634,7 +634,8 @@ def test_skip_nonblocking(self): |
54 |
+ sock1 = socket.socket(socket.AF_INET, socket.SOCK_STREAM) |
55 |
+ fd = sock1.fd.fileno() |
56 |
+ flags = fcntl.fcntl(fd, fcntl.F_GETFL) |
57 |
+- flags = fcntl.fcntl(fd, fcntl.F_SETFL, flags & ~os.O_NONBLOCK) |
58 |
++ fcntl.fcntl(fd, fcntl.F_SETFL, flags & ~os.O_NONBLOCK) |
59 |
++ flags = fcntl.fcntl(fd, fcntl.F_GETFL) |
60 |
+ assert flags & os.O_NONBLOCK == 0 |
61 |
+ |
62 |
+ sock2 = socket.socket(sock1.fd, set_nonblocking=False) |
63 |
+ |
64 |
+From 803422302f5e813f1f00435d7ae943bf8513946c Mon Sep 17 00:00:00 2001 |
65 |
+From: =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?= <mgorny@g.o> |
66 |
+Date: Fri, 29 May 2020 09:07:17 +0200 |
67 |
+Subject: [PATCH 2/4] tests: Unset O_NONBLOCK|O_NDELAY to fix SPARC |
68 |
+ |
69 |
+Fix TestGreenSocket.test_skip_nonblocking() to unset both O_NONBLOCK |
70 |
+and O_NDELAY. This is necessary to fix tests on SPARC where both flags |
71 |
+are used simultaneously, and unsetting one is ineffective (flags remain |
72 |
+the same). This should not affect other platforms where O_NDELAY |
73 |
+is an alias for O_NONBLOCK. |
74 |
+--- |
75 |
+ tests/greenio_test.py | 4 +++- |
76 |
+ 1 file changed, 3 insertions(+), 1 deletion(-) |
77 |
+ |
78 |
+diff --git a/tests/greenio_test.py b/tests/greenio_test.py |
79 |
+index 593444d07..736c2e539 100644 |
80 |
+--- a/tests/greenio_test.py |
81 |
++++ b/tests/greenio_test.py |
82 |
+@@ -634,7 +634,9 @@ def test_skip_nonblocking(self): |
83 |
+ sock1 = socket.socket(socket.AF_INET, socket.SOCK_STREAM) |
84 |
+ fd = sock1.fd.fileno() |
85 |
+ flags = fcntl.fcntl(fd, fcntl.F_GETFL) |
86 |
+- fcntl.fcntl(fd, fcntl.F_SETFL, flags & ~os.O_NONBLOCK) |
87 |
++ # on SPARC, nonblocking mode sets O_NDELAY as well |
88 |
++ fcntl.fcntl(fd, fcntl.F_SETFL, flags & ~(os.O_NONBLOCK |
89 |
++ | os.O_NDELAY)) |
90 |
+ flags = fcntl.fcntl(fd, fcntl.F_GETFL) |
91 |
+ assert flags & os.O_NONBLOCK == 0 |
92 |
+ |
93 |
+ |
94 |
+From b742b443d079ec9001a1452e138773b066ed784e Mon Sep 17 00:00:00 2001 |
95 |
+From: =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?= <mgorny@g.o> |
96 |
+Date: Fri, 29 May 2020 09:09:07 +0200 |
97 |
+Subject: [PATCH 3/4] tests: Assume that nonblocking mode might set O_NDELAY to |
98 |
+ fix SPARC |
99 |
+ |
100 |
+Fix test_set_nonblocking() to account for the alternative possible |
101 |
+outcome that enabling non-blocking mode can set both O_NONBLOCK |
102 |
+and O_NDELAY as it does on SPARC. Note that O_NDELAY may be a superset |
103 |
+of O_NONBLOCK, so we can't just filter it out of new_flags. |
104 |
+--- |
105 |
+ tests/greenio_test.py | 5 ++++- |
106 |
+ 1 file changed, 4 insertions(+), 1 deletion(-) |
107 |
+ |
108 |
+diff --git a/tests/greenio_test.py b/tests/greenio_test.py |
109 |
+index 736c2e539..a2d1ad856 100644 |
110 |
+--- a/tests/greenio_test.py |
111 |
++++ b/tests/greenio_test.py |
112 |
+@@ -925,7 +925,10 @@ def test_set_nonblocking(): |
113 |
+ assert orig_flags & os.O_NONBLOCK == 0 |
114 |
+ greenio.set_nonblocking(sock) |
115 |
+ new_flags = fcntl.fcntl(fileno, fcntl.F_GETFL) |
116 |
+- assert new_flags == (orig_flags | os.O_NONBLOCK) |
117 |
++ # on SPARC, O_NDELAY is set as well, and it might be a superset |
118 |
++ # of O_NONBLOCK |
119 |
++ assert (new_flags == (orig_flags | os.O_NONBLOCK) |
120 |
++ or new_flags == (orig_flags | os.O_NONBLOCK | os.O_NDELAY)) |
121 |
+ |
122 |
+ |
123 |
+ def test_socket_del_fails_gracefully_when_not_fully_initialized(): |
124 |
+ |
125 |
+From d324431b14ea57c6d7b295bd8b00f128ed4c2f5a Mon Sep 17 00:00:00 2001 |
126 |
+From: =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?= <mgorny@g.o> |
127 |
+Date: Fri, 29 May 2020 09:17:21 +0200 |
128 |
+Subject: [PATCH 4/4] tests: Increase timeout for |
129 |
+ test_isolate_from_socket_default_timeout |
130 |
+ |
131 |
+Increase the timeout used for test_isolate_from_socket_default_timeout |
132 |
+from 1 second to 5 seconds. Otherwise, the test can't succeed |
133 |
+on hardware where Python runs slower. In particular, on our SPARC box |
134 |
+importing greenlet modules takes almost 2 seconds, so the test program |
135 |
+does not even start properly. |
136 |
+ |
137 |
+Fixes #614 |
138 |
+--- |
139 |
+ tests/tpool_test.py | 2 +- |
140 |
+ 1 file changed, 1 insertion(+), 1 deletion(-) |
141 |
+ |
142 |
+diff --git a/tests/tpool_test.py b/tests/tpool_test.py |
143 |
+index 4826f30de..1a730dc10 100644 |
144 |
+--- a/tests/tpool_test.py |
145 |
++++ b/tests/tpool_test.py |
146 |
+@@ -366,7 +366,7 @@ def test_leakage_from_tracebacks(self): |
147 |
+ |
148 |
+ |
149 |
+ def test_isolate_from_socket_default_timeout(): |
150 |
+- tests.run_isolated('tpool_isolate_socket_default_timeout.py', timeout=1) |
151 |
++ tests.run_isolated('tpool_isolate_socket_default_timeout.py', timeout=5) |
152 |
+ |
153 |
+ |
154 |
+ def test_exception_leak(): |