Skip to content

CI: build and test on FreeBSD, OpenBSD and NetBSD - #20

Open
neilpang wants to merge 2 commits into
stackless-dev:masterfrom
neilpang:ci/bsd
Open

CI: build and test on FreeBSD, OpenBSD and NetBSD#20
neilpang wants to merge 2 commits into
stackless-dev:masterfrom
neilpang:ci/bsd

Conversation

@neilpang

Copy link
Copy Markdown

Closes #15

The issue anticipated new assembly, a platform.h branch and possible OpenBSD W^X trouble. In practice none of that was needed -- the three BSDs on amd64 already resolve to the existing sysv_amd64 ABI, and the ELF paths in the assembly sources apply unchanged. Only one real portability bug stood in the way.

What changed

1. tools/abiname.sh -- ABI detection was broken on the BSDs

The temp file was created with a three-X mktemp template. GNU mktemp accepts that; BSD mktemp(1) requires at least six and fails:

mktemp: insufficient number of Xs in template `tools/tmp/abinameXXX.c'
Makefile:29: *** Could not determine platform.  Stop.

Changed to a six-X template, which is valid for both. This is the only source change, and it is what the BSD jobs could not be green without.

2. New .github/workflows/buildbsd.yml

A separate workflow, so buildcommit.yml is untouched. Three jobs running in real VMs via vmactions/*-vm on ubuntu-latest; gmake is installed in prepare because the Makefile is GNU-make syntax while the BSD base make is bmake.

The jobs do not upload a library artifact: the ABI is sysv_amd64, identical to the Linux job's, so an artifact would only duplicate it (and collide on the artifact name).

3. README / CHANGELOG -- platform list, a badge for the new workflow, changelog entries.

CI evidence

Both runs are on the exact head commit of this PR (8febe73):

What the BSD logs actually show:

version compiler make abiname tests
FreeBSD 15.1-RELEASE-p1 amd64 clang 19.1.7 sysv_amd64 test_01-test_08 + test_cc, *** All test suites passed ***
OpenBSD 7.9 amd64 clang 19.1.7 sysv_amd64 same
NetBSD 10.1 amd64 base gcc sysv_amd64 same, plus the full suite again under test_static/test_asm

NetBSD is worth noting: because its base compiler is gcc rather than clang, test_static compiles the inline-assembly path instead of printing no static with external asm, so it exercises inline asm on a BSD -- coverage the clang-based BSDs and macOS do not give.

Points for you to decide

  • OpenBSD W^X: the concern in the issue did not materialize. Worth being precise about why, rather than reading too much into the green check: stackman does not generate code at runtime, so W^X is not implicated at all. The relevant OpenBSD mechanism is MAP_STACK, and the test suite switches onto malloc'd stacks without making syscalls while switched, so it passes. A consumer that does syscall on a non-MAP_STACK stack could still be killed by the kernel. This PR proves the library builds and its tests pass; it is not a general guarantee for OpenBSD consumers.
  • OS versions are not pinned. vmactions/*-vm@v1 boots each project's current release (today: 15.1 / 7.9 / 10.1). That tracks upstream automatically but means a future BSD release could break the job without a commit here. Say the word if you would rather pin release: per job.
  • amd64 only. aarch64 images exist for all three; I kept the matrix to what the issue asked for. Easy to add if you want it.

neilpang added 2 commits July 28, 2026 20:03
tools/abiname.sh created its temporary file with a three-X mktemp
template.  GNU mktemp accepts that, but BSD mktemp(1) requires at
least six Xs and fails with "insufficient number of Xs in template",
which made the Makefile abort with "Could not determine platform".

Use a six-X template, which is valid for both.
Add a separate workflow that builds the library and runs the full test
suite on the three BSDs in a real VM, using the vmactions VM actions on
the ubuntu-latest runner.  The existing workflow is left untouched.

No new ABI, assembly file or platform.h branch is needed: the BSDs on
amd64 use the same sysv_amd64 ABI as Linux, and the existing ELF paths
in the assembly sources apply unchanged.  Consequently the jobs do not
upload a library artifact, which would only duplicate the Linux one.

GNU make is installed in the prepare step because the Makefile uses GNU
make syntax while the BSD base system make is bmake.

Closes stackless-dev#15
Copilot AI review requested due to automatic review settings July 28, 2026 14:04

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds CI coverage for the *BSDs (FreeBSD/OpenBSD/NetBSD) on amd64 by introducing a dedicated GitHub Actions workflow, and fixes a portability issue in the ABI detection helper script so those CI jobs can run successfully.

Changes:

  • Fix tools/abiname.sh temp-file creation to be compatible with BSD mktemp(1) by using a 6-X template.
  • Add .github/workflows/buildbsd.yml to build and run the full test suite in FreeBSD/OpenBSD/NetBSD VMs using gmake.
  • Update README and CHANGELOG to document the new CI workflow and BSD coverage.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.

File Description
tools/abiname.sh Makes ABI detection portable to BSD mktemp(1) by using a 6-X template.
.github/workflows/buildbsd.yml New CI workflow running gmake all + gmake test in FreeBSD/OpenBSD/NetBSD VMs.
README.md Adds a CI badge and clarifies BSD support expectations (sysv_amd64 + gmake).
CHANGELOG.md Records the new BSD CI workflow and the mktemp portability fix under Unreleased.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Support for additional POSIX platforms (FreeBSD, OpenBSD, NetBSD)

2 participants