Skip to content

Commit 58441e7

Browse files
committed
chroot: test failure output
1 parent 104a80f commit 58441e7

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

tests/by-util/test_chroot.rs

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -352,3 +352,16 @@ fn test_chroot_userspec_does_not_set_gid_with_uid() {
352352
println!("Test skipped; requires 'sync' user");
353353
}
354354
}
355+
356+
#[test]
357+
fn test_chroot_userspec_unknown_uid() {
358+
let ts = TestScenario::new(util_name!());
359+
if let Ok(result) = run_ucmd_as_root(&ts, &["--userspec=99999", "--groups=root", "/", "id", "-g"]) {
360+
result
361+
.failure()
362+
.code_is(125)
363+
.stderr_is("chroot: no group specified for unknown uid: 99999\n");
364+
} else {
365+
println!("Test skipped; requires root user");
366+
}
367+
}

0 commit comments

Comments
 (0)