◐ Shell
reader mode source ↗
Skip to content

bpo-41818: Updated tests for the standard pty library#22962

Merged
asvetlov merged 10 commits into
python:masterfrom
8vasu:new_pty_tests
Nov 25, 2020
Merged

bpo-41818: Updated tests for the standard pty library#22962
asvetlov merged 10 commits into
python:masterfrom
8vasu:new_pty_tests

Conversation

@8vasu

@8vasu 8vasu commented Oct 25, 2020

Copy link
Copy Markdown
Contributor

This converts the test for pty.master_open() to a test for pty.openpty() with additional tests such as checking slave termios, slave winsize; these additional tests are expected to fail.

This also adds a small test that is expected to fail on FreeBSD and should pass on Linux; reflecting pty.spawn()'s FreeBSD hang issue [ bpo-26228 ].

Solutions to these problems have been implemented here: https://github.com/8vasu/pypty2

If and when these tests are acknowledged, the solutions will be submitted in parts.

This follows the conversation here: #21861

Signed-off-by: Soumendra Ganguly soumendraganguly@gmail.com

https://bugs.python.org/issue41818

Signed-off-by: Soumendra Ganguly <soumendraganguly@gmail.com>
@8vasu

8vasu commented Oct 25, 2020

Copy link
Copy Markdown
Contributor Author

@ethanfurman @aeros

Sir, thank you very much for being patient. Please run the tests when you have time. I welcome suggestions/criticism. I have also sent a message to the teaching email thread.

…FILENO is a tty

Signed-off-by: Soumendra Ganguly <soumendraganguly@gmail.com>
…nBSD

Signed-off-by: Soumendra Ganguly <soumendraganguly@gmail.com>
@gpshead gpshead added the 🔨 test-with-buildbots Test PR w/ buildbots; report in status section label Oct 26, 2020
@bedevere-bot

Copy link
Copy Markdown

🤖 New build scheduled with the buildbot fleet by @gpshead for commit 2a3cba4d8e906af233fc22b1be648bae05e7f08b 🤖

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

@bedevere-bot bedevere-bot removed the 🔨 test-with-buildbots Test PR w/ buildbots; report in status section label Oct 26, 2020

@gpshead gpshead left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Hide comment

i kicked off a test on the buildbots for some additional platform coverage out out curiosity. Note: our buildbot fleet may generate a lot of noise, they aren't all reliably and some were already failing on the main branch to begin with right now. so don't fret if it claims there are failures. only look for obviously related things within them if you go looking at those. :)

@gpshead gpshead requested review from aeros and ethanfurman October 26, 2020 06:10
Signed-off-by: Soumendra Ganguly <soumendraganguly@gmail.com>
@8vasu

8vasu commented Oct 26, 2020

Copy link
Copy Markdown
Contributor Author

@gpshead I have removed those comments :)

@aeros aeros left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Hide comment

I've completed a preliminary review of the test changes. Most of the suggested changes are fairly minor, for the most part I think this is good to go (although for the final approval/merge, I'd prefer to leave it to @ethanfurman or @Yhg1s since I'm no expert with pty or tty).

@8vasu

8vasu commented Oct 27, 2020

Copy link
Copy Markdown
Contributor Author

@aeros I am grateful for the reviews. I will keep working on this with the hope that we can finally put these old bugs to rest.

@aeros aeros requested a review from Yhg1s October 30, 2020 18:03
Signed-off-by: Soumendra Ganguly <soumendraganguly@gmail.com>
@8vasu

8vasu commented Nov 2, 2020

Copy link
Copy Markdown
Contributor Author

