Skip to content
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

Test #1

Open
wants to merge 1 commit into
base: gh-95672
Choose a base branch
from
Open

Test #1

wants to merge 1 commit into from

Conversation

hyeongyun0916
Copy link
Owner

@hyeongyun0916 hyeongyun0916 commented Feb 21, 2023

python#95672 의 첫번째 이슈를 해결하기 위해 test하는 pr입니다..

fcntl에서 F_SETPIPE_SZ에 대하여 page size보다 작은 값으로 pipe를 설정할 경우 page size로 업데이트한다.
그렇기 때문에 test에서도 page_size로 확인해야한다.

@hyeongyun0916 hyeongyun0916 changed the base branch from main to gh-95672 February 21, 2023 16:42
.format(data=data * page_size / (1024 ** 3)))
sys.stdout.flush()
time.sleep(1)
if __name__ == "__main__":
Copy link
Owner Author

Choose a reason for hiding this comment

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

Lib/test/test_fcntl.py에서 from test.memory_watchdog import page_size 이렇게 사용하기 위하여 이쪽을 main일경우만으로 변경하였는데 이런 변경이 괜찮은가요?

test_pipe_r, test_pipe_w = os.pipe()
try:
# Get the default pipesize with F_GETPIPE_SZ
pipesize_default = fcntl.fcntl(test_pipe_w, fcntl.F_GETPIPE_SZ)
print('start mhg')
pipesize_default = fcntl.fcntl(test_pipe_w, 1032)
Copy link
Owner Author

Choose a reason for hiding this comment

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

4096일 경우 Invalid argument가 나오네요..

Copy link
Owner Author

Choose a reason for hiding this comment

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

정상일경우 (1032)

[irteamsu@mhg-cpython-001-mgmd-jp2v-dev cpython]$ ./python -m test test_fcntl
0:00:00 load avg: 1.30 Run tests sequentially
0:00:00 load avg: 1.30 [1/1] test_fcntl
mhg7
mhg9
mhg10 ret: 0, errno: 0, async_err: 0, args: 3 1026 -2147483648
mhg12
4096
start mhg
mhg10 ret: 65536, errno: 0, async_err: 0, args: 4 1032 0
mhg12
end mhg
mhg7
mhg9
mhg10 ret: 32768, errno: 0, async_err: 0, args: 4 1031 32768
mhg12
mhg10 ret: 32768, errno: 0, async_err: 0, args: 4 1032 0
mhg12
mhg7
mhg9
mhg10 ret: 0, errno: 25, async_err: 0, args: 3 4 2048
mhg12
mhg2
mhg4
mhg6
mhg7
mhg9
mhg10 ret: 0, errno: 25, async_err: 0, args: 3 4 2048
mhg12
mhg2
mhg4
mhg6
struct.pack:  b'\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'
struct.pack:  b'\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'

== Tests result: SUCCESS ==

1 test OK.

Total duration: 511 ms
Tests result: SUCCESS

Copy link
Owner Author

Choose a reason for hiding this comment

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

비정상일 경우 (4096)

[irteamsu@mhg-cpython-001-mgmd-jp2v-dev cpython]$ ./python -m test test_fcntl
0:00:00 load avg: 1.67 Run tests sequentially
0:00:00 load avg: 1.67 [1/1] test_fcntl
mhg7
mhg9
mhg10 ret: 0, errno: 0, async_err: 0, args: 3 1026 -2147483648
mhg12
4096
start mhg
mhg10 ret: -1, errno: 22, async_err: 0, args: 4 4096 0
mhg11
mhg7
mhg9
mhg10 ret: 0, errno: 25, async_err: 0, args: 3 4 2048
mhg12
mhg2
mhg4
mhg6
mhg7
mhg9
mhg10 ret: 0, errno: 25, async_err: 0, args: 3 4 2048
mhg12
mhg2
mhg4
mhg6
struct.pack:  b'\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'
struct.pack:  b'\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'
test test_fcntl failed -- Traceback (most recent call last):
  File "/home1/irteamsu/docs/cpython/Lib/test/test_fcntl.py", line 204, in test_fcntl_f_pipesize
    pipesize_default = fcntl.fcntl(test_pipe_w, 4096)
                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
OSError: [Errno 22] Invalid argument

test_fcntl failed (1 error)

