Skip to content

Add a portability workflow beside the existing matrix - #192

Merged
sheredom merged 4 commits into
sheredom:mainfrom
bernardladenthin:portability-matrix
Aug 21, 2026
Merged

Add a portability workflow beside the existing matrix#192
sheredom merged 4 commits into
sheredom:mainfrom
bernardladenthin:portability-matrix

Conversation

@bernardladenthin

Copy link
Copy Markdown
Contributor

cmake.yml covers x86-64 Linux, Windows and macOS across four build types and
four compilers, and covers them well. What no matrix over runs-on reaches is
32-bit, non-x86 architectures, a second libc, the BSDs, and older macOS
deployment targets — and this header's format-macro and timing code differs
along exactly those axes. #188, #189 and #191 were all found through
sheredom/subprocess.h's matrix rather than this repository's own CI.

This mirrors that workflow, added beside cmake.yml rather than folded into it.

Measured before opening this

Run on a fork, where the workflow is not gated: 14 of 14 green.

Job
linux-32-bit, windows-x86 pass
musl pass
linux ppc64le, riscv64, s390x, armv7 pass — full suite, no filter
freebsd 14.3, netbsd 9.4, netbsd 10.1, openbsd 7.9 pass
macOS deployment target 10.14, 10.15, 11.0 pass

netbsd 9.4 is the one worth pointing at: it ships GCC 7.5.0, and it passes
only because #191 landed. Before that it failed twice over — on the hidden
PRI macros and on -std=c++2a being unknown.

Two fixes it needs first

_GNU_SOURCE on Linux. main does not currently build against modern
glibc: the vendored subprocess.h calls pipe2 and
posix_spawn_file_actions_addchdir_np, which glibc declares only under that
macro, and most translation units here compile at strict -std=c99, -std=c11
or -std=c++XX. cmake.yml does not see it because it pins gcc-10 and clang
and excludes the default compiler on Ubuntu. subprocess.h's own
test/CMakeLists.txt sets the same macro for the same reason.

That commit stands on its own — it fixes the build with the existing vendored
copy.

The vendored subprocess.h refresh. It was a pristine snapshot of
8671cee, twelve commits behind. Pristine again afterwards, no local changes.

One deliberate difference from subprocess.h's version

No capability-paths job. There the paths are chosen by -D macros, so CI can
force each one. The analogue here would be UTEST_USE_CLOCKGETTIME, but the
header derives it from the glibc version itself rather than taking it from
outside, so such a job could only confirm the path already taken. A green tick
that cannot fail is worse than no job.

The vendored subprocess.h calls pipe2 and posix_spawn_file_actions_addchdir_np,
which glibc only declares under _GNU_SOURCE. The test suite compiles most of
its translation units at strict -std=c99, -std=c11 and -std=c++XX, where that
macro is not set for us, so those calls reach the compiler undeclared and
-Werror=implicit-function-declaration stops the build.

This is what subprocess.h's own test/CMakeLists.txt does, for the same reason.
The old copy was a pristine snapshot of subprocess.h@8671cee and is twelve
commits behind. Since then upstream gained the SUBPROCESS_HAVE_CWD and
SUBPROCESS_SPAWN_REPORTS_EXEC_ERRORS probes, Windows argument quoting and
handle-inheritance fixes, a fork/exec path for platforms whose posix_spawn
cannot change directory, and pipe ends kept off the standard descriptors.

Pristine snapshot again, no local changes.
cmake.yml covers x86-64 Linux, Windows and macOS. What no matrix over runs-on
reaches is 32-bit, non-x86 architectures, a second libc, the BSDs, and older
macOS deployment targets - and utest.h's format-macro and timing code differs
along exactly those axes.

Measured on a fork before opening this: 14 of 14 green, including NetBSD 9.4
with GCC 7.5.0 and the four emulated architectures running the full suite.

No capability-paths job, unlike subprocess.h's version of this workflow:
UTEST_USE_CLOCKGETTIME is derived from the glibc version by the header itself
rather than being settable from outside, so a job forcing it would only be
able to confirm the path already taken.
Comment thread test/CMakeLists.txt Outdated
# Strict -std=c99/-std=c11/-std=c++XX modes on glibc hide POSIX/GNU
# declarations the vendored subprocess.h uses unless feature test macros are
# enabled.
if(CMAKE_SYSTEM_NAME STREQUAL "Linux")

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

Hm not sure about this. This means we aren't ever testing with _GNU_SOURCE not defined on Linux. Seems sketchy 🤔

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Agreed — scoped to main.c, the only unit that includes the vendored subprocess.h. Everything else now compiles without it.

@sheredom
sheredom merged commit de17c92 into sheredom:main Aug 21, 2026
42 checks passed
@bernardladenthin
bernardladenthin deleted the portability-matrix branch August 22, 2026 11:20
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.

2 participants