88#[ cfg( unix) ]
99use rstest:: rstest;
1010use uucore:: display:: Quotable ;
11- #[ cfg( feature = "feat_selinux" ) ]
11+ #[ cfg( all ( feature = "feat_selinux" , any ( target_os = "linux" , target_os = "android" ) ) ) ]
1212use uucore:: selinux:: get_getfattr_output;
1313use uutests:: util:: TestScenario ;
1414use uutests:: { at_and_ucmd, new_ucmd, path_concat, util_name} ;
@@ -6771,7 +6771,7 @@ fn test_cp_from_stream_permission() {
67716771}
67726772
67736773#[ test]
6774- #[ cfg( feature = "feat_selinux" ) ]
6774+ #[ cfg( all ( feature = "feat_selinux" , any ( target_os = "linux" , target_os = "android" ) ) ) ]
67756775fn test_cp_selinux ( ) {
67766776 let ts = TestScenario :: new ( util_name ! ( ) ) ;
67776777 let at = & ts. fixtures ;
@@ -6820,7 +6820,7 @@ fn test_cp_selinux_invalid() {
68206820}
68216821
68226822#[ test]
6823- #[ cfg( feature = "feat_selinux" ) ]
6823+ #[ cfg( all ( feature = "feat_selinux" , any ( target_os = "linux" , target_os = "android" ) ) ) ]
68246824fn test_cp_preserve_selinux ( ) {
68256825 let ts = TestScenario :: new ( util_name ! ( ) ) ;
68266826 let at = & ts. fixtures ;
@@ -6858,7 +6858,7 @@ fn test_cp_preserve_selinux() {
68586858}
68596859
68606860#[ test]
6861- #[ cfg( feature = "feat_selinux" ) ]
6861+ #[ cfg( all ( feature = "feat_selinux" , any ( target_os = "linux" , target_os = "android" ) ) ) ]
68626862fn test_cp_preserve_selinux_admin_context ( ) {
68636863 let ts = TestScenario :: new ( util_name ! ( ) ) ;
68646864 let at = & ts. fixtures ;
@@ -6917,7 +6917,7 @@ fn test_cp_preserve_selinux_admin_context() {
69176917}
69186918
69196919#[ test]
6920- #[ cfg( feature = "feat_selinux" ) ]
6920+ #[ cfg( all ( feature = "feat_selinux" , any ( target_os = "linux" , target_os = "android" ) ) ) ]
69216921fn test_cp_selinux_context_priority ( ) {
69226922 // This test verifies that -Z takes priority over --context
69236923
@@ -6997,7 +6997,7 @@ fn test_cp_selinux_context_priority() {
69976997}
69986998
69996999#[ test]
7000- #[ cfg( feature = "feat_selinux" ) ]
7000+ #[ cfg( all ( feature = "feat_selinux" , any ( target_os = "linux" , target_os = "android" ) ) ) ]
70017001fn test_cp_selinux_empty_context ( ) {
70027002 // This test verifies that --context without a value works like -Z
70037003
@@ -7043,7 +7043,7 @@ fn test_cp_selinux_empty_context() {
70437043}
70447044
70457045#[ test]
7046- #[ cfg( feature = "feat_selinux" ) ]
7046+ #[ cfg( all ( feature = "feat_selinux" , any ( target_os = "linux" , target_os = "android" ) ) ) ]
70477047fn test_cp_selinux_recursive ( ) {
70487048 // Test SELinux context preservation in recursive directory copies
70497049
@@ -7097,7 +7097,7 @@ fn test_cp_selinux_recursive() {
70977097}
70987098
70997099#[ test]
7100- #[ cfg( feature = "feat_selinux" ) ]
7100+ #[ cfg( all ( feature = "feat_selinux" , any ( target_os = "linux" , target_os = "android" ) ) ) ]
71017101fn test_cp_preserve_context_root ( ) {
71027102 use uutests:: util:: run_ucmd_as_root;
71037103 let scene = TestScenario :: new ( util_name ! ( ) ) ;
@@ -7800,7 +7800,7 @@ fn test_cp_gnu_preserve_mode() {
78007800}
78017801
78027802#[ test]
7803- #[ cfg( feature = "feat_selinux" ) ]
7803+ #[ cfg( all ( feature = "feat_selinux" , any ( target_os = "linux" , target_os = "android" ) ) ) ]
78047804fn test_cp_a_z_overrides_context ( ) {
78057805 // Verifies -aZ succeeds (-Z overrides implicit --preserve=context from -a)
78067806 use std:: path:: Path ;
@@ -7818,7 +7818,7 @@ fn test_cp_a_z_overrides_context() {
78187818}
78197819
78207820#[ test]
7821- #[ cfg( feature = "feat_selinux" ) ]
7821+ #[ cfg( all ( feature = "feat_selinux" , any ( target_os = "linux" , target_os = "android" ) ) ) ]
78227822fn test_cp_a_preserves_context ( ) {
78237823 use std:: path:: Path ;
78247824 use uucore:: selinux:: { get_selinux_security_context, set_selinux_security_context} ;
0 commit comments