Skip to content

Commit

Permalink
chroot: add a new test to verify that 'chroot / ls -al' works
Browse files Browse the repository at this point in the history
  • Loading branch information
sylvestre committed Sep 21, 2022
1 parent 38afd5d commit 002fcb6
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions tests/by-util/test_chroot.rs
Original file line number Diff line number Diff line change
Expand Up @@ -162,3 +162,22 @@ fn test_chroot_skip_chdir() {
print!("Test skipped; requires root user");
}
}

#[test]
fn test_chroot_extra_arg() {
let ts = TestScenario::new(util_name!());
let at = &ts.fixtures;

let dir = "CHROOT_DIR";
at.mkdir(dir);
let env_cd = std::env::current_dir().unwrap();
// Verify that -P is pwd's and not chroot
if let Ok(result) = run_ucmd_as_root(&ts, &[dir, "pwd", "-P"]) {
assert_eq!(
result.success().no_stderr().stdout_str(),
env_cd.to_str().unwrap()
);
} else {
print!("Test skipped; requires root user");
}
}

0 comments on commit 002fcb6

Please sign in to comment.