Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
ac43f5b2
Commit
ac43f5b2
authored
Aug 29, 2013
by
Charles-François Natali
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Issue #18643: Fix some test_socket failures due to large default socket buffer
sizes.
parent
01a38174
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
12 additions
and
5 deletions
+12
-5
Lib/test/support/__init__.py
Lib/test/support/__init__.py
+8
-2
Lib/test/test_socket.py
Lib/test/test_socket.py
+4
-3
No files found.
Lib/test/support/__init__.py
View file @
ac43f5b2
...
@@ -601,8 +601,14 @@ IPV6_ENABLED = _is_ipv6_enabled()
...
@@ -601,8 +601,14 @@ IPV6_ENABLED = _is_ipv6_enabled()
# Windows limit seems to be around 512 B, and many Unix kernels have a
# Windows limit seems to be around 512 B, and many Unix kernels have a
# 64 KiB pipe buffer size or 16 * PAGE_SIZE: take a few megs to be sure.
# 64 KiB pipe buffer size or 16 * PAGE_SIZE: take a few megs to be sure.
# (see issue #17835 for a discussion of this number).
# (see issue #17835 for a discussion of this number).
PIPE_MAX_SIZE
=
4
*
1024
*
1024
+
1
PIPE_MAX_SIZE
=
4
*
1024
*
1024
+
1
# A constant likely larger than the underlying OS socket buffer size, to make
# writes blocking.
# The socket buffer sizes can usually be tuned system-wide (e.g. through sysctl
# on Linux), or on a per-socket basis (SO_SNDBUF/SO_RCVBUF). See issue #18643
# for a discussion of this number).
SOCK_MAX_SIZE
=
16
*
1024
*
1024
+
1
# decorator for skipping tests on non-IEEE 754 platforms
# decorator for skipping tests on non-IEEE 754 platforms
requires_IEEE_754
=
unittest
.
skipUnless
(
requires_IEEE_754
=
unittest
.
skipUnless
(
...
...
Lib/test/test_socket.py
View file @
ac43f5b2
...
@@ -1210,11 +1210,12 @@ class GeneralModuleTests(unittest.TestCase):
...
@@ -1210,11 +1210,12 @@ class GeneralModuleTests(unittest.TestCase):
c
.
settimeout
(
1.5
)
c
.
settimeout
(
1.5
)
with
self
.
assertRaises
(
ZeroDivisionError
):
with
self
.
assertRaises
(
ZeroDivisionError
):
signal
.
alarm
(
1
)
signal
.
alarm
(
1
)
c
.
sendall
(
b"x"
*
(
1024
**
2
)
)
c
.
sendall
(
b"x"
*
support
.
SOCK_MAX_SIZE
)
if
with_timeout
:
if
with_timeout
:
signal
.
signal
(
signal
.
SIGALRM
,
ok_handler
)
signal
.
signal
(
signal
.
SIGALRM
,
ok_handler
)
signal
.
alarm
(
1
)
signal
.
alarm
(
1
)
self
.
assertRaises
(
socket
.
timeout
,
c
.
sendall
,
b"x"
*
(
1024
**
2
))
self
.
assertRaises
(
socket
.
timeout
,
c
.
sendall
,
b"x"
*
support
.
SOCK_MAX_SIZE
)
finally
:
finally
:
signal
.
alarm
(
0
)
signal
.
alarm
(
0
)
signal
.
signal
(
signal
.
SIGALRM
,
old_alarm
)
signal
.
signal
(
signal
.
SIGALRM
,
old_alarm
)
...
@@ -4047,7 +4048,7 @@ class UnbufferedFileObjectClassTestCase(FileObjectClassTestCase):
...
@@ -4047,7 +4048,7 @@ class UnbufferedFileObjectClassTestCase(FileObjectClassTestCase):
self
.
serv_skipped
=
None
self
.
serv_skipped
=
None
self
.
serv_conn
.
setblocking
(
False
)
self
.
serv_conn
.
setblocking
(
False
)
# Try to saturate the socket buffer pipe with repeated large writes.
# Try to saturate the socket buffer pipe with repeated large writes.
BIG
=
b"x"
*
(
1024
**
2
)
BIG
=
b"x"
*
support
.
SOCK_MAX_SIZE
LIMIT
=
10
LIMIT
=
10
# The first write() succeeds since a chunk of data can be buffered
# The first write() succeeds since a chunk of data can be buffered
n
=
self
.
write_file
.
write
(
BIG
)
n
=
self
.
write_file
.
write
(
BIG
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment