Add tests for multiple mode specifications

This commit is contained in:
Martin Kunkel 2025-12-06 15:08:13 +00:00
parent 114be93e01
commit 63dbffa7f3
2 changed files with 18 additions and 0 deletions

View file

@ -99,6 +99,8 @@ fn test_create_fifo_with_mode_and_umask() {
test_fifo_creation("u-r,g-w,o+x", 0o022, "p-w-r--rwx"); // spell-checker:disable-line
test_fifo_creation("a=rwx,o-w", 0o022, "prwxrwxr-x"); // spell-checker:disable-line
test_fifo_creation("=rwx,o-w", 0o022, "prwxr-xr-x"); // spell-checker:disable-line
test_fifo_creation("ug+rw,o+r", 0o022, "prw-rw-rw-"); // spell-checker:disable-line
test_fifo_creation("u=rwx,g=rx,o=", 0o022, "prwxr-x---"); // spell-checker:disable-line
}
#[test]

View file

@ -154,6 +154,22 @@ fn test_mknod_mode_permissions() {
}
}
#[test]
fn test_mknod_mode_comma_separated() {
let ts = TestScenario::new(util_name!());
ts.ucmd()
.arg("-m")
.arg("u=rwx,g=rx,o=")
.arg("test_file")
.arg("p")
.succeeds();
assert!(ts.fixtures.is_fifo("test_file"));
assert_eq!(
ts.fixtures.metadata("test_file").permissions().mode() & 0o777,
0o750
);
}
#[test]
#[cfg(feature = "feat_selinux")]
fn test_mknod_selinux() {