tools/engine-test: per-second process-tree sampler (PSS, CPU, DRM fdinfo GPU), WebKitGTK 6.0 shell, drivers for Servo Nacre and old Nacre, run.sh, analyze.py. docs/engine/engine-comparison.md: method, per-site tables, side-by-side screenshots, caveats, conclusions and what Servo needs for parity. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
27 lines
1.5 KiB
Python
Executable file
27 lines
1.5 KiB
Python
Executable file
#!/usr/bin/env python3
|
|
"""Turn sites.txt into a NACRE_SCRIPT for the Servo Nacre (src/selftest.rs): the same steps as webkit_shell.py's
|
|
driver mode. Marks go to selftest.log as `MARK <label>` lines (sample.py --mark-log reads them).
|
|
|
|
Usage: servo_script.py sites.txt [idle_seconds] > script.txt
|
|
"""
|
|
import sys
|
|
|
|
CHECK_JS = ("JSON.stringify({title: document.title, ready: document.readyState, url: location.href, "
|
|
"nodes: document.getElementsByTagName('*').length, videos: [...document.querySelectorAll('video')]"
|
|
".map(v => ({t: v.currentTime, paused: v.paused, rs: v.readyState, err: v.error && v.error.code, "
|
|
"w: v.videoWidth}))})")
|
|
PLAY_JS = "var v = document.querySelector('video'); if (v && v.paused) { v.muted = true; v.play(); } 0"
|
|
PAUSE_JS = "document.querySelectorAll('video').forEach(v => v.pause()); 0"
|
|
|
|
plan = [line.split() for line in open(sys.argv[1]) if line.strip() and not line.startswith("#")]
|
|
idle = int(sys.argv[2]) if len(sys.argv) > 2 else 60
|
|
print("# generated by tools/engine-test/servo_script.py")
|
|
print("set /startup/welcome_done true\nset /adblock/enabled false\nset /perf/freeze_min 0\nset /perf/discard_min 0")
|
|
print("wait 3")
|
|
for label, url, settle, *opts in plan:
|
|
print(f"log MARK {label}\nnewtab {url}")
|
|
if "play" in opts:
|
|
print(f"wait 10\nsave check-{label}-pre {CHECK_JS}\njs {PLAY_JS}")
|
|
settle = int(settle) - 10
|
|
print(f"wait {settle}\nsave check-{label} {CHECK_JS}\nshot {label}\njs {PAUSE_JS}\nwait 1")
|
|
print(f"log MARK idle\nwait {idle}\nlog MARK done\nstatus done\nquit")
|