88
99use crate :: common:: util:: TestScenario ;
1010
11- #[ cfg( not( any( target_os = "macos" , target_os = "openbsd" ) ) ) ]
11+ #[ cfg( not( any( windows , target_os = "macos" , target_os = "openbsd" ) ) ) ]
1212use bincode:: serialize;
1313use regex:: Regex ;
14- #[ cfg( not( any( target_os = "macos" , target_os = "openbsd" ) ) ) ]
14+ #[ cfg( not( any( windows , target_os = "macos" , target_os = "openbsd" ) ) ) ]
1515use serde:: Serialize ;
16- #[ cfg( not( any( target_os = "macos" , target_os = "openbsd" ) ) ) ]
16+ #[ cfg( not( any( windows , target_os = "macos" , target_os = "openbsd" ) ) ) ]
1717use 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" ) ) ) ]
1919use std:: fs:: File ;
20- #[ cfg( not( any( target_os = "macos" , target_os = "openbsd" ) ) ) ]
20+ #[ cfg( not( any( windows , target_os = "macos" , target_os = "openbsd" ) ) ) ]
2121use std:: { io:: Write , path:: PathBuf } ;
2222
2323#[ test]
@@ -26,6 +26,7 @@ fn test_invalid_arg() {
2626}
2727
2828#[ test]
29+ #[ cfg( not( windows) ) ]
2930fn test_uptime ( ) {
3031 TestScenario :: new ( util_name ! ( ) )
3132 . ucmd ( )
@@ -38,7 +39,7 @@ fn test_uptime() {
3839
3940/// Checks for files without utmpx records for which boot time cannot be calculated
4041#[ test]
41- #[ cfg( not( any( target_os = "openbsd" , target_os = "freebsd" ) ) ) ]
42+ #[ cfg( not( any( windows , target_os = "openbsd" , target_os = "freebsd" ) ) ) ]
4243// Disabled for freebsd, since it doesn't use the utmpxname() sys call to change the default utmpx
4344// file that is accessed using getutxent()
4445fn test_uptime_for_file_without_utmpx_records ( ) {
@@ -82,7 +83,7 @@ fn test_uptime_with_fifo() {
8283}
8384
8485#[ test]
85- #[ cfg( not( target_os = "freebsd" ) ) ]
86+ #[ cfg( not( any ( windows , target_os = "freebsd" ) ) ) ]
8687fn test_uptime_with_non_existent_file ( ) {
8788 // Disabled for freebsd, since it doesn't use the utmpxname() sys call to change the default utmpx
8889 // file that is accessed using getutxent()
@@ -98,7 +99,7 @@ fn test_uptime_with_non_existent_file() {
9899// TODO create a similar test for macos
99100// This will pass
100101#[ test]
101- #[ cfg( not( any( target_os = "openbsd" , target_os = "macos" ) ) ) ]
102+ #[ cfg( not( any( windows , target_os = "openbsd" , target_os = "macos" ) ) ) ]
102103#[ cfg_attr(
103104 all( target_arch = "aarch64" , target_os = "linux" ) ,
104105 ignore = "Issue #7159 - Test not supported on ARM64 Linux"
@@ -244,8 +245,10 @@ fn test_uptime_with_extra_argument() {
244245 . fails ( )
245246 . stderr_contains ( "extra operand 'b'" ) ;
246247}
248+
247249/// Checks whether uptime displays the correct stderr msg when its called with a directory
248250#[ test]
251+ #[ cfg( unix) ]
249252fn test_uptime_with_dir ( ) {
250253 let ts = TestScenario :: new ( util_name ! ( ) ) ;
251254 let at = & ts. fixtures ;
0 commit comments