Skip to content

Commit 473b5a8

Browse files
committed
fix(supervisor-network): support multicall sleep in procfs tests
Signed-off-by: Simon Scatton <[email protected]>
1 parent 83e846d commit 473b5a8

1 file changed

Lines changed: 5 additions & 0 deletions

File tree

  • crates/openshell-supervisor-network/src

‎crates/openshell-supervisor-network/src/procfs.rs‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -507,6 +507,8 @@ pub fn file_sha256(path: &Path) -> Result<String> {
507507
mod tests {
508508
use super::*;
509509
use std::io::Write;
510+
#[cfg(target_os = "linux")]
511+
use std::os::unix::process::CommandExt as _;
510512

511513
/// Block until `/proc/<pid>/exe` points at `target`. `Command::spawn` returns
512514
/// once the child is scheduled, not once it has completed `exec()`; on
@@ -622,6 +624,7 @@ mod tests {
622624
// `/proc/<pid>/exe`, but readlink will now return the tainted
623625
// "<path> (deleted)" string.
624626
let mut cmd = std::process::Command::new(&exe_path);
627+
cmd.arg0("sleep");
625628
cmd.arg("5");
626629
let mut child = spawn_retrying_on_etxtbsy(&mut cmd);
627630
let pid: i32 = child.id().cast_signed();
@@ -672,6 +675,7 @@ mod tests {
672675
std::fs::set_permissions(&exe_path, std::fs::Permissions::from_mode(0o755)).unwrap();
673676

674677
let mut cmd = std::process::Command::new(&exe_path);
678+
cmd.arg0("sleep");
675679
cmd.arg("5");
676680
let mut child = spawn_retrying_on_etxtbsy(&mut cmd);
677681
let pid: i32 = child.id().cast_signed();
@@ -715,6 +719,7 @@ mod tests {
715719
std::fs::set_permissions(&exe_path, std::fs::Permissions::from_mode(0o755)).unwrap();
716720

717721
let mut cmd = std::process::Command::new(&exe_path);
722+
cmd.arg0("sleep");
718723
cmd.arg("5");
719724
let mut child = spawn_retrying_on_etxtbsy(&mut cmd);
720725
let pid: i32 = child.id().cast_signed();

0 commit comments

Comments
 (0)