Skip to content

Conversation

@hyeongyun0916
Copy link
Contributor

@hyeongyun0916hyeongyun0916 commented Feb 23, 2023

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.

skip fcntl when pipesize is smaller than pagesize

pipesize_default=fcntl.fcntl(test_pipe_w, fcntl.F_GETPIPE_SZ)
pipesize=pipesize_default//2# A new value to detect change.
ifpipesize<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.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

os.close(test_pipe_w)
pipesize=pipesize_default//2
ifpipesize<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.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ditto

@bedevere-bot
Copy link

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 I have made the requested changes; please review again. I will then notify any core developers who have left a review that you're ready for them to take another look at this pull request.

pipesize_default=fcntl.fcntl(test_pipe_w, fcntl.F_GETPIPE_SZ)
pipesize=pipesize_default//2# A new value to detect change.
ifpipesize<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.
Copy link
Member

@corona10corona10Feb 23, 2023

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.

hasattr(fcntl, "F_SETPIPE_SZ") andhasattr(fcntl, "F_GETPIPE_SZ"),
"F_SETPIPE_SZ and F_GETPIPE_SZ are not available on all platforms.")
deftest_fcntl_f_pipesize(self):
resource=import_module('resource')
Copy link
Member

@corona10corona10Feb 24, 2023

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?

Copy link
ContributorAuthor

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.

@corona10corona10 added needs backport to 3.10 only security fixes needs backport to 3.11 only security fixes labels Feb 25, 2023
importstruct
importsys
importunittest
importresource
Copy link
Member

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.

Copy link
ContributorAuthor

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.

interval=minimum_interval
returnsys.setswitchinterval(interval)

defget_pagesize():
Copy link
ContributorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@corona10corona10 removed needs backport to 3.10 only security fixes needs backport to 3.11 only security fixes labels Mar 1, 2023
importsys
importunittest
fromtestimportsupport
fromtest.supportimportverbose, cpython_only
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
fromtest.supportimportverbose, cpython_only
fromtest.supportimportverbose, cpython_only, get_pagesize

importstruct
importsys
importunittest
fromtestimportsupport
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
from test import support

hyeongyun0916and others added 5 commits March 1, 2023 21:01
Co-authored-by: Dong-hee Na <donghee.na92@gmail.com>
Co-authored-by: Dong-hee Na <donghee.na92@gmail.com>
Co-authored-by: Dong-hee Na <donghee.na92@gmail.com>
Copy link
Member

@corona10corona10 left a 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!

Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

skip newstestsTests in the Lib/test dir

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants

@hyeongyun0916@bedevere-bot@corona10