diff options
author | kjnash <k.j.nash@usa.net> | 2020-07-16 16:23:55 (GMT) |
---|---|---|
committer | kjnash <k.j.nash@usa.net> | 2020-07-16 16:23:55 (GMT) |
commit | ba68516ddb2714e2e7ab22dd2d00b8841712af53 (patch) | |
tree | 8903fdd97dc9d3406da81a8cd110c7092d2e47dc /tests/safe.test | |
parent | ab138d729bee33a3f0274e72b5cdb0bb2e83c168 (diff) | |
parent | 7d6a2292b530eb21168b734c6dcf292c9927ad08 (diff) | |
download | tcl-ba68516ddb2714e2e7ab22dd2d00b8841712af53.zip tcl-ba68516ddb2714e2e7ab22dd2d00b8841712af53.tar.gz tcl-ba68516ddb2714e2e7ab22dd2d00b8841712af53.tar.bz2 |
Merge safe-extra-tests-8-7
Diffstat (limited to 'tests/safe.test')
-rw-r--r-- | tests/safe.test | 646 |
1 files changed, 326 insertions, 320 deletions
diff --git a/tests/safe.test b/tests/safe.test index c01ce47..38b1705 100644 --- a/tests/safe.test +++ b/tests/safe.test @@ -12,7 +12,7 @@ package require Tcl 8.5- -if {[lsearch [namespace children] ::tcltest] == -1} { +if {"::tcltest" ni [namespace children]} { package require tcltest 2 namespace import -force ::tcltest::* } @@ -82,6 +82,26 @@ set TestsDir [file normalize [file dirname [info script]]] set ZipMountPoint [zipfs root]auto-files zipfs mount $ZipMountPoint [file join $TestsDir auto-files.zip] +set PathMapp {} +lappend PathMapp [file join [info library] $pkgOptDir] TCLLIB/OPTDIR +lappend PathMapp [file join [info library] $pkgJarDir] TCLLIB/JARDIR +lappend PathMapp $tcl_library TCLLIB $TestsDir TESTSDIR $ZipMountPoint ZIPDIR + +proc mapList {map listIn} { + set listOut {} + foreach element $listIn { + lappend listOut [string map $map $element] + } + return $listOut +} +proc mapAndSortList {map listIn} { + set listOut {} + foreach element $listIn { + lappend listOut [string map $map $element] + } + lsort $listOut +} + # Force actual loading of the safe package because we use un-exported (and # thus un-autoindexed) APIs in this test result arguments: catch {safe::interpConfigure} @@ -322,7 +342,6 @@ test safe-7.0cz {example pkgIndex.tcl packages, test in master interpreter, chil set code4 [catch {package require SafeTestPackage2} msg4] set code5 [catch HeresPackage1 msg5] set code6 [catch HeresPackage2 msg6] - list $code3 $msg3 $code4 $msg4 $code5 $msg5 $code6 $msg6 } -cleanup { set ::auto_path $tmpAutoPath @@ -360,7 +379,6 @@ test safe-7.0dz {example pkgIndex.tcl packages, test in master interpreter, main set code4 [catch {package require SafeTestPackage2} msg4] set code5 [catch HeresPackage1 msg5] set code6 [catch HeresPackage2 msg6] - list $code3 $msg3 $code4 $msg4 $code5 $msg5 $code6 $msg6 } -cleanup { set ::auto_path $tmpAutoPath @@ -410,7 +428,6 @@ test safe-7.0ez {example modules packages, test in master interpreter, replace p set out0 [test0::try0] set out1 [mod1::test1::try1] set out2 [mod2::test2::try2] - list $code0 $msg0 $code1 $msg1 $code2 $msg2 -- $out0 $out1 $out2 } -cleanup { tcl::tm::path remove [file join $ZipMountPoint auto0 modules] @@ -453,7 +470,6 @@ test safe-7.0fz {example modules packages, test in master interpreter, append to set out0 [test0::try0] set out1 [mod1::test1::try1] set out2 [mod2::test2::try2] - list $code0 $msg0 $code1 $msg1 $code2 $msg2 -- $out0 $out1 $out2 } -cleanup { tcl::tm::path remove [file join $ZipMountPoint auto0 modules] @@ -505,7 +521,7 @@ test safe-7.1z {tests that everything works at high level with conventional Auto } set tmpAutoPath $::auto_path - lappend ::auto_path [file join $TestsDir auto0] + lappend ::auto_path [file join $ZipMountPoint auto0] set i [safe::interpCreate] set ::auto_path $tmpAutoPath } -body { @@ -565,20 +581,20 @@ test safe-7.2 {tests specific path and interpFind/AddToAccessPath with conventio set token2 [safe::interpAddToAccessPath $i "/dummy/unixlike/test/path"] # should add as p* (not p2 if master has a module path) set token3 [safe::interpAddToAccessPath $i [file join $TestsDir auto0]] + set confA [safe::interpConfigure $i] + set mappA [mapList $PathMapp [dict get $confA -accessPath]] # an error shall occur (SafeTestPackage1 is not anymore in the secure 0-level # provided deep path) - list $token1 $token2 $token3 \ - [catch {interp eval $i {package require SafeTestPackage1}} msg] $msg \ - [safe::interpConfigure $i]\ - [safe::interpDelete $i] + list $token1 $token2 $token3 -- \ + [catch {interp eval $i {package require SafeTestPackage1}} msg] $msg -- \ + $mappA -- [safe::interpDelete $i] } -cleanup { if {$SyncExists} { safe::setAutoPathSync $SyncVal_TMP } -} -match glob -result "{\$p(:0:)} {\$p(:*:)} {\$p(:*:)} 1\ - {can't find package SafeTestPackage1}\ - {-accessPath {[list $tcl_library */dummy/unixlike/test/path $TestsDir/auto0]}\ - -statics 0 -nested 1 -deleteHook {}} {}" +} -match glob -result {{$p(:0:)} {$p(:*:)} {$p(:*:)} --\ + 1 {can't find package SafeTestPackage1} --\ + {TCLLIB */dummy/unixlike/test/path TESTSDIR/auto0} -- {}} test safe-7.2z {tests specific path and interpFind/AddToAccessPath with conventional AutoPathSync; zipfs} -setup { # All ::safe commands are loaded at start of file. set SyncExists [expr {[info commands ::safe::setAutoPathSync] ne {}}] @@ -596,21 +612,21 @@ test safe-7.2z {tests specific path and interpFind/AddToAccessPath with conventi # should add as p* (not p1 if master has a module path) set token2 [safe::interpAddToAccessPath $i "/dummy/unixlike/test/path"] # should add as p* (not p2 if master has a module path) - set token3 [safe::interpAddToAccessPath $i [file join $TestsDir auto0]] + set token3 [safe::interpAddToAccessPath $i [file join $ZipMountPoint auto0]] + set confA [safe::interpConfigure $i] + set mappA [mapList $PathMapp [dict get $confA -accessPath]] # an error shall occur (SafeTestPackage1 is not anymore in the secure 0-level # provided deep path) - list $token1 $token2 $token3 \ - [catch {interp eval $i {package require SafeTestPackage1}} msg] $msg \ - [safe::interpConfigure $i]\ - [safe::interpDelete $i] + list $token1 $token2 $token3 -- \ + [catch {interp eval $i {package require SafeTestPackage1}} msg] $msg -- \ + $mappA -- [safe::interpDelete $i] } -cleanup { if {$SyncExists} { safe::setAutoPathSync $SyncVal_TMP } -} -match glob -result "{\$p(:0:)} {\$p(:*:)} {\$p(:*:)} 1\ - {can't find package SafeTestPackage1}\ - {-accessPath {[list $tcl_library */dummy/unixlike/test/path $TestsDir/auto0]}\ - -statics 0 -nested 1 -deleteHook {}} {}" +} -match glob -result {{$p(:0:)} {$p(:*:)} {$p(:*:)} --\ + 1 {can't find package SafeTestPackage1} --\ + {TCLLIB */dummy/unixlike/test/path ZIPDIR/auto0} -- {}} test safe-7.2opt {tests specific path and interpFind/AddToAccessPath with conventional AutoPathSync, use pkg opt} -setup { # All ::safe commands are loaded at start of file. set SyncExists [expr {[info commands ::safe::setAutoPathSync] ne {}}] @@ -629,22 +645,30 @@ test safe-7.2opt {tests specific path and interpFind/AddToAccessPath with conven set token2 [safe::interpAddToAccessPath $i "/dummy/unixlike/test/path"] # an error shall occur (opt is not anymore in the secure 0-level # provided deep path) - list $token1 $token2 \ - [catch {interp eval $i {package require opt}} msg] $msg \ - [safe::interpConfigure $i]\ - [safe::interpDelete $i] + set confA [safe::interpConfigure $i] + set mappA [mapList $PathMapp [dict get $confA -accessPath]] + list $token1 $token2 -- \ + [catch {interp eval $i {package require opt}} msg] $msg -- \ + $mappA -- [safe::interpDelete $i] } -cleanup { if {$SyncExists} { safe::setAutoPathSync $SyncVal_TMP } -} -match glob -result "{\$p(:0:)} {\$p(:*:)} 1 {$pkgOptErrMsg}\ - {-accessPath {[list $tcl_library */dummy/unixlike/test/path]}\ - -statics 0 -nested 1 -deleteHook {}} {}" +} -match glob -result {{$p(:0:)} {$p(:*:)} -- 1 {can't find package opt} --\ + {TCLLIB */dummy/unixlike/test/path} -- {}} test safe-7.3 {check that safe subinterpreters work} { + set g [interp slaves] + if {$g ne {}} { + append g { -- residue of an earlier test} + } + set h [info vars ::safe::S*] + if {$h ne {}} { + append h { -- residue of an earlier test} + } set i [safe::interpCreate] set j [safe::interpCreate [list $i x]] - list [interp eval $j {join {o k} ""}] [safe::interpDelete $i] [interp exists $j] -} {ok {} 0} + list $g $h [interp eval $j {join {o k} ""}] [safe::interpDelete $i] [interp exists $j] [info vars ::safe::S*] +} {{} {} ok {} 0 {}} test safe-7.4 {tests specific path and positive search with conventional AutoPathSync} -setup { # All ::safe commands are loaded at start of file. set SyncExists [expr {[info commands ::safe::setAutoPathSync] ne {}}] @@ -661,20 +685,20 @@ test safe-7.4 {tests specific path and positive search with conventional AutoPat set token1 [safe::interpAddToAccessPath $i [info library]] # should add as p* (not p1 if master has a module path) set token2 [safe::interpAddToAccessPath $i [file join $TestsDir auto0 auto1]] + set confA [safe::interpConfigure $i] + set mappA [mapList $PathMapp [dict get $confA -accessPath]] # this time, unlike test safe-7.2, SafeTestPackage1 should be found - list $token1 $token2 \ - [catch {interp eval $i {package require SafeTestPackage1}} msg] $msg \ - [safe::interpConfigure $i]\ - [safe::interpDelete $i] + list $token1 $token2 -- \ + [catch {interp eval $i {package require SafeTestPackage1}} msg] $msg -- \ + $mappA -- [safe::interpDelete $i] # Note that the glob match elides directories (those from the module path) # other than the first and last in the access path. } -cleanup { if {$SyncExists} { safe::setAutoPathSync $SyncVal_TMP } -} -match glob -result "{\$p(:0:)} {\$p(:*:)} 0 1.2.3\ - {-accessPath {[list $tcl_library * $TestsDir/auto0/auto1]}\ - -statics 0 -nested 1 -deleteHook {}} {}" +} -match glob -result {{$p(:0:)} {$p(:*:)} -- 0 1.2.3 --\ + {TCLLIB * TESTSDIR/auto0/auto1} -- {}} test safe-7.4z {tests specific path and positive search with conventional AutoPathSync; zipfs} -setup { # All ::safe commands are loaded at start of file. set SyncExists [expr {[info commands ::safe::setAutoPathSync] ne {}}] @@ -690,21 +714,21 @@ test safe-7.4z {tests specific path and positive search with conventional AutoPa # should not add anything (p0) set token1 [safe::interpAddToAccessPath $i [info library]] # should add as p* (not p1 if master has a module path) - set token2 [safe::interpAddToAccessPath $i [file join $TestsDir auto0 auto1]] - # this time, unlike test safe-7.2z, SafeTestPackage1 should be found - list $token1 $token2 \ - [catch {interp eval $i {package require SafeTestPackage1}} msg] $msg \ - [safe::interpConfigure $i]\ - [safe::interpDelete $i] + set token2 [safe::interpAddToAccessPath $i [file join $ZipMountPoint auto0 auto1]] + set confA [safe::interpConfigure $i] + set mappA [mapList $PathMapp [dict get $confA -accessPath]] + # this time, unlike test safe-7.2, SafeTestPackage1 should be found + list $token1 $token2 -- \ + [catch {interp eval $i {package require SafeTestPackage1}} msg] $msg -- \ + $mappA -- [safe::interpDelete $i] # Note that the glob match elides directories (those from the module path) # other than the first and last in the access path. } -cleanup { if {$SyncExists} { safe::setAutoPathSync $SyncVal_TMP } -} -match glob -result "{\$p(:0:)} {\$p(:*:)} 0 1.2.3\ - {-accessPath {[list $tcl_library * $TestsDir/auto0/auto1]}\ - -statics 0 -nested 1 -deleteHook {}} {}" +} -match glob -result {{$p(:0:)} {$p(:*:)} -- 0 1.2.3 --\ + {TCLLIB * ZIPDIR/auto0/auto1} -- {}} test safe-7.4opt {tests specific path and positive search with conventional AutoPathSync, use pkg opt} -setup { # All ::safe commands are loaded at start of file. set SyncExists [expr {[info commands ::safe::setAutoPathSync] ne {}}] @@ -721,20 +745,20 @@ test safe-7.4opt {tests specific path and positive search with conventional Auto set token1 [safe::interpAddToAccessPath $i [info library]] # should add as p* (not p1 if master has a module path) set token2 [safe::interpAddToAccessPath $i [file join [info library] $pkgOptDir]] + set confA [safe::interpConfigure $i] + set mappA [mapList $PathMapp [dict get $confA -accessPath]] # this time, unlike test safe-7.2opt, opt should be found - list $token1 $token2 \ - [catch {interp eval $i {package require opt}} msg] $msg \ - [safe::interpConfigure $i]\ - [safe::interpDelete $i] + list $token1 $token2 -- \ + [catch {interp eval $i {package require opt}} msg] $msg -- \ + $mappA -- [safe::interpDelete $i] # Note that the glob match elides directories (those from the module path) # other than the first and last in the access path. } -cleanup { if {$SyncExists} { safe::setAutoPathSync $SyncVal_TMP } -} -match glob -result "{\$p(:0:)} {\$p(:*:)} 0 0.4.*\ - {-accessPath {[list $tcl_library *$tcl_library/$pkgOptDir]}\ - -statics 0 -nested 1 -deleteHook {}} {}" +} -match glob -result {{$p(:0:)} {$p(:*:)} -- 0 0.4.* --\ + {TCLLIB * TCLLIB/OPTDIR} -- {}} test safe-7.5 {tests positive and negative module loading with conventional AutoPathSync} -setup { # All ::safe commands are loaded at start of file. @@ -994,9 +1018,9 @@ test safe-9.8 {interpConfigure change the access path; tclIndex commands unaffec set i [safe::interpCreate -accessPath [list $tcl_library \ [file join $TestsDir auto0 auto1] \ [file join $TestsDir auto0 auto2]]] - # Inspect. set confA [safe::interpConfigure $i] + set mappA [mapList $PathMapp [dict get $confA -accessPath]] set path1 [::safe::interpFindInAccessPath $i [file join $TestsDir auto0 auto1]] set path2 [::safe::interpFindInAccessPath $i [file join $TestsDir auto0 auto2]] @@ -1015,6 +1039,7 @@ test safe-9.8 {interpConfigure change the access path; tclIndex commands unaffec # Inspect. set confB [safe::interpConfigure $i] + set mappB [mapList $PathMapp [dict get $confB -accessPath]] set path3 [::safe::interpFindInAccessPath $i [file join $TestsDir auto0 auto1]] set path4 [::safe::interpFindInAccessPath $i [file join $TestsDir auto0 auto2]] @@ -1022,17 +1047,16 @@ test safe-9.8 {interpConfigure change the access path; tclIndex commands unaffec set code3 [catch {interp eval $i {report1}} msg3] set code4 [catch {interp eval $i {report2}} msg4] - list $path1 $path2 $path3 $path4 $code3 $msg3 $code4 $msg4 $confA $confB + list $path1 $path2 -- $path3 $path4 -- $code3 $msg3 $code4 $msg4 -- $mappA -- $mappB } -cleanup { safe::interpDelete $i if {$SyncExists} { safe::setAutoPathSync $SyncVal_TMP } -} -match glob -result "{\$p(:1:)} {\$p(:2:)} {\$p(:2:)} {\$p(:1:)} 0 ok1 0 ok2\ - {-accessPath {[list $tcl_library $TestsDir/auto0/auto1 $TestsDir/auto0/auto2]*}\ - -statics 1 -nested 0 -deleteHook {}}\ - {-accessPath {[list $tcl_library $TestsDir/auto0/auto2 $TestsDir/auto0/auto1]*}\ - -statics 1 -nested 0 -deleteHook {}}" +} -match glob -result {{$p(:1:)} {$p(:2:)} -- {$p(:2:)} {$p(:1:)} -- 0 ok1 0 ok2 --\ + {TCLLIB TESTSDIR/auto0/auto1 TESTSDIR/auto0/auto2*} --\ + {TCLLIB TESTSDIR/auto0/auto2 TESTSDIR/auto0/auto1*}} + test safe-9.8z {interpConfigure change the access path; tclIndex commands unaffected by token rearrangement (dummy test of doreset); zipfs} -setup { set SyncExists [expr {[info commands ::safe::setAutoPathSync] ne {}}] if {$SyncExists} { @@ -1043,9 +1067,9 @@ test safe-9.8z {interpConfigure change the access path; tclIndex commands unaffe set i [safe::interpCreate -accessPath [list $tcl_library \ [file join $ZipMountPoint auto0 auto1] \ [file join $ZipMountPoint auto0 auto2]]] - # Inspect. set confA [safe::interpConfigure $i] + set mappA [mapList $PathMapp [dict get $confA -accessPath]] set path1 [::safe::interpFindInAccessPath $i [file join $ZipMountPoint auto0 auto1]] set path2 [::safe::interpFindInAccessPath $i [file join $ZipMountPoint auto0 auto2]] @@ -1061,9 +1085,9 @@ test safe-9.8z {interpConfigure change the access path; tclIndex commands unaffe safe::interpConfigure $i -accessPath [list $tcl_library \ [file join $ZipMountPoint auto0 auto2] \ [file join $ZipMountPoint auto0 auto1]] - # Inspect. set confB [safe::interpConfigure $i] + set mappB [mapList $PathMapp [dict get $confB -accessPath]] set path3 [::safe::interpFindInAccessPath $i [file join $ZipMountPoint auto0 auto1]] set path4 [::safe::interpFindInAccessPath $i [file join $ZipMountPoint auto0 auto2]] @@ -1071,17 +1095,16 @@ test safe-9.8z {interpConfigure change the access path; tclIndex commands unaffe set code3 [catch {interp eval $i {report1}} msg3] set code4 [catch {interp eval $i {report2}} msg4] - list $path1 $path2 $path3 $path4 $code3 $msg3 $code4 $msg4 $confA $confB + list $path1 $path2 -- $path3 $path4 -- $code3 $msg3 $code4 $msg4 -- $mappA -- $mappB } -cleanup { safe::interpDelete $i if {$SyncExists} { safe::setAutoPathSync $SyncVal_TMP } -} -match glob -result "{\$p(:1:)} {\$p(:2:)} {\$p(:2:)} {\$p(:1:)} 0 ok1 0 ok2\ - {-accessPath {[list $tcl_library $ZipMountPoint/auto0/auto1 $ZipMountPoint/auto0/auto2]*}\ - -statics 1 -nested 0 -deleteHook {}}\ - {-accessPath {[list $tcl_library $ZipMountPoint/auto0/auto2 $ZipMountPoint/auto0/auto1]*}\ - -statics 1 -nested 0 -deleteHook {}}" +} -match glob -result {{$p(:1:)} {$p(:2:)} -- {$p(:2:)} {$p(:1:)} -- 0 ok1 0 ok2 --\ + {TCLLIB ZIPDIR/auto0/auto1 ZIPDIR/auto0/auto2*} --\ + {TCLLIB ZIPDIR/auto0/auto2 ZIPDIR/auto0/auto1*}} + test safe-9.9 {interpConfigure change the access path; tclIndex commands unaffected by token rearrangement (actual test of doreset)} -setup { set SyncExists [expr {[info commands ::safe::setAutoPathSync] ne {}}] if {$SyncExists} { @@ -1092,9 +1115,9 @@ test safe-9.9 {interpConfigure change the access path; tclIndex commands unaffec set i [safe::interpCreate -accessPath [list $tcl_library \ [file join $TestsDir auto0 auto1] \ [file join $TestsDir auto0 auto2]]] - # Inspect. set confA [safe::interpConfigure $i] + set mappA [mapList $PathMapp [dict get $confA -accessPath]] set path1 [::safe::interpFindInAccessPath $i [file join $TestsDir auto0 auto1]] set path2 [::safe::interpFindInAccessPath $i [file join $TestsDir auto0 auto2]] @@ -1111,6 +1134,7 @@ test safe-9.9 {interpConfigure change the access path; tclIndex commands unaffec # Inspect. set confB [safe::interpConfigure $i] + set mappB [mapList $PathMapp [dict get $confB -accessPath]] set path3 [::safe::interpFindInAccessPath $i [file join $TestsDir auto0 auto1]] set path4 [::safe::interpFindInAccessPath $i [file join $TestsDir auto0 auto2]] @@ -1118,17 +1142,17 @@ test safe-9.9 {interpConfigure change the access path; tclIndex commands unaffec set code3 [catch {interp eval $i {report1}} msg3] set code4 [catch {interp eval $i {report2}} msg4] - list $path1 $path2 $path3 $path4 $code3 $msg3 $code4 $msg4 $confA $confB + list $path1 $path2 -- $path3 $path4 -- $code3 $msg3 $code4 $msg4 -- $mappA -- $mappB } -cleanup { safe::interpDelete $i if {$SyncExists} { safe::setAutoPathSync $SyncVal_TMP } -} -match glob -result "{\$p(:1:)} {\$p(:2:)} {\$p(:2:)} {\$p(:1:)} 0 ok1 0 ok2\ - {-accessPath {[list $tcl_library $TestsDir/auto0/auto1 $TestsDir/auto0/auto2]*}\ - -statics 1 -nested 0 -deleteHook {}}\ - {-accessPath {[list $tcl_library $TestsDir/auto0/auto2 $TestsDir/auto0/auto1]*}\ - -statics 1 -nested 0 -deleteHook {}}" +} -match glob -result {{$p(:1:)} {$p(:2:)} -- {$p(:2:)} {$p(:1:)} --\ + 0 ok1 0 ok2 --\ + {TCLLIB TESTSDIR/auto0/auto1 TESTSDIR/auto0/auto2*} --\ + {TCLLIB TESTSDIR/auto0/auto2 TESTSDIR/auto0/auto1*}} + test safe-9.9z {interpConfigure change the access path; tclIndex commands unaffected by token rearrangement (actual test of doreset); zipfs} -setup { set SyncExists [expr {[info commands ::safe::setAutoPathSync] ne {}}] if {$SyncExists} { @@ -1139,9 +1163,9 @@ test safe-9.9z {interpConfigure change the access path; tclIndex commands unaffe set i [safe::interpCreate -accessPath [list $tcl_library \ [file join $ZipMountPoint auto0 auto1] \ [file join $ZipMountPoint auto0 auto2]]] - # Inspect. set confA [safe::interpConfigure $i] + set mappA [mapList $PathMapp [dict get $confA -accessPath]] set path1 [::safe::interpFindInAccessPath $i [file join $ZipMountPoint auto0 auto1]] set path2 [::safe::interpFindInAccessPath $i [file join $ZipMountPoint auto0 auto2]] @@ -1155,9 +1179,9 @@ test safe-9.9z {interpConfigure change the access path; tclIndex commands unaffe safe::interpConfigure $i -accessPath [list $tcl_library \ [file join $ZipMountPoint auto0 auto2] \ [file join $ZipMountPoint auto0 auto1]] - # Inspect. set confB [safe::interpConfigure $i] + set mappB [mapList $PathMapp [dict get $confB -accessPath]] set path3 [::safe::interpFindInAccessPath $i [file join $ZipMountPoint auto0 auto1]] set path4 [::safe::interpFindInAccessPath $i [file join $ZipMountPoint auto0 auto2]] @@ -1165,17 +1189,16 @@ test safe-9.9z {interpConfigure change the access path; tclIndex commands unaffe set code3 [catch {interp eval $i {report1}} msg3] set code4 [catch {interp eval $i {report2}} msg4] - list $path1 $path2 $path3 $path4 $code3 $msg3 $code4 $msg4 $confA $confB + list $path1 $path2 -- $path3 $path4 -- $code3 $msg3 $code4 $msg4 -- $mappA -- $mappB } -cleanup { safe::interpDelete $i if {$SyncExists} { safe::setAutoPathSync $SyncVal_TMP } -} -match glob -result "{\$p(:1:)} {\$p(:2:)} {\$p(:2:)} {\$p(:1:)} 0 ok1 0 ok2\ - {-accessPath {[list $tcl_library $ZipMountPoint/auto0/auto1 $ZipMountPoint/auto0/auto2]*}\ - -statics 1 -nested 0 -deleteHook {}}\ - {-accessPath {[list $tcl_library $ZipMountPoint/auto0/auto2 $ZipMountPoint/auto0/auto1]*}\ - -statics 1 -nested 0 -deleteHook {}}" +} -match glob -result {{$p(:1:)} {$p(:2:)} -- {$p(:2:)} {$p(:1:)} --\ + 0 ok1 0 ok2 --\ + {TCLLIB ZIPDIR/auto0/auto1 ZIPDIR/auto0/auto2*} --\ + {TCLLIB ZIPDIR/auto0/auto2 ZIPDIR/auto0/auto1*}} test safe-9.10 {interpConfigure change the access path; pkgIndex.tcl packages unaffected by token rearrangement} -setup { set SyncExists [expr {[info commands ::safe::setAutoPathSync] ne {}}] if {$SyncExists} { @@ -1191,6 +1214,7 @@ test safe-9.10 {interpConfigure change the access path; pkgIndex.tcl packages un # Inspect. set confA [safe::interpConfigure $i] + set mappA [mapList $PathMapp [dict get $confA -accessPath]] set path0 [::safe::interpFindInAccessPath $i [file join $TestsDir auto0]] set path1 [::safe::interpFindInAccessPath $i [file join $TestsDir auto0 auto1]] set path2 [::safe::interpFindInAccessPath $i [file join $TestsDir auto0 auto2]] @@ -1208,6 +1232,7 @@ test safe-9.10 {interpConfigure change the access path; pkgIndex.tcl packages un # Inspect. set confB [safe::interpConfigure $i] + set mappB [mapList $PathMapp [dict get $confB -accessPath]] set path3 [::safe::interpFindInAccessPath $i [file join $TestsDir auto0 auto1]] set path4 [::safe::interpFindInAccessPath $i [file join $TestsDir auto0 auto2]] @@ -1217,20 +1242,17 @@ test safe-9.10 {interpConfigure change the access path; pkgIndex.tcl packages un set code5 [catch {interp eval $i {HeresPackage1}} msg5 opts5] set code6 [catch {interp eval $i {HeresPackage2}} msg6 opts6] - list $path1 $path2 $path3 $path4 $code3 $msg3 $code4 $msg4 $confA $confB \ - $code5 $msg5 $code6 $msg6 - + list $path1 $path2 -- $path3 $path4 -- $code3 $msg3 $code4 $msg4 -- \ + $mappA -- $mappB -- $code5 $msg5 $code6 $msg6 } -cleanup { safe::interpDelete $i if {$SyncExists} { safe::setAutoPathSync $SyncVal_TMP } -} -match glob -result "{\$p(:2:)} {\$p(:3:)} {\$p(:3:)} {\$p(:2:)} 0 1.2.3 0 2.3.4\ - {-accessPath {[list $tcl_library $TestsDir/auto0 $TestsDir/auto0/auto1 $TestsDir/auto0/auto2]*}\ - -statics 1 -nested 0 -deleteHook {}}\ - {-accessPath {[list $tcl_library $TestsDir/auto0 $TestsDir/auto0/auto2 $TestsDir/auto0/auto1]*}\ - -statics 1 -nested 0 -deleteHook {}}\ - 0 OK1 0 OK2" +} -match glob -result {{$p(:2:)} {$p(:3:)} -- {$p(:3:)} {$p(:2:)} -- 0 1.2.3 0 2.3.4 --\ + {TCLLIB TESTSDIR/auto0 TESTSDIR/auto0/auto1 TESTSDIR/auto0/auto2*} --\ + {TCLLIB TESTSDIR/auto0 TESTSDIR/auto0/auto2 TESTSDIR/auto0/auto1*} --\ + 0 OK1 0 OK2} test safe-9.10z {interpConfigure change the access path; pkgIndex.tcl packages unaffected by token rearrangement; zipfs} -setup { set SyncExists [expr {[info commands ::safe::setAutoPathSync] ne {}}] if {$SyncExists} { @@ -1243,9 +1265,9 @@ test safe-9.10z {interpConfigure change the access path; pkgIndex.tcl packages u [file join $ZipMountPoint auto0] \ [file join $ZipMountPoint auto0 auto1] \ [file join $ZipMountPoint auto0 auto2]]] - # Inspect. set confA [safe::interpConfigure $i] + set mappA [mapList $PathMapp [dict get $confA -accessPath]] set path0 [::safe::interpFindInAccessPath $i [file join $ZipMountPoint auto0]] set path1 [::safe::interpFindInAccessPath $i [file join $ZipMountPoint auto0 auto1]] set path2 [::safe::interpFindInAccessPath $i [file join $ZipMountPoint auto0 auto2]] @@ -1260,9 +1282,9 @@ test safe-9.10z {interpConfigure change the access path; pkgIndex.tcl packages u [file join $ZipMountPoint auto0] \ [file join $ZipMountPoint auto0 auto2] \ [file join $ZipMountPoint auto0 auto1]] - # Inspect. set confB [safe::interpConfigure $i] + set mappB [mapList $PathMapp [dict get $confB -accessPath]] set path3 [::safe::interpFindInAccessPath $i [file join $ZipMountPoint auto0 auto1]] set path4 [::safe::interpFindInAccessPath $i [file join $ZipMountPoint auto0 auto2]] @@ -1272,20 +1294,17 @@ test safe-9.10z {interpConfigure change the access path; pkgIndex.tcl packages u set code5 [catch {interp eval $i {HeresPackage1}} msg5 opts5] set code6 [catch {interp eval $i {HeresPackage2}} msg6 opts6] - list $path1 $path2 $path3 $path4 $code3 $msg3 $code4 $msg4 $confA $confB \ - $code5 $msg5 $code6 $msg6 - + list $path1 $path2 -- $path3 $path4 -- $code3 $msg3 $code4 $msg4 -- \ + $mappA -- $mappB -- $code5 $msg5 $code6 $msg6 } -cleanup { safe::interpDelete $i if {$SyncExists} { safe::setAutoPathSync $SyncVal_TMP } -} -match glob -result "{\$p(:2:)} {\$p(:3:)} {\$p(:3:)} {\$p(:2:)} 0 1.2.3 0 2.3.4\ - {-accessPath {[list $tcl_library $ZipMountPoint/auto0 $ZipMountPoint/auto0/auto1 $ZipMountPoint/auto0/auto2]*}\ - -statics 1 -nested 0 -deleteHook {}}\ - {-accessPath {[list $tcl_library $ZipMountPoint/auto0 $ZipMountPoint/auto0/auto2 $ZipMountPoint/auto0/auto1]*}\ - -statics 1 -nested 0 -deleteHook {}}\ - 0 OK1 0 OK2" +} -match glob -result {{$p(:2:)} {$p(:3:)} -- {$p(:3:)} {$p(:2:)} -- 0 1.2.3 0 2.3.4 --\ + {TCLLIB ZIPDIR/auto0 ZIPDIR/auto0/auto1 ZIPDIR/auto0/auto2*} --\ + {TCLLIB ZIPDIR/auto0 ZIPDIR/auto0/auto2 ZIPDIR/auto0/auto1*} --\ + 0 OK1 0 OK2} test safe-9.10opt {interpConfigure change the access path; pkgIndex.tcl packages unaffected by token rearrangement, uses pkg opt and tcl::idna} -setup { set SyncExists [expr {[info commands ::safe::setAutoPathSync] ne {}}] if {$SyncExists} { @@ -1296,9 +1315,9 @@ test safe-9.10opt {interpConfigure change the access path; pkgIndex.tcl packages set i [safe::interpCreate -accessPath [list $tcl_library \ [file join $tcl_library $pkgOptDir] \ [file join $tcl_library $pkgJarDir]]] - # Inspect. set confA [safe::interpConfigure $i] + set mappA [mapList $PathMapp [dict get $confA -accessPath]] set path1 [::safe::interpFindInAccessPath $i [file join $tcl_library $pkgOptDir]] set path2 [::safe::interpFindInAccessPath $i [file join $tcl_library $pkgJarDir]] @@ -1310,9 +1329,9 @@ test safe-9.10opt {interpConfigure change the access path; pkgIndex.tcl packages safe::interpConfigure $i -accessPath [list $tcl_library \ [file join $tcl_library $pkgJarDir] \ [file join $tcl_library $pkgOptDir]] - # Inspect. set confB [safe::interpConfigure $i] + set mappB [mapList $PathMapp [dict get $confB -accessPath]] set path3 [::safe::interpFindInAccessPath $i [file join $tcl_library $pkgOptDir]] set path4 [::safe::interpFindInAccessPath $i [file join $tcl_library $pkgJarDir]] @@ -1322,18 +1341,17 @@ test safe-9.10opt {interpConfigure change the access path; pkgIndex.tcl packages set code5 [catch {interp eval $i {::tcl::Lempty {a list}}} msg5] set code6 [catch {interp eval $i {::tcl::idna::IDNAencode example.com}} msg6] - list $path1 $path2 $path3 $path4 $code3 $msg3 $code4 $msg4 \ - $confA $confB $code5 $msg5 $code6 $msg6 + list $path1 $path2 -- $path3 $path4 -- $code3 $msg3 $code4 $msg4 -- \ + $mappA -- $mappB -- $code5 $msg5 $code6 $msg6 } -cleanup { safe::interpDelete $i if {$SyncExists} { safe::setAutoPathSync $SyncVal_TMP } -} -match glob -result "{\$p(:1:)} {\$p(:2:)} {\$p(:2:)} {\$p(:1:)} 0 1.* 0 0.4.*\ - {-accessPath {[list $tcl_library $tcl_library/$pkgOptDir $tcl_library/$pkgJarDir]*}\ - -statics 1 -nested 0 -deleteHook {}}\ - {-accessPath {[list $tcl_library $tcl_library/$pkgJarDir $tcl_library/$pkgOptDir]*}\ - -statics 1 -nested 0 -deleteHook {}} 0 0 0 example.com" +} -match glob -result {{$p(:1:)} {$p(:2:)} -- {$p(:2:)} {$p(:1:)} -- 0 1.* 0 0.4.* --\ + {TCLLIB TCLLIB/OPTDIR TCLLIB/JARDIR*} --\ + {TCLLIB TCLLIB/JARDIR TCLLIB/OPTDIR*} --\ + 0 0 0 example.com} test safe-9.11 {interpConfigure change the access path; pkgIndex.tcl packages unaffected by token rearrangement, 9.10 without path auto0} -setup { set SyncExists [expr {[info commands ::safe::setAutoPathSync] ne {}}] if {$SyncExists} { @@ -1347,6 +1365,7 @@ test safe-9.11 {interpConfigure change the access path; pkgIndex.tcl packages un # Inspect. set confA [safe::interpConfigure $i] + set mappA [mapList $PathMapp [dict get $confA -accessPath]] set path1 [::safe::interpFindInAccessPath $i [file join $TestsDir auto0 auto1]] set path2 [::safe::interpFindInAccessPath $i [file join $TestsDir auto0 auto2]] @@ -1360,6 +1379,7 @@ test safe-9.11 {interpConfigure change the access path; pkgIndex.tcl packages un # Inspect. set confB [safe::interpConfigure $i] + set mappB [mapList $PathMapp [dict get $confB -accessPath]] set path3 [::safe::interpFindInAccessPath $i [file join $TestsDir auto0 auto1]] set path4 [::safe::interpFindInAccessPath $i [file join $TestsDir auto0 auto2]] @@ -1369,19 +1389,18 @@ test safe-9.11 {interpConfigure change the access path; pkgIndex.tcl packages un set code5 [catch {interp eval $i {HeresPackage1}} msg5 opts5] set code6 [catch {interp eval $i {HeresPackage2}} msg6 opts6] - list $path1 $path2 $path3 $path4 $code3 $msg3 $code4 $msg4 $confA $confB \ + list $path1 $path2 -- $path3 $path4 -- $code3 $msg3 $code4 $msg4 -- $mappA -- $mappB -- \ $code5 $msg5 $code6 $msg6 } -cleanup { safe::interpDelete $i if {$SyncExists} { safe::setAutoPathSync $SyncVal_TMP } -} -match glob -result "{\$p(:1:)} {\$p(:2:)} {\$p(:2:)} {\$p(:1:)} 0 1.2.3 0 2.3.4\ - {-accessPath {[list $tcl_library $TestsDir/auto0/auto1 $TestsDir/auto0/auto2]*}\ - -statics 1 -nested 0 -deleteHook {}}\ - {-accessPath {[list $tcl_library $TestsDir/auto0/auto2 $TestsDir/auto0/auto1]*}\ - -statics 1 -nested 0 -deleteHook {}}\ - 0 OK1 0 OK2" +} -match glob -result {{$p(:1:)} {$p(:2:)} -- {$p(:2:)} {$p(:1:)} --\ + 0 1.2.3 0 2.3.4 --\ + {TCLLIB TESTSDIR/auto0/auto1 TESTSDIR/auto0/auto2*} --\ + {TCLLIB TESTSDIR/auto0/auto2 TESTSDIR/auto0/auto1*} --\ + 0 OK1 0 OK2} test safe-9.11z {interpConfigure change the access path; pkgIndex.tcl packages unaffected by token rearrangement, 9.10 without path auto0; zipfs} -setup { set SyncExists [expr {[info commands ::safe::setAutoPathSync] ne {}}] if {$SyncExists} { @@ -1392,9 +1411,9 @@ test safe-9.11z {interpConfigure change the access path; pkgIndex.tcl packages u set i [safe::interpCreate -accessPath [list $tcl_library \ [file join $ZipMountPoint auto0 auto1] \ [file join $ZipMountPoint auto0 auto2]]] - # Inspect. set confA [safe::interpConfigure $i] + set mappA [mapList $PathMapp [dict get $confA -accessPath]] set path1 [::safe::interpFindInAccessPath $i [file join $ZipMountPoint auto0 auto1]] set path2 [::safe::interpFindInAccessPath $i [file join $ZipMountPoint auto0 auto2]] @@ -1405,9 +1424,9 @@ test safe-9.11z {interpConfigure change the access path; pkgIndex.tcl packages u safe::interpConfigure $i -accessPath [list $tcl_library \ [file join $ZipMountPoint auto0 auto2] \ [file join $ZipMountPoint auto0 auto1]] - # Inspect. set confB [safe::interpConfigure $i] + set mappB [mapList $PathMapp [dict get $confB -accessPath]] set path3 [::safe::interpFindInAccessPath $i [file join $ZipMountPoint auto0 auto1]] set path4 [::safe::interpFindInAccessPath $i [file join $ZipMountPoint auto0 auto2]] @@ -1417,19 +1436,18 @@ test safe-9.11z {interpConfigure change the access path; pkgIndex.tcl packages u set code5 [catch {interp eval $i {HeresPackage1}} msg5 opts5] set code6 [catch {interp eval $i {HeresPackage2}} msg6 opts6] - list $path1 $path2 $path3 $path4 $code3 $msg3 $code4 $msg4 $confA $confB \ - $code5 $msg5 $code6 $msg6 + list $path1 $path2 -- $path3 $path4 -- $code3 $msg3 $code4 $msg4 -- \ + $mappA -- $mappB -- $code5 $msg5 $code6 $msg6 } -cleanup { safe::interpDelete $i if {$SyncExists} { safe::setAutoPathSync $SyncVal_TMP } -} -match glob -result "{\$p(:1:)} {\$p(:2:)} {\$p(:2:)} {\$p(:1:)} 0 1.2.3 0 2.3.4\ - {-accessPath {[list $tcl_library $ZipMountPoint/auto0/auto1 $ZipMountPoint/auto0/auto2]*}\ - -statics 1 -nested 0 -deleteHook {}}\ - {-accessPath {[list $tcl_library $ZipMountPoint/auto0/auto2 $ZipMountPoint/auto0/auto1]*}\ - -statics 1 -nested 0 -deleteHook {}}\ - 0 OK1 0 OK2" +} -match glob -result {{$p(:1:)} {$p(:2:)} -- {$p(:2:)} {$p(:1:)} --\ + 0 1.2.3 0 2.3.4 --\ + {TCLLIB ZIPDIR/auto0/auto1 ZIPDIR/auto0/auto2*} --\ + {TCLLIB ZIPDIR/auto0/auto2 ZIPDIR/auto0/auto1*} --\ + 0 OK1 0 OK2} test safe-9.12 {interpConfigure change the access path; pkgIndex.tcl packages fail if directory de-listed} -setup { set SyncExists [expr {[info commands ::safe::setAutoPathSync] ne {}}] if {$SyncExists} { @@ -1440,9 +1458,9 @@ test safe-9.12 {interpConfigure change the access path; pkgIndex.tcl packages fa set i [safe::interpCreate -accessPath [list $tcl_library \ [file join $TestsDir auto0 auto1] \ [file join $TestsDir auto0 auto2]]] - # Inspect. set confA [safe::interpConfigure $i] + set mappA [mapList $PathMapp [dict get $confA -accessPath]] set path1 [::safe::interpFindInAccessPath $i [file join $TestsDir auto0 auto1]] set path2 [::safe::interpFindInAccessPath $i [file join $TestsDir auto0 auto2]] @@ -1454,6 +1472,7 @@ test safe-9.12 {interpConfigure change the access path; pkgIndex.tcl packages fa # Inspect. set confB [safe::interpConfigure $i] + set mappB [mapList $PathMapp [dict get $confB -accessPath]] set code4 [catch {::safe::interpFindInAccessPath $i [file join $TestsDir auto0 auto1]} path4] set code5 [catch {::safe::interpFindInAccessPath $i [file join $TestsDir auto0 auto2]} path5] @@ -1461,17 +1480,15 @@ test safe-9.12 {interpConfigure change the access path; pkgIndex.tcl packages fa set code3 [catch {interp eval $i {package require SafeTestPackage1}} msg3] set code6 [catch {interp eval $i {package require SafeTestPackage2}} msg6] - list $path1 $path2 $code4 $path4 $code5 $path5 $code3 $msg3 $code6 $msg6 $confA $confB + list $path1 $path2 -- $code4 $path4 -- $code5 $path5 -- $code3 $code6 -- $mappA -- $mappB } -cleanup { safe::interpDelete $i if {$SyncExists} { safe::setAutoPathSync $SyncVal_TMP } -} -match glob -result "{\$p(:1:)} {\$p(:2:)} 1 {* not found in access path}\ - 1 {* not found in access path} 1 {*} 1 {*}\ - {-accessPath {[list $tcl_library $TestsDir/auto0/auto1 $TestsDir/auto0/auto2]*}\ - -statics 1 -nested 0 -deleteHook {}}\ - {-accessPath {[list $tcl_library]*} -statics 1 -nested 0 -deleteHook {}}" +} -match glob -result {{$p(:1:)} {$p(:2:)} -- 1 {* not found in access path} --\ + 1 {* not found in access path} -- 1 1 --\ + {TCLLIB TESTSDIR/auto0/auto1 TESTSDIR/auto0/auto2*} -- {TCLLIB*}} test safe-9.12z {interpConfigure change the access path; pkgIndex.tcl packages fail if directory de-listed; zipfs} -setup { set SyncExists [expr {[info commands ::safe::setAutoPathSync] ne {}}] if {$SyncExists} { @@ -1482,9 +1499,9 @@ test safe-9.12z {interpConfigure change the access path; pkgIndex.tcl packages f set i [safe::interpCreate -accessPath [list $tcl_library \ [file join $ZipMountPoint auto0 auto1] \ [file join $ZipMountPoint auto0 auto2]]] - # Inspect. set confA [safe::interpConfigure $i] + set mappA [mapList $PathMapp [dict get $confA -accessPath]] set path1 [::safe::interpFindInAccessPath $i [file join $ZipMountPoint auto0 auto1]] set path2 [::safe::interpFindInAccessPath $i [file join $ZipMountPoint auto0 auto2]] @@ -1496,6 +1513,7 @@ test safe-9.12z {interpConfigure change the access path; pkgIndex.tcl packages f # Inspect. set confB [safe::interpConfigure $i] + set mappB [mapList $PathMapp [dict get $confB -accessPath]] set code4 [catch {::safe::interpFindInAccessPath $i [file join $ZipMountPoint auto0 auto1]} path4] set code5 [catch {::safe::interpFindInAccessPath $i [file join $ZipMountPoint auto0 auto2]} path5] @@ -1503,17 +1521,16 @@ test safe-9.12z {interpConfigure change the access path; pkgIndex.tcl packages f set code3 [catch {interp eval $i {package require SafeTestPackage1}} msg3] set code6 [catch {interp eval $i {package require SafeTestPackage2}} msg6] - list $path1 $path2 $code4 $path4 $code5 $path5 $code3 $msg3 $code6 $msg6 $confA $confB + list $path1 $path2 -- $code4 $path4 -- $code5 $path5 -- $code3 $code6 -- \ + $mappA -- $mappB } -cleanup { safe::interpDelete $i if {$SyncExists} { safe::setAutoPathSync $SyncVal_TMP } -} -match glob -result "{\$p(:1:)} {\$p(:2:)} 1 {* not found in access path}\ - 1 {* not found in access path} 1 {*} 1 {*}\ - {-accessPath {[list $tcl_library $ZipMountPoint/auto0/auto1 $ZipMountPoint/auto0/auto2]*}\ - -statics 1 -nested 0 -deleteHook {}}\ - {-accessPath {[list $tcl_library]*} -statics 1 -nested 0 -deleteHook {}}" +} -match glob -result {{$p(:1:)} {$p(:2:)} -- 1 {* not found in access path} --\ + 1 {* not found in access path} -- 1 1 --\ + {TCLLIB ZIPDIR/auto0/auto1 ZIPDIR/auto0/auto2*} -- {TCLLIB*}} test safe-9.12opt {interpConfigure change the access path; pkgIndex.tcl packages fail if directory de-listed, uses pkg opt and tcl::idna} -setup { set SyncExists [expr {[info commands ::safe::setAutoPathSync] ne {}}] if {$SyncExists} { @@ -1524,9 +1541,9 @@ test safe-9.12opt {interpConfigure change the access path; pkgIndex.tcl packages set i [safe::interpCreate -accessPath [list $tcl_library \ [file join $tcl_library $pkgOptDir] \ [file join $tcl_library $pkgJarDir]]] - # Inspect. set confA [safe::interpConfigure $i] + set mappA [mapList $PathMapp [dict get $confA -accessPath]] set path1 [::safe::interpFindInAccessPath $i [file join $tcl_library $pkgOptDir]] set path2 [::safe::interpFindInAccessPath $i [file join $tcl_library $pkgJarDir]] @@ -1538,6 +1555,7 @@ test safe-9.12opt {interpConfigure change the access path; pkgIndex.tcl packages # Inspect. set confB [safe::interpConfigure $i] + set mappB [mapList $PathMapp [dict get $confB -accessPath]] set code4 [catch {::safe::interpFindInAccessPath $i [file join $tcl_library $pkgOptDir]} path4] set code5 [catch {::safe::interpFindInAccessPath $i [file join $tcl_library $pkgJarDir]} path5] @@ -1545,17 +1563,16 @@ test safe-9.12opt {interpConfigure change the access path; pkgIndex.tcl packages set code3 [catch {interp eval $i {package require opt}} msg3] set code6 [catch {interp eval $i {package require tcl::idna}} msg6] - list $path1 $path2 $code4 $path4 $code5 $path5 $code3 $msg3 $code6 $msg6 $confA $confB + list $path1 $path2 -- $code4 $path4 -- $code5 $path5 -- $code3 $code6 -- \ + $mappA -- $mappB } -cleanup { safe::interpDelete $i if {$SyncExists} { safe::setAutoPathSync $SyncVal_TMP } -} -match glob -result "{\$p(:1:)} {\$p(:2:)} 1 {* not found in access path}\ - 1 {* not found in access path} 1 {*} 1 {*}\ - {-accessPath {[list $tcl_library $tcl_library/$pkgOptDir $tcl_library/$pkgJarDir]*}\ - -statics 1 -nested 0 -deleteHook {}}\ - {-accessPath {[list $tcl_library]*} -statics 1 -nested 0 -deleteHook {}}" +} -match glob -result {{$p(:1:)} {$p(:2:)} -- 1 {* not found in access path} --\ + 1 {* not found in access path} -- 1 1 --\ + {TCLLIB TCLLIB/OPTDIR TCLLIB/JARDIR*} -- {TCLLIB*}} test safe-9.20 {check module loading} -setup { set SyncExists [expr {[info commands ::safe::setAutoPathSync] ne {}}] if {$SyncExists} { @@ -1572,6 +1589,7 @@ test safe-9.20 {check module loading} -setup { # Inspect. set confA [safe::interpConfigure $i] + set sortA [mapAndSortList $PathMapp [dict get $confA -accessPath]] set modsA [interp eval $i {tcl::tm::path list}] set path0 [::safe::interpFindInAccessPath $i [file join $TestsDir auto0 modules]] set path1 [::safe::interpFindInAccessPath $i [file join $TestsDir auto0 modules mod1]] @@ -1585,8 +1603,8 @@ test safe-9.20 {check module loading} -setup { set out1 [interp eval $i {mod1::test1::try1}] set out2 [interp eval $i {mod2::test2::try2}] - list $path0 $path1 $path2 -- $modsA -- \ - $code0 $msg0 $code1 $msg1 $code2 $msg2 -- $confA -- $out0 $out1 $out2 + list [lsort [list $path0 $path1 $path2]] -- $modsA -- \ + $code0 $msg0 $code1 $msg1 $code2 $msg2 -- $sortA -- $out0 $out1 $out2 } -cleanup { tcl::tm::path remove [file join $TestsDir auto0 modules] foreach path [lreverse $oldTm] { @@ -1596,13 +1614,19 @@ test safe-9.20 {check module loading} -setup { if {$SyncExists} { safe::setAutoPathSync $SyncVal_TMP } -} -match glob -result "{\$p(:1:)} {\$p(:2:)} {\$p(:3:)} -- {{\$p(:1:)}} --\ +} -match glob -result {{{$p(:1:)} {$p(:2:)} {$p(:3:)}} -- {{$p(:1:)}} --\ 0 0.5 0 1.0 0 2.0 --\ - {-accessPath {[list $tcl_library $TestsDir/auto0/modules \ - $TestsDir/auto0/modules/mod1 \ - $TestsDir/auto0/modules/mod2]*}\ - -statics 1 -nested 0 -deleteHook {}} --\ - res0 res1 res2" + {TCLLIB TESTSDIR/auto0/modules TESTSDIR/auto0/modules/mod1\ + TESTSDIR/auto0/modules/mod2} -- res0 res1 res2} +# - The command safe::InterpSetConfig adds the master's [tcl::tm::list] in +# tokenized form to the slave's access path, and then adds all the +# descendants, discovered recursively by using glob. +# - The order of the directories in the list returned by glob is system-dependent, +# and therefore this is true also for (a) the order of token assignment to +# descendants of the [tcl::tm::list] roots; and (b) the order of those same +# directories in the access path. Both those things must be sorted before +# comparing with expected results. The test is therefore not totally strict, +# but will notice missing or surplus directories. test safe-9.20z {check module loading; zipfs} -setup { set SyncExists [expr {[info commands ::safe::setAutoPathSync] ne {}}] if {$SyncExists} { @@ -1619,6 +1643,7 @@ test safe-9.20z {check module loading; zipfs} -setup { # Inspect. set confA [safe::interpConfigure $i] + set sortA [mapAndSortList $PathMapp [dict get $confA -accessPath]] set modsA [interp eval $i {tcl::tm::path list}] set path0 [::safe::interpFindInAccessPath $i [file join $ZipMountPoint auto0 modules]] set path1 [::safe::interpFindInAccessPath $i [file join $ZipMountPoint auto0 modules mod1]] @@ -1632,8 +1657,8 @@ test safe-9.20z {check module loading; zipfs} -setup { set out1 [interp eval $i {mod1::test1::try1}] set out2 [interp eval $i {mod2::test2::try2}] - list $path0 $path1 $path2 -- $modsA -- \ - $code0 $msg0 $code1 $msg1 $code2 $msg2 -- $confA -- $out0 $out1 $out2 + list [lsort [list $path0 $path1 $path2]] -- $modsA -- \ + $code0 $msg0 $code1 $msg1 $code2 $msg2 -- $sortA -- $out0 $out1 $out2 } -cleanup { tcl::tm::path remove [file join $ZipMountPoint auto0 modules] foreach path [lreverse $oldTm] { @@ -1643,13 +1668,11 @@ test safe-9.20z {check module loading; zipfs} -setup { if {$SyncExists} { safe::setAutoPathSync $SyncVal_TMP } -} -match glob -result "{\$p(:1:)} {\$p(:2:)} {\$p(:3:)} -- {{\$p(:1:)}} --\ +} -match glob -result {{{$p(:1:)} {$p(:2:)} {$p(:3:)}} -- {{$p(:1:)}} --\ 0 0.5 0 1.0 0 2.0 --\ - {-accessPath {[list $tcl_library $ZipMountPoint/auto0/modules \ - $ZipMountPoint/auto0/modules/mod1 \ - $ZipMountPoint/auto0/modules/mod2]*}\ - -statics 1 -nested 0 -deleteHook {}} --\ - res0 res1 res2" + {TCLLIB ZIPDIR/auto0/modules ZIPDIR/auto0/modules/mod1\ + ZIPDIR/auto0/modules/mod2} -- res0 res1 res2} +# See comments on lsort after test safe-9.20. test safe-9.21 {interpConfigure change the access path; check module loading; stale data case 1} -setup { set SyncExists [expr {[info commands ::safe::setAutoPathSync] ne {}}] if {$SyncExists} { @@ -1666,6 +1689,7 @@ test safe-9.21 {interpConfigure change the access path; check module loading; st # Inspect. set confA [safe::interpConfigure $i] + set sortA [mapAndSortList $PathMapp [dict get $confA -accessPath]] set modsA [interp eval $i {tcl::tm::path list}] set path0 [::safe::interpFindInAccessPath $i [file join $TestsDir auto0 modules]] set path1 [::safe::interpFindInAccessPath $i [file join $TestsDir auto0 modules mod1]] @@ -1679,6 +1703,7 @@ test safe-9.21 {interpConfigure change the access path; check module loading; st # Inspect. set confB [safe::interpConfigure $i] + set sortB [mapAndSortList $PathMapp [dict get $confB -accessPath]] set modsB [interp eval $i {tcl::tm::path list}] set path3 [::safe::interpFindInAccessPath $i [file join $TestsDir auto0 modules]] set path4 [::safe::interpFindInAccessPath $i [file join $TestsDir auto0 modules mod1]] @@ -1697,8 +1722,8 @@ test safe-9.21 {interpConfigure change the access path; check module loading; st set out1 [interp eval $i {mod1::test1::try1}] set out2 [interp eval $i {mod2::test2::try2}] - list $path0 $path1 $path2 -- $modsA -- $path3 $path4 $path5 -- $modsB -- \ - $code0 $msg0 $code1 $msg1 $code2 $msg2 -- $confA -- $confB -- \ + list [lsort [list $path0 $path1 $path2]] -- $modsA -- [lsort [list $path3 $path4 $path5]] -- $modsB -- \ + $code0 $msg0 $code1 $msg1 $code2 $msg2 -- $sortA -- $sortB -- \ $out0 $out1 $out2 } -cleanup { tcl::tm::path remove [file join $TestsDir auto0 modules] @@ -1709,22 +1734,15 @@ test safe-9.21 {interpConfigure change the access path; check module loading; st if {$SyncExists} { safe::setAutoPathSync $SyncVal_TMP } -} -match glob -result "{\$p(:1:)} {\$p(:2:)} {\$p(:3:)} -- {{\$p(:1:)}} --\ - {\$p(:3:)} {\$p(:4:)} {\$p(:5:)} -- {{\$p(:3:)}} --\ +} -match glob -result {{{$p(:1:)} {$p(:2:)} {$p(:3:)}} -- {{$p(:1:)}} --\ + {{$p(:3:)} {$p(:4:)} {$p(:5:)}} -- {{$p(:3:)}} --\ 0 0.5 0 1.0 0 2.0 --\ - {-accessPath {[list $tcl_library \ - $TestsDir/auto0/modules \ - $TestsDir/auto0/modules/mod1 \ - $TestsDir/auto0/modules/mod2]}\ - -statics 1 -nested 0 -deleteHook {}} --\ - {-accessPath {[list $tcl_library \ - $TestsDir/auto0/auto1 \ - $TestsDir/auto0/auto2 \ - $TestsDir/auto0/modules \ - $TestsDir/auto0/modules/mod1 \ - $TestsDir/auto0/modules/mod2]}\ - -statics 1 -nested 0 -deleteHook {}} --\ - res0 res1 res2" + {TCLLIB TESTSDIR/auto0/modules TESTSDIR/auto0/modules/mod1\ + TESTSDIR/auto0/modules/mod2} --\ + {TCLLIB TESTSDIR/auto0/auto1 TESTSDIR/auto0/auto2 TESTSDIR/auto0/modules\ + TESTSDIR/auto0/modules/mod1 TESTSDIR/auto0/modules/mod2} --\ + res0 res1 res2} +# See comments on lsort after test safe-9.20. test safe-9.21z {interpConfigure change the access path; check module loading; stale data case 1; zipfs} -setup { set SyncExists [expr {[info commands ::safe::setAutoPathSync] ne {}}] if {$SyncExists} { @@ -1741,6 +1759,7 @@ test safe-9.21z {interpConfigure change the access path; check module loading; s # Inspect. set confA [safe::interpConfigure $i] + set sortA [mapAndSortList $PathMapp [dict get $confA -accessPath]] set modsA [interp eval $i {tcl::tm::path list}] set path0 [::safe::interpFindInAccessPath $i [file join $ZipMountPoint auto0 modules]] set path1 [::safe::interpFindInAccessPath $i [file join $ZipMountPoint auto0 modules mod1]] @@ -1751,9 +1770,9 @@ test safe-9.21z {interpConfigure change the access path; check module loading; s safe::interpConfigure $i -accessPath [list $tcl_library \ [file join $ZipMountPoint auto0 auto1] \ [file join $ZipMountPoint auto0 auto2]] - # Inspect. set confB [safe::interpConfigure $i] + set sortB [mapAndSortList $PathMapp [dict get $confB -accessPath]] set modsB [interp eval $i {tcl::tm::path list}] set path3 [::safe::interpFindInAccessPath $i [file join $ZipMountPoint auto0 modules]] set path4 [::safe::interpFindInAccessPath $i [file join $ZipMountPoint auto0 modules mod1]] @@ -1772,9 +1791,10 @@ test safe-9.21z {interpConfigure change the access path; check module loading; s set out1 [interp eval $i {mod1::test1::try1}] set out2 [interp eval $i {mod2::test2::try2}] - list $path0 $path1 $path2 -- $modsA -- $path3 $path4 $path5 -- $modsB -- \ - $code0 $msg0 $code1 $msg1 $code2 $msg2 -- $confA -- $confB -- \ - $out0 $out1 $out2 + list [lsort [list $path0 $path1 $path2]] -- $modsA -- \ + [lsort [list $path3 $path4 $path5]] -- $modsB -- \ + $code0 $msg0 $code1 $msg1 $code2 $msg2 -- $sortA -- $sortB -- \ + $out0 $out1 $out2 } -cleanup { tcl::tm::path remove [file join $ZipMountPoint auto0 modules] foreach path [lreverse $oldTm] { @@ -1784,22 +1804,15 @@ test safe-9.21z {interpConfigure change the access path; check module loading; s if {$SyncExists} { safe::setAutoPathSync $SyncVal_TMP } -} -match glob -result "{\$p(:1:)} {\$p(:2:)} {\$p(:3:)} -- {{\$p(:1:)}} --\ - {\$p(:3:)} {\$p(:4:)} {\$p(:5:)} -- {{\$p(:3:)}} --\ +} -match glob -result {{{$p(:1:)} {$p(:2:)} {$p(:3:)}} -- {{$p(:1:)}} --\ + {{$p(:3:)} {$p(:4:)} {$p(:5:)}} -- {{$p(:3:)}} --\ 0 0.5 0 1.0 0 2.0 --\ - {-accessPath {[list $tcl_library \ - $ZipMountPoint/auto0/modules \ - $ZipMountPoint/auto0/modules/mod1 \ - $ZipMountPoint/auto0/modules/mod2]}\ - -statics 1 -nested 0 -deleteHook {}} --\ - {-accessPath {[list $tcl_library \ - $ZipMountPoint/auto0/auto1 \ - $ZipMountPoint/auto0/auto2 \ - $ZipMountPoint/auto0/modules \ - $ZipMountPoint/auto0/modules/mod1 \ - $ZipMountPoint/auto0/modules/mod2]}\ - -statics 1 -nested 0 -deleteHook {}} --\ - res0 res1 res2" + {TCLLIB ZIPDIR/auto0/modules ZIPDIR/auto0/modules/mod1\ + ZIPDIR/auto0/modules/mod2} --\ + {TCLLIB ZIPDIR/auto0/auto1 ZIPDIR/auto0/auto2 ZIPDIR/auto0/modules\ + ZIPDIR/auto0/modules/mod1 ZIPDIR/auto0/modules/mod2} --\ + res0 res1 res2} +# See comments on lsort after test safe-9.20. test safe-9.22 {interpConfigure change the access path; check module loading; stale data case 0} -setup { set SyncExists [expr {[info commands ::safe::setAutoPathSync] ne {}}] if {$SyncExists} { @@ -1816,6 +1829,7 @@ test safe-9.22 {interpConfigure change the access path; check module loading; st # Inspect. set confA [safe::interpConfigure $i] + set sortA [mapAndSortList $PathMapp [dict get $confA -accessPath]] set modsA [interp eval $i {tcl::tm::path list}] set path0 [::safe::interpFindInAccessPath $i [file join $TestsDir auto0 modules]] set path1 [::safe::interpFindInAccessPath $i [file join $TestsDir auto0 modules mod1]] @@ -1829,6 +1843,7 @@ test safe-9.22 {interpConfigure change the access path; check module loading; st # Inspect. set confB [safe::interpConfigure $i] + set sortB [mapAndSortList $PathMapp [dict get $confB -accessPath]] set modsB [interp eval $i {tcl::tm::path list}] set path3 [::safe::interpFindInAccessPath $i [file join $TestsDir auto0 modules]] set path4 [::safe::interpFindInAccessPath $i [file join $TestsDir auto0 modules mod1]] @@ -1842,8 +1857,8 @@ test safe-9.22 {interpConfigure change the access path; check module loading; st set out1 [interp eval $i {mod1::test1::try1}] set out2 [interp eval $i {mod2::test2::try2}] - list $path0 $path1 $path2 -- $modsA -- $path3 $path4 $path5 -- $modsB -- \ - $code0 $msg0 $code1 $msg1 $code2 $msg2 -- $confA -- $confB -- \ + list [lsort [list $path0 $path1 $path2]] -- $modsA -- [lsort [list $path3 $path4 $path5]] -- $modsB -- \ + $code0 $msg0 $code1 $msg1 $code2 $msg2 -- $sortA -- $sortB -- \ $out0 $out1 $out2 } -cleanup { tcl::tm::path remove [file join $TestsDir auto0 modules] @@ -1854,22 +1869,15 @@ test safe-9.22 {interpConfigure change the access path; check module loading; st if {$SyncExists} { safe::setAutoPathSync $SyncVal_TMP } -} -match glob -result "{\$p(:1:)} {\$p(:2:)} {\$p(:3:)} -- {{\$p(:1:)}} --\ - {\$p(:3:)} {\$p(:4:)} {\$p(:5:)} -- {{\$p(:3:)}} --\ +} -match glob -result {{{$p(:1:)} {$p(:2:)} {$p(:3:)}} -- {{$p(:1:)}} --\ + {{$p(:3:)} {$p(:4:)} {$p(:5:)}} -- {{$p(:3:)}} --\ 0 0.5 0 1.0 0 2.0 --\ - {-accessPath {[list $tcl_library \ - $TestsDir/auto0/modules \ - $TestsDir/auto0/modules/mod1 \ - $TestsDir/auto0/modules/mod2]}\ - -statics 1 -nested 0 -deleteHook {}} --\ - {-accessPath {[list $tcl_library \ - $TestsDir/auto0/auto1 \ - $TestsDir/auto0/auto2 \ - $TestsDir/auto0/modules \ - $TestsDir/auto0/modules/mod1 \ - $TestsDir/auto0/modules/mod2]}\ - -statics 1 -nested 0 -deleteHook {}} --\ - res0 res1 res2" + {TCLLIB TESTSDIR/auto0/modules TESTSDIR/auto0/modules/mod1\ + TESTSDIR/auto0/modules/mod2} --\ + {TCLLIB TESTSDIR/auto0/auto1 TESTSDIR/auto0/auto2 TESTSDIR/auto0/modules\ + TESTSDIR/auto0/modules/mod1 TESTSDIR/auto0/modules/mod2} --\ + res0 res1 res2} +# See comments on lsort after test safe-9.20. test safe-9.22z {interpConfigure change the access path; check module loading; stale data case 0; zipfs} -setup { set SyncExists [expr {[info commands ::safe::setAutoPathSync] ne {}}] if {$SyncExists} { @@ -1886,6 +1894,7 @@ test safe-9.22z {interpConfigure change the access path; check module loading; s # Inspect. set confA [safe::interpConfigure $i] + set sortA [mapAndSortList $PathMapp [dict get $confA -accessPath]] set modsA [interp eval $i {tcl::tm::path list}] set path0 [::safe::interpFindInAccessPath $i [file join $ZipMountPoint auto0 modules]] set path1 [::safe::interpFindInAccessPath $i [file join $ZipMountPoint auto0 modules mod1]] @@ -1896,9 +1905,9 @@ test safe-9.22z {interpConfigure change the access path; check module loading; s safe::interpConfigure $i -accessPath [list $tcl_library \ [file join $ZipMountPoint auto0 auto1] \ [file join $ZipMountPoint auto0 auto2]] - # Inspect. set confB [safe::interpConfigure $i] + set sortB [mapAndSortList $PathMapp [dict get $confB -accessPath]] set modsB [interp eval $i {tcl::tm::path list}] set path3 [::safe::interpFindInAccessPath $i [file join $ZipMountPoint auto0 modules]] set path4 [::safe::interpFindInAccessPath $i [file join $ZipMountPoint auto0 modules mod1]] @@ -1912,9 +1921,10 @@ test safe-9.22z {interpConfigure change the access path; check module loading; s set out1 [interp eval $i {mod1::test1::try1}] set out2 [interp eval $i {mod2::test2::try2}] - list $path0 $path1 $path2 -- $modsA -- $path3 $path4 $path5 -- $modsB -- \ - $code0 $msg0 $code1 $msg1 $code2 $msg2 -- $confA -- $confB -- \ - $out0 $out1 $out2 + list [lsort [list $path0 $path1 $path2]] -- $modsA -- \ + [lsort [list $path3 $path4 $path5]] -- $modsB -- \ + $code0 $msg0 $code1 $msg1 $code2 $msg2 -- $sortA -- $sortB -- \ + $out0 $out1 $out2 } -cleanup { tcl::tm::path remove [file join $ZipMountPoint auto0 modules] foreach path [lreverse $oldTm] { @@ -1924,22 +1934,15 @@ test safe-9.22z {interpConfigure change the access path; check module loading; s if {$SyncExists} { safe::setAutoPathSync $SyncVal_TMP } -} -match glob -result "{\$p(:1:)} {\$p(:2:)} {\$p(:3:)} -- {{\$p(:1:)}} --\ - {\$p(:3:)} {\$p(:4:)} {\$p(:5:)} -- {{\$p(:3:)}} --\ +} -match glob -result {{{$p(:1:)} {$p(:2:)} {$p(:3:)}} -- {{$p(:1:)}} --\ + {{$p(:3:)} {$p(:4:)} {$p(:5:)}} -- {{$p(:3:)}} --\ 0 0.5 0 1.0 0 2.0 --\ - {-accessPath {[list $tcl_library \ - $ZipMountPoint/auto0/modules \ - $ZipMountPoint/auto0/modules/mod1 \ - $ZipMountPoint/auto0/modules/mod2]}\ - -statics 1 -nested 0 -deleteHook {}} --\ - {-accessPath {[list $tcl_library \ - $ZipMountPoint/auto0/auto1 \ - $ZipMountPoint/auto0/auto2 \ - $ZipMountPoint/auto0/modules \ - $ZipMountPoint/auto0/modules/mod1 \ - $ZipMountPoint/auto0/modules/mod2]}\ - -statics 1 -nested 0 -deleteHook {}} --\ - res0 res1 res2" + {TCLLIB ZIPDIR/auto0/modules ZIPDIR/auto0/modules/mod1\ + ZIPDIR/auto0/modules/mod2} --\ + {TCLLIB ZIPDIR/auto0/auto1 ZIPDIR/auto0/auto2 ZIPDIR/auto0/modules\ + ZIPDIR/auto0/modules/mod1 ZIPDIR/auto0/modules/mod2} --\ + res0 res1 res2} +# See comments on lsort after test safe-9.20. test safe-9.23 {interpConfigure change the access path; check module loading; stale data case 3} -setup { set SyncExists [expr {[info commands ::safe::setAutoPathSync] ne {}}] if {$SyncExists} { @@ -1956,6 +1959,7 @@ test safe-9.23 {interpConfigure change the access path; check module loading; st # Inspect. set confA [safe::interpConfigure $i] + set sortA [mapAndSortList $PathMapp [dict get $confA -accessPath]] set modsA [interp eval $i {tcl::tm::path list}] set path0 [::safe::interpFindInAccessPath $i [file join $TestsDir auto0 modules]] set path1 [::safe::interpFindInAccessPath $i [file join $TestsDir auto0 modules mod1]] @@ -1974,6 +1978,7 @@ test safe-9.23 {interpConfigure change the access path; check module loading; st # Inspect. set confB [safe::interpConfigure $i] + set sortB [mapAndSortList $PathMapp [dict get $confB -accessPath]] set modsB [interp eval $i {tcl::tm::path list}] set path3 [::safe::interpFindInAccessPath $i [file join $TestsDir auto0 modules]] set path4 [::safe::interpFindInAccessPath $i [file join $TestsDir auto0 modules mod1]] @@ -1992,8 +1997,8 @@ test safe-9.23 {interpConfigure change the access path; check module loading; st set out1 [interp eval $i {mod1::test1::try1}] set out2 [interp eval $i {mod2::test2::try2}] - list $path0 $path1 $path2 -- $modsA -- $path3 $path4 $path5 -- $modsB -- \ - $code0 $msg0 $code1 $msg1 $code2 $msg2 -- $confA -- $confB -- \ + list [lsort [list $path0 $path1 $path2]] -- $modsA -- [lsort [list $path3 $path4 $path5]] -- $modsB -- \ + $code0 $msg0 $code1 $msg1 $code2 $msg2 -- $sortA -- $sortB -- \ $out0 $out1 $out2 } -cleanup { @@ -2005,22 +2010,15 @@ test safe-9.23 {interpConfigure change the access path; check module loading; st if {$SyncExists} { safe::setAutoPathSync $SyncVal_TMP } -} -match glob -result "{\$p(:1:)} {\$p(:2:)} {\$p(:3:)} -- {{\$p(:1:)}} --\ - {\$p(:3:)} {\$p(:4:)} {\$p(:5:)} -- {{\$p(:3:)}} --\ +} -match glob -result {{{$p(:1:)} {$p(:2:)} {$p(:3:)}} -- {{$p(:1:)}} --\ + {{$p(:3:)} {$p(:4:)} {$p(:5:)}} -- {{$p(:3:)}} --\ 0 0.5 0 1.0 0 2.0 --\ - {-accessPath {[list $tcl_library \ - $TestsDir/auto0/modules \ - $TestsDir/auto0/modules/mod1 \ - $TestsDir/auto0/modules/mod2]}\ - -statics 1 -nested 0 -deleteHook {}} --\ - {-accessPath {[list $tcl_library \ - $TestsDir/auto0/auto1 \ - $TestsDir/auto0/auto2 \ - $TestsDir/auto0/modules \ - $TestsDir/auto0/modules/mod1 \ - $TestsDir/auto0/modules/mod2]}\ - -statics 1 -nested 0 -deleteHook {}} --\ - res0 res1 res2" + {TCLLIB TESTSDIR/auto0/modules TESTSDIR/auto0/modules/mod1\ + TESTSDIR/auto0/modules/mod2} --\ + {TCLLIB TESTSDIR/auto0/auto1 TESTSDIR/auto0/auto2 TESTSDIR/auto0/modules\ + TESTSDIR/auto0/modules/mod1 TESTSDIR/auto0/modules/mod2} --\ + res0 res1 res2} +# See comments on lsort after test safe-9.20. test safe-9.23z {interpConfigure change the access path; check module loading; stale data case 3; zipfs} -setup { set SyncExists [expr {[info commands ::safe::setAutoPathSync] ne {}}] if {$SyncExists} { @@ -2037,6 +2035,7 @@ test safe-9.23z {interpConfigure change the access path; check module loading; s # Inspect. set confA [safe::interpConfigure $i] + set sortA [mapAndSortList $PathMapp [dict get $confA -accessPath]] set modsA [interp eval $i {tcl::tm::path list}] set path0 [::safe::interpFindInAccessPath $i [file join $ZipMountPoint auto0 modules]] set path1 [::safe::interpFindInAccessPath $i [file join $ZipMountPoint auto0 modules mod1]] @@ -2052,9 +2051,9 @@ test safe-9.23z {interpConfigure change the access path; check module loading; s safe::interpConfigure $i -accessPath [list $tcl_library \ [file join $ZipMountPoint auto0 auto1] \ [file join $ZipMountPoint auto0 auto2]] - # Inspect. set confB [safe::interpConfigure $i] + set sortB [mapAndSortList $PathMapp [dict get $confB -accessPath]] set modsB [interp eval $i {tcl::tm::path list}] set path3 [::safe::interpFindInAccessPath $i [file join $ZipMountPoint auto0 modules]] set path4 [::safe::interpFindInAccessPath $i [file join $ZipMountPoint auto0 modules mod1]] @@ -2073,10 +2072,10 @@ test safe-9.23z {interpConfigure change the access path; check module loading; s set out1 [interp eval $i {mod1::test1::try1}] set out2 [interp eval $i {mod2::test2::try2}] - list $path0 $path1 $path2 -- $modsA -- $path3 $path4 $path5 -- $modsB -- \ - $code0 $msg0 $code1 $msg1 $code2 $msg2 -- $confA -- $confB -- \ - $out0 $out1 $out2 - + list [lsort [list $path0 $path1 $path2]] -- $modsA -- \ + [lsort [list $path3 $path4 $path5]] -- $modsB -- \ + $code0 $msg0 $code1 $msg1 $code2 $msg2 -- $sortA -- $sortB -- \ + $out0 $out1 $out2 } -cleanup { tcl::tm::path remove [file join $ZipMountPoint auto0 modules] foreach path [lreverse $oldTm] { @@ -2086,22 +2085,15 @@ test safe-9.23z {interpConfigure change the access path; check module loading; s if {$SyncExists} { safe::setAutoPathSync $SyncVal_TMP } -} -match glob -result "{\$p(:1:)} {\$p(:2:)} {\$p(:3:)} -- {{\$p(:1:)}} --\ - {\$p(:3:)} {\$p(:4:)} {\$p(:5:)} -- {{\$p(:3:)}} --\ +} -match glob -result {{{$p(:1:)} {$p(:2:)} {$p(:3:)}} -- {{$p(:1:)}} --\ + {{$p(:3:)} {$p(:4:)} {$p(:5:)}} -- {{$p(:3:)}} --\ 0 0.5 0 1.0 0 2.0 --\ - {-accessPath {[list $tcl_library \ - $ZipMountPoint/auto0/modules \ - $ZipMountPoint/auto0/modules/mod1 \ - $ZipMountPoint/auto0/modules/mod2]}\ - -statics 1 -nested 0 -deleteHook {}} --\ - {-accessPath {[list $tcl_library \ - $ZipMountPoint/auto0/auto1 \ - $ZipMountPoint/auto0/auto2 \ - $ZipMountPoint/auto0/modules \ - $ZipMountPoint/auto0/modules/mod1 \ - $ZipMountPoint/auto0/modules/mod2]}\ - -statics 1 -nested 0 -deleteHook {}} --\ - res0 res1 res2" + {TCLLIB ZIPDIR/auto0/modules ZIPDIR/auto0/modules/mod1\ + ZIPDIR/auto0/modules/mod2} --\ + {TCLLIB ZIPDIR/auto0/auto1 ZIPDIR/auto0/auto2 ZIPDIR/auto0/modules\ + ZIPDIR/auto0/modules/mod1 ZIPDIR/auto0/modules/mod2} --\ + res0 res1 res2} +# See comments on lsort after test safe-9.20. test safe-9.24 {interpConfigure change the access path; check module loading; stale data case 2 (worst case)} -setup { set SyncExists [expr {[info commands ::safe::setAutoPathSync] ne {}}] if {$SyncExists} { @@ -2118,6 +2110,7 @@ test safe-9.24 {interpConfigure change the access path; check module loading; st # Inspect. set confA [safe::interpConfigure $i] + set sortA [mapAndSortList $PathMapp [dict get $confA -accessPath]] set modsA [interp eval $i {tcl::tm::path list}] set path0 [::safe::interpFindInAccessPath $i [file join $TestsDir auto0 modules]] set path1 [::safe::interpFindInAccessPath $i [file join $TestsDir auto0 modules mod1]] @@ -2136,6 +2129,7 @@ test safe-9.24 {interpConfigure change the access path; check module loading; st # Inspect. set confB [safe::interpConfigure $i] + set sortB [mapAndSortList $PathMapp [dict get $confB -accessPath]] set modsB [interp eval $i {tcl::tm::path list}] set path3 [::safe::interpFindInAccessPath $i [file join $TestsDir auto0 modules]] set path4 [::safe::interpFindInAccessPath $i [file join $TestsDir auto0 modules mod1]] @@ -2149,8 +2143,8 @@ test safe-9.24 {interpConfigure change the access path; check module loading; st set out1 [interp eval $i {mod1::test1::try1}] set out2 [interp eval $i {mod2::test2::try2}] - list $path0 $path1 $path2 -- $modsA -- $path3 $path4 $path5 -- $modsB -- \ - $code0 $msg0 $code1 $msg1 $code2 $msg2 -- $confA -- $confB -- \ + list [lsort [list $path0 $path1 $path2]] -- $modsA -- [lsort [list $path3 $path4 $path5]] -- $modsB -- \ + $code0 $msg0 $code1 $msg1 $code2 $msg2 -- $sortA -- $sortB -- \ $out0 $out1 $out2 } -cleanup { tcl::tm::path remove [file join $TestsDir auto0 modules] @@ -2161,22 +2155,15 @@ test safe-9.24 {interpConfigure change the access path; check module loading; st if {$SyncExists} { safe::setAutoPathSync $SyncVal_TMP } -} -match glob -result "{\$p(:1:)} {\$p(:2:)} {\$p(:3:)} -- {{\$p(:1:)}} --\ - {\$p(:3:)} {\$p(:4:)} {\$p(:5:)} -- {{\$p(:3:)}} --\ +} -match glob -result {{{$p(:1:)} {$p(:2:)} {$p(:3:)}} -- {{$p(:1:)}} --\ + {{$p(:3:)} {$p(:4:)} {$p(:5:)}} -- {{$p(:3:)}} --\ 0 0.5 0 1.0 0 2.0 --\ - {-accessPath {[list $tcl_library \ - $TestsDir/auto0/modules \ - $TestsDir/auto0/modules/mod1 \ - $TestsDir/auto0/modules/mod2]}\ - -statics 1 -nested 0 -deleteHook {}} --\ - {-accessPath {[list $tcl_library \ - $TestsDir/auto0/auto1 \ - $TestsDir/auto0/auto2 \ - $TestsDir/auto0/modules \ - $TestsDir/auto0/modules/mod1 \ - $TestsDir/auto0/modules/mod2]}\ - -statics 1 -nested 0 -deleteHook {}} --\ - res0 res1 res2" + {TCLLIB TESTSDIR/auto0/modules TESTSDIR/auto0/modules/mod1\ + TESTSDIR/auto0/modules/mod2} --\ + {TCLLIB TESTSDIR/auto0/auto1 TESTSDIR/auto0/auto2 TESTSDIR/auto0/modules\ + TESTSDIR/auto0/modules/mod1 TESTSDIR/auto0/modules/mod2} --\ + res0 res1 res2} +# See comments on lsort after test safe-9.20. test safe-9.24z {interpConfigure change the access path; check module loading; stale data case 2 (worst case); zipfs} -setup { set SyncExists [expr {[info commands ::safe::setAutoPathSync] ne {}}] if {$SyncExists} { @@ -2193,6 +2180,7 @@ test safe-9.24z {interpConfigure change the access path; check module loading; s # Inspect. set confA [safe::interpConfigure $i] + set sortA [mapAndSortList $PathMapp [dict get $confA -accessPath]] set modsA [interp eval $i {tcl::tm::path list}] set path0 [::safe::interpFindInAccessPath $i [file join $ZipMountPoint auto0 modules]] set path1 [::safe::interpFindInAccessPath $i [file join $ZipMountPoint auto0 modules mod1]] @@ -2208,9 +2196,9 @@ test safe-9.24z {interpConfigure change the access path; check module loading; s safe::interpConfigure $i -accessPath [list $tcl_library \ [file join $ZipMountPoint auto0 auto1] \ [file join $ZipMountPoint auto0 auto2]] - # Inspect. set confB [safe::interpConfigure $i] + set sortB [mapAndSortList $PathMapp [dict get $confB -accessPath]] set modsB [interp eval $i {tcl::tm::path list}] set path3 [::safe::interpFindInAccessPath $i [file join $ZipMountPoint auto0 modules]] set path4 [::safe::interpFindInAccessPath $i [file join $ZipMountPoint auto0 modules mod1]] @@ -2224,9 +2212,10 @@ test safe-9.24z {interpConfigure change the access path; check module loading; s set out1 [interp eval $i {mod1::test1::try1}] set out2 [interp eval $i {mod2::test2::try2}] - list $path0 $path1 $path2 -- $modsA -- $path3 $path4 $path5 -- $modsB -- \ - $code0 $msg0 $code1 $msg1 $code2 $msg2 -- $confA -- $confB -- \ - $out0 $out1 $out2 + list [lsort [list $path0 $path1 $path2]] -- $modsA -- \ + [lsort [list $path3 $path4 $path5]] -- $modsB -- \ + $code0 $msg0 $code1 $msg1 $code2 $msg2 -- $sortA -- $sortB -- \ + $out0 $out1 $out2 } -cleanup { tcl::tm::path remove [file join $ZipMountPoint auto0 modules] foreach path [lreverse $oldTm] { @@ -2236,22 +2225,15 @@ test safe-9.24z {interpConfigure change the access path; check module loading; s if {$SyncExists} { safe::setAutoPathSync $SyncVal_TMP } -} -match glob -result "{\$p(:1:)} {\$p(:2:)} {\$p(:3:)} -- {{\$p(:1:)}} --\ - {\$p(:3:)} {\$p(:4:)} {\$p(:5:)} -- {{\$p(:3:)}} --\ +} -match glob -result {{{$p(:1:)} {$p(:2:)} {$p(:3:)}} -- {{$p(:1:)}} --\ + {{$p(:3:)} {$p(:4:)} {$p(:5:)}} -- {{$p(:3:)}} --\ 0 0.5 0 1.0 0 2.0 --\ - {-accessPath {[list $tcl_library \ - $ZipMountPoint/auto0/modules \ - $ZipMountPoint/auto0/modules/mod1 \ - $ZipMountPoint/auto0/modules/mod2]}\ - -statics 1 -nested 0 -deleteHook {}} --\ - {-accessPath {[list $tcl_library \ - $ZipMountPoint/auto0/auto1 \ - $ZipMountPoint/auto0/auto2 \ - $ZipMountPoint/auto0/modules \ - $ZipMountPoint/auto0/modules/mod1 \ - $ZipMountPoint/auto0/modules/mod2]}\ - -statics 1 -nested 0 -deleteHook {}} --\ - res0 res1 res2" + {TCLLIB ZIPDIR/auto0/modules ZIPDIR/auto0/modules/mod1\ + ZIPDIR/auto0/modules/mod2} --\ + {TCLLIB ZIPDIR/auto0/auto1 ZIPDIR/auto0/auto2 ZIPDIR/auto0/modules\ + ZIPDIR/auto0/modules/mod1 ZIPDIR/auto0/modules/mod2} --\ + res0 res1 res2} +# See comments on lsort after test safe-9.20. catch {teststaticpkg Safepkg1 0 0} test safe-10.1 {testing statics loading} -constraints TcltestPackage -setup { @@ -2456,6 +2438,15 @@ proc buildEnvironment {filename} { set testdir2 [makeDirectory deletemetoo $testdir] set testfile [makeFile {} $filename $testdir2] } +proc buildEnvironment2 {filename} { + upvar 1 testdir testdir testdir2 testdir2 testfile testfile + upvar 1 testdir3 testdir3 testfile2 testfile2 + set testdir [makeDirectory deletethisdir] + set testdir2 [makeDirectory deletemetoo $testdir] + set testfile [makeFile {} $filename $testdir2] + set testdir3 [makeDirectory deleteme $testdir] + set testfile2 [makeFile {} $filename $testdir3] +} #### New tests for Safe base glob, with patches @ Bug 2964715 test safe-13.1 {glob is restricted [Bug 2964715]} -setup { set i [safe::interpCreate] @@ -2527,21 +2518,33 @@ test safe-13.6 {as 13.4 but test silent failure when result is outside access_pa safe::interpDelete $i removeDirectory $testdir } -result {} -test safe-13.7 {mimic the glob call by tclPkgUnknown which gives a deliberate error in a safe interpreter [Bug 2964715]} -setup { +test safe-13.7 {mimic the glob call by tclPkgUnknown in a safe interpreter [Bug 2964715]} -setup { set i [safe::interpCreate] buildEnvironment pkgIndex.tcl } -body { set safeTD [::safe::interpAddToAccessPath $i $testdir] ::safe::interpAddToAccessPath $i $testdir2 - string map [list $safeTD EXPECTED] [$i eval [list \ + mapList [list $safeTD EXPECTED] [$i eval [list \ + glob -directory $safeTD -join * pkgIndex.tcl]] +} -cleanup { + safe::interpDelete $i + removeDirectory $testdir +} -result {EXPECTED/deletemetoo/pkgIndex.tcl} +test safe-13.7a {mimic the glob call by tclPkgUnknown in a safe interpreter with multiple subdirectories} -setup { + set i [safe::interpCreate] + buildEnvironment2 pkgIndex.tcl +} -body { + set safeTD [::safe::interpAddToAccessPath $i $testdir] + ::safe::interpAddToAccessPath $i $testdir2 + ::safe::interpAddToAccessPath $i $testdir3 + mapAndSortList [list $safeTD EXPECTED] [$i eval [list \ glob -directory $safeTD -join * pkgIndex.tcl]] } -cleanup { safe::interpDelete $i removeDirectory $testdir -} -result {{EXPECTED/deletemetoo/pkgIndex.tcl}} -# Note the extra {} around the result above; that's *expected* because of the -# format of virtual path roots. -test safe-13.8 {mimic the glob call by tclPkgUnknown without the deliberate error that is specific to pkgIndex.tcl [Bug 2964715]} -setup { +} -result {EXPECTED/deleteme/pkgIndex.tcl EXPECTED/deletemetoo/pkgIndex.tcl} +# See comments on lsort after test safe-9.20. +test safe-13.8 {mimic the glob call by tclPkgUnknown without the special treatment that is specific to pkgIndex.tcl [Bug 2964715]} -setup { set i [safe::interpCreate] buildEnvironment notIndex.tcl } -body { @@ -2579,6 +2582,7 @@ test safe-13.10 {as 13.8 but test silent failure when result is outside access_p removeDirectory $testdir } -result {} rename buildEnvironment {} +rename buildEnvironment2 {} #### Test for the module path test safe-14.1 {Check that module path is the same as in the master interpreter [Bug 2964715]} -setup { @@ -3152,7 +3156,9 @@ test safe-19.2 {Check that each directory of the module path is a valid token} - set ::auto_path $saveAutoPath zipfs unmount ${ZipMountPoint} -unset pkgOptErrMsg pkgOptDir pkgJarDir saveAutoPath TestsDir ZipMountPoint +unset pkgOptErrMsg pkgOptDir pkgJarDir saveAutoPath TestsDir ZipMountPoint PathMapp +rename mapList {} +rename mapAndSortList {} # cleanup ::tcltest::cleanupTests return |