makepad/libs/relax/compiler/tests/macro_scope/run.sh
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

22 lines
1.5 KiB
Bash
Executable file

#!/bin/bash
# usage: run.sh <makepad binary>: macro resolution independent of load order and through import
# chains (= rustc, expected.txt); prints the outputs, then "macro_scope: ok" or "macro_scope: FAILED"
# (exit 1). Cases:
# the same user crate in two programs (one also loads dep_a, which exports another `trace!`)
# a re-export chain (top: `pub use mid::inner;`, a module glob-importing it, a root glob) and
# an import inside a fn body, with dep_a exporting decoys of the same names
H=$(cd "$(dirname "$0")" && pwd)
# no disk cache: its "makepad-run cache:" lines and stored code are not part of what is tested
export MAKEPAD_RUN_CACHE=off
T=$(mktemp -d)
{
for v in with without; do
if [ $v = with ]; then DEPS='[{"index":0,"extern_crate_name":"dep_a"},{"index":2,"extern_crate_name":"user"}]'; else DEPS='[{"index":2,"extern_crate_name":"user"}]'; fi
sed -e "s#@R@#$H#g" -e "s#@MAIN@#main_${v}_a.rs#" -e "s#@DEPS@#$DEPS#" $H/units.json.in > $T/units-$v.json
MAKEPAD_RUN_STD=$H/../../std MAKEPAD_RUN_CACHE_DIR=$T/target-$v $1 run --quiet --units $T/units-$v.json app 2>&1 | grep -v '^makepad-run:\|^makepad-run cache' || true
done
sed -e "s#@R@#$H#g" $H/units-chain.json.in > $T/units-chain.json
MAKEPAD_RUN_STD=$H/../../std MAKEPAD_RUN_CACHE_DIR=$T/target-chain $1 run --quiet --units $T/units-chain.json app 2>&1 | grep -v '^makepad-run:\|^makepad-run cache' || true
} > $T/out.txt
cat $T/out.txt
if cmp -s $T/out.txt $H/expected.txt; then echo "macro_scope: ok"; else echo "macro_scope: FAILED"; exit 1; fi