Added unit tests for stty.rs to improve test coverage
This adds comprehensive unit test coverage for the core functions in stty.rs. Tests cover flag parsing, control character handling, combination settings, termios modifications, and trait implementations.
Fixes #9061
I would have preferred actual integration test ( in tests/by-util) Not unit test
CodSpeed Performance Report
Merging #9094 will not alter performance
Comparing naoNao89:stty-add-unit-tests (70c9158) with main (7c62885)
Summary
✅ 127 untouched
⏩ 6 skipped[^skipped]
[^skipped]: 6 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports.
GNU testsuite comparison:
Skip an intermittent issue tests/misc/tee (fails in this run but passes in the 'main' branch)
GNU testsuite comparison:
Skipping an intermittent issue tests/misc/tee (passes in this run but fails in the 'main' branch)
a lot of tests just do succeed(). We should check the output too
GNU testsuite comparison:
Skipping an intermittent issue tests/tail/overlay-headers (passes in this run but fails in the 'main' branch)
according to codecov: it only improved the code coverage by 2% https://app.codecov.io/gh/uutils/coreutils/pull/9094/indirect-changes did you check if it is correct ? :)
currently using llvm-cov for coverage measurement, but something is wrong with it :v
Our 23% coverage reflects the TTY limitation, not poor testing.
GNU coreutils stty ALSO requires real TTY: https://github.com/coreutils/coreutils/blob/master/tests/stty/stty-invalid.sh
Both skip tests in CI. ~75% of stty code is TTY-dependent (terminal I/O, signals, device ops) and cannot be tested in CI.
GNU testsuite comparison:
Skipping an intermittent issue tests/misc/tee (passes in this run but fails in the 'main' branch)
GNU testsuite comparison:
Skipping an intermittent issue tests/misc/tee (passes in this run but fails in the 'main' branch)
GNU testsuite comparison:
Skip an intermittent issue tests/timeout/timeout (fails in this run but passes in the 'main' branch)
Skipping an intermittent issue tests/misc/tee (passes in this run but fails in the 'main' branch)
GNU testsuite comparison:
Skipping an intermittent issue tests/misc/tee (passes in this run but fails in the 'main' branch)
GNU testsuite comparison:
Skip an intermittent issue tests/timeout/timeout (fails in this run but passes in the 'main' branch)
my local: 1.90.0 stable, CI might use different version 🙉
GNU testsuite comparison:
Skipping an intermittent issue tests/tail/overlay-headers (passes in this run but fails in the 'main' branch)
GNU testsuite comparison:
Skipping an intermittent issue tests/misc/tee (passes in this run but fails in the 'main' branch)
GNU testsuite comparison:
Skipping an intermittent issue tests/misc/tee (passes in this run but fails in the 'main' branch)
GNU testsuite comparison:
Skipping an intermittent issue tests/misc/tee (passes in this run but fails in the 'main' branch)
GNU testsuite comparison:
Skipping an intermittent issue tests/misc/tee (passes in this run but fails in the 'main' branch)
GNU testsuite comparison:
Skip an intermittent issue tests/tail/overlay-headers (fails in this run but passes in the 'main' branch)
http://github.com/uutils/coreutils/pull/9348 I made a PR that gives an example of a way to create a TTY for the integration tests. Was hoping to use that for stty and more.
tks
GNU testsuite comparison:
Congrats! The gnu test tests/du/files0-from is no longer failing!
GNU testsuite comparison:
Skip an intermittent issue tests/misc/tee (fails in this run but passes in the 'main' branch)
Skip an intermittent issue tests/tail/overlay-headers (fails in this run but passes in the 'main' branch)