Skip to content

Enable some FileHandle tests on Linux, FreeBSD, and OpenBSD.#1728

Merged
grynspan merged 13 commits into
mainfrom
jgrynspan/enable-filehandle-close-tests-on-bsd
May 26, 2026
Merged

Enable some FileHandle tests on Linux, FreeBSD, and OpenBSD.#1728
grynspan merged 13 commits into
mainfrom
jgrynspan/enable-filehandle-close-tests-on-bsd

Conversation

@grynspan
Copy link
Copy Markdown
Contributor

@grynspan grynspan commented May 25, 2026

Enables those tests that rely on funopen() on FreeBSD and OpenBSD, which have said function.

On Linux, we have fopencookie() instead, but it's guarded by _GNU_SOURCE so it isn't always available (e.g. it builds for me on Ubuntu 24.04 but doesn't build in our CI). For the purposes of testing these code paths, I've hard-coded the declaration of fopencookie() in our test target.

Android theoretically has funopen() and WASI theoretically has fopencookie(), but neither is testable at the moment so I've left them out for now. Windows does not have an equivalent API.

Checklist:

  • Code and documentation should follow the style of the Style Guide.
  • If public symbols are renamed or modified, DocC references should be updated.

@grynspan grynspan added this to the Swift 6.4.0 (main) milestone May 25, 2026
@grynspan grynspan self-assigned this May 25, 2026
@grynspan grynspan added freebsd 😈 FreeBSD support openbsd 🐡 OpenBSD support labels May 25, 2026
@grynspan grynspan force-pushed the jgrynspan/enable-filehandle-close-tests-on-bsd branch from be6aaa4 to b4d5b07 Compare May 25, 2026 14:59
Enables those tests that rely on `funopen()` on FreeBSD and OpenBSD, which have
said function. Linux has `fopencookie()` which we could use in theory, except
that it requires `_GNU_SOURCE` and is non-trivial to declare ourselves due to
the use of a custom C structure also guarded by that macro.
@grynspan grynspan force-pushed the jgrynspan/enable-filehandle-close-tests-on-bsd branch from b3b3ecc to 267c89c Compare May 25, 2026 15:07
@grynspan grynspan changed the title Enable some FileHandle tests on FreeBSD and OpenBSD. Enable some FileHandle tests on Linux, FreeBSD, and OpenBSD. May 25, 2026
@grynspan grynspan added the linux 🐧 Linux support (all distros) label May 25, 2026
@grynspan grynspan merged commit ae4bccb into main May 26, 2026
69 of 70 checks passed
@grynspan grynspan deleted the jgrynspan/enable-filehandle-close-tests-on-bsd branch May 26, 2026 18:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

freebsd 😈 FreeBSD support linux 🐧 Linux support (all distros) openbsd 🐡 OpenBSD support

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants