Browse Source

runtests: native Tcl 8.6 support via guarded punk::lib compat load (lpop)

The validated compat family is brought across for the harness: guarded
'package require punk::lib' when ::lpop is absent, at both boot levels -
the toplevel two-stage boot (right after punk::args, whose parse needs
lpop at runtests.tcl's own argument parsing) and the singleproc
testinterp (before the shellrun preload, whose runx parses via
punk::args::parse). No-ops on Tcl 8.7+/9: -discover-only stays ~0.35s.

Native 8.6.17 verification: -discover-only works; punkcheck subtree
84/84, punk/lib subtree 43/43+1 gated skip, runner discovery suite
22/22, and a multiproc (-singleproc 0) probe 49/49.

Tcl 9.0.3 regression per the src/tests/AGENTS.md runner-change
contract: full suite in both modes with -report json,
runtests_parity.tcl reports PARITY: ok (files=96 total=1064
passed=1047 skipped=16 failed=1 - the sole failure is the documented
pre-existing exec-14.3 baseline).

src/tests/AGENTS.md records the supported-interpreter change and the
still-broken punk86-kit runtests route (kit/dev module skew - use a
native 8.6 tclsh for 8.6 legs).

Assisted-by: harness=claude; primary-model=claude-fable-5; api-location=anthropic.com
master
Julian Noble 6 days ago
parent
commit
1fbee821fc
  1. 1
      src/tests/AGENTS.md
  2. 16
      src/tests/runtests.tcl

1
src/tests/AGENTS.md

@ -41,6 +41,7 @@ Top-level test harness and source-tree tests for ShellSpy/Punk. Tests here exerc
## Work Guidance
- Select an appropriate interpreter, such as `tclsh`, `tclsh90`, or a built Punk executable such as `punk902z`.
- Native Tcl 8.6 tclsh is a supported runner interpreter (2026-07-21): `runtests.tcl` loads punk::lib's validated forward-compat command family (lpop etc - builtin parity pinned by `modules/punk/lib/testsuites/lib/compat.test`) at both boot levels (toplevel and testinterp) when the builtins are absent. The guards are no-ops on Tcl 8.7+/9, preserving the G-093 fast two-stage `-discover-only` boot. The punk86-kit route for runtests remains broken (kit/dev module skew loading dev punk::path) - use a native 8.6 tclsh for 8.6 legs.
- Run the full source-tree suite with `<tcl_interpreter> src/tests/runtests.tcl`.
- Use `-include-paths` with directory glob patterns relative to `src/tests/`, forward slashes — `modules/punk/args/***` runs that whole subtree (`X/***` deliberately excludes files directly in `X`; bare `X` is files-directly-in-X only). The flag accepts a space-separated list of patterns and may also be repeated, with all occurrences accumulating (`-multiple 1` as of 2026-07-10; previously the last flag silently won). Single-file targeting: `-include-paths modules/punk/args/testsuites/args dynamic.test`.
- Use `-exclude-paths` (same syntax and accumulation) to remove directories from discovery — `**`|`***` tails prune the matched subtree, other matches drop only that directory's files, and exclusion wins for the same file. It gives broad runs a middle ground between full and targeted: e.g `-exclude-paths shell/***` when no built kit is present, or skipping a heavy suite family unrelated to the change.

16
src/tests/runtests.tcl

@ -39,6 +39,14 @@ if {$libdir_arch ni $::auto_path} {
#inspection tool (boot ~1s instead of ~11s) for humans, agents and the runner-targeting
#regression suite (runner/testsuites/discovery/pathdiscovery.test).
package require punk::args
if {[info commands ::lpop] eq ""} {
#Native Tcl 8.6 interpreter: no builtin lpop, which punk::args::parse (and later runner code)
#uses. punk::lib installs its validated forward-compat family (lpop, ledit, lremove, ...) as
#global aliases whenever the builtins are absent - behavioural parity with the 8.7/9 builtins
#is pinned by modules/punk/lib/testsuites/lib/compat.test. Guarded: on Tcl 8.7+/9 this never
#runs, preserving the G-093 fast two-stage boot for -discover-only.
package require punk::lib
}
#test-file discovery + -include-paths/-exclude-paths filtering (G-093) - shared with the
#runner-targeting regression suite
@ -1150,6 +1158,14 @@ foreach testfile_relative $testfiles {
testinterp eval [list set ::argc [llength $tcltestoptions]]
testinterp eval {package require tcltest}
testinterp eval [list tcltest::configure {*}$tcltestoptions]
testinterp eval {
if {[info commands ::lpop] eq ""} {
#native Tcl 8.6 testinterp: shellrun's runx (the runner's capture mechanism) parses via
#punk::args::parse, which uses lpop. punk::lib installs the validated compat aliases
#(parity pinned by modules/punk/lib compat.test). No-op on Tcl 8.7+/9.
package require punk::lib
}
}
testinterp eval {package require shellrun}
#puts ">>>> [testinterp eval {
# set result ""

Loading…
Cancel
Save