11use rand:: RngCore ;
22
3- #[ cfg( any(
4- windows,
5- target_os = "freebsd" ,
6- target_os = "linux" ,
7- target_os = "netbsd" ,
8- target_os = "illumos" ,
9- target_vendor = "apple" ,
10- ) ) ]
113use crate :: assert_matches:: assert_matches;
12- #[ cfg( any(
13- windows,
14- target_os = "freebsd" ,
15- target_os = "linux" ,
16- target_os = "netbsd" ,
17- target_os = "illumos" ,
18- target_vendor = "apple" ,
19- ) ) ]
20- use crate :: fs:: TryLockError ;
21- use crate :: fs:: { self , File , FileTimes , OpenOptions } ;
4+ use crate :: fs:: { self , File , FileTimes , OpenOptions , TryLockError } ;
225use crate :: io:: prelude:: * ;
236use crate :: io:: { BorrowedBuf , ErrorKind , SeekFrom } ;
247use crate :: mem:: MaybeUninit ;
@@ -222,15 +205,22 @@ fn file_test_io_seek_and_write() {
222205}
223206
224207#[ test]
225- #[ cfg( any(
226- windows,
227- target_os = "freebsd" ,
228- target_os = "linux" ,
229- target_os = "netbsd" ,
230- target_os = "solaris" ,
231- target_os = "illumos" ,
232- target_vendor = "apple" ,
233- ) ) ]
208+ #[ cfg_attr(
209+ not( any(
210+ windows,
211+ target_os = "aix" ,
212+ target_os = "cygwin" ,
213+ target_os = "freebsd" ,
214+ target_os = "fuchsia" ,
215+ target_os = "illumos" ,
216+ target_os = "linux" ,
217+ target_os = "netbsd" ,
218+ target_os = "openbsd" ,
219+ target_os = "solaris" ,
220+ target_vendor = "apple" ,
221+ ) ) ,
222+ should_panic
223+ ) ]
234224fn file_lock_multiple_shared ( ) {
235225 let tmpdir = tmpdir ( ) ;
236226 let filename = & tmpdir. join ( "file_lock_multiple_shared_test.txt" ) ;
@@ -247,15 +237,22 @@ fn file_lock_multiple_shared() {
247237}
248238
249239#[ test]
250- #[ cfg( any(
251- windows,
252- target_os = "freebsd" ,
253- target_os = "linux" ,
254- target_os = "netbsd" ,
255- target_os = "solaris" ,
256- target_os = "illumos" ,
257- target_vendor = "apple" ,
258- ) ) ]
240+ #[ cfg_attr(
241+ not( any(
242+ windows,
243+ target_os = "aix" ,
244+ target_os = "cygwin" ,
245+ target_os = "freebsd" ,
246+ target_os = "fuchsia" ,
247+ target_os = "illumos" ,
248+ target_os = "linux" ,
249+ target_os = "netbsd" ,
250+ target_os = "openbsd" ,
251+ target_os = "solaris" ,
252+ target_vendor = "apple" ,
253+ ) ) ,
254+ should_panic
255+ ) ]
259256fn file_lock_blocking ( ) {
260257 let tmpdir = tmpdir ( ) ;
261258 let filename = & tmpdir. join ( "file_lock_blocking_test.txt" ) ;
@@ -273,15 +270,22 @@ fn file_lock_blocking() {
273270}
274271
275272#[ test]
276- #[ cfg( any(
277- windows,
278- target_os = "freebsd" ,
279- target_os = "linux" ,
280- target_os = "netbsd" ,
281- target_os = "solaris" ,
282- target_os = "illumos" ,
283- target_vendor = "apple" ,
284- ) ) ]
273+ #[ cfg_attr(
274+ not( any(
275+ windows,
276+ target_os = "aix" ,
277+ target_os = "cygwin" ,
278+ target_os = "freebsd" ,
279+ target_os = "fuchsia" ,
280+ target_os = "illumos" ,
281+ target_os = "linux" ,
282+ target_os = "netbsd" ,
283+ target_os = "openbsd" ,
284+ target_os = "solaris" ,
285+ target_vendor = "apple" ,
286+ ) ) ,
287+ should_panic
288+ ) ]
285289fn file_lock_drop ( ) {
286290 let tmpdir = tmpdir ( ) ;
287291 let filename = & tmpdir. join ( "file_lock_dup_test.txt" ) ;
@@ -296,15 +300,22 @@ fn file_lock_drop() {
296300}
297301
298302#[ test]
299- #[ cfg( any(
300- windows,
301- target_os = "freebsd" ,
302- target_os = "linux" ,
303- target_os = "netbsd" ,
304- target_os = "solaris" ,
305- target_os = "illumos" ,
306- target_vendor = "apple" ,
307- ) ) ]
303+ #[ cfg_attr(
304+ not( any(
305+ windows,
306+ target_os = "aix" ,
307+ target_os = "cygwin" ,
308+ target_os = "freebsd" ,
309+ target_os = "fuchsia" ,
310+ target_os = "illumos" ,
311+ target_os = "linux" ,
312+ target_os = "netbsd" ,
313+ target_os = "openbsd" ,
314+ target_os = "solaris" ,
315+ target_vendor = "apple" ,
316+ ) ) ,
317+ should_panic
318+ ) ]
308319fn file_lock_dup ( ) {
309320 let tmpdir = tmpdir ( ) ;
310321 let filename = & tmpdir. join ( "file_lock_dup_test.txt" ) ;
@@ -1252,7 +1263,7 @@ fn readlink_not_symlink() {
12521263}
12531264
12541265#[ test]
1255- #[ cfg_attr( target_os = "android" , ignore) ] // Android SELinux rules prevent creating hardlinks
1266+ #[ cfg_attr( target_os = "android" , ignore = " Android SELinux rules prevent creating hardlinks" ) ]
12561267fn links_work ( ) {
12571268 let tmpdir = tmpdir ( ) ;
12581269 let input = tmpdir. join ( "in.txt" ) ;
@@ -1748,7 +1759,7 @@ fn metadata_access_times() {
17481759
17491760/// Test creating hard links to symlinks.
17501761#[ test]
1751- #[ cfg_attr( target_os = "android" , ignore) ] // Android SELinux rules prevent creating hardlinks
1762+ #[ cfg_attr( target_os = "android" , ignore = " Android SELinux rules prevent creating hardlinks" ) ]
17521763fn symlink_hard_link ( ) {
17531764 let tmpdir = tmpdir ( ) ;
17541765 if !got_symlink_permission ( & tmpdir) {
0 commit comments