Skip to content

Commit

Permalink
chore: bump jobserver to respect --jobserver-auth=fifo:PATH'
Browse files Browse the repository at this point in the history
  • Loading branch information
weihanglo committed Feb 28, 2023
1 parent 65cab34 commit b9bfda5
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 12 deletions.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ im-rc = "15.0.0"
indexmap = "1"
is-terminal = "0.4.4"
itertools = "0.10.0"
jobserver = "0.1.24"
jobserver = "0.1.26"
lazy_static = "1.2.0"
lazycell = "1.2.0"
libc = "0.2"
Expand Down
2 changes: 1 addition & 1 deletion crates/cargo-util/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ anyhow = "1.0.34"
crypto-hash = "0.3.1"
filetime = "0.2.9"
hex = "0.4.2"
jobserver = "0.1.21"
jobserver = "0.1.26"
libc = "0.2.88"
log = "0.4.6"
same-file = "1.0.6"
Expand Down
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 b9bfda5

Please sign in to comment.