makepad/libs/relax/compiler/tests/modules/stream_watch.py
Admin b22a714840 makepad run: the Rust JIT (libs/relax) and makepad-remote
The JIT that runs makepad apps from source: lexer, front end, type checker,
lazy borrow checker (Gandalf; `--check-first` opts in), codegen, session and
warm/cold caches keyed by compiler stamp, provided crates bound late,
startup images, live patching. User-facing name is `makepad run` (binary
`makepad`, MAKEPAD_RUN_* env, ~/.makepad-run); libs/relax stays the internal
library name. `makepad check` reports rustc-style diagnostics with rustc
error codes and checks a whole workspace (`--workspace`). Runs on macOS,
Linux, Windows and Android. makepad-remote: one tool schema for apps and the
WM (app/1): grabs, captures, traces, frame profiles and tweaks.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-13 12:26:21 +02:00

27 lines
1.1 KiB
Python

"""Exercise watcher draining and delayed module diagnostics without a GUI."""
import os
import pathlib
import shutil
import subprocess
import sys
import tempfile
root = pathlib.Path(__file__).resolve().parent
with tempfile.TemporaryDirectory(prefix="module-stream-watch-") as tmp:
pkg = pathlib.Path(tmp) / "pkg"
shutil.copytree(root / "stream_watch", pkg, ignore=shutil.ignore_patterns("target*"))
p = subprocess.run(
[os.path.abspath(sys.argv[1]), "run", "--quiet", "module-stream-watch"],
cwd=pkg,
env=dict(os.environ, MAKEPAD_RUN_CACHE="0"),
capture_output=True, text=True, timeout=120,
)
lines = p.stderr.splitlines()
quiet = next((i for i, s in enumerate(lines) if s == "stream-watch: quiet window ended"), None)
errors = [i for i, s in enumerate(lines) if s.startswith("makepad live:") and "memory/watch-stream.rs:" in s]
ok = p.returncode == 0 and "out module stream watcher: true" in p.stdout and quiet is not None and errors and min(errors) > quiet
if not ok:
print(p.stdout)
print(p.stderr)
sys.exit("modules stream watcher: FAIL")
print("modules stream watcher: PASS")