Ensure passing relative paths to CLI works
This commit is contained in:
@@ -237,6 +237,53 @@ fn blacklist_overlays_survive_tmp_bind() {
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn relative_chdir_works() {
|
||||
let output = sandbox(&["--chdir", "src"])
|
||||
.args(["--", "bash", "-c", "pwd"])
|
||||
.output()
|
||||
.expect("agent-sandbox binary failed to execute");
|
||||
|
||||
assert!(
|
||||
output.status.success(),
|
||||
"relative --chdir should work, stderr: {}",
|
||||
String::from_utf8_lossy(&output.stderr)
|
||||
);
|
||||
let stdout = String::from_utf8_lossy(&output.stdout).trim().to_string();
|
||||
assert!(
|
||||
stdout.ends_with("/src"),
|
||||
"expected cwd ending in /src, got: {stdout}"
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn relative_rw_path_works() {
|
||||
let output = sandbox(&["--rw", "src"])
|
||||
.args(["--", "bash", "-c", "echo ok"])
|
||||
.output()
|
||||
.expect("agent-sandbox binary failed to execute");
|
||||
|
||||
assert!(
|
||||
output.status.success(),
|
||||
"relative --rw should work, stderr: {}",
|
||||
String::from_utf8_lossy(&output.stderr)
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn relative_ro_path_works() {
|
||||
let output = sandbox(&["--ro", "src"])
|
||||
.args(["--", "bash", "-c", "echo ok"])
|
||||
.output()
|
||||
.expect("agent-sandbox binary failed to execute");
|
||||
|
||||
assert!(
|
||||
output.status.success(),
|
||||
"relative --ro should work, stderr: {}",
|
||||
String::from_utf8_lossy(&output.stderr)
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn rw_missing_path_errors() {
|
||||
let output = sandbox(&["--rw", "/nonexistent/xyz"])
|
||||
|
||||
Reference in New Issue
Block a user