Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 7 additions & 35 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion libshpool/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ shpool-protocol = { version = "0.2.1", path = "../shpool-protocol" } # client-se

# rusty wrapper for unix apis
[dependencies.nix]
version = "0.28"
version = "0.29"
features = ["poll", "ioctl", "socket", "user", "process", "signal", "term", "fs"]

[dependencies.tracing-subscriber]
Expand Down
6 changes: 5 additions & 1 deletion shpool/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,12 @@ libshpool = { version = "0.8.2", path = "../libshpool" }
[dev-dependencies]
lazy_static = "1" # globals
crossbeam-channel = "0.5" # channels
nix = { version = "0.26", features = ["poll", "ioctl"] } # rusty wrapper for unix apis
tempfile = "3" # keeping tests hermetic
regex = "1" # test assertions
serde_json = "1" # json parsing
ntest = "0.9" # test timeouts

# rusty wrapper for unix apis
[dependencies.nix]
version = "0.29"
features = ["poll", "ioctl", "process", "signal", "fs"]
13 changes: 4 additions & 9 deletions shpool/tests/daemon.rs
Original file line number Diff line number Diff line change
@@ -1,11 +1,7 @@
use std::{
fmt::Write,
io::Read,
os::unix::{
io::{AsRawFd, FromRawFd},
net::UnixListener,
process::CommandExt as _,
},
os::unix::{io::AsRawFd, net::UnixListener, process::CommandExt as _},
path,
process::{Command, Stdio},
time,
Expand Down Expand Up @@ -80,8 +76,7 @@ fn systemd_activation() -> anyhow::Result<()> {

let (parent_stderr, child_stderr) =
nix::unistd::pipe().context("creating pipe to collect stderr")?;
// Safety: this is a test
let child_stderr_pipe = unsafe { Stdio::from_raw_fd(child_stderr) };
let child_stderr_pipe = Stdio::from(child_stderr);
let mut cmd = Command::new(support::shpool_bin()?);
cmd.stdout(Stdio::piped())
.stderr(child_stderr_pipe)
Expand Down Expand Up @@ -147,8 +142,8 @@ fn systemd_activation() -> anyhow::Result<()> {
nix::sys::wait::waitpid(child_pid, None).context("reaping daemon")?;

let mut stderr_buf: Vec<u8> = vec![0; 1024 * 8];
let len =
nix::unistd::read(parent_stderr, &mut stderr_buf[..]).context("reading stderr")?;
let len = nix::unistd::read(parent_stderr.as_raw_fd(), &mut stderr_buf[..])
.context("reading stderr")?;
let stderr = String::from_utf8_lossy(&stderr_buf[..len]);
assert!(stderr.contains("using systemd activation socket"));

Expand Down