/// Check if a container runtime (podman or docker) is available and responsive. pub fn is_container_runtime_available() -> bool { for runtime in &["podman", "docker"] { if std::process::Command::new(runtime) .args(["info"]) .stdout(std::process::Stdio::null()) .stderr(std::process::Stdio::null()) .status() .map(|s| s.success()) .unwrap_or(false) { return true; } } false } /// Macro that skips the current test with an explicit message when /// no container runtime is available. /// /// Usage: `skip_without_runtime!();` macro_rules! skip_without_runtime { () => { if !crate::runtime::is_container_runtime_available() { eprintln!("SKIPPED: no container runtime (podman/docker) found"); return; } }; } /// Macro that skips the current test with an explicit message when /// git is not available. macro_rules! skip_without_git { () => { if !crate::git_helpers::is_git_available() { eprintln!("SKIPPED: git not found"); return; } }; } /// Return the name of an available container runtime ("podman" or "docker"), /// falling back to "podman" when neither is responsive. pub fn detect_container_runtime() -> &'static str { for runtime in &["podman", "docker"] { if std::process::Command::new(runtime) .args(["info"]) .stdout(std::process::Stdio::null()) .stderr(std::process::Stdio::null()) .status() .map(|s| s.success()) .unwrap_or(false) { return runtime; } } "podman" } pub(crate) use skip_without_git; pub(crate) use skip_without_runtime;