Skip to content

ci: run the functional tests on macOS - #320

Draft
u5surf wants to merge 3 commits into
nginx:mainfrom
u5surf:ci/macos-functional-tests
Draft

ci: run the functional tests on macOS#320
u5surf wants to merge 3 commits into
nginx:mainfrom
u5surf:ci/macos-functional-tests

Conversation

@u5surf

@u5surf u5surf commented Aug 29, 2026

Copy link
Copy Markdown

Note

Draft, because it sits on top of two other PRs. The branch carries their commits so that CI can show the end state; only the third commit belongs to this PR.

commit PR
test: enlarge the shared_dict zone for larger memory pages #318
fix(examples): link CoreFoundation for the awssig example on Darwin #319
ci: run the functional tests on macOS this one

I will rebase and mark it ready once those two land. Happy to close it in the meantime if you would rather not have a draft sitting open.

Proposed changes

prove examples/t runs on the Linux and Windows jobs only. Both use 4k memory pages, and the macOS job in ci.yaml runs cargo test without ever configuring nginx with --add-module. So no job exercises the functional suite on a system whose page size differs from 4k.

That gap hid a real failure. nginx dedicates a whole slab page per slot size, so the 64k zone in shared_dict.t is sixteen pages at 4k but only four at 16k — not enough to store a key and a value that fall into different size classes. The test failed on Apple Silicon while CI stayed green (#318).

This adds a macos job to the NGINX workflow, mirroring the Linux one with a single stable-1.30 / static configuration to keep the added time modest. perl and prove are already present on the runner image.

Testing

Run locally on Apple Silicon (16k pages) against nginx 1.30.4, building all six example modules:

branch contents result
this branch Files=5, Tests=28 — all pass
without #318 (64k zone) t/shared_dict.t: Failed 4/14 subtests
without #319 does not link — ld: symbol(s) not found for architecture arm64

So the job does what it is meant to do: it fails on the bug #318 fixes, and passes once the fix is in.

One caveat

Across those runs, t/shared_dict.t subtest 3 ("check value 2") failed intermittently — roughly one run in four, independently of zone size or platform. The config uses worker_processes 2 and check() retries until a response comes back from the expected worker, so this looks like a timing assumption in the test rather than anything in the module. It is not introduced by this PR, but wiring the suite into another job makes it more visible. I can look into it separately if you would like that sorted first.

Checklist

  • I have written my commit messages in the Conventional Commits format.
  • I have read the CONTRIBUTING doc
  • I have added tests (when possible) that prove my fix is effective or that my feature works
  • I have checked that all unit tests pass after adding my changes
  • I have updated necessary documentation
  • I have rebased my branch onto main
  • I will ensure my PR is targeting the main branch and pulling from my branch from my own fork

u5surf added 3 commits August 29, 2026 07:28
The zone is declared as 64k, which is 16 slab pages on a 4k page system
but only 4 on a 16k one.  nginx allocates a whole page per slot size, so
storing a key and a value of different size classes already needs two of
those four, and the third `shared_dict` write in the test fails:

    slab alloc: 9 slot: 1
    [crit] ngx_slab_alloc() failed: no memory

The example drops the write silently, so the request still returns 200
and three subtests fail on a value that was never stored.  This is
reproducible on Apple Silicon macOS, and applies equally to Linux arm64
builds configured with 16k or 64k pages; only the 4k page systems CI
runs on have enough room.

512k keeps the zone at eight pages or more everywhere, matching the
minimum that nginx's own zone-backed modules enforce.

Signed-off-by: Y.Horie <u5.horie@gmail.com>
The awssig example depends on iana_time_zone, which resolves the system
time zone through CoreFoundation on Apple platforms.  Nothing pulls the
framework into the link line, so building the examples as nginx modules
on macOS fails:

    "_CFStringGetCStringPtr", referenced from:
        iana_time_zone::platform::string_ref::StringRef$LT$T$GT$::as_utf8
        in libawssig.a
    ld: symbol(s) not found for architecture arm64

Add the framework to that module's libs on Darwin only; every other
platform keeps the current link line.

Signed-off-by: Y.Horie <u5.horie@gmail.com>
prove examples/t currently runs on the Linux and Windows jobs only, and
both use 4k memory pages.  The macOS job in ci.yaml builds and runs
cargo test but never the functional suite, so no CI job exercises the
tests on a system with larger pages.

That gap hid a real failure: a 64k shared memory zone is sixteen slab
pages at 4k but only four at 16k, which is not enough for the
shared_dict test to store a key and a value in different size classes.

Add a macOS job to the NGINX workflow, mirroring the Linux one with a
single static configuration to keep the added time modest.  Homebrew
already provides the perl and prove that Test::Nginx needs.

Signed-off-by: Y.Horie <u5.horie@gmail.com>
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.

1 participant