mirror of
https://github.com/RGBCube/uutils-coreutils
synced 2025-07-27 19:17:43 +00:00
Merge pull request #7752 from sylvestre/stat-C
stat: add support for selinux
This commit is contained in:
commit
219e87d57c
5 changed files with 169 additions and 1 deletions
|
@ -490,3 +490,27 @@ fn test_printf_invalid_directive() {
|
|||
.fails_with_code(1)
|
||||
.stderr_contains("'%9%': invalid directive");
|
||||
}
|
||||
|
||||
#[test]
|
||||
#[cfg(feature = "feat_selinux")]
|
||||
fn test_stat_selinux() {
|
||||
let ts = TestScenario::new(util_name!());
|
||||
let at = &ts.fixtures;
|
||||
at.touch("f");
|
||||
ts.ucmd()
|
||||
.arg("--printf='%C'")
|
||||
.arg("f")
|
||||
.succeeds()
|
||||
.no_stderr()
|
||||
.stdout_contains("unconfined_u");
|
||||
ts.ucmd()
|
||||
.arg("--printf='%C'")
|
||||
.arg("/bin/")
|
||||
.succeeds()
|
||||
.no_stderr()
|
||||
.stdout_contains("system_u");
|
||||
// Count that we have 4 fields
|
||||
let result = ts.ucmd().arg("--printf='%C'").arg("/bin/").succeeds();
|
||||
let s: Vec<_> = result.stdout_str().split(":").collect();
|
||||
assert!(s.len() == 4);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue