Accept SRC:DST remap syntax in --ro/--rw
This commit is contained in:
@@ -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");
|
||||
|
||||
Reference in New Issue
Block a user