@aeros Thank you for being patient. I have made the following changes as per your suggestions:

  1. I had added a comment saying that the tty could be left in an abnormal state [ only winsize, not termios/terminfo ]. I have solved the problem by adding an addCleanup(). I have also renamed some variables, added functions [ _get_term_winsz() and _set_term_winsz() ] to increase readability.

  2. I have changed the debug() in the except clause of the second try-except block in test_openpty() to a warnings.warn() as per your suggestion.

  3. I realized why I added the extra "RELEVANT ANYMORE" comment. The following comment mentions pty.master _open(), which opens the slave and subsequently closes it. As a result, the original test_basic() function was having t
    o call pty.slave_open() to re-open the slave. However, the new test_openpty() calls pty.openpty(), which, unlike pty.ma ster_open(), does not close the slave end. Anyway, that part does not seem to affect the test on Linux and FreeBSD.
    I have removed the "RELEVANT ANYMORE" comments.

  4. Removed the "pty.openpty() passed" and "pty.fork() passed" comments.

  5. Replaced % with f-strings. However, I have not trimmed down the debug messages yet because test_fork() has similar debug messages in it. I will remove them all at once if you wish.

  6. Added the existing empty line between class and subsequent function definition.

8vasu added 3 commits November 2, 2020 16:16
Signed-off-by: Soumendra Ganguly <soumendraganguly@gmail.com>
Signed-off-by: Soumendra Ganguly <soumendraganguly@gmail.com>
Signed-off-by: Soumendra Ganguly <soumendraganguly@gmail.com>
Signed-off-by: Soumendra Ganguly <soumendraganguly@gmail.com>
28 hidden items Load more…

@asvetlov asvetlov left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Hide comment

LGTM, I think we can merge the PR and unblock @8vasu to work on future PTY improvements.

@bedevere-bot

Copy link
Copy Markdown

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

Hi! The buildbot x86 Gentoo Installed with X 3.x has failed when building commit c13d899.

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/all/#builders/464/builds/445) and take a look at the build logs.
  4. Check if the failure is related to this commit (c13d899) 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/all/#builders/464/builds/445

Failed tests:

  • test_pty

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

== Tests result: FAILURE then FAILURE ==

411 tests OK.

1 test failed:
test_pty

13 tests skipped:
test_asdl_parser test_check_c_globals test_clinic test_devpoll
test_gdb test_ioctl test_kqueue test_msilib test_startfile
test_winconsoleio test_winreg test_winsound test_zipfile64

1 re-run test:
test_pty

Total duration: 28 min 6 sec

Click to see traceback logs
remote: Enumerating objects: 18, done.        
remote: Counting objects:   5% (1/18)        
remote: Counting objects:  11% (2/18)        
remote: Counting objects:  16% (3/18)        
remote: Counting objects:  22% (4/18)        
remote: Counting objects:  27% (5/18)        
remote: Counting objects:  33% (6/18)        
remote: Counting objects:  38% (7/18)        
remote: Counting objects:  44% (8/18)        
remote: Counting objects:  50% (9/18)        
remote: Counting objects:  55% (10/18)        
remote: Counting objects:  61% (11/18)        
remote: Counting objects:  66% (12/18)        
remote: Counting objects:  72% (13/18)        
remote: Counting objects:  77% (14/18)        
remote: Counting objects:  83% (15/18)        
remote: Counting objects:  88% (16/18)        
remote: Counting objects:  94% (17/18)        
remote: Counting objects: 100% (18/18)        
remote: Counting objects: 100% (18/18), done.        
remote: Compressing objects:  10% (1/10)        
remote: Compressing objects:  20% (2/10)        
remote: Compressing objects:  30% (3/10)        
remote: Compressing objects:  40% (4/10)        
remote: Compressing objects:  50% (5/10)        
remote: Compressing objects:  60% (6/10)        
remote: Compressing objects:  70% (7/10)        
remote: Compressing objects:  80% (8/10)        
remote: Compressing objects:  90% (9/10)        
remote: Compressing objects: 100% (10/10)        
remote: Compressing objects: 100% (10/10), done.        
remote: Total 10 (delta 8), reused 1 (delta 0), pack-reused 0        
From https://github.com/python/cpython
 * branch                  master     -> FETCH_HEAD
