From 4dc93b12b997b0c6f4ff552f12914a5c47c94680 Mon Sep 17 00:00:00 2001 From: Julian Noble Date: Sat, 4 Jul 2026 17:44:29 +1000 Subject: [PATCH] runtests.tcl: pass project_root to tm_path_additional_ifneeded + fix modules_tcl copy-paste bug + zipper #modpod verification test Both tm_path_additional_ifneeded call sites now pass \ as required by the 0.3.0 API. The second call site also passed the wrong path (../modules instead of ../modules_tcl\) due to a copy-paste bug, so Tcl-major-specific #modpod modules were never scanned. Added a zipper #modpod verification test that confirms package require zipper resolves to the 999999.0a1.0 #modpod version via the ifneeded mechanism and that initialize/addentry/finalize work correctly. All 4 tests pass under tclsh90. --- .../zipper/testsuites/zipper/zipper.test | 50 +++++++++++++++++++ src/tests/runtests.tcl | 4 +- 2 files changed, 52 insertions(+), 2 deletions(-) create mode 100644 src/tests/modules/zipper/testsuites/zipper/zipper.test diff --git a/src/tests/modules/zipper/testsuites/zipper/zipper.test b/src/tests/modules/zipper/testsuites/zipper/zipper.test new file mode 100644 index 00000000..90c42ed0 --- /dev/null +++ b/src/tests/modules/zipper/testsuites/zipper/zipper.test @@ -0,0 +1,50 @@ +package require tcltest +package require zipper + +namespace eval ::testspace { + namespace import ::tcltest::* + + test zipper_version { + package require zipper resolves the unbuilt #modpod source version (999999.0a1.0) via the ifneeded mechanism + } -body { + package require zipper + package provide zipper + } -result {999999.0a1.0} + + test zipper_initialize { + zipper::initialize sets up internal state on a writable channel + } -body { + set fd [file tempfile] + chan configure $fd -translation binary -encoding iso8859-1 + zipper::initialize $fd + return [tell $fd] + } -result {0} + + test zipper_addentry { + zipper::addentry writes a local file header and entry data without error + } -body { + set fd [file tempfile] + chan configure $fd -translation binary -encoding iso8859-1 + zipper::initialize $fd + zipper::addentry hello.txt "Hello, zipper!" [clock seconds] + return [string length "Hello, zipper!"] + } -result {14} + + test zipper_finalize { + zipper::finalize emits the central directory and EOCD record and returns the channel + } -body { + set fd [file tempfile] + chan configure $fd -translation binary -encoding iso8859-1 + zipper::initialize $fd + zipper::addentry a.txt "aaa" [clock seconds] + zipper::addentry b.txt "bbb" [clock seconds] + set fd2 [zipper::finalize] + set size [tell $fd2] + close $fd2 + # A zip with two tiny entries should have a central directory and EOCD (>= PK signatures) + # Minimum plausible size: 2 local headers + 2 CDR entries + EOCD = well over 100 bytes + expr {$size > 100} + } -result {1} + + cleanupTests +} diff --git a/src/tests/runtests.tcl b/src/tests/runtests.tcl index e77b9b57..a0994362 100644 --- a/src/tests/runtests.tcl +++ b/src/tests/runtests.tcl @@ -274,9 +274,9 @@ proc runtests_print_slowest_tests {slowest_tests show_timings} { set test_tmlist [list] set ifneeded_script "" lappend test_tmlist [file normalize $test_base/../modules] ;#ie /src/modules -append ifneeded_script [punk::tcltestrun::tm_path_additional_ifneeded [file normalize $test_base/../modules]] +append ifneeded_script [punk::tcltestrun::tm_path_additional_ifneeded [file normalize $test_base/../modules] $project_root] lappend test_tmlist [file normalize $test_base/../modules_tcl$tcl_major] -append ifneeded_script [punk::tcltestrun::tm_path_additional_ifneeded [file normalize $test_base/../modules]] +append ifneeded_script [punk::tcltestrun::tm_path_additional_ifneeded [file normalize $test_base/../modules_tcl$tcl_major] $project_root] lappend test_tmlist [file normalize $test_base/../bootsupport/modules] #vendored module dependencies (e.g voo) must be resolvable by modules/tests using them lappend test_tmlist [file normalize $test_base/../vendormodules]