8
8
9
9
use crate :: common:: util:: TestScenario ;
10
10
11
- #[ cfg( not( any( target_os ="macos" , target_os ="openbsd" ) ) ) ]
11
+ #[ cfg( not( any( windows , target_os ="macos" , target_os ="openbsd" ) ) ) ]
12
12
use bincode:: serialize;
13
13
use regex:: Regex ;
14
- #[ cfg( not( any( target_os ="macos" , target_os ="openbsd" ) ) ) ]
14
+ #[ cfg( not( any( windows , target_os ="macos" , target_os ="openbsd" ) ) ) ]
15
15
use serde:: Serialize ;
16
- #[ cfg( not( any( target_os ="macos" , target_os ="openbsd" ) ) ) ]
16
+ #[ cfg( not( any( windows , target_os ="macos" , target_os ="openbsd" ) ) ) ]
17
17
use serde_big_array:: BigArray ;
18
- #[ cfg( not( any( target_os ="macos" , target_os ="openbsd" ) ) ) ]
18
+ #[ cfg( not( any( windows , target_os ="macos" , target_os ="openbsd" ) ) ) ]
19
19
use std:: fs:: File ;
20
- #[ cfg( not( any( target_os ="macos" , target_os ="openbsd" ) ) ) ]
20
+ #[ cfg( not( any( windows , target_os ="macos" , target_os ="openbsd" ) ) ) ]
21
21
use std:: { io:: Write , path:: PathBuf } ;
22
22
23
23
#[ test]
@@ -26,6 +26,7 @@ fn test_invalid_arg() {
26
26
}
27
27
28
28
#[ test]
29
+ #[ cfg( not( windows) ) ]
29
30
fn test_uptime ( ) {
30
31
TestScenario :: new ( util_name ! ( ) )
31
32
. ucmd ( )
@@ -38,7 +39,7 @@ fn test_uptime() {
38
39
39
40
/// Checks for files without utmpx records for which boot time cannot be calculated
40
41
#[ test]
41
- #[ cfg( not( any( target_os ="openbsd" , target_os ="freebsd" ) ) ) ]
42
+ #[ cfg( not( any( windows , target_os ="openbsd" , target_os ="freebsd" ) ) ) ]
42
43
// Disabled for freebsd, since it doesn't use the utmpxname() sys call to change the default utmpx
43
44
// file that is accessed using getutxent()
44
45
fn test_uptime_for_file_without_utmpx_records ( ) {
@@ -82,7 +83,7 @@ fn test_uptime_with_fifo() {
82
83
}
83
84
84
85
#[ test]
85
- #[ cfg( not( target_os ="freebsd" ) ) ]
86
+ #[ cfg( not( any ( windows , target_os ="freebsd" ) ) ) ]
86
87
fn test_uptime_with_non_existent_file ( ) {
87
88
// Disabled for freebsd, since it doesn't use the utmpxname() sys call to change the default utmpx
88
89
// file that is accessed using getutxent()
@@ -98,7 +99,7 @@ fn test_uptime_with_non_existent_file() {
98
99
// TODO create a similar test for macos
99
100
// This will pass
100
101
#[ test]
101
- #[ cfg( not( any( target_os ="openbsd" , target_os ="macos" ) ) ) ]
102
+ #[ cfg( not( any( windows , target_os ="openbsd" , target_os ="macos" ) ) ) ]
102
103
#[ cfg_attr(
103
104
all( target_arch ="aarch64" , target_os ="linux" ) ,
104
105
ignore ="Issue #7159 - Test not supported on ARM64 Linux"
@@ -244,8 +245,10 @@ fn test_uptime_with_extra_argument() {
244
245
. fails ( )
245
246
. stderr_contains ( "extra operand 'b'" ) ;
246
247
}
248
+
247
249
/// Checks whether uptime displays the correct stderr msg when its called with a directory
248
250
#[ test]
251
+ #[ cfg( unix) ]
249
252
fn test_uptime_with_dir ( ) {
250
253
let ts =TestScenario :: new ( util_name ! ( ) ) ;
251
254
let at =& ts. fixtures ;