Skip to content

Commit 534bfac

Browse files
Auto merge of #149111 - tgross35:fs-test-updates, r=<try>
fs: Run file lock tests on all platforms that support it try-job: arm-android try-job: test-various
2 parents 07bdbae + b824299 commit 534bfac

File tree

1 file changed

+66
-38
lines changed

1 file changed

+66
-38
lines changed

library/std/src/fs/tests.rs

Lines changed: 66 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -222,15 +222,22 @@ fn file_test_io_seek_and_write() {
222222
}
223223

224224
#[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-
))]
225+
#[cfg_attr(
226+
not(any(
227+
windows,
228+
target_os = "aix",
229+
target_os = "cygwin",
230+
target_os = "freebsd",
231+
target_os = "fuchsia",
232+
target_os = "illumos",
233+
target_os = "linux",
234+
target_os = "netbsd",
235+
target_os = "openbsd",
236+
target_os = "solaris",
237+
target_vendor = "apple",
238+
)),
239+
should_panic
240+
)]
234241
fn file_lock_multiple_shared() {
235242
let tmpdir = tmpdir();
236243
let filename = &tmpdir.join("file_lock_multiple_shared_test.txt");
@@ -247,15 +254,22 @@ fn file_lock_multiple_shared() {
247254
}
248255

249256
#[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-
))]
257+
#[cfg_attr(
258+
not(any(
259+
windows,
260+
target_os = "aix",
261+
target_os = "cygwin",
262+
target_os = "freebsd",
263+
target_os = "fuchsia",
264+
target_os = "illumos",
265+
target_os = "linux",
266+
target_os = "netbsd",
267+
target_os = "openbsd",
268+
target_os = "solaris",
269+
target_vendor = "apple",
270+
)),
271+
should_panic
272+
)]
259273
fn file_lock_blocking() {
260274
let tmpdir = tmpdir();
261275
let filename = &tmpdir.join("file_lock_blocking_test.txt");
@@ -273,15 +287,22 @@ fn file_lock_blocking() {
273287
}
274288

275289
#[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-
))]
290+
#[cfg_attr(
291+
not(any(
292+
windows,
293+
target_os = "aix",
294+
target_os = "cygwin",
295+
target_os = "freebsd",
296+
target_os = "fuchsia",
297+
target_os = "illumos",
298+
target_os = "linux",
299+
target_os = "netbsd",
300+
target_os = "openbsd",
301+
target_os = "solaris",
302+
target_vendor = "apple",
303+
)),
304+
should_panic
305+
)]
285306
fn file_lock_drop() {
286307
let tmpdir = tmpdir();
287308
let filename = &tmpdir.join("file_lock_dup_test.txt");
@@ -296,15 +317,22 @@ fn file_lock_drop() {
296317
}
297318

298319
#[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-
))]
320+
#[cfg_attr(
321+
not(any(
322+
windows,
323+
target_os = "aix",
324+
target_os = "cygwin",
325+
target_os = "freebsd",
326+
target_os = "fuchsia",
327+
target_os = "illumos",
328+
target_os = "linux",
329+
target_os = "netbsd",
330+
target_os = "openbsd",
331+
target_os = "solaris",
332+
target_vendor = "apple",
333+
)),
334+
should_panic
335+
)]
308336
fn file_lock_dup() {
309337
let tmpdir = tmpdir();
310338
let filename = &tmpdir.join("file_lock_dup_test.txt");
@@ -1252,7 +1280,7 @@ fn readlink_not_symlink() {
12521280
}
12531281

12541282
#[test]
1255-
#[cfg_attr(target_os = "android", ignore)] // Android SELinux rules prevent creating hardlinks
1283+
#[cfg_attr(target_os = "android", ignore = "Android SELinux rules prevent creating hardlinks")]
12561284
fn links_work() {
12571285
let tmpdir = tmpdir();
12581286
let input = tmpdir.join("in.txt");
@@ -1748,7 +1776,7 @@ fn metadata_access_times() {
17481776

17491777
/// Test creating hard links to symlinks.
17501778
#[test]
1751-
#[cfg_attr(target_os = "android", ignore)] // Android SELinux rules prevent creating hardlinks
1779+
#[cfg_attr(target_os = "android", ignore = "Android SELinux rules prevent creating hardlinks")]
17521780
fn symlink_hard_link() {
17531781
let tmpdir = tmpdir();
17541782
if !got_symlink_permission(&tmpdir) {

0 commit comments

Comments
 (0)