Skip to content

Commit 7732f27

Browse files
committed
selinux: use the uucore function
1 parent 438ed3c commit 7732f27

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

src/uucore/src/lib/features/selinux.rs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -325,6 +325,11 @@ mod tests {
325325

326326
#[test]
327327
fn test_get_selinux_security_context() {
328+
if !is_selinux_enabled() {
329+
// Skip the test if SELinux is not enabled
330+
return;
331+
}
332+
328333
let tmpfile = NamedTempFile::new().expect("Failed to create tempfile");
329334
let path = tmpfile.path();
330335
if !is_selinux_enabled() {
@@ -394,6 +399,11 @@ mod tests {
394399

395400
#[test]
396401
fn test_get_selinux_context_nonexistent_file() {
402+
if !is_selinux_enabled() {
403+
// Skip the test if SELinux is not enabled
404+
return;
405+
}
406+
397407
let path = Path::new("/nonexistent/file/that/does/not/exist");
398408
if !is_selinux_enabled() {
399409
println!("test skipped: Kernel has no support for SElinux context");

0 commit comments

Comments
 (0)