makepad/libs/relax/compiler/tests/modules/visibility.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

33 lines
1.3 KiB
Python

"""Assert the actual reload body lists, including transitive crate visibility."""
import ast
import os
import pathlib
import re
import subprocess
import sys
root = pathlib.Path(__file__).resolve().parent
p = subprocess.run(
[os.path.abspath(sys.argv[1]), "test", str(root / "visibility.rs")],
env=dict(os.environ, MAKEPAD_RUN_CACHE="0", MAKEPAD_RUN_RELOAD_TRACE="1"),
capture_output=True, text=True, timeout=120,
)
try:
assert p.returncode == 0, f"exit {p.returncode}"
assert "out crate visibility: true" in p.stdout
for phase, expected in [
("base", {"own_collision", "direct_collision", "transitive_collision"}),
("leaf", {"transitive_collision"}),
]:
trace = p.stderr.split(f"visibility: {phase} begin\n", 1)[1].split(
f"visibility: {phase} end\n", 1
)[0]
lists = re.findall(r"\(bodies (\[.*?\])\)", trace)
assert len(lists) == 1, f"{phase}: expected one check phase, got {lists}"
bodies = ast.literal_eval(lists[0])
assert sorted(bodies) == sorted(expected), f"{phase}: expected {expected}, got {bodies}"
print(f"modules visibility {phase}: PASS (bodies {bodies})")
except (AssertionError, IndexError) as error:
print(p.stdout)
print(p.stderr)
sys.exit(f"modules visibility: FAIL ({error})")