1
Fork 0
mirror of https://github.com/RGBCube/uutils-coreutils synced 2025-07-28 03:27:44 +00:00

chroot: add a new test to verify that 'chroot / ls -al' works

This commit is contained in:
Sylvestre Ledru 2022-09-21 17:16:19 +02:00
parent 2e26e1d2bd
commit 69b52b4a1b

View file

@ -1,4 +1,4 @@
// spell-checker:ignore (words) araba newroot userspec chdir
// spell-checker:ignore (words) araba newroot userspec chdir pwd's
use crate::common::util::*;
@ -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");
}
}