Browse Source
multishell.test (10 tests, ~105s solo child - the -jobs floor) split five ways along shared-fixture boundaries, every test moved verbatim with its provenance lines: multishell.test keeps wrap + structure/LF-only + exec smoke (incl WSL); multishell_wrapverify.test (fresh-wrap checkfile) and multishell_wrapdeterminism.test (byte-identical re-wrap) each re-pay the wrap fixture; runtimecmd_checkfile.test and runtimecmd_roundtrip.test guard the committed bin/runtime.cmd and its source round-trip with no wrap fixture at all. argparsingtest.test (17 tests, ~32s) split into timeit/discover/contract/first_call (11) + argparsingtest_compare.test (compare_*, 6). Assessed and left unsplit: dtplite.test (24.6s solo), scriptexec.test (12s); exec.test excluded as imported core material. File headers point at the src/tests/modules/AGENTS.md punk/mix bullet for the sibling map; the runtests longest-first weight table carries measured post-split weights. runtests_parity.tcl gains a -names mode: multiset comparison of '- testname:' lines from '-report markdown -show-passes 1' captures, file attribution ignored - verbatim moves compare identical, lost/ duplicated/renamed tests are reported. Verified (native tclsh 9.0.3): repeated -jobs 8 full-suite runs 1m26.3s / 1m26.8s (was 2m16s at G-091, ~5m40s sequential - 4.07x vs the pre-parallel baseline, 36.6% vs the G-091 reference); slowest child 30.7s / 31.3s (bound 45s); NAMES identical (989 occurrences) vs the pre-split sequential capture; tallies identical in every run (989/973/ 15/1, exec-14.3 sole failure, files 87 -> 92); PARITY ok -jobs 8 vs -jobs 1 and between repeats; repo clean after runs. Notable finding recorded in the goal file: child-wall contention inflation (~45% with 50s+ dominant children present) collapsed to ~15% once the work distribution was flattened - splitting reduced both the critical path and the contention itself. G-092 flipped to achieved 2026-07-19 and archived (GOALS-archive.md record, detail file with full verification evidence to goals/archive/). goals_lint clean. Also noted in the goal file, out of scope: runtests -include-paths multi-pattern/repeated-flag matching misbehaved during measurement (single value with four deep patterns matched one; repeated flags matched zero) - contradicts documented semantics, needs its own investigation. Assisted-by: harness=claude; primary-model=claude-fable-5; api-location=anthropic.commaster
14 changed files with 565 additions and 168 deletions
@ -0,0 +1,78 @@
|
||||
|
||||
package require tcltest |
||||
package require argparsingtest |
||||
package require json |
||||
|
||||
namespace eval ::testspace { |
||||
namespace import ::tcltest::* |
||||
|
||||
#added 2026-07-18 (agent) - suite rewritten for the argparsingtest 1.0.0 restructure: |
||||
#parser procs live in per-style namespaces (opts/tkstyle/tclstyle), harness results are keyed by style |
||||
#Split 2026-07-19 (G-092 - parallel-floor reduction, tests moved verbatim from |
||||
#argparsingtest.test): this file holds the compare_* coverage; timeit/discover_parsers/ |
||||
#parser-contract/first_call tests live in argparsingtest.test in this directory. |
||||
|
||||
#added 2026-07-18 (agent) - N/A rows: unsupported library/style combos stay visible in the table |
||||
test compare_table_sections {Test that compare -format table emits all three style sections with N/A rows} -body { |
||||
set r [argparsingtest::compare -iterations 20 -format table -parsers {manual_switch punkargs cmdline_typed argp}] |
||||
set ok 1 |
||||
foreach expected {"options only" "tk style (positionals first)" "tcl style (positionals last)" "N/A" "not loaded:" "Parser"} { |
||||
if {[string first $expected $r] < 0} { set ok "missing: $expected" ; break } |
||||
} |
||||
set ok |
||||
} -result 1 |
||||
|
||||
#added 2026-07-18 (agent) |
||||
test compare_dict {Test that compare -format dict returns style-keyed results/first_call/not_loaded/unsupported} -body { |
||||
set r [argparsingtest::compare -style opts -iterations 20 -parsers {manual_switch} -format dict] |
||||
set ok 1 |
||||
foreach key {results first_call not_loaded unsupported} { |
||||
if {![dict exists $r $key]} { set ok "missing $key" ; break } |
||||
} |
||||
if {$ok eq 1 && ![dict exists $r results opts manual_switch us_per_call]} { set ok "missing results.opts.manual_switch" } |
||||
if {$ok eq 1 && [dict get $r unsupported opts] ne ""} { set ok "unexpected unsupported list" } |
||||
set ok |
||||
} -result 1 |
||||
|
||||
#added 2026-07-18 (agent) |
||||
test compare_json {Test that compare -format json round-trips with style-keyed unsupported and first_call structure} -body { |
||||
set r [argparsingtest::compare -style tkstyle -iterations 20 -parsers {manual_switch cmdline_typed} -format json] |
||||
set ok 1 |
||||
if {[catch {set d [json::json2dict $r]} _err]} { set ok "json parse: $_err" } |
||||
if {$ok eq 1 && ![dict exists $d results tkstyle manual_switch us_per_call]} { set ok "missing results" } |
||||
if {$ok eq 1 && [dict get $d unsupported tkstyle] ne "cmdline_typed"} { set ok "unsupported: [dict get $d unsupported tkstyle]" } |
||||
if {$ok eq 1 && ![dict exists $d first_call tkstyle manual_switch cold]} { set ok "missing first_call cold" } |
||||
if {$ok eq 1 && ![dict exists $d first_call tkstyle manual_switch warm]} { set ok "missing first_call warm" } |
||||
set ok |
||||
} -result 1 |
||||
|
||||
#added 2026-07-17 (agent) |
||||
test compare_badformat {Test that compare -format bogus raises an error containing choiceviolation} -body { |
||||
set caught [catch {argparsingtest::compare -format bogus} err] |
||||
set ok 0 |
||||
if {$caught && ([string first "choiceviolation" $err] >= 0 || [string first "must be one of" $err] >= 0)} { |
||||
set ok 1 |
||||
} |
||||
set ok |
||||
} -result 1 |
||||
|
||||
#added 2026-07-18 (agent) |
||||
test compare_badstyle {Test that compare -style bogus raises an error containing choiceviolation} -body { |
||||
set caught [catch {argparsingtest::compare -style bogus} err] |
||||
set ok 0 |
||||
if {$caught && ([string first "choiceviolation" $err] >= 0 || [string first "must be one of" $err] >= 0)} { |
||||
set ok 1 |
||||
} |
||||
set ok |
||||
} -result 1 |
||||
|
||||
#added 2026-07-17 (agent) |
||||
test compare_table_first_columns {Test that compare table output has first_cold and first_warm columns} -body { |
||||
set r [argparsingtest::compare -style opts -iterations 20 -format table -parsers {manual_switch}] |
||||
set ok 1 |
||||
if {[string first "first_cold" $r] < 0} { set ok 0 } |
||||
if {$ok && [string first "first_warm" $r] < 0} { set ok 0 } |
||||
set ok |
||||
} -result 1 |
||||
} |
||||
tcltest::cleanupTests |
||||
@ -0,0 +1,100 @@
|
||||
package require tcltest |
||||
|
||||
package require Thread ;#punk::fileline textinfo (used by scriptwrap machinery) calls thread::id |
||||
package require punk::mix::commandset::scriptwrap |
||||
|
||||
#Characterization of the punk MULTISHELL polyglot build machinery |
||||
#(punk::mix::commandset::scriptwrap::multishell + checkfile) - added 2026-07-10 at the |
||||
#user's direction: the polyglot technique is deliberately maintained despite its |
||||
#fragility, so the machinery that generates bin/*.cmd needs pins. |
||||
# |
||||
#Split 2026-07-19 (G-092 - parallel-floor reduction, test moved verbatim from |
||||
#multishell.test via multishell_wrapverify.test): this file holds the wrap determinism |
||||
#pin. The other .test files in this directory hold the rest of the multishell/scriptwrap |
||||
#coverage - see src/tests/modules/AGENTS.md (punk/mix bullet). |
||||
# |
||||
#Covered here: |
||||
# - wrapping is deterministic (byte-identical on re-wrap) |
||||
# |
||||
#NOTE for agents: bin/*.cmd files are GENERATED - fix the payloads under src/scriptapps/ |
||||
#(<name>.ps1/.bash/.tcl + <name>_wrap.toml) and re-wrap; do not edit the polyglot output |
||||
#(see bin/AGENTS.md and src/scriptapps/AGENTS.md). |
||||
|
||||
namespace eval ::testspace { |
||||
namespace import ::tcltest::* |
||||
variable common { |
||||
set result "" |
||||
} |
||||
|
||||
variable ps_payload {Write-Host "MARKER_POWERSHELL_OK"} |
||||
variable sh_payload {echo "MARKER_SHELL_OK"} |
||||
|
||||
#write with explicit lf translation - payload/toml files are consumed byte-wise |
||||
proc writefile_lf {path content} { |
||||
set fd [open $path w] |
||||
fconfigure $fd -translation lf |
||||
puts $fd $content |
||||
close $fd |
||||
} |
||||
variable fixdir [makeDirectory scriptwrap_fixture] |
||||
writefile_lf $fixdir/wrapset.ps1 $ps_payload |
||||
writefile_lf $fixdir/wrapset.sh $sh_payload |
||||
writefile_lf $fixdir/wrapset_wrap.toml { |
||||
[application] |
||||
template="punk.multishell.cmd" |
||||
scripts=[ |
||||
"wrapset.ps1", |
||||
"wrapset.sh" |
||||
] |
||||
default_outputfile="wrapset.cmd" |
||||
default_nextshellpath="/usr/bin/env bash" |
||||
default_nextshelltype="bash" |
||||
win32.nextshellpath="cmd.exe /c powershell -nop -nol -ExecutionPolicy bypass -File" |
||||
win32.nextshelltype="powershell" |
||||
win32.outputfile="wrapset.cmd" |
||||
} |
||||
|
||||
#wrap once at load - the test re-wraps and compares against this output (multishell |
||||
#chats on stdout; that output is not part of test comparisons) |
||||
variable wrapresult "" |
||||
variable outfile "" |
||||
variable wrap_ok 0 |
||||
variable startdir [pwd] |
||||
cd $fixdir |
||||
if {![catch {punk::mix::commandset::scriptwrap::multishell wrapset -outputfolder $fixdir -askme 0 -force 1} wrapresult]} { |
||||
if {[dict exists $wrapresult filename]} { |
||||
set outfile [dict get $wrapresult filename] |
||||
set wrap_ok [file exists $outfile] |
||||
} |
||||
} |
||||
cd $startdir |
||||
testConstraint wrapok $wrap_ok |
||||
|
||||
proc readbytes {path} { |
||||
set fd [open $path r] |
||||
fconfigure $fd -translation binary |
||||
set data [read $fd] |
||||
close $fd |
||||
return $data |
||||
} |
||||
|
||||
test scriptwrap_multishell_wrap_deterministic {re-wrapping the same scriptset produces byte-identical output}\ |
||||
-constraints wrapok\ |
||||
-setup $common -body { |
||||
variable fixdir |
||||
variable outfile |
||||
variable startdir |
||||
set outdir2 [makeDirectory scriptwrap_fixture_rewrap] |
||||
cd $fixdir |
||||
set res2 [punk::mix::commandset::scriptwrap::multishell wrapset -outputfolder $outdir2 -askme 0 -force 1] |
||||
cd $startdir |
||||
set outfile2 [dict get $res2 filename] |
||||
lappend result [file exists $outfile2] |
||||
lappend result [expr {[readbytes $outfile] eq [readbytes $outfile2]}] |
||||
}\ |
||||
-cleanup { |
||||
cd $startdir |
||||
}\ |
||||
-result [list 1 1] |
||||
} |
||||
tcltest::cleanupTests ;#needed to produce test summary line. |
||||
@ -0,0 +1,95 @@
|
||||
package require tcltest |
||||
|
||||
package require Thread ;#punk::fileline textinfo (used by scriptwrap checkfile) calls thread::id |
||||
package require punk::mix::commandset::scriptwrap |
||||
|
||||
#Characterization of the punk MULTISHELL polyglot build machinery |
||||
#(punk::mix::commandset::scriptwrap::multishell + checkfile) - added 2026-07-10 at the |
||||
#user's direction: the polyglot technique is deliberately maintained despite its |
||||
#fragility, so the machinery that generates bin/*.cmd needs pins. |
||||
# |
||||
#Split 2026-07-19 (G-092 - parallel-floor reduction, tests moved verbatim from |
||||
#multishell.test): this file holds checkfile validation of a fresh wrap. The other .test |
||||
#files in this directory hold the rest of the multishell/scriptwrap coverage - see |
||||
#src/tests/modules/AGENTS.md (punk/mix bullet). |
||||
# |
||||
#Covered here: |
||||
# - checkfile (the 512-byte label/boundary validator) reports no label location errors |
||||
# for a fresh wrap |
||||
# |
||||
#NOTE for agents: bin/*.cmd files are GENERATED - fix the payloads under src/scriptapps/ |
||||
#(<name>.ps1/.bash/.tcl + <name>_wrap.toml) and re-wrap; do not edit the polyglot output |
||||
#(see bin/AGENTS.md and src/scriptapps/AGENTS.md). |
||||
|
||||
namespace eval ::testspace { |
||||
namespace import ::tcltest::* |
||||
variable common { |
||||
set result "" |
||||
} |
||||
|
||||
variable ps_payload {Write-Host "MARKER_POWERSHELL_OK"} |
||||
variable sh_payload {echo "MARKER_SHELL_OK"} |
||||
|
||||
#write with explicit lf translation - payload/toml files are consumed byte-wise |
||||
proc writefile_lf {path content} { |
||||
set fd [open $path w] |
||||
fconfigure $fd -translation lf |
||||
puts $fd $content |
||||
close $fd |
||||
} |
||||
variable fixdir [makeDirectory scriptwrap_fixture] |
||||
writefile_lf $fixdir/wrapset.ps1 $ps_payload |
||||
writefile_lf $fixdir/wrapset.sh $sh_payload |
||||
writefile_lf $fixdir/wrapset_wrap.toml { |
||||
[application] |
||||
template="punk.multishell.cmd" |
||||
scripts=[ |
||||
"wrapset.ps1", |
||||
"wrapset.sh" |
||||
] |
||||
default_outputfile="wrapset.cmd" |
||||
default_nextshellpath="/usr/bin/env bash" |
||||
default_nextshelltype="bash" |
||||
win32.nextshellpath="cmd.exe /c powershell -nop -nol -ExecutionPolicy bypass -File" |
||||
win32.nextshelltype="powershell" |
||||
win32.outputfile="wrapset.cmd" |
||||
} |
||||
|
||||
#wrap once at load - the tests examine this output (multishell chats on stdout; that |
||||
#output is not part of test comparisons) |
||||
variable wrapresult "" |
||||
variable outfile "" |
||||
variable wrap_ok 0 |
||||
variable startdir [pwd] |
||||
cd $fixdir |
||||
if {![catch {punk::mix::commandset::scriptwrap::multishell wrapset -outputfolder $fixdir -askme 0 -force 1} wrapresult]} { |
||||
if {[dict exists $wrapresult filename]} { |
||||
set outfile [dict get $wrapresult filename] |
||||
set wrap_ok [file exists $outfile] |
||||
} |
||||
} |
||||
cd $startdir |
||||
testConstraint wrapok $wrap_ok |
||||
|
||||
proc readbytes {path} { |
||||
set fd [open $path r] |
||||
fconfigure $fd -translation binary |
||||
set data [read $fd] |
||||
close $fd |
||||
return $data |
||||
} |
||||
|
||||
test scriptwrap_checkfile_generated_no_label_errors {checkfile reports no 512-byte label location errors for a fresh wrap}\ |
||||
-constraints wrapok\ |
||||
-setup $common -body { |
||||
variable outfile |
||||
set summary [punk::mix::commandset::scriptwrap::checkfile $outfile] |
||||
lappend result [string match "*ERROR: label location errors*" $summary] |
||||
#sanity: the analysis actually ran (labels enumerated) |
||||
lappend result [string match "*call-labels-found:*" $summary] |
||||
}\ |
||||
-cleanup { |
||||
}\ |
||||
-result [list 0 1] |
||||
} |
||||
tcltest::cleanupTests ;#needed to produce test summary line. |
||||
@ -0,0 +1,62 @@
|
||||
package require tcltest |
||||
|
||||
package require Thread ;#punk::fileline textinfo (used by scriptwrap checkfile) calls thread::id |
||||
package require punk::mix::commandset::scriptwrap |
||||
|
||||
#Characterization of the punk MULTISHELL polyglot build machinery |
||||
#(punk::mix::commandset::scriptwrap::multishell + checkfile) - added 2026-07-10 at the |
||||
#user's direction: the polyglot technique is deliberately maintained despite its |
||||
#fragility, so the machinery that generates bin/*.cmd needs pins. |
||||
# |
||||
#Split 2026-07-19 (G-092 - parallel-floor reduction, test moved verbatim from |
||||
#multishell.test): this file guards the COMMITTED bin/runtime.cmd artifact (no wrap |
||||
#fixture needed). The other .test files in this directory hold the rest of the |
||||
#multishell/scriptwrap coverage - see src/tests/modules/AGENTS.md (punk/mix bullet). |
||||
# |
||||
#Covered here: |
||||
# - checkfile (the 512-byte label/boundary validator) reports no label location errors |
||||
# for the committed bin/runtime.cmd, and the artifact is LF-only - guarding against |
||||
# hand-edits or line-ending damage to the shipped artifact |
||||
# |
||||
#NOTE for agents: bin/*.cmd files are GENERATED - fix the payloads under src/scriptapps/ |
||||
#(<name>.ps1/.bash/.tcl + <name>_wrap.toml) and re-wrap; do not edit the polyglot output |
||||
#(see bin/AGENTS.md and src/scriptapps/AGENTS.md). |
||||
|
||||
namespace eval ::testspace { |
||||
namespace import ::tcltest::* |
||||
variable common { |
||||
set result "" |
||||
} |
||||
|
||||
variable testdir [file dirname [file normalize [info script]]] |
||||
#<projectroot>/src/tests/modules/punk/mix/testsuites/scriptwrap -> 7 levels up |
||||
variable projectroot [file normalize [file join $testdir .. .. .. .. .. .. ..]] |
||||
|
||||
proc readbytes {path} { |
||||
set fd [open $path r] |
||||
fconfigure $fd -translation binary |
||||
set data [read $fd] |
||||
close $fd |
||||
return $data |
||||
} |
||||
|
||||
test scriptwrap_checkfile_committed_runtime_cmd {the committed bin/runtime.cmd passes checkfile - no label/boundary damage from hand-edits or line-ending conversion}\ |
||||
-setup $common -body { |
||||
variable projectroot |
||||
set target [file join $projectroot bin runtime.cmd] |
||||
if {![file exists $target]} { |
||||
#not built/present in this checkout - treat as vacuous pass with marker |
||||
lappend result no_runtime_cmd |
||||
} else { |
||||
set data [readbytes $target] |
||||
#LF-only is part of the artifact's contract |
||||
lappend result [expr {[string first \r $data] == -1}] |
||||
set summary [punk::mix::commandset::scriptwrap::checkfile $target] |
||||
lappend result [string match "*ERROR: label location errors*" $summary] |
||||
} |
||||
}\ |
||||
-cleanup { |
||||
}\ |
||||
-result [list 1 0] |
||||
} |
||||
tcltest::cleanupTests ;#needed to produce test summary line. |
||||
@ -0,0 +1,70 @@
|
||||
package require tcltest |
||||
|
||||
package require Thread ;#punk::fileline textinfo (used by scriptwrap machinery) calls thread::id |
||||
package require punk::mix::commandset::scriptwrap |
||||
|
||||
#Characterization of the punk MULTISHELL polyglot build machinery |
||||
#(punk::mix::commandset::scriptwrap::multishell + checkfile) - added 2026-07-10 at the |
||||
#user's direction: the polyglot technique is deliberately maintained despite its |
||||
#fragility, so the machinery that generates bin/*.cmd needs pins. |
||||
# |
||||
#Split 2026-07-19 (G-092 - parallel-floor reduction, test moved verbatim from |
||||
#multishell.test): this file holds the source-to-artifact round-trip pin (no wrap fixture |
||||
#needed - it wraps the real runtime scriptset from src/scriptapps/bin). The other .test |
||||
#files in this directory hold the rest of the multishell/scriptwrap coverage - see |
||||
#src/tests/modules/AGENTS.md (punk/mix bullet). |
||||
# |
||||
#Covered here: |
||||
# - re-wrapping the runtime scriptset from src/scriptapps/bin reproduces the committed |
||||
# bin/runtime.cmd byte for byte - the artifact is in sync with its sources and |
||||
# un-hand-edited |
||||
# |
||||
#NOTE for agents: bin/*.cmd files are GENERATED - fix the payloads under src/scriptapps/ |
||||
#(<name>.ps1/.bash/.tcl + <name>_wrap.toml) and re-wrap; do not edit the polyglot output |
||||
#(see bin/AGENTS.md and src/scriptapps/AGENTS.md). |
||||
|
||||
namespace eval ::testspace { |
||||
namespace import ::tcltest::* |
||||
variable common { |
||||
set result "" |
||||
} |
||||
|
||||
variable testdir [file dirname [file normalize [info script]]] |
||||
#<projectroot>/src/tests/modules/punk/mix/testsuites/scriptwrap -> 7 levels up |
||||
variable projectroot [file normalize [file join $testdir .. .. .. .. .. .. ..]] |
||||
variable startdir [pwd] |
||||
|
||||
proc readbytes {path} { |
||||
set fd [open $path r] |
||||
fconfigure $fd -translation binary |
||||
set data [read $fd] |
||||
close $fd |
||||
return $data |
||||
} |
||||
|
||||
test scriptwrap_runtime_cmd_roundtrip_no_drift {re-wrapping the runtime scriptset from src/scriptapps/bin reproduces the committed bin/runtime.cmd byte for byte - the artifact is in sync with its sources and un-hand-edited}\ |
||||
-setup $common -body { |
||||
variable projectroot |
||||
variable startdir |
||||
set target [file join $projectroot bin runtime.cmd] |
||||
set scriptapps [file join $projectroot src scriptapps bin] |
||||
if {![file exists $target] || ![file exists $scriptapps/runtime_wrap.toml]} { |
||||
lappend result no_runtime_sources |
||||
} else { |
||||
set outdir [makeDirectory scriptwrap_runtime_roundtrip] |
||||
cd $scriptapps |
||||
set res [punk::mix::commandset::scriptwrap::multishell runtime -outputfolder $outdir -askme 0 -force 1] |
||||
cd $startdir |
||||
set fresh [dict get $res filename] |
||||
lappend result [expr {[readbytes $fresh] eq [readbytes $target]}] |
||||
#a failure here means either bin/runtime.cmd was edited directly (fix the |
||||
#src/scriptapps payloads instead and re-wrap), or the payloads/template |
||||
#changed without regenerating bin/runtime.cmd (re-wrap and commit it) |
||||
} |
||||
}\ |
||||
-cleanup { |
||||
cd $startdir |
||||
}\ |
||||
-result [list 1] |
||||
} |
||||
tcltest::cleanupTests ;#needed to produce test summary line. |
||||
Loading…
Reference in new issue