Skip to content

gh-132742: Improve tests for fcntl.ioctl() #132791

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

Merged
merged 9 commits into from
Apr 28, 2025

Conversation

serhiy-storchaka
Copy link
Member

@serhiy-storchaka serhiy-storchaka commented Apr 22, 2025

  • Do not skip ALL ioctl() tests when /dev/tty is not available. Done in other PR.
  • Use better tests for integer argument.
  • Add also parallel tests for tcflush() and tcflow().

* Do not skip ALL ioctl() tests when /dev/tty is not available.
* Use better tests for integer argument.
* Add also parallel tests for tcflush() and tcflow().
@bedevere-app bedevere-app bot added awaiting core review tests Tests in the Lib/test dir labels Apr 22, 2025
@serhiy-storchaka
Copy link
Member Author

For some reasons tcflush() and tcflow() work differently on Linux/OpenIndiana vs BSD/macOS.

@serhiy-storchaka serhiy-storchaka marked this pull request as ready for review April 24, 2025 09:57
@serhiy-storchaka serhiy-storchaka added the 🔨 test-with-buildbots Test PR w/ buildbots; report in status section label Apr 24, 2025
@bedevere-bot
Copy link

🤖 New build scheduled with the buildbot fleet by @serhiy-storchaka for commit 7efcbf9 🤖

Results will be shown at:

https://buildbot.python.org/all/#/grid?branch=refs%2Fpull%2F132791%2Fmerge

If you want to schedule another build, you need to add the 🔨 test-with-buildbots label again.

@bedevere-bot bedevere-bot removed the 🔨 test-with-buildbots Test PR w/ buildbots; report in status section label Apr 24, 2025
Copy link

@auvipy auvipy left a comment

Choose a reason for hiding this comment

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

looks good

@serhiy-storchaka serhiy-storchaka merged commit ed8e886 into python:main Apr 28, 2025
42 checks passed
@serhiy-storchaka serhiy-storchaka deleted the test-ioctl2 branch April 28, 2025 07:42
@serhiy-storchaka serhiy-storchaka added the needs backport to 3.13 bugs and security fixes label Apr 28, 2025
@miss-islington-app
Copy link

Thanks @serhiy-storchaka for the PR 🌮🎉.. I'm working now to backport this PR to: 3.13.
🐍🍒⛏🤖

@miss-islington-app
Copy link

Sorry, @serhiy-storchaka, I could not cleanly backport this to 3.13 due to a conflict.
Please backport using cherry_picker on command line.

cherry_picker ed8e886f4f59df4eceefeb7eef2e3d146967df34 3.13

serhiy-storchaka added a commit to serhiy-storchaka/cpython that referenced this pull request Apr 28, 2025
)

* Use better tests for integer argument.
* Add also parallel tests for tcflush() and tcflow().
(cherry picked from commit ed8e886)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
@bedevere-app
Copy link

bedevere-app bot commented Apr 28, 2025

GH-133066 is a backport of this pull request to the 3.13 branch.

@bedevere-app bedevere-app bot removed the needs backport to 3.13 bugs and security fixes label Apr 28, 2025
@bedevere-bot
Copy link

⚠️⚠️⚠️ Buildbot failure ⚠️⚠️⚠️

Hi! The buildbot aarch64 Android 3.x (tier-3) has failed when building commit ed8e886.

