diff --git a/Cargo.toml b/Cargo.toml index 5cc8c679a103..a418e99dcff1 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -115,3 +115,7 @@ doc = false vendored-openssl = ["openssl/vendored"] vendored-libgit2 = ["libgit2-sys/vendored"] pretty-env-logger = ["pretty_env_logger"] + +# Temporary patch. Will remove once the upstream PR gets merged. +[patch.crates-io] +jobserver = { git = "https://github.com/weihanglo/jobserver-rs", branch = "jobserver-style-fifo" } diff --git a/tests/testsuite/jobserver.rs b/tests/testsuite/jobserver.rs index c645e0d72268..9ccff141e1e1 100644 --- a/tests/testsuite/jobserver.rs +++ b/tests/testsuite/jobserver.rs @@ -22,20 +22,24 @@ fn main() { #[cfg(unix)] fn validate(s: &str) { - use std::fs::File; + use std::fs::{self, File}; use std::io::*; use std::os::unix::prelude::*; - let fds = s.split(',').collect::>(); - println!("{}", s); - assert_eq!(fds.len(), 2); - unsafe { - let mut read = File::from_raw_fd(fds[0].parse().unwrap()); - let mut write = File::from_raw_fd(fds[1].parse().unwrap()); + if let Some((r, w)) = s.split_once(',') { + // `--jobserver-auth=R,W` + unsafe { + let mut read = File::from_raw_fd(r.parse().unwrap()); + let mut write = File::from_raw_fd(w.parse().unwrap()); - let mut buf = [0]; - assert_eq!(read.read(&mut buf).unwrap(), 1); - assert_eq!(write.write(&buf).unwrap(), 1); + let mut buf = [0]; + assert_eq!(read.read(&mut buf).unwrap(), 1); + assert_eq!(write.write(&buf).unwrap(), 1); + } + } else { + // `--jobserver-auth=fifo:PATH` is the default since GNU Make 4.4 + let (_, path) = s.split_once(':').expect("fifo:PATH"); + assert!(fs::metadata(path).unwrap().file_type().is_fifo()); } }