From 7ede4962cd7f32a0c66069e6ccd473de903b47fc Mon Sep 17 00:00:00 2001 From: "Y.Horie" Date: Thu, 17 Sep 2026 19:50:43 +0900 Subject: [PATCH 1/2] test: make the example tests pass on macOS Two unrelated failures, both only visible once the functional suite runs on a Mac, which no CI job does yet. awssig.t started a config for a module that is no longer built there. Skip it on Darwin, matching the configure-time condition added in #319. shared_dict.t's check() waits for a second worker pid to prove the value came from shared memory, retrying back to back. Consecutive connections keep landing on the worker that is already awake: 38 of 40 in a plain nginx with two workers, so the loop exhausts and the test fails almost every run. Pausing between retries spreads them, measured 0 failures in 50 runs against 50 in 50 before. The loop still returns as soon as it sees a second pid, so the cost is one pause per check where the first retry already lands elsewhere. Signed-off-by: Y.Horie --- examples/t/awssig.t | 5 +++++ examples/t/shared_dict.t | 7 ++++++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/examples/t/awssig.t b/examples/t/awssig.t index ba43cd09..c8aaeb11 100644 --- a/examples/t/awssig.t +++ b/examples/t/awssig.t @@ -21,6 +21,11 @@ use Test::Nginx; select STDERR; $| = 1; select STDOUT; $| = 1; +# The example is not built on Darwin: chrono reaches the local timezone +# through CoreFoundation, which is not fork-safe. See examples/config. +plan(skip_all => 'awssig example is not built on this platform') + if $^O eq 'darwin'; + my $t = Test::Nginx->new()->has(qw/http proxy/)->plan(1) ->write_file_expand('nginx.conf', <<"EOF"); diff --git a/examples/t/shared_dict.t b/examples/t/shared_dict.t index 122c41e8..e4090700 100644 --- a/examples/t/shared_dict.t +++ b/examples/t/shared_dict.t @@ -108,7 +108,12 @@ sub check { my $pid = $1; - for (1 .. 25) { + for (1 .. 60) { + # Back-to-back requests keep landing on the worker that is + # already awake. Pause so the kernel has a reason to wake + # the other one. + select(undef, undef, undef, 0.2); + $r = http_get($uri); return unless ($r =~ $like && $r =~ /X-Process: (\d+)/); From 7fbdd303b1b7f009662cf62be3cb58c4400f5cb3 Mon Sep 17 00:00:00 2001 From: "Y.Horie" Date: Sat, 29 Aug 2026 21:45:11 +0900 Subject: [PATCH 2/2] ci: run the functional tests on macOS 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 --- .github/workflows/nginx.yaml | 63 ++++++++++++++++++++++++++++++++++++ 1 file changed, 63 insertions(+) diff --git a/.github/workflows/nginx.yaml b/.github/workflows/nginx.yaml index 2f88fbc3..cd97eeb7 100644 --- a/.github/workflows/nginx.yaml +++ b/.github/workflows/nginx.yaml @@ -145,6 +145,69 @@ jobs: run: | prove -j$(nproc) --state=save ${NGX_TEST_FILES} || prove -v --state=failed + macos: + runs-on: macos-latest + + strategy: + fail-fast: false + matrix: + nginx-ref: + - stable-1.30 + module: + - static + + steps: + - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 + - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 + with: + ref: ${{ matrix.nginx-ref }} + repository: 'nginx/nginx' + path: 'nginx' + - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 + with: + repository: 'nginx/nginx-tests' + path: 'nginx/tests' + sparse-checkout: | + lib + + - uses: dtolnay/rust-toolchain@e97e2d8cc328f1b50210efc529dca0028893a2d9 + with: + toolchain: stable + + - uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0 + with: + path: | + ~/.cargo/bin/ + ~/.cargo/registry/index/ + ~/.cargo/registry/cache/ + ~/.cargo/git/db/ + nginx/objs/**/CACHEDIR.TAG + nginx/objs/**/ngx-debug + nginx/objs/**/ngx-release + key: ${{ runner.os }}-nginx-${{ hashFiles('**/Cargo.lock') }} + restore-keys: ${{ runner.os }}-nginx- + + - name: Configure nginx with static modules + working-directory: nginx + run: | + ${NGX_CONFIGURE_CMD} \ + ${NGX_CONFIGURE_UNIX} \ + ${NGX_CONFIGURE_STATIC_MODULES} + + - name: Build nginx + working-directory: nginx + run: make -j$(sysctl -n hw.ncpu) + + - name: Run tests + env: + PERL5LIB: ${{ github.workspace }}/nginx/tests/lib + TEST_NGINX_BINARY: ${{ github.workspace }}/nginx/objs/nginx + TEST_NGINX_MODULES: ${{ github.workspace }}/nginx/objs + TEST_NGINX_VERBOSE: 1 + run: | + prove -j$(sysctl -n hw.ncpu) --state=save ${NGX_TEST_FILES} \ + || prove -v --state=failed + windows: runs-on: windows-2022 env: