diff --git a/tests/by-util/test_chroot.rs b/tests/by-util/test_chroot.rs index adc6f1f90e1..f4c6652ba1c 100644 --- a/tests/by-util/test_chroot.rs +++ b/tests/by-util/test_chroot.rs @@ -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"); + } +}