Verify standalone packages and Windows Vulkan rendering under isolated Wine

This commit is contained in:
UnixNight committed 2026-10-23 17:42:05 -04:00
1 parent 008c0e16da
commit 670adb4795
10 files changed
+71 -13

No files matched your search

+28 -8
View File
@@ -47,7 +47,14 @@ def inside(args):
if display.poll() is not None: raise RuntimeError('Xvfb failed; see xvfb.log')
time.sleep(0.1)
wine_env = dict(os.environ, LIBGL_DRIVERS_PATH='/native/usr/lib/i386-linux-gnu/dri')
wine = subprocess.Popen(['/opt/wine-stable/bin/wine', args.game], cwd='/work/game', stdout=wlog, stderr=wlog, env=wine_env)
application = ['/opt/wine-stable/bin/wine', args.game]
if args.port_smoke:
application = ['/opt/wine-stable/bin/wine', r'Z:\port\GamePort.exe',
'--assets', r'Z:\port\assets', '--scene', r'Z:\port\scenes\level1b\scene.json',
'--level', 'gam/level1b.gam', '--original-camera', '--with-player',
'--headless', '--frames', '2', '--time', '0.05', '--no-validation',
'--screenshot', r'Z:\work\port-frame.ppm']
wine = subprocess.Popen(application, cwd='/work' if args.port_smoke else '/work/game', stdout=wlog, stderr=wlog, env=wine_env)
captures = []
for index in range(3):
time.sleep(args.seconds / 3)
@@ -56,6 +63,7 @@ def inside(args):
captures.append({'file': target, 'captureExit': image.returncode, 'wineExit': wine.poll()})
if args.enter:
captures[-1]['sentReturn'] = enter_key()
if args.port_smoke and wine.poll() is not None: break
tree = subprocess.run(['xwininfo', '-root', '-tree'], capture_output=True, text=True)
(work/'windows.txt').write_text(tree.stdout + tree.stderr)
processes = []
@@ -63,7 +71,7 @@ def inside(args):
try: processes.append(path.parent.name + ': ' + path.read_bytes().replace(b'\x00', b' ').decode('utf8', 'replace'))
except OSError: pass
(work/'processes.txt').write_text('\n'.join(processes)+'\n')
(work/'capture.json').write_text(json.dumps({'game': args.game, 'captures': captures}, indent=2)+'\n')
(work/'capture.json').write_text(json.dumps({'game': 'GamePort.exe' if args.port_smoke else args.game, 'captures': captures}, indent=2)+'\n')
finally:
subprocess.run(['/opt/wine-stable/bin/wineserver', '-k'], timeout=10, check=False)
if wine and wine.poll() is None: wine.terminate()
@@ -79,17 +87,18 @@ def main():
p.add_argument('--enter', action='store_true', help='Send Return after each screenshot')
p.add_argument('--debug', action='store_true', help='Record Wine process and exception diagnostics')
p.add_argument('--wine-renderer', choices=['gl','vulkan'], default='gl')
p.add_argument('--port-smoke', action='store_true', help='Preliminary Windows port check under Wine64; not native Windows validation')
p.add_argument('--output', type=Path)
args = p.parse_args()
if not 3 <= args.seconds <= 120: p.error('--seconds must be 3..120')
if args.inside: return inside(args)
project = Path(__file__).resolve().parents[2]
source = project.parent/'Original'
work = (args.output or project/'artifacts/reference').resolve()
work = (args.output or project/('artifacts/windows-smoke' if args.port_smoke else 'artifacts/reference')).resolve()
if work.is_relative_to(source.resolve()) or source.resolve().is_relative_to(work):
p.error('Output must be separate from originals')
work.mkdir(parents=True, exist_ok=True)
if not (work/'game').exists(): shutil.copytree(source, work/'game')
if not args.port_smoke and not (work/'game').exists(): shutil.copytree(source, work/'game')
(work/'home').mkdir(exist_ok=True)
(work/'home/.asoundrc').write_text('pcm.!default { type null }\nctl.!default { type hw card 0 }\n')
(work/'alsa-null.conf').write_text('pcm.default { type null }\npcm.null { type null }\n')
@@ -102,22 +111,33 @@ def main():
'--ro-bind', str(project/'.tools/wine/opt/wine-stable'), '/opt/wine-stable',
'--ro-bind', str(project/'.tools/native'), '/native',
'--ro-bind', str(Path(__file__).resolve()), '/capture.py']
for key,value in {'HOME':'/work/home', 'WINEPREFIX':'/work/prefix', 'WINEARCH':'win32',
if args.port_smoke:
cmd += ['--ro-bind', str(project/'dist/win-x64'), '/port']
for key,value in {'HOME':'/work/home', 'WINEPREFIX':'/work/prefix', 'WINEARCH':'win64' if args.port_smoke else 'win32',
'DISPLAY':':89', 'PATH':'/opt/wine-stable/bin:/usr/bin:/bin', 'LANG':'C.UTF-8',
'WINEDEBUG':'-all,err+all,warn+ddraw,warn+d3d,+seh' if args.debug else '-all',
'ALSA_CONFIG_PATH':'/work/alsa-null.conf', 'WINEDLLOVERRIDES':'mscoree,mshtml=',
'ALSA_CONFIG_PATH':'/work/alsa-null.conf',
'WINEDLLOVERRIDES':'mscoree=b;mshtml=' if args.port_smoke else 'mscoree,mshtml=',
'WINE_D3D_CONFIG':'renderer='+args.wine_renderer,
'LD_LIBRARY_PATH':'/native/usr/lib/x86_64-linux-gnu:/native/usr/lib/i386-linux-gnu',
'LIBGL_ALWAYS_SOFTWARE':'1', '__GLX_VENDOR_LIBRARY_NAME':'mesa',
'__EGL_VENDOR_LIBRARY_FILENAMES':'/usr/share/glvnd/egl_vendor.d/50_mesa.json'}.items():
cmd += ['--setenv', key, value]
if args.wine_renderer == 'vulkan':
if args.port_smoke:
cmd += ['--setenv', 'VK_DRIVER_FILES', '/usr/share/vulkan/icd.d/lvp_icd.json']
elif args.wine_renderer == 'vulkan':
cmd += ['--setenv', 'VK_DRIVER_FILES', '/native/usr/share/vulkan/icd.d/lvp_icd.json']
cmd += ['/usr/bin/python3', '/capture.py', '--inside', '--game', args.game, '--seconds', str(args.seconds)]
if args.enter: cmd += ['--enter']
print('Running copied original with no network and no original-directory mount:', work, flush=True)
if args.port_smoke: cmd += ['--port-smoke']
print('Running isolated Windows port' if args.port_smoke else 'Running copied original', 'with no network and no original-directory mount:', work, flush=True)
subprocess.run(cmd, check=True, timeout=args.seconds + 40)
print('Capture metadata:', work/'capture.json')
if args.port_smoke:
result = json.loads((work/'capture.json').read_text())
if result['captures'][-1]['wineExit'] != 0 or not (work/'port-frame.ppm').is_file():
raise SystemExit('Windows port smoke did not pass; inspect wine.log (native Windows remains unverified)')
print('Windows port rendered under Wine; native Windows validation is still required')
if __name__ == '__main__': main()