tinymux/tests/luajit
Stephen Dennis ac5b8a0694 test(lua/jit): assert execution, not attempts, and show what declined (#1426)
Two changes, both aimed at the same hole: the suite could not tell "the Lua
JIT ran compiled code" from "the Lua JIT declined and the interpreter
answered".

## lua_jit_fn.mux TC007 was a permanent Skip

It gated on `config(lua_jit)` being 1, which the smoke config never sets, so
it logged

    TC007: string-arith sequence engages Lua JIT. Skipped (need JIT and lua_jit 1).

on every run.  And had it run, it asserted on tr.lj_try -- attempts, which is
lua_run_ok + lua_run_fail.  A declined run increments lua_run_fail, so
attempts advance either way and the assertion could not fail for the reason
it existed.

Now it enables the JIT at run time and requires lua_run_ok to advance:

    TC007: string-arith sequence executes on the Lua JIT. Succeeded (lua_run_ok 1 to 3).

The exercise sits at file top level rather than in the triggered case, for
the reason jitstats_fn.mux documents for its TC006: @admin in a triggered
attribute body does not take effect before the [lua(...)] in the same command
list, so the chunk would run with lua_jit still 0 and lua_run_ok would never
advance.  Both config values are saved and restored, and the case asserts the
restore as well.

Verified it can fail.  Changing the exercise's `@admin lua_jit=1` to 0:

    TC007: ... Failed (str=hello result=5 lua_run_ok 1 to 1 lua_jit=0/0 brackets=1/1)

Note the results are still correct -- `hello` and `5` -- because the
interpreter answered.  That is exactly the case the old assertion passed.

## The AGREE harness hid how little it compiles

tests/luajit/run.sh reported per-case declines but summarised only
pass/fail, so "all match interpreter" read as coverage.  Counting them apart:

    agree_executed: 2   agree_declined: 32   (of 34 AGREE chunks)

**Two of thirty-four.**  The other 32 agree because the interpreter answered
them.  That is correct behaviour and not a regression -- #1326's reentrancy
guard is why -- but it means the AGREE block currently validates the compiler
on 2 chunks while looking like it validates 34, and nothing said so.

Suite: 1554 passed / 0 failed / 319 of 319 (up one -- TC007 now produces a
verdict where it produced a Skip).  tests/luajit: PASSED.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-07-27 09:18:30 -06:00
..
.gitignore test(luajit): keep a failed run's workdir instead of deleting it (#1446) (#1450) 2026-07-26 16:34:00 -06:00
run.sh test(lua/jit): assert execution, not attempts, and show what declined (#1426) 2026-07-27 09:18:30 -06:00