termtris tests: copied Lua harness carries dead loader modes and a stale trace path #7

Open
opened 2026-11-13 08:51:16 +02:00 by opencode.siil.arti.ee · 0 comments
Collaborator

The six termtris test copies of dwt/loader/loader.lua still carry loader-only code paths that no termtris test reaches, plus one stale diagnostic. This is cleanup that should happen with (or before) the de-duplication in the sibling issue.

Dead or unreachable in the termtris tests (head 58f8f44)

  • Descriptor modes. LOADER_MODE, LOADER_A8_DESC, RETURN_STUB and RETURN_SP are declared in every copy but no tests/*.sh sets them. The w32(DESC + 0x60, MODE), if MODE == 1 then ... jauc/jruc and cpu.state['A8'].value = A8DESC and DESC or 0 branches are therefore dead for these six tests.
  • marker/xhello result branches. The if base:find("marker") ... elseif base:find("xhello") ... dump code is unreachable for termtris COFFs (the files are termtris.coff), as is the base_contains_marker counter polling.
  • Stale trace path. Every copy does dbg:command("trace /tmp/opencode/ld1.tr") but then prints LOADER: trace written to /tmp/opencode/ld.tr. Either fix the two paths or drop LOADER_TRACE.
  • Empty status block. All six contain an empty conditional whose body is only a comment:
    if st ~= 0xFFFFFFFF and not done then
        -- The loader writes 0 on success...
    end
    
    It does nothing; either implement the intended "nonzero is final" rule or remove it.
  • Unused key. play_keys.lua:43 declares key_p and never uses it (input.lua:158-159 is the one that does).
  • Diverged result format. play.lua:280 prints DIAG: tick=... quit=...; play_keys.lua prints the loops/events/last/focus/rev/quit line. A shared harness needs one format.

Acceptance

After removing the dead paths, apps/termtris/verify.sh --skip-mame still reports verify: PASS, and grep finds no unused MODE/A8DESC/RETURN_SP/xhello constants in apps/termtris/tests/.

This is a follow-up to PR #5, not a blocker for it.

The six termtris test copies of `dwt/loader/loader.lua` still carry loader-only code paths that no termtris test reaches, plus one stale diagnostic. This is cleanup that should happen with (or before) the de-duplication in the sibling issue. ## Dead or unreachable in the termtris tests (head `58f8f44`) - **Descriptor modes.** `LOADER_MODE`, `LOADER_A8_DESC`, `RETURN_STUB` and `RETURN_SP` are declared in every copy but no `tests/*.sh` sets them. The `w32(DESC + 0x60, MODE)`, `if MODE == 1 then ... jauc/jruc` and `cpu.state['A8'].value = A8DESC and DESC or 0` branches are therefore dead for these six tests. - **marker/xhello result branches.** The `if base:find("marker") ... elseif base:find("xhello") ...` dump code is unreachable for termtris COFFs (the files are `termtris.coff`), as is the `base_contains_marker` counter polling. - **Stale trace path.** Every copy does `dbg:command("trace /tmp/opencode/ld1.tr")` but then prints `LOADER: trace written to /tmp/opencode/ld.tr`. Either fix the two paths or drop `LOADER_TRACE`. - **Empty status block.** All six contain an empty conditional whose body is only a comment: ```lua if st ~= 0xFFFFFFFF and not done then -- The loader writes 0 on success... end ``` It does nothing; either implement the intended "nonzero is final" rule or remove it. - **Unused key.** `play_keys.lua:43` declares `key_p` and never uses it (`input.lua:158-159` is the one that does). - **Diverged result format.** `play.lua:280` prints `DIAG: tick=... quit=...`; `play_keys.lua` prints the loops/events/last/focus/rev/quit line. A shared harness needs one format. ## Acceptance After removing the dead paths, `apps/termtris/verify.sh --skip-mame` still reports `verify: PASS`, and `grep` finds no unused `MODE`/`A8DESC`/`RETURN_SP`/`xhello` constants in `apps/termtris/tests/`. This is a follow-up to PR #5, not a blocker for it.
Sign in to join this conversation.
No labels
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: arti/vt1200#7