Skip to content

Commit 957929d

Browse files
committed
Fix tests/fs/statx.rs on older Linux kernels.
1 parent b184b83 commit 957929d

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

tests/fs/statx.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,11 @@ fn test_statx_unknown_flags() {
1111
unsafe { StatxFlags::from_bits_unchecked(!0 & !linux_raw_sys::general::STATX__RESERVED) };
1212

1313
// It's also ok to pass such flags to `statx`.
14-
let result = rustix::fs::statx(&f, "Cargo.toml", AtFlags::empty(), too_many_flags).unwrap();
14+
let result = match rustix::fs::statx(&f, "Cargo.toml", AtFlags::empty(), too_many_flags) {
15+
// If we don't have `statx` at all, skip the rest of this test.
16+
Err(rustix::io::Errno::NOSYS) => return,
17+
otherwise => otherwise.unwrap(),
18+
};
1519

1620
// But, rustix should mask off bits it doesn't recognize, because these
1721
// extra flags may tell future kernels to set extra fields beyond the

0 commit comments

Comments
 (0)