Skip to content
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

feat(completion): progress toward passing bash-completion test suite #288

Merged
merged 22 commits into from
Dec 10, 2024

Conversation

reubeno
Copy link
Owner

@reubeno reubeno commented Dec 6, 2024

These changes are an assortment focused on being able to run the bash-completion pytest/pexpect-based test suite and increase our pass rate of its tests. Along the way a number of targeted fixes and additions were made to address compatibility issues identified as side effects of these tests.

Upon initial execution of the tests we saw:

447 failed, 1043 passed, 381 skipped, 18 xfailed, 174 errors in 2361.74s (0:39:21)

(xfailed means "expected failed".) I haven't done a full re-run of the tests, but expected the pass rate to be somewhat higher with these changes.

Notable changes:

  • Overhaul of the "basic" input backend to support tab completion, and further, to support programmatic testing via pexpect and other standard pty-based testing frameworks. This required a fair bit of fiddling to avoid use of VT100-style escape sequences as well as get the output to match what other shells emit.
  • Implementation of the lastpipe option.
  • Initial partial implementation of the mapfile built-in, required by some completion helper functions. The most notable constraint is that we only support \n as a delimiter. There are other limitations as well, identified by calls to error::unimp() in the code.
  • Stub implementation of bind built-in, emitting just enough to let some completion helper functions pass. Clearly more work is required here, as well as some thought as to which functions we can/should expose.
  • Workarounds or fixes for various compat issues found with pattern matching, regex processing, and extended tests expressions.

@reubeno reubeno requested a review from Copilot December 6, 2024 20:38

Choose a reason for hiding this comment

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

Copilot reviewed 35 out of 35 changed files in this pull request and generated no suggestions.

Copy link

github-actions bot commented Dec 6, 2024

Test Results

    2 files      9 suites   1m 17s ⏱️
  553 tests   553 ✅ 0 💤 0 ❌
1 092 runs  1 092 ✅ 0 💤 0 ❌

Results for commit 7f0351b.

♻️ This comment has been updated with latest results.

Copy link

github-actions bot commented Dec 6, 2024

Performance Benchmark Report

Benchmark name Baseline (μs) Test/PR (μs) Delta (μs) Delta %
expand_one_string 3.44 μs 3.50 μs 0.06 μs ⚪ Unchanged
instantiate_shell 60.91 μs 62.51 μs 1.60 μs 🟠 +2.63%
instantiate_shell_with_init_scripts 31122.34 μs 30617.10 μs -505.24 μs ⚪ Unchanged
parse_bash_completion 2889.09 μs 2838.09 μs -51.00 μs ⚪ Unchanged
parse_sample_script 4.41 μs 4.37 μs -0.04 μs 🟢 -0.98%
run_echo_builtin_command 90.80 μs 92.49 μs 1.69 μs ⚪ Unchanged
run_one_builtin_command 108.72 μs 110.91 μs 2.19 μs ⚪ Unchanged
run_one_external_command 1936.81 μs 1976.33 μs 39.52 μs 🟠 +2.04%
run_one_external_command_directly 1008.97 μs 1013.85 μs 4.88 μs ⚪ Unchanged

Code Coverage Report: Only Changed Files listed

Package Base Coverage New Coverage Difference
brush-core/src/builtins/complete.rs 🔴 21.83% 🟠 56.43% 🟢 34.6%
brush-core/src/builtins/factory.rs 🟢 82.35% 🟢 82.5% 🟢 0.15%
brush-core/src/builtins/mapfile.rs 🔴 0% 🟢 76.6% 🟢 76.6%
brush-core/src/builtins/set.rs 🟠 70.18% 🟠 56.07% 🔴 -14.11%
brush-core/src/commands.rs 🟢 86.43% 🟢 86.83% 🟢 0.4%
brush-core/src/completion.rs 🔴 20.4% 🔴 28.42% 🟢 8.02%
brush-core/src/escape.rs 🟢 87.18% 🟢 87% 🔴 -0.18%
brush-core/src/expansion.rs 🟢 96.26% 🟢 96.21% 🔴 -0.05%
brush-core/src/extendedtests.rs 🟠 69.51% 🟠 70.3% 🟢 0.79%
brush-core/src/interp.rs 🟢 91.2% 🟢 91.23% 🟢 0.03%
brush-core/src/namedoptions.rs 🟠 53.85% 🟠 54.81% 🟢 0.96%
brush-core/src/options.rs 🟢 89.58% 🟢 89.8% 🟢 0.22%
brush-core/src/shell.rs 🟢 79.06% 🟢 77.99% 🔴 -1.07%
brush-core/src/sys/unix/terminal.rs 🔴 37.74% 🔴 32.65% 🔴 -5.09%
brush-interactive/src/basic/basic_shell.rs 🟢 100% 🟠 73.08% 🔴 -26.92%
brush-interactive/src/basic/raw_mode.rs 🔴 0% 🟢 94.12% 🟢 94.12%
brush-interactive/src/basic/term_line_reader.rs 🔴 0% 🔴 28.79% 🟢 28.79%
brush-parser/src/parser.rs 🟢 99.14% 🟢 99.15% 🟢 0.01%
brush-parser/src/tokenizer.rs 🟢 96% 🟢 96.03% 🟢 0.03%
brush-shell/src/events.rs 🔴 38.04% 🔴 37.23% 🔴 -0.81%
brush-shell/src/main.rs 🟢 90.91% 🟢 90.38% 🔴 -0.53%
brush-shell/src/shell_factory.rs 🔴 48.48% 🔴 34.78% 🔴 -13.7%
Overall Coverage 🟢 74.65% 🟢 74.29% 🔴 -0.36%

Minimum allowed coverage is 70%, this run produced 74.29%``76.79%

@reubeno reubeno force-pushed the completion-changes branch 2 times, most recently from 96a5e17 to e61af91 Compare December 6, 2024 23:22
@reubeno reubeno marked this pull request as ready for review December 7, 2024 01:04
@reubeno reubeno requested a review from Copilot December 7, 2024 15:39

Choose a reason for hiding this comment

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

Copilot reviewed 38 out of 38 changed files in this pull request and generated no suggestions.

@reubeno reubeno force-pushed the completion-changes branch from e61af91 to c4a3b70 Compare December 9, 2024 06:52
@reubeno reubeno merged commit 1302eb8 into main Dec 10, 2024
17 checks passed
@reubeno reubeno deleted the completion-changes branch December 10, 2024 18:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant