88#[ cfg( unix) ]
99use rstest:: rstest;
1010use uucore:: display:: Quotable ;
11- #[ cfg( feature = "feat_selinux" ) ]
11+ #[ cfg( all(
12+ feature = "feat_selinux" ,
13+ any( target_os = "linux" , target_os = "android" )
14+ ) ) ]
1215use uucore:: selinux:: get_getfattr_output;
1316use uutests:: util:: TestScenario ;
1417use uutests:: { at_and_ucmd, new_ucmd, path_concat, util_name} ;
@@ -6771,7 +6774,10 @@ fn test_cp_from_stream_permission() {
67716774}
67726775
67736776#[ test]
6774- #[ cfg( feature = "feat_selinux" ) ]
6777+ #[ cfg( all(
6778+ feature = "feat_selinux" ,
6779+ any( target_os = "linux" , target_os = "android" )
6780+ ) ) ]
67756781fn test_cp_selinux ( ) {
67766782 let ts = TestScenario :: new ( util_name ! ( ) ) ;
67776783 let at = & ts. fixtures ;
@@ -6820,7 +6826,10 @@ fn test_cp_selinux_invalid() {
68206826}
68216827
68226828#[ test]
6823- #[ cfg( feature = "feat_selinux" ) ]
6829+ #[ cfg( all(
6830+ feature = "feat_selinux" ,
6831+ any( target_os = "linux" , target_os = "android" )
6832+ ) ) ]
68246833fn test_cp_preserve_selinux ( ) {
68256834 let ts = TestScenario :: new ( util_name ! ( ) ) ;
68266835 let at = & ts. fixtures ;
@@ -6858,7 +6867,10 @@ fn test_cp_preserve_selinux() {
68586867}
68596868
68606869#[ test]
6861- #[ cfg( feature = "feat_selinux" ) ]
6870+ #[ cfg( all(
6871+ feature = "feat_selinux" ,
6872+ any( target_os = "linux" , target_os = "android" )
6873+ ) ) ]
68626874fn test_cp_preserve_selinux_admin_context ( ) {
68636875 let ts = TestScenario :: new ( util_name ! ( ) ) ;
68646876 let at = & ts. fixtures ;
@@ -6917,7 +6929,10 @@ fn test_cp_preserve_selinux_admin_context() {
69176929}
69186930
69196931#[ test]
6920- #[ cfg( feature = "feat_selinux" ) ]
6932+ #[ cfg( all(
6933+ feature = "feat_selinux" ,
6934+ any( target_os = "linux" , target_os = "android" )
6935+ ) ) ]
69216936fn test_cp_selinux_context_priority ( ) {
69226937 // This test verifies that -Z takes priority over --context
69236938
@@ -6997,7 +7012,10 @@ fn test_cp_selinux_context_priority() {
69977012}
69987013
69997014#[ test]
7000- #[ cfg( feature = "feat_selinux" ) ]
7015+ #[ cfg( all(
7016+ feature = "feat_selinux" ,
7017+ any( target_os = "linux" , target_os = "android" )
7018+ ) ) ]
70017019fn test_cp_selinux_empty_context ( ) {
70027020 // This test verifies that --context without a value works like -Z
70037021
@@ -7043,7 +7061,10 @@ fn test_cp_selinux_empty_context() {
70437061}
70447062
70457063#[ test]
7046- #[ cfg( feature = "feat_selinux" ) ]
7064+ #[ cfg( all(
7065+ feature = "feat_selinux" ,
7066+ any( target_os = "linux" , target_os = "android" )
7067+ ) ) ]
70477068fn test_cp_selinux_recursive ( ) {
70487069 // Test SELinux context preservation in recursive directory copies
70497070
@@ -7097,7 +7118,10 @@ fn test_cp_selinux_recursive() {
70977118}
70987119
70997120#[ test]
7100- #[ cfg( feature = "feat_selinux" ) ]
7121+ #[ cfg( all(
7122+ feature = "feat_selinux" ,
7123+ any( target_os = "linux" , target_os = "android" )
7124+ ) ) ]
71017125fn test_cp_preserve_context_root ( ) {
71027126 use uutests:: util:: run_ucmd_as_root;
71037127 let scene = TestScenario :: new ( util_name ! ( ) ) ;
@@ -7800,7 +7824,10 @@ fn test_cp_gnu_preserve_mode() {
78007824}
78017825
78027826#[ test]
7803- #[ cfg( feature = "feat_selinux" ) ]
7827+ #[ cfg( all(
7828+ feature = "feat_selinux" ,
7829+ any( target_os = "linux" , target_os = "android" )
7830+ ) ) ]
78047831fn test_cp_a_z_overrides_context ( ) {
78057832 // Verifies -aZ succeeds (-Z overrides implicit --preserve=context from -a)
78067833 use std:: path:: Path ;
@@ -7818,7 +7845,10 @@ fn test_cp_a_z_overrides_context() {
78187845}
78197846
78207847#[ test]
7821- #[ cfg( feature = "feat_selinux" ) ]
7848+ #[ cfg( all(
7849+ feature = "feat_selinux" ,
7850+ any( target_os = "linux" , target_os = "android" )
7851+ ) ) ]
78227852fn test_cp_a_preserves_context ( ) {
78237853 use std:: path:: Path ;
78247854 use uucore:: selinux:: { get_selinux_security_context, set_selinux_security_context} ;
0 commit comments