@@ -22,6 +22,11 @@ fn help() {
2222 new_ucmd ! ( ) . arg ( "-h" ) . succeeds ( ) ;
2323}
2424
25+ #[ test]
26+ fn invalid_input ( ) {
27+ new_ucmd ! ( ) . arg ( "-/" ) . fails ( ) . code_is ( 125 ) ;
28+ }
29+
2530#[ test]
2631fn print ( ) {
2732 new_ucmd ! ( ) . succeeds ( ) ;
@@ -46,7 +51,7 @@ fn invalid() {
4651 "unconfined_u:unconfined_r:unconfined_t:s0" ,
4752 "inexistent-file" ,
4853 ] ;
49- new_ucmd ! ( ) . args ( args) . fails ( ) . code_is ( 127 ) ;
54+ new_ucmd ! ( ) . args ( args) . fails ( ) . code_is ( 1 ) ;
5055
5156 let args = & [ "invalid" , "/bin/true" ] ;
5257 new_ucmd ! ( ) . args ( args) . fails ( ) . code_is ( 1 ) ;
@@ -55,7 +60,7 @@ fn invalid() {
5560 new_ucmd ! ( ) . args ( args) . fails ( ) . code_is ( 1 ) ;
5661
5762 let args = & [ "--compute" , "--compute" ] ;
58- new_ucmd ! ( ) . args ( args) . fails ( ) . code_is ( 1 ) ;
63+ new_ucmd ! ( ) . args ( args) . fails ( ) . code_is ( 125 ) ;
5964
6065 // clap has an issue that makes this test fail: https://github.com/clap-rs/clap/issues/1543
6166 // TODO: Enable this code once the issue is fixed in the clap version we're using.
@@ -64,14 +69,15 @@ fn invalid() {
6469 for flag in [
6570 "-t" , "--type" , "-u" , "--user" , "-r" , "--role" , "-l" , "--range" ,
6671 ] {
67- new_ucmd ! ( ) . arg ( flag) . fails ( ) . code_is ( 1 ) ;
72+ new_ucmd ! ( ) . arg ( flag) . fails ( ) . code_is ( 125 ) ;
6873
6974 let args = & [ flag, "example" , flag, "example" ] ;
70- new_ucmd ! ( ) . args ( args) . fails ( ) . code_is ( 1 ) ;
75+ new_ucmd ! ( ) . args ( args) . fails ( ) . code_is ( 125 ) ;
7176 }
7277}
7378
7479#[ test]
80+ #[ cfg( feature = "feat_selinux" ) ]
7581fn plain_context ( ) {
7682 let ctx = "unconfined_u:unconfined_r:unconfined_t:s0-s0" ;
7783 new_ucmd ! ( ) . args ( & [ ctx, "/bin/true" ] ) . succeeds ( ) ;
@@ -90,6 +96,7 @@ fn plain_context() {
9096}
9197
9298#[ test]
99+ #[ cfg( feature = "feat_selinux" ) ]
93100fn custom_context ( ) {
94101 let t_ud = "unconfined_t" ;
95102 let u_ud = "unconfined_u" ;
0 commit comments