What do you need to do:

  1. Don't panic.
  2. Check the buildbot page in the devguide if you don't know what the buildbots are or how they work.
  3. Go to the page of the buildbot that failed (https://buildbot.python.org/#/builders/1594/builds/2107) and take a look at the build logs.
  4. Check if the failure is related to this commit (ed8e886) or if it is a false positive.
  5. If the failure is related to this commit, please, reflect that on the issue and make a new Pull Request with a fix.

You can take a look at the buildbot page here:

https://buildbot.python.org/#/builders/1594/builds/2107

Failed tests:

  • test_ioctl
  • test_termios

Failed subtests:

  • test_tcflush_clear_input_or_output - test.test_termios.TestFunctions.test_tcflush_clear_input_or_output
  • test_ioctl_clear_input_or_output - test.test_ioctl.IoctlTestsPty.test_ioctl_clear_input_or_output

Summary of the results of the build (if available):

==

Click to see traceback logs
Traceback (most recent call last):
  File "/data/user/0/org.python.testbed/files/python/lib/python3.14/test/test_termios.py", line 173, in test_tcflush_clear_input_or_output
    self.assertEqual(os.read(rfd, 1024), b'ABCDEF')
    ~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AssertionError: b'ef' != b'ABCDEF'


Traceback (most recent call last):
  File "/data/user/0/org.python.testbed/files/python/lib/python3.14/test/test_termios.py", line 173, in test_tcflush_clear_input_or_output
    self.assertEqual(os.read(rfd, 1024), b'ABCDEF')
    ~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AssertionError: b'efABCDEF' != b'ABCDEF'


Traceback (most recent call last):
  File "/data/user/0/org.python.testbed/files/python/lib/python3.14/test/test_ioctl.py", line 164, in test_ioctl_clear_input_or_output
    self.assertEqual(os.read(rfd, 1024), b'ABCDEF')
    ~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AssertionError: b'ef' != b'ABCDEF'

@bedevere-bot
Copy link

⚠️⚠️⚠️ Buildbot failure ⚠️⚠️⚠️

Hi! The buildbot AMD64 Android 3.x (tier-3) has failed when building commit ed8e886.

What do you need to do:

  1. Don't panic.
  2. Check the buildbot page in the devguide if you don't know what the buildbots are or how they work.
  3. Go to the page of the buildbot that failed (https://buildbot.python.org/#/builders/1591/builds/1933) and take a look at the build logs.
  4. Check if the failure is related to this commit (ed8e886) or if it is a false positive.
  5. If the failure is related to this commit, please, reflect that on the issue and make a new Pull Request with a fix.

You can take a look at the buildbot page here:

https://buildbot.python.org/#/builders/1591/builds/1933

Failed tests:

  • test_ioctl
  • test_termios

Failed subtests:

  • test_tcflush_clear_input_or_output - test.test_termios.TestFunctions.test_tcflush_clear_input_or_output
  • test_ioctl_clear_input_or_output - test.test_ioctl.IoctlTestsPty.test_ioctl_clear_input_or_output

Summary of the results of the build (if available):

==

Click to see traceback logs
Traceback (most recent call last):
  File "/data/user/0/org.python.testbed/files/python/lib/python3.14/test/test_termios.py", line 173, in test_tcflush_clear_input_or_output
    self.assertEqual(os.read(rfd, 1024), b'ABCDEF')
    ~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AssertionError: b'ef' != b'ABCDEF'


Traceback (most recent call last):
  File "/data/user/0/org.python.testbed/files/python/lib/python3.14/test/test_termios.py", line 173, in test_tcflush_clear_input_or_output
    self.assertEqual(os.read(rfd, 1024), b'ABCDEF')
    ~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AssertionError: b'efABCDEF' != b'ABCDEF'


Traceback (most recent call last):
  File "/data/user/0/org.python.testbed/files/python/lib/python3.14/test/test_ioctl.py", line 164, in test_ioctl_clear_input_or_output
    self.assertEqual(os.read(rfd, 1024), b'ABCDEF')
    ~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AssertionError: b'ef' != b'ABCDEF'

serhiy-storchaka added a commit that referenced this pull request Apr 28, 2025
)

* Use better tests for integer argument.
* Add also parallel tests for tcflush() and tcflow().
(cherry picked from commit ed8e886)
@serhiy-storchaka
Copy link
Member Author

#133070 should fix the newly added tests on Android.

@bedevere-bot
Copy link

⚠️⚠️⚠️ Buildbot failure ⚠️⚠️⚠️

Hi! The buildbot aarch64 RHEL8 LTO 3.x (tier-2) has failed when building commit ed8e886.

What do you need to do:

  1. Don't panic.
  2. Check the buildbot page in the devguide if you don't know what the buildbots are or how they work.
  3. Go to the page of the buildbot that failed (https://buildbot.python.org/#/builders/338/builds/8637) and take a look at the build logs.
  4. Check if the failure is related to this commit (ed8e886) or if it is a false positive.
  5. If the failure is related to this commit, please, reflect that on the issue and make a new Pull Request with a fix.

You can take a look at the buildbot page here:

https://buildbot.python.org/#/builders/338/builds/8637

Summary of the results of the build (if available):

==

Click to see traceback logs
Traceback (most recent call last):
  File "/home/buildbot/buildarea/3.x.cstratak-RHEL8-aarch64.lto/build/Lib/threading.py", line 1079, in _bootstrap_inner
    self._context.run(self.run)
    ~~~~~~~~~~~~~~~~~^^^^^^^^^^
  File "/home/buildbot/buildarea/3.x.cstratak-RHEL8-aarch64.lto/build/Lib/threading.py", line 1021, in run
    self._target(*self._args, **self._kwargs)
    ~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/buildbot/buildarea/3.x.cstratak-RHEL8-aarch64.lto/build/Lib/test/test_interpreters/test_stress.py", line 47, in run
    interp = interpreters.create()
  File "/home/buildbot/buildarea/3.x.cstratak-RHEL8-aarch64.lto/build/Lib/test/support/interpreters/__init__.py", line 76, in create
    id = _interpreters.create(reqrefs=True)
interpreters.InterpreterError: interpreter creation failed
k


Traceback (most recent call last):
  File "/home/buildbot/buildarea/3.x.cstratak-RHEL8-aarch64.lto/build/Lib/threading.py", line 1079, in _bootstrap_inner
    self._context.run(self.run)
    ~~~~~~~~~~~~~~~~~^^^^^^^^^^
  File "/home/buildbot/buildarea/3.x.cstratak-RHEL8-aarch64.lto/build/Lib/threading.py", line 1021, in run
    self._target(*self._args, **self._kwargs)
    ~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/buildbot/buildarea/3.x.cstratak-RHEL8-aarch64.lto/build/Lib/test/test_interpreters/test_stress.py", line 30, in task
    interp = interpreters.create()
  File "/home/buildbot/buildarea/3.x.cstratak-RHEL8-aarch64.lto/build/Lib/test/support/interpreters/__init__.py", line 76, in create
    id = _interpreters.create(reqrefs=True)
interpreters.InterpreterError: interpreter creation failed
k

@vstinner
Copy link
Member

There are failures on "AMD64 Android 3.x" buildbot: https://buildbot.python.org/#/builders/1591/builds/1936

FAIL: test_ioctl_clear_input_or_output (test.test_ioctl.IoctlTestsPty.test_ioctl_clear_input_or_output)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/data/user/0/org.python.testbed/files/python/lib/python3.14/test/test_ioctl.py", line 164, in test_ioctl_clear_input_or_output
    self.assertEqual(os.read(rfd, 1024), b'ABCDEF')
    ~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AssertionError: b'ef' != b'ABCDEF'

FAIL: test_tcflush_clear_input_or_output (test.test_termios.TestFunctions.test_tcflush_clear_input_or_output)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/data/user/0/org.python.testbed/files/python/lib/python3.14/test/test_termios.py", line 173, in test_tcflush_clear_input_or_output
    self.assertEqual(os.read(rfd, 1024), b'ABCDEF')
    ~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AssertionError: b'ef' != b'ABCDEF'

@serhiy-storchaka:

#133070 should fix the newly added tests on Android.

Aha, let me see.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
skip news tests Tests in the Lib/test dir
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants