stty: run the tests that were ignored for lack of a tty - #14381
Open
harshasiddartha wants to merge 1 commit into
Open
stty: run the tests that were ignored for lack of a tty#14381harshasiddartha wants to merge 1 commit into
harshasiddartha wants to merge 1 commit into
Conversation
Thirty-one tests in tests/by-util/test_stty.rs were marked #[ignore = "Fails because cargo test does not run in a tty"], so `cargo test` never executed them. They did not need a real terminal: they either used stdin, or called `terminal_simulation(true)`, which gives every invocation its own pty, so a setting applied by one invocation could never be observed by the next one. Point them at a single pty via `pty_path()` and `--file`, the way the tests in the same file that already run do, and correct the assertions that were written against output stty does not produce (`size` prints "<rows> <columns>", and settings equal to the sane defaults only show up under `--all`). Running them uncovered that setting a character size did nothing: `cs5`/`cs6`/`cs7` were OR'd into the control flags without clearing CSIZE first, so `stty cs7` on a terminal already set to `cs8` left it at `cs8`. Clear a flag's group before setting it. `speed` is not implemented, so test_print_speed stays ignored, now with a reason that says why.
|
GNU testsuite comparison: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Thirty-one tests in
tests/by-util/test_stty.rswere marked#[ignore = "Fails because cargo test does not run in a tty"], so they never ran. They did not actually need the harness to be attached to a terminal: they either used stdin, or calledterminal_simulation(true), which gives everynew_ucmd!()invocation its own pty, so a setting applied by one invocation could never be seen by the--allread-back in the next one.They now share a single pty via
pty_path()and--file, the way the tests in the same file that already run do. A few assertions were written against output stty does not produce and are corrected:sizeprints<rows> <columns>, and settings that equal the sane defaults only show up under--all.Running them uncovered a real bug.
cs5/cs6/cs7are declared as members of theCSIZEgroup, but the bit was OR'd into the control flags without clearing the group first, sostty cs7on a terminal already set tocs8exited 0 and left it atcs8. A flag's group is now cleared before the flag is set.The read-back assertions compare whole whitespace-delimited tokens rather than substrings.
stdout_contains("parenb")also matches-parenb, so those checks passed whether or not the setting had been applied; the same held foricanonandopost. Flipping a setting in one of the converted tests now fails it, where the substring form passed.On macOS the file goes from 51 passing / 32 ignored to 81 passing / 2 ignored.
speedis not implemented in this stty, sotest_print_speedstays ignored, now with a reason that says so, andspecial_settingsasserts the operand's current rejection so it is still covered.Fixes #14370