Skip to content

Commit b643615

Browse files
linesightclaude
andcommitted
Fix macOS CI: run tests in user login session for Mach port rendezvous
GitHub Actions macos-14 runners execute jobs in a background bootstrap domain where child processes cannot look up MachPortRendezvousServer (error 1102 / BOOTSTRAP_UNKNOWN_SERVICE), causing the network service and renderer subprocesses to terminate immediately and OnContextInitialized to never fire. Fix: run the test step via "sudo launchctl asuser $(id -u)" so the CEF browser process lives in the user's login session bootstrap domain, where its registered Mach rendezvous service is visible to all children. Also add --use-mock-keychain to MAC switches in both test files, matching CEF's own macOS test infrastructure (client_app_browser.cc) to prevent keychain authorization prompts from blocking initialization. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent cc0217e commit b643615

3 files changed

Lines changed: 23 additions & 13 deletions

File tree

.github/workflows/ci-macos.yml

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -120,9 +120,11 @@ jobs:
120120
chmod +x cefpython3/subprocess
121121
122122
- name: Run unit tests
123-
run: python unittests/_test_runner.py
124-
env:
125-
PYTHONPATH: ${{ github.workspace }}
123+
run: |
124+
python_bin="$(which python)"
125+
sudo launchctl asuser "$(id -u)" \
126+
/usr/bin/env PYTHONPATH="${{ github.workspace }}" \
127+
"$python_bin" unittests/_test_runner.py
126128
127129
wheel:
128130
needs: test

unittests/main_test.py

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -159,15 +159,19 @@ def test_main(self):
159159
switches["in-process-gpu"] = ""
160160
switches["no-zygote"] = ""
161161
if MAC:
162-
# Mach port rendezvous (bootstrap_look_up) fails for child
163-
# processes on macOS CI runners regardless of --no-sandbox.
164-
# Single-process mode runs renderer/network/GPU in-process,
165-
# eliminating all subprocess spawning and bootstrap IPC.
166-
switches["single-process"] = ""
162+
# macOS CI runners run in a background bootstrap domain where
163+
# MachPortRendezvousServer lookups fail for child processes.
164+
# The CI workflow runs tests via "launchctl asuser" to place the
165+
# browser process in the user's login session bootstrap domain.
166+
# These switches add further subprocess-spawn reduction as guards.
167167
switches["no-sandbox"] = ""
168168
switches["disable-gpu"] = ""
169169
switches["disable-gpu-compositing"] = ""
170170
switches["in-process-gpu"] = ""
171+
switches["single-process"] = ""
172+
# Prevent macOS keychain authorization prompts during init
173+
# (matches CEF's own test infrastructure on macOS).
174+
switches["use-mock-keychain"] = ""
171175
cef.Initialize(settings, switches=switches)
172176
subtest_message("cef.Initialize() ok")
173177

unittests/osr_test.py

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -127,13 +127,17 @@ def test_osr(self):
127127
switches["in-process-gpu"] = ""
128128
switches["no-zygote"] = ""
129129
if MAC:
130-
# Mach port rendezvous (bootstrap_look_up) fails for child
131-
# processes on macOS CI runners regardless of --no-sandbox.
132-
# Single-process mode runs renderer/network/GPU in-process,
133-
# eliminating all subprocess spawning and bootstrap IPC.
134-
switches["single-process"] = ""
130+
# macOS CI runners run in a background bootstrap domain where
131+
# MachPortRendezvousServer lookups fail for child processes.
132+
# The CI workflow runs tests via "launchctl asuser" to place the
133+
# browser process in the user's login session bootstrap domain.
134+
# These switches add further subprocess-spawn reduction as guards.
135135
switches["no-sandbox"] = ""
136136
switches["in-process-gpu"] = ""
137+
switches["single-process"] = ""
138+
# Prevent macOS keychain authorization prompts during init
139+
# (matches CEF's own test infrastructure on macOS).
140+
switches["use-mock-keychain"] = ""
137141
browser_settings = {
138142
# Tweaking OSR performance (Issue #240)
139143
"windowless_frame_rate": 30, # Default frame rate in CEF is 30

0 commit comments

Comments
 (0)