-
-
Notifications
You must be signed in to change notification settings - Fork 30.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
gh-95672 skip fcntl when pipesize is smaller than pagesize #102163
gh-95672 skip fcntl when pipesize is smaller than pagesize #102163
Conversation
Lib/test/test_fcntl.py
Outdated
@@ -201,7 +201,8 @@ def test_fcntl_f_pipesize(self): | |||
# Get the default pipesize with F_GETPIPE_SZ | |||
pipesize_default = fcntl.fcntl(test_pipe_w, fcntl.F_GETPIPE_SZ) | |||
pipesize = pipesize_default // 2 # A new value to detect change. | |||
if pipesize < 512: # the POSIX minimum | |||
minimum_pipe_size = os.sysconf('SC_PAGESIZE') # There's a check that attempts to skip the tests if the pipe capacity is 512 bytes, but that's less than the smallest page size on x86. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please follow PEP8: https://peps.python.org/pep-0008/#maximum-line-length
Lib/test/test_subprocess.py
Outdated
@@ -717,7 +717,8 @@ def test_pipesizes(self): | |||
os.close(test_pipe_r) | |||
os.close(test_pipe_w) | |||
pipesize = pipesize_default // 2 | |||
if pipesize < 512: # the POSIX minimum | |||
minimum_pipe_size = os.sysconf('SC_PAGESIZE') # There's a check that attempts to skip the tests if the pipe capacity is 512 bytes, but that's less than the smallest page size on x86. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ditto
A Python core developer has requested some changes be made to your pull request before we can consider merging it. If you could please address their requests along with any other requests in other reviews from core developers that would be appreciated. Once you have made the requested changes, please leave a comment on this pull request containing the phrase |
Lib/test/test_fcntl.py
Outdated
@@ -201,7 +201,8 @@ def test_fcntl_f_pipesize(self): | |||
# Get the default pipesize with F_GETPIPE_SZ | |||
pipesize_default = fcntl.fcntl(test_pipe_w, fcntl.F_GETPIPE_SZ) | |||
pipesize = pipesize_default // 2 # A new value to detect change. | |||
if pipesize < 512: # the POSIX minimum | |||
minimum_pipe_size = os.sysconf('SC_PAGESIZE') # There's a check that attempts to skip the tests if the pipe capacity is 512 bytes, but that's less than the smallest page size on x86. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There's a check that attempts to skip the tests if the pipe capacity is 512 bytes, but that's less than the smallest page size on x86.
You need to describe why the os.sysconf('SC_PAGESIZE') is needed rather than describe the issue itself.
Lib/test/test_fcntl.py
Outdated
@@ -196,12 +196,14 @@ def test_fcntl_f_getpath(self): | |||
hasattr(fcntl, "F_SETPIPE_SZ") and hasattr(fcntl, "F_GETPIPE_SZ"), | |||
"F_SETPIPE_SZ and F_GETPIPE_SZ are not available on all platforms.") | |||
def test_fcntl_f_pipesize(self): | |||
resource = import_module('resource') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not just using import resource
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh that's right, I'll fix it.
Lib/test/test_fcntl.py
Outdated
@@ -6,6 +6,7 @@ | |||
import struct | |||
import sys | |||
import unittest | |||
import resource |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@hyeongyun0916 resource module looks like not available on Windows platform.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll add a function to the test support.
@@ -1892,6 +1894,16 @@ def setswitchinterval(interval): | |||
interval = minimum_interval | |||
return sys.setswitchinterval(interval) | |||
|
|||
def get_pagesize(): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll change https://github.com/python/cpython/blob/main/Lib/test/memory_watchdog.py#L13 to get_pagesize in other pr.
Lib/test/test_fcntl.py
Outdated
@@ -6,6 +6,7 @@ | |||
import struct | |||
import sys | |||
import unittest | |||
from test import support | |||
from test.support import verbose, cpython_only |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
from test.support import verbose, cpython_only | |
from test.support import verbose, cpython_only, get_pagesize |
Lib/test/test_fcntl.py
Outdated
@@ -6,6 +6,7 @@ | |||
import struct | |||
import sys | |||
import unittest | |||
from test import support |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
from test import support |
Co-authored-by: Dong-hee Na <[email protected]>
Co-authored-by: Dong-hee Na <[email protected]>
Co-authored-by: Dong-hee Na <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm!
Thanks for the hardwork!
skip fcntl when pipesize is smaller than pagesize