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

Only run expectrl gix-prompt tests where supported #1644

Merged
merged 1 commit into from
Oct 24, 2024

Conversation

EliahKagan
Copy link
Member

@EliahKagan EliahKagan commented Oct 24, 2024

Two important gix-prompt tests simulate interactivity using expectrl, which (non-optionally) depends on ptyprocess. But the only (families of) Unix-like operating systems that ptyprocess currently supports are Linux, FreeBSD, and macOS.

In ptyprocess on other Unix-like systems, the call in Master::get_slave_name to the free-standing get_slave_name function fails to compile, because the latter function is not defined. This is not specific to any particular way of using ptyprocess; it occurs both when building gitoxide's tests and when building ptyprocess's tests.

error[E0425]: cannot find function `get_slave_name` in this scope
   --> /home/ek/.cargo/registry/src/index.crates.io-6f17d22bba15001f/ptyprocess-0.4.1/src/lib.rs:431:9
    |
431 |         get_slave_name(&self.fd)
    |         ^^^^^^^^^^^^^^ not found in this scope
    |
help: consider using the method on `Self`
    |
431 |         self.get_slave_name(&self.fd)
    |         +++++

For more information about this error, try `rustc --explain E0425`.
error: could not compile `ptyprocess` (lib) due to 1 previous error
warning: build failed, waiting for other jobs to finish...
error: command `/home/ek/.rustup/toolchains/stable-x86_64-unknown-illumos/bin/cargo test --no-run --message-format json-render-diagnostics` exited with code 101

That is from a cargo nextest run --no-fail-fast run in gix-prompt on OmniOS, which is an illumos system. The error message shown above is from that system, as are the full details in this gist, which shows the problem on the main branch and how the build succeeds and other gix-prompt tests are able to run and pass after the fix here.

Please note that the problem isn't illumos-specific. Any Unix-like system that is not Linux, FreeBSD, or macOS should be expected to be affected.

The problem does not prevent gix-prompt from building other than for tests, because it is a dev dependency. Specifically, ptyprocess is a transitive dependency through expectrl, which is a dev dependency of gix-prompt.

The gix-prompt tests that used expectrl were, prior to this PR, targeted to all "unix" systems. This narrows them to systems where target_os is linux, freebsd, or macos, and conditions the expectrl dev dependency on those targets. This way, running the test suite no longer fails to build on other Unix-like systems.

Two important `gix-prompt` tests simulate interactivity with
`expectrl`, which (non-optionally) depends on `ptyprocess`. But the
only (families of) Unix-like operating systems that `ptyprocess`
currently supports are Linux, FreeBSD, and macOS.

The tests that used `expectrl` were previously targeted to all
"unix" systems. This narrows them to systems where `target_os` is
`linux`, `freebsd`, or `macos`, and conditions the `expectrl` dev
dependency on those targets.

This way, running the test suite no longer fails to build on other
Unix-like systems. (In particular, this fixes the failure on
OmniOS, an illumos system. But the problem isn't illumos-specific.)
@EliahKagan EliahKagan force-pushed the run-ci/ptyprocess-targets branch from 2f6ce5f to 9f7b34a Compare October 24, 2024 00:29
Copy link
Member

@Byron Byron left a comment

Choose a reason for hiding this comment

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

Thanks a lot for your help, it's much appreciated!

@Byron Byron merged commit 22209fd into GitoxideLabs:main Oct 24, 2024
16 checks passed
@EliahKagan EliahKagan deleted the run-ci/ptyprocess-targets branch October 24, 2024 06:15
EliahKagan added a commit to EliahKagan/gitoxide that referenced this pull request Oct 24, 2024
This is cleanup realted to GitoxideLabs#1644, which further complicated the
attributes on the `#[ignore]`d `username_password_not_available`
test with an empty that was build (but never run) whenever the
`expectrl` tests of `gix-prompt` were not built. Instead of keeping
its attributes more complicated and maintaining an expectation that
they continue to be updated along with the `target_os` support for
`expectrl`'s `ptyprocess` dependency, this removes that empty test.

The purpose of the test case that this removes is unclear, and it
may not have value anymore. It is unclear in part because actual
interaction to provide a username and password is likely to work on
some systems for which the related tests that use `expectrl` are
not being built. But this empty test case might be read to say
otherwise.

See also the related discussion at:
GitoxideLabs#1644 (review)
EliahKagan added a commit to EliahKagan/gitoxide that referenced this pull request Oct 24, 2024
This is cleanup related to GitoxideLabs#1644, which further complicated the
attributes on the `#[ignore]`d `username_password_not_available`
test with an empty that was build (but never run) whenever the
`expectrl` tests of `gix-prompt` were not built. Instead of keeping
its attributes more complicated and maintaining an expectation that
they continue to be updated along with the `target_os` support for
`expectrl`'s `ptyprocess` dependency, this removes that empty test.

The purpose of the test case that this removes is unclear, and it
may not have value anymore. It is unclear in part because actual
interaction to provide a username and password is likely to work on
some systems for which the related tests that use `expectrl` are
not being built. But this empty test case might be read to say
otherwise.

See also the related discussion at:
GitoxideLabs#1644 (review)
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.

2 participants