Skip to content

Commit

Permalink
bump jobserver to respects jobserver-style=fifo'
Browse files Browse the repository at this point in the history
  • Loading branch information
weihanglo committed Feb 25, 2023
1 parent 65cab34 commit 0a3c8bb
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 10 deletions.
4 changes: 4 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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" }
24 changes: 14 additions & 10 deletions tests/testsuite/jobserver.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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::<Vec<_>>();
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());
}
}
Expand Down

0 comments on commit 0a3c8bb

Please sign in to comment.