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

chroot: add 'test_default_shell`

This commit is contained in:
Jan Scheer 2021-09-19 22:21:29 +02:00
parent 94fbe1edef
commit 8db8d8ac4e
No known key found for this signature in database
GPG key ID: C62AD4C29E2B9828

View file

@ -89,3 +89,24 @@ fn test_preference_of_userspec() {
println!("result.stdout = {}", result.stdout_str());
println!("result.stderr = {}", result.stderr_str());
}
#[test]
fn test_default_shell() {
let ts = TestScenario::new(util_name!());
let at = &ts.fixtures;
let dir = "CHROOT_DIR";
at.mkdir(dir);
let shell = std::env::var("SHELL").unwrap_or_else(|_| "/bin/sh".to_string());
let expected = format!(
"chroot: failed to run command '{}': No such file or directory",
shell
);
if let Ok(result) = run_ucmd_as_root(&ts, &[dir]) {
result.stderr_contains(expected);
} else {
print!("TEST SKIPPED");
}
}