Skip to content

Commit 9e16c1e

Browse files
fix(mac): allow Unity app in firewall for AltTester; add lsof diagnostic
Allow Sample Unity 6 macOS.app through macOS firewall before UI tests so AltTester server can accept connections on port 13000. On failure, dump lsof -i :13000 to see if anything is bound.
1 parent 3e7a869 commit 9e16c1e

2 files changed

Lines changed: 22 additions & 0 deletions

File tree

.github/workflows/ui-tests.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,13 @@ jobs:
147147
python-version: "3.13"
148148
- name: Install dependencies
149149
run: pip install -r sample-unity6/Tests/requirements-desktop.txt
150+
- name: Allow Unity app through macOS firewall for AltTester
151+
run: |
152+
APP_PATH="${{ github.workspace }}/sample-unity6/Tests/Sample Unity 6 macOS.app"
153+
if [ -d "$APP_PATH" ]; then
154+
sudo /usr/libexec/ApplicationFirewall/socketfilterfw --add "$APP_PATH" 2>/dev/null || true
155+
sudo /usr/libexec/ApplicationFirewall/socketfilterfw --unblockapp "$APP_PATH" 2>/dev/null || true
156+
fi
150157
- name: Run UI tests
151158
env:
152159
UNITY_APP_PATH: Sample Unity 6 macOS.app

sample/Tests/test/test_mac.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -178,6 +178,21 @@ def _connect_altdriver(cls):
178178

179179
cls._dump_player_log_tail()
180180
cls._dump_alttester_server_log_tail()
181+
try:
182+
import subprocess
183+
r = subprocess.run(
184+
["lsof", "-i", ":13000"],
185+
capture_output=True,
186+
text=True,
187+
timeout=5,
188+
)
189+
print("----- lsof -i :13000 -----")
190+
print(r.stdout or "(none)")
191+
if r.stderr:
192+
print(r.stderr)
193+
print("----- end lsof -----")
194+
except Exception as e:
195+
print(f"lsof diagnostic failed: {e}")
181196
raise SystemExit(f"AltTester server port 13000 never opened on macOS (last host tried: {last_host_tried}).")
182197

183198
@classmethod

0 commit comments

Comments
 (0)