From 9f7b34a18bc41423ade3261ae920e94e19d71e56 Mon Sep 17 00:00:00 2001 From: Eliah Kagan Date: Wed, 23 Oct 2024 14:28:02 -0400 Subject: [PATCH] Only run expectrl gix-prompt tests where supported 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.) --- gix-prompt/Cargo.toml | 2 ++ gix-prompt/tests/prompt.rs | 6 +++--- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/gix-prompt/Cargo.toml b/gix-prompt/Cargo.toml index ed8dfcddd5d..4de04fd8e66 100644 --- a/gix-prompt/Cargo.toml +++ b/gix-prompt/Cargo.toml @@ -27,4 +27,6 @@ parking_lot = "0.12.1" [dev-dependencies] gix-testtools = { path = "../tests/tools" } serial_test = { version = "3.1.0", default-features = false } + +[target.'cfg(any(target_os = "linux", target_os = "freebsd", target_os = "macos"))'.dev-dependencies] expectrl = "0.7.0" diff --git a/gix-prompt/tests/prompt.rs b/gix-prompt/tests/prompt.rs index 3853162e1ef..7f90e3b3885 100644 --- a/gix-prompt/tests/prompt.rs +++ b/gix-prompt/tests/prompt.rs @@ -34,7 +34,7 @@ mod ask { } #[test] - #[cfg(unix)] + #[cfg(any(target_os = "linux", target_os = "freebsd", target_os = "macos"))] fn askpass_only() { let mut cmd = std::process::Command::new(env!("CARGO")); cmd.args(["build", "--example", "use-askpass", "--example", "askpass"]); @@ -48,7 +48,7 @@ mod ask { } #[test] - #[cfg(unix)] + #[cfg(any(target_os = "linux", target_os = "freebsd", target_os = "macos"))] fn username_password() { let mut cmd = std::process::Command::new(env!("CARGO")); cmd.args(["build", "--example", "credentials"]); @@ -65,7 +65,7 @@ mod ask { } #[test] - #[cfg(not(unix))] + #[cfg(not(any(target_os = "linux", target_os = "freebsd", target_os = "macos")))] #[ignore] fn username_password_not_available() {} }