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

ls: add selinux support

This commit is contained in:
Sylvestre Ledru 2025-04-16 22:03:42 +02:00
parent 8487e12057
commit 4651a58b82
2 changed files with 22 additions and 6 deletions

View file

@ -4183,6 +4183,26 @@ fn test_ls_context2() {
}
}
#[test]
#[cfg(feature = "feat_selinux")]
fn test_ls_context_long() {
if !uucore::selinux::is_selinux_enabled() {
return;
}
let scene = TestScenario::new(util_name!());
let at = &scene.fixtures;
at.touch("foo");
for c_flag in ["-Zl", "-Zal"] {
let result = scene.ucmd().args(&[c_flag, "foo"]).succeeds();
let line: Vec<_> = result.stdout_str().split(" ").collect();
assert!(line[0].ends_with("."));
assert!(line[4].starts_with("unconfined_u"));
let s: Vec<_> = line[4].split(":").collect();
assert!(s.len() == 4);
}
}
#[test]
#[cfg(feature = "feat_selinux")]
fn test_ls_context_format() {