-
-
Notifications
You must be signed in to change notification settings - Fork 33.6k
gh-140482: Add some code to help debug the broken echo annoyance #140480
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -328,6 +328,9 @@ def _runtest(result: TestResult, runtests: RunTests) -> None: | |
| support.junit_xml_list = None | ||
|
|
||
|
|
||
| import termios | ||
| import subprocess | ||
|
|
||
| def run_single_test(test_name: TestName, runtests: RunTests) -> TestResult: | ||
| """Run a single test. | ||
|
|
||
|
|
@@ -346,6 +349,21 @@ def run_single_test(test_name: TestName, runtests: RunTests) -> TestResult: | |
| pgo = runtests.pgo | ||
| try: | ||
| _runtest(result, runtests) | ||
| try: | ||
| attrs = termios.tcgetattr(sys.__stdin__.fileno()) | ||
| lflags = attrs[3] | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm only abstractly aware of what you're checking here, but it makes me wonder if we can/should add this as an environment marker. Implementing this there might be better at pinpointing where things are going wrong (and also automatically restore things for you, if implemented correctly).
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Yeah, that's an interesting idea I might explore when I get a little more time. I've also vaguely thought it would be kind of cool if you could set something to run some arbitrary code around each test, but that would take more design and discussion.
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @zware I like this suggestion so much, I'm going to refocus this PR to do exactly that. My remote got messed up so either I'll resolve the conflicts or just start over with a new PR, but either way, local testing solves the problem nicely. I think my debugging efforts were unsuccessful because more than one test can actually leave the tty in a Along those lines, I wish regrtest gave me a little more information about which tests changed the env in its test summary. Scrolling up I can see things like but it would be nice if the summary, um, summarized these! Maybe that's implied in the |
||
| echo = lflags & termios.ECHO | ||
| except termios.error: | ||
| state = subprocess.run(['stty', '-a'], capture_output=True, text=True) | ||
| for word in state.stdout.split(): | ||
| if word in ('echo', '-echo'): | ||
| echo = (word == 'echo') | ||
| break | ||
| else: | ||
| print(f'{red}test {test_name} MAYBE - {state.stdout}') | ||
| echo = False | ||
| if not echo: | ||
| print(f"{red}test {test_name} BROKE -ECHO") | ||
| except: | ||
| if not pgo: | ||
| msg = traceback.format_exc() | ||
|
|
||
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 need help everything is closed out
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.
Help please