Skip to content

Commit 0690751

Browse files
committed
fix(ci): make signal probe portable and gate Linux initialization
Signed-off-by: Drew Newberry <anewberry@nvidia.com>
1 parent 3cf6200 commit 0690751

2 files changed

Lines changed: 20 additions & 6 deletions

File tree

‎crates/openshell-cli/src/ssh.rs‎

Lines changed: 19 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2230,6 +2230,18 @@ mod tests {
22302230
}
22312231
}
22322232

2233+
#[cfg(target_os = "linux")]
2234+
#[test]
2235+
fn interactive_signal_workload_child() {
2236+
let Some(marker) = std::env::var_os("OPENSHELL_SIGNAL_WAIT_MARKER") else {
2237+
return;
2238+
};
2239+
// Only publish readiness after exec has reset the parent's caught
2240+
// signal dispositions. No external utility filename is assumed.
2241+
fs::write(marker, std::process::id().to_string()).unwrap();
2242+
std::thread::sleep(Duration::from_secs(30));
2243+
}
2244+
22332245
#[cfg(target_os = "linux")]
22342246
#[test]
22352247
fn interactive_signal_wait_child() {
@@ -2238,12 +2250,14 @@ mod tests {
22382250
};
22392251
let mut command = Command::new("sh");
22402252
command
2253+
.args(["-c", "ulimit -c 0; exec \"$@\"", "signal-probe"])
2254+
.arg(std::env::current_exe().unwrap())
22412255
.args([
2242-
"-c",
2243-
"ulimit -c 0; printf '%s' $$ > \"$1\"; exec sleep 30",
2244-
"signal-probe",
2256+
"--exact",
2257+
"ssh::tests::interactive_signal_workload_child",
2258+
"--nocapture",
22452259
])
2246-
.arg(marker)
2260+
.env("OPENSHELL_SIGNAL_WAIT_MARKER", marker)
22472261
.stdin(Stdio::inherit());
22482262
let runtime = tokio::runtime::Builder::new_current_thread()
22492263
.enable_all()
@@ -2287,8 +2301,7 @@ mod tests {
22872301
let deadline = Instant::now() + Duration::from_secs(10);
22882302
loop {
22892303
if let Ok(pid) = fs::read_to_string(&marker)
2290-
&& let Ok(executable) = fs::read_link(format!("/proc/{pid}/exe"))
2291-
&& executable.file_name().is_some_and(|name| name == "sleep")
2304+
&& pid.parse::<u32>().is_ok()
22922305
{
22932306
break;
22942307
}

‎crates/openshell-sandbox/src/process.rs‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -232,6 +232,7 @@ fn apply_canonical_process_environment(
232232

233233
static BOUNDARY_USER_ENVIRONMENT: OnceLock<HashMap<String, String>> = OnceLock::new();
234234

235+
#[cfg(target_os = "linux")]
235236
pub(crate) fn install_boundary_user_environment(
236237
environment: HashMap<String, String>,
237238
) -> Result<(), String> {

0 commit comments

Comments
 (0)