From 91bd99f29a71c34f5ea35b6ce40d141819ae4fb4 Mon Sep 17 00:00:00 2001 From: Kenta Kubo <601636+kkebo@users.noreply.github.com> Date: Wed, 28 Jan 2026 21:24:57 +0900 Subject: [PATCH] Fix Darwin tests --- Tests/SystemTests/StatTests.swift | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/Tests/SystemTests/StatTests.swift b/Tests/SystemTests/StatTests.swift index d10d926..0f392cb 100644 --- a/Tests/SystemTests/StatTests.swift +++ b/Tests/SystemTests/StatTests.swift @@ -385,13 +385,13 @@ private struct StatTests { #endif flags.insert(userSettableFlags) - try #require(fchflags(fd.rawValue, UInt(flags.rawValue)) == 0, "\(Errno.current)") + try #require(fchflags(fd.rawValue, flags.rawValue) == 0, "\(Errno.current)") stat = try fd.stat() #expect(stat.flags == flags) flags.remove(userSettableFlags) - try #require(fchflags(fd.rawValue, UInt(flags.rawValue)) == 0, "\(Errno.current)") + try #require(fchflags(fd.rawValue, flags.rawValue) == 0, "\(Errno.current)") stat = try fd.stat() #expect(stat.flags == flags) @@ -418,4 +418,11 @@ private func == (lhs: timespec, rhs: timespec) -> Bool { lhs.tv_sec == rhs.tv_sec && lhs.tv_nsec == rhs.tv_nsec } +#if os(FreeBSD) +// Helper functions for FreeBSD +private func fchflags(_ fd: CInt, _ flags: CInterop.FileFlags) -> CInt { + fchflags(fd, UInt(flags)) +} +#endif + #endif