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

selinux: use the uucore::selinux::is_selinux_enabled() function

This commit is contained in:
Sylvestre Ledru 2025-05-10 21:03:58 +02:00
parent 45b0c39ed7
commit 6091d0b62b
6 changed files with 21 additions and 14 deletions

View file

@ -376,8 +376,7 @@ fn test_id_zero() {
#[test]
#[cfg(feature = "feat_selinux")]
fn test_id_context() {
use selinux::{self, KernelSupport};
if selinux::kernel_support() == KernelSupport::Unsupported {
if !uucore::selinux::is_selinux_enabled() {
println!("test skipped: Kernel has no support for SElinux context");
return;
}
@ -450,12 +449,11 @@ fn test_id_no_specified_user_posixly() {
feature = "feat_selinux"
))]
{
use selinux::{self, KernelSupport};
if selinux::kernel_support() == KernelSupport::Unsupported {
println!("test skipped: Kernel has no support for SElinux context");
} else {
if uucore::selinux::is_selinux_enabled() {
let result = ts.ucmd().succeeds();
assert!(result.stdout_str().contains("context="));
} else {
println!("test skipped: Kernel has no support for SElinux context");
}
}
}