== Tests result: FAILURE ==

1 test failed:
    test_fcntl

Total duration: 545 ms
Tests result: FAILURE

Copy link
Owner Author

Choose a reason for hiding this comment

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

거기에 더하여 1029는 안되고, 1031은 되고 1033이상은 안되는 것 같네요

suc = []
for i in range(4097):
try:
pipesize_default = fcntl.fcntl(test_pipe_w, i)
Copy link
Owner Author

Choose a reason for hiding this comment

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

i가 page_size와 같은 4096이면 실패합니다.

[irteamsu@mhg-cpython-001-mgmd-jp2v-dev cpython]$ ./python -m test test_fcntl
0:00:00 load avg: 0.42 Run tests sequentially
0:00:00 load avg: 0.42 [1/1] test_fcntl
mhg7
mhg9
mhg10 ret: 0, errno: 0, async_err: 0, args: 3 1026 -2147483648
mhg12
4096
start mhg
mhg10 ret: -1, errno: 22, async_err: 0, args: 4 4096 0
mhg11
mhg7
mhg9
mhg10 ret: 0, errno: 25, async_err: 0, args: 3 4 2048
mhg12
mhg2
mhg4
mhg6
mhg7
mhg9
mhg10 ret: 0, errno: 25, async_err: 0, args: 3 4 2048
mhg12
mhg2
mhg4
mhg6
struct.pack:  b'\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'
struct.pack:  b'\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'
test test_fcntl failed -- Traceback (most recent call last):
  File "/home1/irteamsu/docs/cpython/Lib/test/test_fcntl.py", line 204, in test_fcntl_f_pipesize
    pipesize_default = fcntl.fcntl(test_pipe_w, 4096)
                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
OSError: [Errno 22] Invalid argument

test_fcntl failed (1 error)

== Tests result: FAILURE ==

1 test failed:
    test_fcntl

Total duration: 534 ms
Tests result: FAILURE

Copy link
Owner Author

Choose a reason for hiding this comment

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

성공할경우의 로그입니다.

[irteamsu@mhg-cpython-001-mgmd-jp2v-dev cpython]$ ./python -m test test_fcntl
0:00:00 load avg: 0.46 Run tests sequentially
0:00:00 load avg: 0.46 [1/1] test_fcntl
mhg7
mhg9
mhg10 ret: 0, errno: 0, async_err: 0, args: 3 1026 -2147483648
mhg12
4096
start mhg
mhg10 ret: 65536, errno: 0, async_err: 0, args: 4 1032 0
mhg12
end mhg
mhg7
mhg9
mhg10 ret: 32768, errno: 0, async_err: 0, args: 4 1031 32768
mhg12
mhg10 ret: 32768, errno: 0, async_err: 0, args: 4 1032 0
mhg12
mhg7
mhg9
mhg10 ret: 0, errno: 25, async_err: 0, args: 3 4 2048
mhg12
mhg2
mhg4
mhg6
mhg7
mhg9
mhg10 ret: 0, errno: 25, async_err: 0, args: 3 4 2048
mhg12
mhg2
mhg4
mhg6
struct.pack:  b'\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'
struct.pack:  b'\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'

== Tests result: SUCCESS ==

1 test OK.

Total duration: 515 ms
Tests result: SUCCESS

except:
continue
suc.append(i)
print('end mhg', suc)
Copy link
Owner Author

Choose a reason for hiding this comment

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

suc에 담기는 값은 다음과 같습니다.
end mhg [0, 1, 2, 3, 4, 8, 9, 10, 11, 1025, 1026, 1030, 1031, 1032]

@corona10
Copy link

corona10 commented Feb 21, 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.
Since this feature appears to be Linux specific, the check should:
Use os.sysconf('SC_PAGESIZE') as a minimum
Fix the typos ("SkitTest") in test_fcntl_f_pipesize and test_pipesizes

https://github.com/python/cpython/blob/6a5104f4fa83ed08fe31f712757dddabfede394c/Lib/test/test_fcntl.py#LL202C27-L202C30
에서 512로 하드코딩된 값을 os.sysconf('SC_PAGESIZE')로 설정해서 테스트 코드를 x86의 경우에 적절하게 스킵되도록 하는것이 목적인것 같은데 혹시 같은 이해일까요?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants