JOLT_TRACE: honor the env at runtime in a built joltc
The JOLT_TRACE opt-in was a top-level form in compile-eval.ss, so in a self-contained joltc it ran at heap-build time — where JOLT_TRACE is always unset — and never at runtime. `JOLT_TRACE=1 joltc -M:run` therefore produced no trace from the distributed binary (it worked only under the source-loaded dev launcher). REPL/nREPL tracing was unaffected (those enable at runtime). Make it a jolt-trace-init-from-env! fn called from the runtime entrypoints — the cli.ss dispatch and the built-joltc launcher — before any app namespace compiles, so the app's own code is traced. While here, drop a redundant trace print in the joltc launcher (jolt-report-throwable already emits it) that double-printed the block once tracing actually produced one. joltc-selfbuild-smoke asserts JOLT_TRACE=1 through the built binary yields exactly one tail-frame trace.
This commit is contained in:
parent
bff1c288b0
commit
c8167e1c05
4 changed files with 31 additions and 10 deletions
|
|
@ -42,6 +42,20 @@ if [ "$got_e" != "45" ]; then
|
|||
exit 1
|
||||
fi
|
||||
|
||||
# 2b. JOLT_TRACE must take effect in the BUILT binary. The env check runs at
|
||||
# runtime (the launcher), NOT at heap-build where JOLT_TRACE is always unset — so
|
||||
# an uncaught error shows a tail-frame trace recovering the TCO-elided chain, and
|
||||
# exactly ONE trace block (the launcher must not double-print it).
|
||||
got_tr="$(env -i HOME="$HOME" JOLT_TRACE=1 "$joltc" -e '(defn a [x] (+ x 1)) (defn b [x] (a x)) (b :x)' 2>&1)"
|
||||
if ! printf '%s' "$got_tr" | grep -q ' trace:' || ! printf '%s' "$got_tr" | grep -q 'b'; then
|
||||
echo " FAIL: JOLT_TRACE=1 in the built joltc produced no tail-frame trace"
|
||||
echo "--- got ---"; echo "$got_tr"; exit 1
|
||||
fi
|
||||
if [ "$(printf '%s' "$got_tr" | grep -c ' trace:')" != "1" ]; then
|
||||
echo " FAIL: built joltc double-printed the trace block"
|
||||
echo "--- got ---"; echo "$got_tr"; exit 1
|
||||
fi
|
||||
|
||||
# 3. Build an app through the distributed joltc with an EMPTY environment — no
|
||||
# PATH at all, so no chez, no cc, no shell tools are reachable. This is the core
|
||||
# guarantee: joltc compiles apps entirely on its own.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue