STRA-101 make embedded payload lifetime test tolerate fd reuse
Linux / keyless-cuda-gate (pull_request) Skipped
Linux / verify (pull_request) Successful in 4m22s
Linux / keyless-cuda (pull_request) Skipped
Linux / static-cuda-package (pull_request) Skipped
Linux / hosted-cuda-package (pull_request) Skipped
Linux / linux-cli-container (pull_request) Successful in 4m19s
Linux / linux-static-cli (pull_request) Failing after 10m51s
Linux / release-cli (pull_request) Skipped

This commit is contained in:
Pavlo Ratushnyi
2026-10-07 22:04:20 +02:00
parent 4720ef135b
commit c4b383661a
+14 -3
View File
@@ -118,7 +118,7 @@ mod tests {
#[cfg(target_os = "linux")]
#[test]
fn sealed_payload_is_exact_immutable_and_removed_on_drop() {
use std::io::Write;
use std::{io::Write, os::unix::fs::MetadataExt};
let engine = materialize(b"immutable fixture bytes").unwrap();
let path = engine.executable.clone();
assert_eq!(std::fs::read(&path).unwrap(), b"immutable fixture bytes");
@@ -126,8 +126,19 @@ mod tests {
assert!(other.write_all(b"x").is_err());
assert!(other.set_len(0).is_err());
assert!(other.set_len(100).is_err());
drop(other);
// Keep a witness open so this inode cannot be recycled during the check.
// Parallel tests can reuse the original descriptor number after Drop.
let original = other.metadata().unwrap();
assert_eq!(std::fs::metadata(&path).unwrap().ino(), original.ino());
drop(engine);
assert!(!path.exists());
match std::fs::metadata(&path) {
Ok(current) => assert_ne!(
(current.dev(), current.ino()),
(original.dev(), original.ino()),
"original descriptor still refers to the payload after Drop"
),
Err(error) => assert_eq!(error.kind(), std::io::ErrorKind::NotFound),
}
drop(other);
}
}