Reset branch 'master'

	not a dynamic executable

	not a dynamic executable
	not a dynamic executable
  WARNING: The script easy_install-3.10 is installed in '/buildbot/buildarea/cpython/3.x.ware-gentoo-x86.installed/build/target/bin' which is not on PATH.
  Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location.
  WARNING: The scripts pip3 and pip3.10 are installed in '/buildbot/buildarea/cpython/3.x.ware-gentoo-x86.installed/build/target/bin' which is not on PATH.
  Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location.

@bedevere-bot

Copy link
Copy Markdown

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

Hi! The buildbot x86 Gentoo Non-Debug with X 3.x has failed when building commit c13d899.

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/all/#builders/58/builds/442) and take a look at the build logs.
  4. Check if the failure is related to this commit (c13d899) 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/all/#builders/58/builds/442

Failed tests:

  • test_pty

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

== Tests result: FAILURE then FAILURE ==

414 tests OK.

10 slowest tests:

  • test_peg_generator: 7 min 5 sec
  • test_tokenize: 3 min 45 sec
  • test_concurrent_futures: 3 min 45 sec
  • test_multiprocessing_spawn: 2 min 58 sec
  • test_asyncio: 2 min 39 sec
  • test_lib2to3: 2 min 31 sec
  • test_unparse: 2 min 25 sec
  • test_multiprocessing_forkserver: 1 min 54 sec
  • test_multiprocessing_fork: 1 min 21 sec
  • test_io: 1 min 15 sec

1 test failed:
test_pty

10 tests skipped:
test_devpoll test_gdb test_ioctl test_kqueue test_msilib
test_startfile test_winconsoleio test_winreg test_winsound
test_zipfile64

1 re-run test:
test_pty

Total duration: 35 min 23 sec

Click to see traceback logs
remote: Enumerating objects: 18, done.        
remote: Counting objects:   5% (1/18)        
remote: Counting objects:  11% (2/18)        
remote: Counting objects:  16% (3/18)        
remote: Counting objects:  22% (4/18)        
remote: Counting objects:  27% (5/18)        
remote: Counting objects:  33% (6/18)        
remote: Counting objects:  38% (7/18)        
remote: Counting objects:  44% (8/18)        
remote: Counting objects:  50% (9/18)        
remote: Counting objects:  55% (10/18)        
remote: Counting objects:  61% (11/18)        
remote: Counting objects:  66% (12/18)        
remote: Counting objects:  72% (13/18)        
remote: Counting objects:  77% (14/18)        
remote: Counting objects:  83% (15/18)        
remote: Counting objects:  88% (16/18)        
remote: Counting objects:  94% (17/18)        
remote: Counting objects: 100% (18/18)        
remote: Counting objects: 100% (18/18), done.        
remote: Compressing objects:  10% (1/10)        
remote: Compressing objects:  20% (2/10)        
remote: Compressing objects:  30% (3/10)        
remote: Compressing objects:  40% (4/10)        
remote: Compressing objects:  50% (5/10)        
remote: Compressing objects:  60% (6/10)        
remote: Compressing objects:  70% (7/10)        
remote: Compressing objects:  80% (8/10)        
remote: Compressing objects:  90% (9/10)        
remote: Compressing objects: 100% (10/10)        
remote: Compressing objects: 100% (10/10), done.        
remote: Total 10 (delta 8), reused 1 (delta 0), pack-reused 0        
From https://github.com/python/cpython
 * branch                  master     -> FETCH_HEAD
Reset branch 'master'

	not a dynamic executable

	not a dynamic executable

@asvetlov

Copy link
Copy Markdown
Contributor

The test fails with 'unexpected success' error, perhaps expectedFailure() should not be applied for this configuration.
Investigating.

@ethanfurman

Copy link
Copy Markdown
Member

Or perhaps Gentoo is one of the cases where it succeeds, and the the expected failure wrapper should not be applied in that case.

@asvetlov

Copy link
Copy Markdown
Contributor

#23514 is created for fix

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

Labels

tests Tests in the Lib/test dir

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants