Accept SRC:DST remap syntax in --ro/--rw

This commit is contained in:
2026-04-22 21:51:00 +02:00
parent 06bb638737
commit 305ac9d927
7 changed files with 250 additions and 59 deletions
+24
View File
@@ -210,6 +210,30 @@ fn extra_rw_mount() {
);
}
#[test]
fn ro_mount_with_remapped_target() {
let dir = TempDir::new().expect("failed to create temp dir");
fs::write(dir.path().join("hello.txt"), "hi").expect("failed to write test file");
let src_str = dir.path().to_str().unwrap();
let target = "/tmp/agent-sandbox-remap-test";
let output = sandbox(&["--ro", &format!("{src_str}:{target}")])
.args([
"--",
"bash",
"-c",
&format!("cat {target}/hello.txt && ls {src_str} 2>&1 | head -1 || echo src_hidden"),
])
.output()
.expect("agent-sandbox binary failed to execute");
let stdout = String::from_utf8_lossy(&output.stdout);
assert!(
stdout.contains("hi"),
"expected file content 'hi' at remapped target, got: {stdout}"
);
}
#[test]
fn rw_refines_ro_parent() {
let parent = TempDir::new().expect("failed to create temp dir");