test(cfnetwork): scope probe overlays after private-prefix startup

This commit is contained in:
lucannez64 committed 2026-10-18 14:20:40 +02:00
1 parent fb12b2aa07
commit 70d2d3121f
2 files changed
+13 -6

No files matched your search

+6 -2
View File
@@ -23,9 +23,13 @@ with open(TRACE, 'a') as stream:
stream.write(json.dumps({'args':sys.argv[1:], 'prefix':os.environ['DPREFIX']}) + '\\n')
if sys.argv[1] == 'shutdown':
raise SystemExit(0)
assert urllib.request.urlopen(sys.argv[2]).read() == b'darling-session-ok'
assert sys.argv[1:3] == ['shell', 'env']
assert 'DYLD_FRAMEWORK_PATH' not in os.environ and 'DYLD_LIBRARY_PATH' not in os.environ
urls = [arg for arg in sys.argv[1:] if arg.startswith('http://')]
assert len(urls) == 2
assert urllib.request.urlopen(urls[0]).read() == b'darling-session-ok'
try:
urllib.request.urlopen(sys.argv[3], timeout=2)
urllib.request.urlopen(urls[1], timeout=2)
except OSError:
pass
else:
+7 -4
View File
@@ -54,15 +54,18 @@ Thread(target=server.serve_forever, daemon=True).start()
prefix = Path(tempfile.mkdtemp(prefix='urlsession-prefix-', dir=root / 'build'))
env = {key: os.environ[key] for key in ('PATH', 'HOME', 'USER', 'LOGNAME', 'DISPLAY',
'XAUTHORITY', 'XDG_RUNTIME_DIR', 'DBUS_SESSION_BUS_ADDRESS', 'LANG') if key in os.environ}
env.update(DPREFIX=str(prefix), EGL_PLATFORM='x11', LC_ALL='en_US.UTF-8',
DYLD_FRAMEWORK_PATH='/Volumes/SystemRoot' + str(frameworks.resolve()),
DYLD_LIBRARY_PATH='/Volumes/SystemRoot' + str(libraries.resolve()))
env.update(DPREFIX=str(prefix), EGL_PLATFORM='x11', LC_ALL='en_US.UTF-8')
log = args.log
result = None
try:
with log.open('w') as stream:
os.chmod(log, 0o600)
result = subprocess.run(['darling', str(args.probe.resolve()),
# Apply overlays to the probe only, after the private namespace boots.
# launchd/shellspawn must start against the installed base runtime.
result = subprocess.run(['darling', 'shell', 'env',
'DYLD_FRAMEWORK_PATH=/Volumes/SystemRoot' + str(frameworks.resolve()),
'DYLD_LIBRARY_PATH=/Volumes/SystemRoot' + str(libraries.resolve()),
'/Volumes/SystemRoot' + str(args.probe.resolve()),
f'http://127.0.0.1:{server.server_port}/payload',
f'http://127.0.0.1:{reserved.getsockname()[1]}/payload'],
env=env, stdout=stream, stderr=subprocess.STDOUT, timeout=90)