summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorkjnash <k.j.nash@usa.net>2020-07-14 16:57:38 (GMT)
committerkjnash <k.j.nash@usa.net>2020-07-14 16:57:38 (GMT)
commiteeb4747a4dc3cef279db5fd9c9415ebca8091b72 (patch)
treecb0e0dd285abd0575ee85dc9464d900a61fc0476
parentb1d03f8f36eac45fe770b94db11c95d3e17eedf5 (diff)
downloadtcl-eeb4747a4dc3cef279db5fd9c9415ebca8091b72.zip
tcl-eeb4747a4dc3cef279db5fd9c9415ebca8091b72.tar.gz
tcl-eeb4747a4dc3cef279db5fd9c9415ebca8091b72.tar.bz2
Rearrange tests in tests/safe.test to agree with upstream order
-rw-r--r--tests/safe.test1412
1 files changed, 679 insertions, 733 deletions
diff --git a/tests/safe.test b/tests/safe.test
index 75dc2bf..9e942be 100644
--- a/tests/safe.test
+++ b/tests/safe.test
@@ -253,7 +253,20 @@ test safe-7.0a {example tclIndex commands, test in master interpreter} -setup {
set ::auto_path $tmpAutoPath
auto_reset
} -match glob -result {0 ok1 0 ok2}
-
+test safe-7.0az {example tclIndex commands, test in master interpreter; zipfs} -setup {
+ set tmpAutoPath $::auto_path
+ lappend ::auto_path [file join $ZipMountPoint auto0 auto1] [file join $ZipMountPoint auto0 auto2]
+} -body {
+ # Try to load the commands.
+ set code3 [catch report1 msg3]
+ set code4 [catch report2 msg4]
+ list $code3 $msg3 $code4 $msg4
+} -cleanup {
+ catch {rename report1 {}}
+ catch {rename report2 {}}
+ set ::auto_path $tmpAutoPath
+ auto_reset
+} -match glob -result {0 ok1 0 ok2}
test safe-7.0b {example tclIndex commands, negative test in master interpreter} -setup {
set tmpAutoPath $::auto_path
lappend ::auto_path [file join $TestsDir auto0]
@@ -268,7 +281,20 @@ test safe-7.0b {example tclIndex commands, negative test in master interpreter}
set ::auto_path $tmpAutoPath
auto_reset
} -match glob -result {1 {invalid command name "report1"} 1 {invalid command name "report2"}}
-
+test safe-7.0bz {example tclIndex commands, negative test in master interpreter; zipfs} -setup {
+ set tmpAutoPath $::auto_path
+ lappend ::auto_path [file join $ZipMountPoint auto0]
+} -body {
+ # Try to load the commands.
+ set code3 [catch report1 msg3]
+ set code4 [catch report2 msg4]
+ list $code3 $msg3 $code4 $msg4
+} -cleanup {
+ catch {rename report1 {}}
+ catch {rename report2 {}}
+ set ::auto_path $tmpAutoPath
+ auto_reset
+} -match glob -result {1 {invalid command name "report1"} 1 {invalid command name "report2"}}
test safe-7.0c {example pkgIndex.tcl packages, test in master interpreter, child directories} -setup {
set tmpAutoPath $::auto_path
lappend ::auto_path [file join $TestsDir auto0]
@@ -287,7 +313,24 @@ test safe-7.0c {example pkgIndex.tcl packages, test in master interpreter, child
catch {rename HeresPackage1 {}}
catch {rename HeresPackage2 {}}
} -match glob -result {0 1.2.3 0 2.3.4 0 OK1 0 OK2}
+test safe-7.0cz {example pkgIndex.tcl packages, test in master interpreter, child directories; zipfs} -setup {
+ set tmpAutoPath $::auto_path
+ lappend ::auto_path [file join $ZipMountPoint auto0]
+} -body {
+ # Try to load the packages and run a command from each one.
+ set code3 [catch {package require SafeTestPackage1} msg3]
+ 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
+ catch {package forget SafeTestPackage1}
+ catch {package forget SafeTestPackage2}
+ catch {rename HeresPackage1 {}}
+ catch {rename HeresPackage2 {}}
+} -match glob -result {0 1.2.3 0 2.3.4 0 OK1 0 OK2}
test safe-7.0d {example pkgIndex.tcl packages, test in master interpreter, main directories} -setup {
set tmpAutoPath $::auto_path
lappend ::auto_path [file join $TestsDir auto0 auto1] \
@@ -307,7 +350,25 @@ test safe-7.0d {example pkgIndex.tcl packages, test in master interpreter, main
catch {rename HeresPackage1 {}}
catch {rename HeresPackage2 {}}
} -match glob -result {0 1.2.3 0 2.3.4 0 OK1 0 OK2}
+test safe-7.0dz {example pkgIndex.tcl packages, test in master interpreter, main directories; zipfs} -setup {
+ set tmpAutoPath $::auto_path
+ lappend ::auto_path [file join $ZipMountPoint auto0 auto1] \
+ [file join $ZipMountPoint auto0 auto2]
+} -body {
+ # Try to load the packages and run a command from each one.
+ set code3 [catch {package require SafeTestPackage1} msg3]
+ 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
+ catch {package forget SafeTestPackage1}
+ catch {package forget SafeTestPackage2}
+ catch {rename HeresPackage1 {}}
+ catch {rename HeresPackage2 {}}
+} -match glob -result {0 1.2.3 0 2.3.4 0 OK1 0 OK2}
test safe-7.0e {example modules packages, test in master interpreter, replace path} -setup {
set oldTm [tcl::tm::path list]
foreach path $oldTm {
@@ -335,9 +396,12 @@ test safe-7.0e {example modules packages, test in master interpreter, replace pa
catch {namespace delete ::test0}
catch {namespace delete ::mod1}
} -match glob -result {0 0.5 0 1.0 0 2.0 -- res0 res1 res2}
-
-test safe-7.0f {example modules packages, test in master interpreter, append to path} -setup {
- tcl::tm::path add [file join $TestsDir auto0 modules]
+test safe-7.0ez {example modules packages, test in master interpreter, replace path; zipfs} -setup {
+ set oldTm [tcl::tm::path list]
+ foreach path $oldTm {
+ tcl::tm::path remove $path
+ }
+ tcl::tm::path add [file join $ZipMountPoint auto0 modules]
} -body {
# Try to load the modules and run a command from each one.
set code0 [catch {package require test0} msg0]
@@ -349,89 +413,18 @@ test safe-7.0f {example modules packages, test in master interpreter, append to
list $code0 $msg0 $code1 $msg1 $code2 $msg2 -- $out0 $out1 $out2
} -cleanup {
- tcl::tm::path remove [file join $TestsDir auto0 modules]
+ tcl::tm::path remove [file join $ZipMountPoint auto0 modules]
+ foreach path [lreverse $oldTm] {
+ tcl::tm::path add $path
+ }
catch {package forget test0}
catch {package forget mod1::test1}
catch {package forget mod2::test2}
catch {namespace delete ::test0}
catch {namespace delete ::mod1}
} -match glob -result {0 0.5 0 1.0 0 2.0 -- res0 res1 res2}
-
-test safe-7.0az {example tclIndex commands, test in master interpreter; zipfs} -setup {
- set tmpAutoPath $::auto_path
- lappend ::auto_path [file join $ZipMountPoint auto0 auto1] [file join $ZipMountPoint auto0 auto2]
-} -body {
- # Try to load the commands.
- set code3 [catch report1 msg3]
- set code4 [catch report2 msg4]
- list $code3 $msg3 $code4 $msg4
-} -cleanup {
- catch {rename report1 {}}
- catch {rename report2 {}}
- set ::auto_path $tmpAutoPath
- auto_reset
-} -match glob -result {0 ok1 0 ok2}
-
-test safe-7.0bz {example tclIndex commands, negative test in master interpreter; zipfs} -setup {
- set tmpAutoPath $::auto_path
- lappend ::auto_path [file join $ZipMountPoint auto0]
-} -body {
- # Try to load the commands.
- set code3 [catch report1 msg3]
- set code4 [catch report2 msg4]
- list $code3 $msg3 $code4 $msg4
-} -cleanup {
- catch {rename report1 {}}
- catch {rename report2 {}}
- set ::auto_path $tmpAutoPath
- auto_reset
-} -match glob -result {1 {invalid command name "report1"} 1 {invalid command name "report2"}}
-
-test safe-7.0cz {example pkgIndex.tcl packages, test in master interpreter, child directories; zipfs} -setup {
- set tmpAutoPath $::auto_path
- lappend ::auto_path [file join $ZipMountPoint auto0]
-} -body {
- # Try to load the packages and run a command from each one.
- set code3 [catch {package require SafeTestPackage1} msg3]
- 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
- catch {package forget SafeTestPackage1}
- catch {package forget SafeTestPackage2}
- catch {rename HeresPackage1 {}}
- catch {rename HeresPackage2 {}}
-} -match glob -result {0 1.2.3 0 2.3.4 0 OK1 0 OK2}
-
-test safe-7.0dz {example pkgIndex.tcl packages, test in master interpreter, main directories; zipfs} -setup {
- set tmpAutoPath $::auto_path
- lappend ::auto_path [file join $ZipMountPoint auto0 auto1] \
- [file join $ZipMountPoint auto0 auto2]
-} -body {
- # Try to load the packages and run a command from each one.
- set code3 [catch {package require SafeTestPackage1} msg3]
- 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
- catch {package forget SafeTestPackage1}
- catch {package forget SafeTestPackage2}
- catch {rename HeresPackage1 {}}
- catch {rename HeresPackage2 {}}
-} -match glob -result {0 1.2.3 0 2.3.4 0 OK1 0 OK2}
-
-test safe-7.0ez {example modules packages, test in master interpreter, replace path; zipfs} -setup {
- set oldTm [tcl::tm::path list]
- foreach path $oldTm {
- tcl::tm::path remove $path
- }
- tcl::tm::path add [file join $ZipMountPoint auto0 modules]
+test safe-7.0f {example modules packages, test in master interpreter, append to path} -setup {
+ tcl::tm::path add [file join $TestsDir auto0 modules]
} -body {
# Try to load the modules and run a command from each one.
set code0 [catch {package require test0} msg0]
@@ -443,17 +436,13 @@ test safe-7.0ez {example modules packages, test in master interpreter, replace p
list $code0 $msg0 $code1 $msg1 $code2 $msg2 -- $out0 $out1 $out2
} -cleanup {
- tcl::tm::path remove [file join $ZipMountPoint auto0 modules]
- foreach path [lreverse $oldTm] {
- tcl::tm::path add $path
- }
+ tcl::tm::path remove [file join $TestsDir auto0 modules]
catch {package forget test0}
catch {package forget mod1::test1}
catch {package forget mod2::test2}
catch {namespace delete ::test0}
catch {namespace delete ::mod1}
} -match glob -result {0 0.5 0 1.0 0 2.0 -- res0 res1 res2}
-
test safe-7.0fz {example modules packages, test in master interpreter, append to path; zipfs} -setup {
tcl::tm::path add [file join $ZipMountPoint auto0 modules]
} -body {
@@ -475,9 +464,9 @@ test safe-7.0fz {example modules packages, test in master interpreter, append to
catch {namespace delete ::mod1}
} -match glob -result {0 0.5 0 1.0 0 2.0 -- res0 res1 res2}
-
# high level general test
-test safe-7.1opt {tests that everything works at high level with conventional AutoPathSync, use pkg opt} -setup {
+# Use example packages not tcl8.x/opt
+test safe-7.1 {tests that everything works at high level with conventional AutoPathSync} -setup {
# All ::safe commands are loaded at start of file.
set SyncExists [expr {[info commands ::safe::setAutoPathSync] ne {}}]
@@ -486,26 +475,27 @@ test safe-7.1opt {tests that everything works at high level with conventional Au
safe::setAutoPathSync 1
}
+ set tmpAutoPath $::auto_path
+ lappend ::auto_path [file join $TestsDir auto0]
set i [safe::interpCreate]
-
+ set ::auto_path $tmpAutoPath
} -body {
# no error shall occur:
# (because the default access_path shall include 1st level sub dirs so
# package require in a slave works like in the master)
- set v [interp eval $i {package require opt}]
+ set v [interp eval $i {package require SafeTestPackage1}]
# no error shall occur:
- interp eval $i {::tcl::Lempty {a list}}
+ interp eval $i {HeresPackage1}
set v
} -cleanup {
safe::interpDelete $i
if {$SyncExists} {
safe::setAutoPathSync $SyncVal_TMP
}
-} -match glob -result 0.4.*
-
+} -match glob -result 1.2.3
# high level general test
-# Use example packages not tcl8.x/opt
-test safe-7.1 {tests that everything works at high level with conventional AutoPathSync} -setup {
+# Use zipped example packages not tcl8.x/opt
+test safe-7.1z {tests that everything works at high level with conventional AutoPathSync; zipfs} -setup {
# All ::safe commands are loaded at start of file.
set SyncExists [expr {[info commands ::safe::setAutoPathSync] ne {}}]
@@ -532,10 +522,8 @@ test safe-7.1 {tests that everything works at high level with conventional AutoP
safe::setAutoPathSync $SyncVal_TMP
}
} -match glob -result 1.2.3
-
# high level general test
-# Use zipped example packages not tcl8.x/opt
-test safe-7.1z {tests that everything works at high level with conventional AutoPathSync; zipfs} -setup {
+test safe-7.1opt {tests that everything works at high level with conventional AutoPathSync, use pkg opt} -setup {
# All ::safe commands are loaded at start of file.
set SyncExists [expr {[info commands ::safe::setAutoPathSync] ne {}}]
@@ -544,26 +532,23 @@ test safe-7.1z {tests that everything works at high level with conventional Auto
safe::setAutoPathSync 1
}
- set tmpAutoPath $::auto_path
- lappend ::auto_path [file join $TestsDir auto0]
set i [safe::interpCreate]
- set ::auto_path $tmpAutoPath
+
} -body {
# no error shall occur:
# (because the default access_path shall include 1st level sub dirs so
# package require in a slave works like in the master)
- set v [interp eval $i {package require SafeTestPackage1}]
+ set v [interp eval $i {package require opt}]
# no error shall occur:
- interp eval $i {HeresPackage1}
+ interp eval $i {::tcl::Lempty {a list}}
set v
} -cleanup {
safe::interpDelete $i
if {$SyncExists} {
safe::setAutoPathSync $SyncVal_TMP
}
-} -match glob -result 1.2.3
-
-test safe-7.2opt {tests specific path and interpFind/AddToAccessPath with conventional AutoPathSync, use pkg opt} -setup {
+} -match glob -result 0.4.*
+test safe-7.2 {tests specific path and interpFind/AddToAccessPath with conventional AutoPathSync} -setup {
# All ::safe commands are loaded at start of file.
set SyncExists [expr {[info commands ::safe::setAutoPathSync] ne {}}]
@@ -579,21 +564,23 @@ test safe-7.2opt {tests specific path and interpFind/AddToAccessPath with conven
set token1 [safe::interpAddToAccessPath $i [info library]]
# should add as p* (not p1 if master has a module path)
set token2 [safe::interpAddToAccessPath $i "/dummy/unixlike/test/path"]
- # an error shall occur (opt is not anymore in the secure 0-level
+ # should add as p* (not p2 if master has a module path)
+ set token3 [safe::interpAddToAccessPath $i [file join $TestsDir auto0]]
+ # an error shall occur (SafeTestPackage1 is not anymore in the secure 0-level
# provided deep path)
- list $token1 $token2 \
- [catch {interp eval $i {package require opt}} msg] $msg \
+ list $token1 $token2 $token3 \
+ [catch {interp eval $i {package require SafeTestPackage1}} msg] $msg \
[safe::interpConfigure $i]\
[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]}\
+} -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 {}} {}"
-
-test safe-7.2 {tests specific path and interpFind/AddToAccessPath with conventional AutoPathSync} -setup {
+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 {}}]
@@ -625,8 +612,7 @@ test safe-7.2 {tests specific path and interpFind/AddToAccessPath with conventio
{can't find package SafeTestPackage1}\
{-accessPath {[list $tcl_library */dummy/unixlike/test/path $TestsDir/auto0]}\
-statics 0 -nested 1 -deleteHook {}} {}"
-
-test safe-7.2z {tests specific path and interpFind/AddToAccessPath with conventional AutoPathSync; zipfs} -setup {
+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 {}}]
@@ -642,30 +628,25 @@ test safe-7.2z {tests specific path and interpFind/AddToAccessPath with conventi
set token1 [safe::interpAddToAccessPath $i [info library]]
# 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]]
- # an error shall occur (SafeTestPackage1 is not anymore in the secure 0-level
+ # an error shall occur (opt is not anymore in the secure 0-level
# provided deep path)
- list $token1 $token2 $token3 \
- [catch {interp eval $i {package require SafeTestPackage1}} msg] $msg \
+ list $token1 $token2 \
+ [catch {interp eval $i {package require opt}} msg] $msg \
[safe::interpConfigure $i]\
[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]}\
+} -match glob -result "{\$p(:0:)} {\$p(:*:)} 1 {$pkgOptErrMsg}\
+ {-accessPath {[list $tcl_library */dummy/unixlike/test/path]}\
-statics 0 -nested 1 -deleteHook {}} {}"
-
test safe-7.3 {check that safe subinterpreters work} {
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}
-
-test safe-7.4opt {tests specific path and positive search with conventional AutoPathSync, use pkg opt} -setup {
+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 {}}]
@@ -680,10 +661,10 @@ test safe-7.4opt {tests specific path and positive search with conventional Auto
# 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 [info library] $pkgOptDir]]
- # this time, unlike test safe-7.2opt, opt should be found
+ set token2 [safe::interpAddToAccessPath $i [file join $TestsDir auto0 auto1]]
+ # this time, unlike test safe-7.2, SafeTestPackage1 should be found
list $token1 $token2 \
- [catch {interp eval $i {package require opt}} msg] $msg \
+ [catch {interp eval $i {package require SafeTestPackage1}} msg] $msg \
[safe::interpConfigure $i]\
[safe::interpDelete $i]
# Note that the glob match elides directories (those from the module path)
@@ -692,11 +673,10 @@ test safe-7.4opt {tests specific path and positive search with conventional Auto
if {$SyncExists} {
safe::setAutoPathSync $SyncVal_TMP
}
-} -match glob -result "{\$p(:0:)} {\$p(:*:)} 0 0.4.*\
- {-accessPath {[list $tcl_library *$tcl_library/$pkgOptDir]}\
+} -match glob -result "{\$p(:0:)} {\$p(:*:)} 0 1.2.3\
+ {-accessPath {[list $tcl_library * $TestsDir/auto0/auto1]}\
-statics 0 -nested 1 -deleteHook {}} {}"
-
-test safe-7.4 {tests specific path and positive search with conventional AutoPathSync} -setup {
+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 {}}]
@@ -712,7 +692,7 @@ 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]]
- # this time, unlike test safe-7.2, SafeTestPackage1 should be found
+ # 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]\
@@ -726,8 +706,7 @@ test safe-7.4 {tests specific path and positive search with conventional AutoPat
} -match glob -result "{\$p(:0:)} {\$p(:*:)} 0 1.2.3\
{-accessPath {[list $tcl_library * $TestsDir/auto0/auto1]}\
-statics 0 -nested 1 -deleteHook {}} {}"
-
-test safe-7.4z {tests specific path and positive search with conventional AutoPathSync; zipfs} -setup {
+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 {}}]
@@ -742,10 +721,10 @@ 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
+ set token2 [safe::interpAddToAccessPath $i [file join [info library] $pkgOptDir]]
+ # this time, unlike test safe-7.2opt, opt should be found
list $token1 $token2 \
- [catch {interp eval $i {package require SafeTestPackage1}} msg] $msg \
+ [catch {interp eval $i {package require opt}} msg] $msg \
[safe::interpConfigure $i]\
[safe::interpDelete $i]
# Note that the glob match elides directories (those from the module path)
@@ -754,8 +733,8 @@ test safe-7.4z {tests specific path and positive search with conventional AutoPa
if {$SyncExists} {
safe::setAutoPathSync $SyncVal_TMP
}
-} -match glob -result "{\$p(:0:)} {\$p(:*:)} 0 1.2.3\
- {-accessPath {[list $tcl_library * $TestsDir/auto0/auto1]}\
+} -match glob -result "{\$p(:0:)} {\$p(:*:)} 0 0.4.*\
+ {-accessPath {[list $tcl_library *$tcl_library/$pkgOptDir]}\
-statics 0 -nested 1 -deleteHook {}} {}"
test safe-7.5 {tests positive and negative module loading with conventional AutoPathSync} -setup {
@@ -983,7 +962,6 @@ test safe-9.6 {interpConfigure widget like behaviour} -body {
} -cleanup {
safe::interpDelete $i
} -match glob -result {{-accessPath * -statics 0 -nested 1 -deleteHook {foo bar}} {-accessPath *} {-nested 1} {-statics 0} {-deleteHook {foo bar}} {-accessPath * -statics 1 -nested 1 -deleteHook {foo bar}} {-accessPath * -statics 0 -nested 0 -deleteHook toto}}
-
test safe-9.7 {interpConfigure widget like behaviour (demystified)} -body {
# this test shall work, believed equivalent to 9.6
set i [safe::interpCreate \
@@ -1007,7 +985,6 @@ test safe-9.7 {interpConfigure widget like behaviour (demystified)} -body {
} -cleanup {
safe::interpDelete $i
} -match glob -result {{-accessPath * -statics 0 -nested 1 -deleteHook {foo bar}} {-accessPath *} {-nested 1} {-statics 0} {-deleteHook {foo bar}} {-accessPath * -statics 1 -nested 1 -deleteHook {foo bar}} {-accessPath * -statics 0 -nested 0 -deleteHook toto}}
-
test safe-9.8 {interpConfigure change the access path; tclIndex commands unaffected by token rearrangement (dummy test of doreset)} -setup {
set SyncExists [expr {[info commands ::safe::setAutoPathSync] ne {}}]
if {$SyncExists} {
@@ -1057,7 +1034,55 @@ test safe-9.8 {interpConfigure change the access path; tclIndex commands unaffec
-statics 1 -nested 0 -deleteHook {}}\
{-accessPath {[list $tcl_library $TestsDir/auto0/auto2 $TestsDir/auto0/auto1]*}\
-statics 1 -nested 0 -deleteHook {}}"
+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} {
+ set SyncVal_TMP [safe::setAutoPathSync]
+ safe::setAutoPathSync 1
+ }
+} -body {
+ 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 path1 [::safe::interpFindInAccessPath $i [file join $ZipMountPoint auto0 auto1]]
+ set path2 [::safe::interpFindInAccessPath $i [file join $ZipMountPoint auto0 auto2]]
+
+ # Load auto_load data.
+ interp eval $i {catch nonExistentCommand}
+
+ # Load and run the commands.
+ # This guarantees the test will pass even if the tokens are swapped.
+ set code1 [catch {interp eval $i {report1}} msg1]
+ set code2 [catch {interp eval $i {report2}} msg2]
+
+ # Rearrange access path. Swap tokens {$p(:1:)} and {$p(:2:)}.
+ safe::interpConfigure $i -accessPath [list $tcl_library \
+ [file join $ZipMountPoint auto0 auto2] \
+ [file join $ZipMountPoint auto0 auto1]]
+
+ # Inspect.
+ set confB [safe::interpConfigure $i]
+ set path3 [::safe::interpFindInAccessPath $i [file join $ZipMountPoint auto0 auto1]]
+ set path4 [::safe::interpFindInAccessPath $i [file join $ZipMountPoint auto0 auto2]]
+ # Run the commands.
+ 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
+} -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 {}}"
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} {
@@ -1105,8 +1130,7 @@ test safe-9.9 {interpConfigure change the access path; tclIndex commands unaffec
-statics 1 -nested 0 -deleteHook {}}\
{-accessPath {[list $tcl_library $TestsDir/auto0/auto2 $TestsDir/auto0/auto1]*}\
-statics 1 -nested 0 -deleteHook {}}"
-
-test safe-9.10opt {interpConfigure change the access path; pkgIndex.tcl packages unaffected by token rearrangement, use pkg opt and tcl::idna} -setup {
+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} {
set SyncVal_TMP [safe::setAutoPathSync]
@@ -1114,47 +1138,45 @@ test safe-9.10opt {interpConfigure change the access path; pkgIndex.tcl packages
}
} -body {
set i [safe::interpCreate -accessPath [list $tcl_library \
- [file join $tcl_library $pkgOptDir] \
- [file join $tcl_library $pkgJarDir]]]
+ [file join $ZipMountPoint auto0 auto1] \
+ [file join $ZipMountPoint auto0 auto2]]]
# Inspect.
set confA [safe::interpConfigure $i]
- set path1 [::safe::interpFindInAccessPath $i [file join $tcl_library $pkgOptDir]]
- set path2 [::safe::interpFindInAccessPath $i [file join $tcl_library $pkgJarDir]]
+ set path1 [::safe::interpFindInAccessPath $i [file join $ZipMountPoint auto0 auto1]]
+ set path2 [::safe::interpFindInAccessPath $i [file join $ZipMountPoint auto0 auto2]]
- # Load pkgIndex.tcl data.
- catch {interp eval $i {package require NOEXIST}}
+ # Load auto_load data.
+ interp eval $i {catch nonExistentCommand}
+
+ # Do not load the commands. With the tokens swapped, the test
+ # will pass only if the Safe Base has called auto_reset.
# Rearrange access path. Swap tokens {$p(:1:)} and {$p(:2:)}.
- # This has no effect because the records in Pkg of these directories were from access as children of {$p(:0:)}.
safe::interpConfigure $i -accessPath [list $tcl_library \
- [file join $tcl_library $pkgJarDir] \
- [file join $tcl_library $pkgOptDir]]
+ [file join $ZipMountPoint auto0 auto2] \
+ [file join $ZipMountPoint auto0 auto1]]
# Inspect.
set confB [safe::interpConfigure $i]
- set path3 [::safe::interpFindInAccessPath $i [file join $tcl_library $pkgOptDir]]
- set path4 [::safe::interpFindInAccessPath $i [file join $tcl_library $pkgJarDir]]
+ set path3 [::safe::interpFindInAccessPath $i [file join $ZipMountPoint auto0 auto1]]
+ set path4 [::safe::interpFindInAccessPath $i [file join $ZipMountPoint auto0 auto2]]
- # Try to load the packages and run a command from each one.
- set code3 [catch {interp eval $i {package require tcl::idna}} msg3]
- set code4 [catch {interp eval $i {package require opt}} msg4]
- set code5 [catch {interp eval $i {::tcl::Lempty {a list}}} msg5]
- set code6 [catch {interp eval $i {::tcl::idna::IDNAencode example.com}} msg6]
+ # Load and run the commands.
+ 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 $code5 $msg5 $code6 $msg6
+ list $path1 $path2 $path3 $path4 $code3 $msg3 $code4 $msg4 $confA $confB
} -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]*}\
+} -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 $tcl_library/$pkgJarDir $tcl_library/$pkgOptDir]*}\
- -statics 1 -nested 0 -deleteHook {}} 0 0 0 example.com"
-
+ {-accessPath {[list $tcl_library $ZipMountPoint/auto0/auto2 $ZipMountPoint/auto0/auto1]*}\
+ -statics 1 -nested 0 -deleteHook {}}"
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} {
@@ -1210,7 +1232,109 @@ test safe-9.10 {interpConfigure change the access path; pkgIndex.tcl packages un
{-accessPath {[list $tcl_library $TestsDir/auto0 $TestsDir/auto0/auto2 $TestsDir/auto0/auto1]*}\
-statics 1 -nested 0 -deleteHook {}}\
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} {
+ set SyncVal_TMP [safe::setAutoPathSync]
+ safe::setAutoPathSync 1
+ }
+} -body {
+ # For complete correspondence to safe-9.10opt, include auto0 in access path.
+ set i [safe::interpCreate -accessPath [list $tcl_library \
+ [file join $ZipMountPoint auto0] \
+ [file join $ZipMountPoint auto0 auto1] \
+ [file join $ZipMountPoint auto0 auto2]]]
+ # Inspect.
+ set confA [safe::interpConfigure $i]
+ 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]]
+
+ # Load pkgIndex.tcl data.
+ catch {interp eval $i {package require NOEXIST}}
+
+ # Rearrange access path. Swap tokens {$p(:2:)} and {$p(:3:)}.
+ # This would have no effect because the records in Pkg of these directories
+ # were from access as children of {$p(:1:)}.
+ safe::interpConfigure $i -accessPath [list $tcl_library \
+ [file join $ZipMountPoint auto0] \
+ [file join $ZipMountPoint auto0 auto2] \
+ [file join $ZipMountPoint auto0 auto1]]
+
+ # Inspect.
+ set confB [safe::interpConfigure $i]
+ set path3 [::safe::interpFindInAccessPath $i [file join $ZipMountPoint auto0 auto1]]
+ set path4 [::safe::interpFindInAccessPath $i [file join $ZipMountPoint auto0 auto2]]
+
+ # Try to load the packages and run a command from each one.
+ set code3 [catch {interp eval $i {package require SafeTestPackage1}} msg3 opts3]
+ set code4 [catch {interp eval $i {package require SafeTestPackage2}} msg4 opts4]
+ 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
+
+} -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"
+test safe-9.10opt {interpConfigure change the access path; pkgIndex.tcl packages unaffected by token rearrangement, use pkg opt and tcl::idna} -setup {
+ set SyncExists [expr {[info commands ::safe::setAutoPathSync] ne {}}]
+ if {$SyncExists} {
+ set SyncVal_TMP [safe::setAutoPathSync]
+ safe::setAutoPathSync 1
+ }
+} -body {
+ 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 path1 [::safe::interpFindInAccessPath $i [file join $tcl_library $pkgOptDir]]
+ set path2 [::safe::interpFindInAccessPath $i [file join $tcl_library $pkgJarDir]]
+
+ # Load pkgIndex.tcl data.
+ catch {interp eval $i {package require NOEXIST}}
+
+ # Rearrange access path. Swap tokens {$p(:1:)} and {$p(:2:)}.
+ # This has no effect because the records in Pkg of these directories were from access as children of {$p(:0:)}.
+ safe::interpConfigure $i -accessPath [list $tcl_library \
+ [file join $tcl_library $pkgJarDir] \
+ [file join $tcl_library $pkgOptDir]]
+
+ # Inspect.
+ set confB [safe::interpConfigure $i]
+ set path3 [::safe::interpFindInAccessPath $i [file join $tcl_library $pkgOptDir]]
+ set path4 [::safe::interpFindInAccessPath $i [file join $tcl_library $pkgJarDir]]
+
+ # Try to load the packages and run a command from each one.
+ set code3 [catch {interp eval $i {package require tcl::idna}} msg3]
+ set code4 [catch {interp eval $i {package require opt}} msg4]
+ 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
+} -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"
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} {
@@ -1259,8 +1383,7 @@ test safe-9.11 {interpConfigure change the access path; pkgIndex.tcl packages un
{-accessPath {[list $tcl_library $TestsDir/auto0/auto2 $TestsDir/auto0/auto1]*}\
-statics 1 -nested 0 -deleteHook {}}\
0 OK1 0 OK2"
-
-test safe-9.12opt {interpConfigure change the access path; pkgIndex.tcl packages fail if directory de-listed, use pkg opt and tcl::idna} -setup {
+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} {
set SyncVal_TMP [safe::setAutoPathSync]
@@ -1268,41 +1391,46 @@ test safe-9.12opt {interpConfigure change the access path; pkgIndex.tcl packages
}
} -body {
set i [safe::interpCreate -accessPath [list $tcl_library \
- [file join $tcl_library $pkgOptDir] \
- [file join $tcl_library $pkgJarDir]]]
+ [file join $ZipMountPoint auto0 auto1] \
+ [file join $ZipMountPoint auto0 auto2]]]
# Inspect.
set confA [safe::interpConfigure $i]
- set path1 [::safe::interpFindInAccessPath $i [file join $tcl_library $pkgOptDir]]
- set path2 [::safe::interpFindInAccessPath $i [file join $tcl_library $pkgJarDir]]
+ set path1 [::safe::interpFindInAccessPath $i [file join $ZipMountPoint auto0 auto1]]
+ set path2 [::safe::interpFindInAccessPath $i [file join $ZipMountPoint auto0 auto2]]
# Load pkgIndex.tcl data.
catch {interp eval $i {package require NOEXIST}}
- # Limit access path. Remove tokens {$p(:1:)} and {$p(:2:)}.
- safe::interpConfigure $i -accessPath [list $tcl_library]
+ # Rearrange access path. Swap tokens {$p(:1:)} and {$p(:2:)}.
+ safe::interpConfigure $i -accessPath [list $tcl_library \
+ [file join $ZipMountPoint auto0 auto2] \
+ [file join $ZipMountPoint auto0 auto1]]
# Inspect.
set confB [safe::interpConfigure $i]
- set code4 [catch {::safe::interpFindInAccessPath $i [file join $tcl_library $pkgOptDir]} path4]
- set code5 [catch {::safe::interpFindInAccessPath $i [file join $tcl_library $pkgJarDir]} path5]
+ set path3 [::safe::interpFindInAccessPath $i [file join $ZipMountPoint auto0 auto1]]
+ set path4 [::safe::interpFindInAccessPath $i [file join $ZipMountPoint auto0 auto2]]
- # Try to load the packages.
- set code3 [catch {interp eval $i {package require opt}} msg3]
- set code6 [catch {interp eval $i {package require tcl::idna}} msg6]
+ # Try to load the packages and run a command from each one.
+ set code3 [catch {interp eval $i {package require SafeTestPackage1}} msg3 opts3]
+ set code4 [catch {interp eval $i {package require SafeTestPackage2}} msg4 opts4]
+ set code5 [catch {interp eval $i {HeresPackage1}} msg5 opts5]
+ set code6 [catch {interp eval $i {HeresPackage2}} msg6 opts6]
- list $path1 $path2 $code4 $path4 $code5 $path5 $code3 $msg3 $code6 $msg6 $confA $confB
+ list $path1 $path2 $path3 $path4 $code3 $msg3 $code4 $msg4 $confA $confB \
+ $code5 $msg5 $code6 $msg6
} -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]*}\
+} -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]*} -statics 1 -nested 0 -deleteHook {}}"
-
+ {-accessPath {[list $tcl_library $ZipMountPoint/auto0/auto2 $ZipMountPoint/auto0/auto1]*}\
+ -statics 1 -nested 0 -deleteHook {}}\
+ 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} {
@@ -1345,7 +1473,90 @@ test safe-9.12 {interpConfigure change the access path; pkgIndex.tcl packages fa
{-accessPath {[list $tcl_library $TestsDir/auto0/auto1 $TestsDir/auto0/auto2]*}\
-statics 1 -nested 0 -deleteHook {}}\
{-accessPath {[list $tcl_library]*} -statics 1 -nested 0 -deleteHook {}}"
+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} {
+ set SyncVal_TMP [safe::setAutoPathSync]
+ safe::setAutoPathSync 1
+ }
+} -body {
+ 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 path1 [::safe::interpFindInAccessPath $i [file join $ZipMountPoint auto0 auto1]]
+ set path2 [::safe::interpFindInAccessPath $i [file join $ZipMountPoint auto0 auto2]]
+
+ # Load pkgIndex.tcl data.
+ catch {interp eval $i {package require NOEXIST}}
+
+ # Limit access path. Remove tokens {$p(:1:)} and {$p(:2:)}.
+ safe::interpConfigure $i -accessPath [list $tcl_library]
+
+ # Inspect.
+ set confB [safe::interpConfigure $i]
+ set code4 [catch {::safe::interpFindInAccessPath $i [file join $ZipMountPoint auto0 auto1]} path4]
+ set code5 [catch {::safe::interpFindInAccessPath $i [file join $ZipMountPoint auto0 auto2]} path5]
+ # Try to load the packages.
+ 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
+} -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 {}}"
+test safe-9.12opt {interpConfigure change the access path; pkgIndex.tcl packages fail if directory de-listed, use pkg opt and tcl::idna} -setup {
+ set SyncExists [expr {[info commands ::safe::setAutoPathSync] ne {}}]
+ if {$SyncExists} {
+ set SyncVal_TMP [safe::setAutoPathSync]
+ safe::setAutoPathSync 1
+ }
+} -body {
+ 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 path1 [::safe::interpFindInAccessPath $i [file join $tcl_library $pkgOptDir]]
+ set path2 [::safe::interpFindInAccessPath $i [file join $tcl_library $pkgJarDir]]
+
+ # Load pkgIndex.tcl data.
+ catch {interp eval $i {package require NOEXIST}}
+
+ # Limit access path. Remove tokens {$p(:1:)} and {$p(:2:)}.
+ safe::interpConfigure $i -accessPath [list $tcl_library]
+
+ # Inspect.
+ set confB [safe::interpConfigure $i]
+ set code4 [catch {::safe::interpFindInAccessPath $i [file join $tcl_library $pkgOptDir]} path4]
+ set code5 [catch {::safe::interpFindInAccessPath $i [file join $tcl_library $pkgJarDir]} path5]
+
+ # Try to load the 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
+} -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 {}}"
test safe-9.20 {check module loading} -setup {
set SyncExists [expr {[info commands ::safe::setAutoPathSync] ne {}}]
if {$SyncExists} {
@@ -1393,8 +1604,7 @@ test safe-9.20 {check module loading} -setup {
$TestsDir/auto0/modules/mod2]*}\
-statics 1 -nested 0 -deleteHook {}} --\
res0 res1 res2"
-
-test safe-9.21 {interpConfigure change the access path; check module loading; stale data case 1} -setup {
+test safe-9.20z {check module loading; zipfs} -setup {
set SyncExists [expr {[info commands ::safe::setAutoPathSync] ne {}}]
if {$SyncExists} {
set SyncVal_TMP [safe::setAutoPathSync]
@@ -1404,34 +1614,16 @@ test safe-9.21 {interpConfigure change the access path; check module loading; st
foreach path $oldTm {
tcl::tm::path remove $path
}
- tcl::tm::path add [file join $TestsDir auto0 modules]
+ tcl::tm::path add [file join $ZipMountPoint auto0 modules]
} -body {
set i [safe::interpCreate -accessPath [list $tcl_library]]
# Inspect.
set confA [safe::interpConfigure $i]
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]]
- set path2 [::safe::interpFindInAccessPath $i [file join $TestsDir auto0 modules mod2]]
-
- # Add to access path.
- # This injects more tokens, pushing modules to higher token numbers.
- safe::interpConfigure $i -accessPath [list $tcl_library \
- [file join $TestsDir auto0 auto1] \
- [file join $TestsDir auto0 auto2]]
-
- # Inspect.
- set confB [safe::interpConfigure $i]
- 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]]
- set path5 [::safe::interpFindInAccessPath $i [file join $TestsDir auto0 modules mod2]]
-
- # Load pkg data.
- catch {interp eval $i {package require NOEXIST}}
- catch {interp eval $i {package require mod1::NOEXIST}}
- catch {interp eval $i {package require mod2::NOEXIST}}
+ set path0 [::safe::interpFindInAccessPath $i [file join $ZipMountPoint auto0 modules]]
+ set path1 [::safe::interpFindInAccessPath $i [file join $ZipMountPoint auto0 modules mod1]]
+ set path2 [::safe::interpFindInAccessPath $i [file join $ZipMountPoint auto0 modules mod2]]
# Try to load the packages and run a command from each one.
set code0 [catch {interp eval $i {package require test0}} msg0]
@@ -1441,11 +1633,10 @@ 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 -- \
- $out0 $out1 $out2
+ list $path0 $path1 $path2 -- $modsA -- \
+ $code0 $msg0 $code1 $msg1 $code2 $msg2 -- $confA -- $out0 $out1 $out2
} -cleanup {
- tcl::tm::path remove [file join $TestsDir auto0 modules]
+ tcl::tm::path remove [file join $ZipMountPoint auto0 modules]
foreach path [lreverse $oldTm] {
tcl::tm::path add $path
}
@@ -1454,23 +1645,13 @@ test safe-9.21 {interpConfigure change the access path; check module loading; st
safe::setAutoPathSync $SyncVal_TMP
}
} -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]}\
+ {-accessPath {[list $tcl_library $ZipMountPoint/auto0/modules \
+ $ZipMountPoint/auto0/modules/mod1 \
+ $ZipMountPoint/auto0/modules/mod2]*}\
-statics 1 -nested 0 -deleteHook {}} --\
res0 res1 res2"
-
-test safe-9.22 {interpConfigure change the access path; check module loading; stale data case 0} -setup {
+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} {
set SyncVal_TMP [safe::setAutoPathSync]
@@ -1494,8 +1675,8 @@ test safe-9.22 {interpConfigure change the access path; check module loading; st
# Add to access path.
# This injects more tokens, pushing modules to higher token numbers.
safe::interpConfigure $i -accessPath [list $tcl_library \
- [file join $TestsDir auto0 auto1] \
- [file join $TestsDir auto0 auto2]]
+ [file join $TestsDir auto0 auto1] \
+ [file join $TestsDir auto0 auto2]]
# Inspect.
set confB [safe::interpConfigure $i]
@@ -1504,6 +1685,11 @@ test safe-9.22 {interpConfigure change the access path; check module loading; st
set path4 [::safe::interpFindInAccessPath $i [file join $TestsDir auto0 modules mod1]]
set path5 [::safe::interpFindInAccessPath $i [file join $TestsDir auto0 modules mod2]]
+ # Load pkg data.
+ catch {interp eval $i {package require NOEXIST}}
+ catch {interp eval $i {package require mod1::NOEXIST}}
+ catch {interp eval $i {package require mod2::NOEXIST}}
+
# Try to load the packages and run a command from each one.
set code0 [catch {interp eval $i {package require test0}} msg0]
set code1 [catch {interp eval $i {package require mod1::test1}} msg1]
@@ -1528,20 +1714,19 @@ test safe-9.22 {interpConfigure change the access path; check module loading; st
{\$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]}\
+ $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]}\
+ $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"
-
-test safe-9.23 {interpConfigure change the access path; check module loading; stale data case 3} -setup {
+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} {
set SyncVal_TMP [safe::setAutoPathSync]
@@ -1551,36 +1736,31 @@ test safe-9.23 {interpConfigure change the access path; check module loading; st
foreach path $oldTm {
tcl::tm::path remove $path
}
- tcl::tm::path add [file join $TestsDir auto0 modules]
+ tcl::tm::path add [file join $ZipMountPoint auto0 modules]
} -body {
set i [safe::interpCreate -accessPath [list $tcl_library]]
# Inspect.
set confA [safe::interpConfigure $i]
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]]
- set path2 [::safe::interpFindInAccessPath $i [file join $TestsDir auto0 modules mod2]]
-
- # Force the interpreter to acquire pkg data which will soon become stale.
- catch {interp eval $i {package require NOEXIST}}
- catch {interp eval $i {package require mod1::NOEXIST}}
- catch {interp eval $i {package require mod2::NOEXIST}}
+ set path0 [::safe::interpFindInAccessPath $i [file join $ZipMountPoint auto0 modules]]
+ set path1 [::safe::interpFindInAccessPath $i [file join $ZipMountPoint auto0 modules mod1]]
+ set path2 [::safe::interpFindInAccessPath $i [file join $ZipMountPoint auto0 modules mod2]]
# Add to access path.
# This injects more tokens, pushing modules to higher token numbers.
safe::interpConfigure $i -accessPath [list $tcl_library \
- [file join $TestsDir auto0 auto1] \
- [file join $TestsDir auto0 auto2]]
+ [file join $ZipMountPoint auto0 auto1] \
+ [file join $ZipMountPoint auto0 auto2]]
# Inspect.
set confB [safe::interpConfigure $i]
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]]
- set path5 [::safe::interpFindInAccessPath $i [file join $TestsDir auto0 modules mod2]]
+ set path3 [::safe::interpFindInAccessPath $i [file join $ZipMountPoint auto0 modules]]
+ set path4 [::safe::interpFindInAccessPath $i [file join $ZipMountPoint auto0 modules mod1]]
+ set path5 [::safe::interpFindInAccessPath $i [file join $ZipMountPoint auto0 modules mod2]]
- # Refresh stale pkg data.
+ # Load pkg data.
catch {interp eval $i {package require NOEXIST}}
catch {interp eval $i {package require mod1::NOEXIST}}
catch {interp eval $i {package require mod2::NOEXIST}}
@@ -1596,9 +1776,8 @@ test safe-9.23 {interpConfigure change the access path; check module loading; st
list $path0 $path1 $path2 -- $modsA -- $path3 $path4 $path5 -- $modsB -- \
$code0 $msg0 $code1 $msg1 $code2 $msg2 -- $confA -- $confB -- \
$out0 $out1 $out2
-
} -cleanup {
- tcl::tm::path remove [file join $TestsDir auto0 modules]
+ tcl::tm::path remove [file join $ZipMountPoint auto0 modules]
foreach path [lreverse $oldTm] {
tcl::tm::path add $path
}
@@ -1610,20 +1789,19 @@ test safe-9.23 {interpConfigure change the access path; check module loading; st
{\$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]}\
+ $ZipMountPoint/auto0/modules \
+ $ZipMountPoint/auto0/modules/mod1 \
+ $ZipMountPoint/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]}\
+ $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"
-
-test safe-9.24 {interpConfigure change the access path; check module loading; stale data case 2 (worst case)} -setup {
+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} {
set SyncVal_TMP [safe::setAutoPathSync]
@@ -1644,16 +1822,11 @@ test safe-9.24 {interpConfigure change the access path; check module loading; st
set path1 [::safe::interpFindInAccessPath $i [file join $TestsDir auto0 modules mod1]]
set path2 [::safe::interpFindInAccessPath $i [file join $TestsDir auto0 modules mod2]]
- # Force the interpreter to acquire pkg data which will soon become stale.
- catch {interp eval $i {package require NOEXIST}}
- catch {interp eval $i {package require mod1::NOEXIST}}
- catch {interp eval $i {package require mod2::NOEXIST}}
-
# Add to access path.
# This injects more tokens, pushing modules to higher token numbers.
safe::interpConfigure $i -accessPath [list $tcl_library \
- [file join $TestsDir auto0 auto1] \
- [file join $TestsDir auto0 auto2]]
+ [file join $TestsDir auto0 auto1] \
+ [file join $TestsDir auto0 auto2]]
# Inspect.
set confB [safe::interpConfigure $i]
@@ -1691,262 +1864,14 @@ test safe-9.24 {interpConfigure change the access path; check module loading; st
$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]}\
+ $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"
-
-
-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} {
- set SyncVal_TMP [safe::setAutoPathSync]
- safe::setAutoPathSync 1
- }
-} -body {
- 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 path1 [::safe::interpFindInAccessPath $i [file join $ZipMountPoint auto0 auto1]]
- set path2 [::safe::interpFindInAccessPath $i [file join $ZipMountPoint auto0 auto2]]
-
- # Load auto_load data.
- interp eval $i {catch nonExistentCommand}
-
- # Load and run the commands.
- # This guarantees the test will pass even if the tokens are swapped.
- set code1 [catch {interp eval $i {report1}} msg1]
- set code2 [catch {interp eval $i {report2}} msg2]
-
- # Rearrange access path. Swap tokens {$p(:1:)} and {$p(:2:)}.
- safe::interpConfigure $i -accessPath [list $tcl_library \
- [file join $ZipMountPoint auto0 auto2] \
- [file join $ZipMountPoint auto0 auto1]]
-
- # Inspect.
- set confB [safe::interpConfigure $i]
- set path3 [::safe::interpFindInAccessPath $i [file join $ZipMountPoint auto0 auto1]]
- set path4 [::safe::interpFindInAccessPath $i [file join $ZipMountPoint auto0 auto2]]
-
- # Run the commands.
- 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
-} -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 {}}"
-
-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} {
- set SyncVal_TMP [safe::setAutoPathSync]
- safe::setAutoPathSync 1
- }
-} -body {
- 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 path1 [::safe::interpFindInAccessPath $i [file join $ZipMountPoint auto0 auto1]]
- set path2 [::safe::interpFindInAccessPath $i [file join $ZipMountPoint auto0 auto2]]
-
- # Load auto_load data.
- interp eval $i {catch nonExistentCommand}
-
- # Do not load the commands. With the tokens swapped, the test
- # will pass only if the Safe Base has called auto_reset.
-
- # Rearrange access path. Swap tokens {$p(:1:)} and {$p(:2:)}.
- safe::interpConfigure $i -accessPath [list $tcl_library \
- [file join $ZipMountPoint auto0 auto2] \
- [file join $ZipMountPoint auto0 auto1]]
-
- # Inspect.
- set confB [safe::interpConfigure $i]
- set path3 [::safe::interpFindInAccessPath $i [file join $ZipMountPoint auto0 auto1]]
- set path4 [::safe::interpFindInAccessPath $i [file join $ZipMountPoint auto0 auto2]]
-
- # Load and run the commands.
- 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
-} -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 {}}"
-
-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} {
- set SyncVal_TMP [safe::setAutoPathSync]
- safe::setAutoPathSync 1
- }
-} -body {
- # For complete correspondence to safe-9.10opt, include auto0 in access path.
- set i [safe::interpCreate -accessPath [list $tcl_library \
- [file join $ZipMountPoint auto0] \
- [file join $ZipMountPoint auto0 auto1] \
- [file join $ZipMountPoint auto0 auto2]]]
-
- # Inspect.
- set confA [safe::interpConfigure $i]
- 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]]
-
- # Load pkgIndex.tcl data.
- catch {interp eval $i {package require NOEXIST}}
-
- # Rearrange access path. Swap tokens {$p(:2:)} and {$p(:3:)}.
- # This would have no effect because the records in Pkg of these directories
- # were from access as children of {$p(:1:)}.
- safe::interpConfigure $i -accessPath [list $tcl_library \
- [file join $ZipMountPoint auto0] \
- [file join $ZipMountPoint auto0 auto2] \
- [file join $ZipMountPoint auto0 auto1]]
-
- # Inspect.
- set confB [safe::interpConfigure $i]
- set path3 [::safe::interpFindInAccessPath $i [file join $ZipMountPoint auto0 auto1]]
- set path4 [::safe::interpFindInAccessPath $i [file join $ZipMountPoint auto0 auto2]]
-
- # Try to load the packages and run a command from each one.
- set code3 [catch {interp eval $i {package require SafeTestPackage1}} msg3 opts3]
- set code4 [catch {interp eval $i {package require SafeTestPackage2}} msg4 opts4]
- 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
-
-} -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"
-
-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} {
- set SyncVal_TMP [safe::setAutoPathSync]
- safe::setAutoPathSync 1
- }
-} -body {
- 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 path1 [::safe::interpFindInAccessPath $i [file join $ZipMountPoint auto0 auto1]]
- set path2 [::safe::interpFindInAccessPath $i [file join $ZipMountPoint auto0 auto2]]
-
- # Load pkgIndex.tcl data.
- catch {interp eval $i {package require NOEXIST}}
-
- # Rearrange access path. Swap tokens {$p(:1:)} and {$p(:2:)}.
- safe::interpConfigure $i -accessPath [list $tcl_library \
- [file join $ZipMountPoint auto0 auto2] \
- [file join $ZipMountPoint auto0 auto1]]
-
- # Inspect.
- set confB [safe::interpConfigure $i]
- set path3 [::safe::interpFindInAccessPath $i [file join $ZipMountPoint auto0 auto1]]
- set path4 [::safe::interpFindInAccessPath $i [file join $ZipMountPoint auto0 auto2]]
-
- # Try to load the packages and run a command from each one.
- set code3 [catch {interp eval $i {package require SafeTestPackage1}} msg3 opts3]
- set code4 [catch {interp eval $i {package require SafeTestPackage2}} msg4 opts4]
- 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
-} -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"
-
-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} {
- set SyncVal_TMP [safe::setAutoPathSync]
- safe::setAutoPathSync 1
- }
-} -body {
- 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 path1 [::safe::interpFindInAccessPath $i [file join $ZipMountPoint auto0 auto1]]
- set path2 [::safe::interpFindInAccessPath $i [file join $ZipMountPoint auto0 auto2]]
-
- # Load pkgIndex.tcl data.
- catch {interp eval $i {package require NOEXIST}}
-
- # Limit access path. Remove tokens {$p(:1:)} and {$p(:2:)}.
- safe::interpConfigure $i -accessPath [list $tcl_library]
-
- # Inspect.
- set confB [safe::interpConfigure $i]
- set code4 [catch {::safe::interpFindInAccessPath $i [file join $ZipMountPoint auto0 auto1]} path4]
- set code5 [catch {::safe::interpFindInAccessPath $i [file join $ZipMountPoint auto0 auto2]} path5]
-
- # Try to load the packages.
- 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
-} -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 {}}"
-
-test safe-9.20z {check module loading; zipfs} -setup {
+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} {
set SyncVal_TMP [safe::setAutoPathSync]
@@ -1967,6 +1892,19 @@ test safe-9.20z {check module loading; zipfs} -setup {
set path1 [::safe::interpFindInAccessPath $i [file join $ZipMountPoint auto0 modules mod1]]
set path2 [::safe::interpFindInAccessPath $i [file join $ZipMountPoint auto0 modules mod2]]
+ # Add to access path.
+ # This injects more tokens, pushing modules to higher token numbers.
+ safe::interpConfigure $i -accessPath [list $tcl_library \
+ [file join $ZipMountPoint auto0 auto1] \
+ [file join $ZipMountPoint auto0 auto2]]
+
+ # Inspect.
+ set confB [safe::interpConfigure $i]
+ 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]]
+ set path5 [::safe::interpFindInAccessPath $i [file join $ZipMountPoint auto0 modules mod2]]
+
# Try to load the packages and run a command from each one.
set code0 [catch {interp eval $i {package require test0}} msg0]
set code1 [catch {interp eval $i {package require mod1::test1}} msg1]
@@ -1975,8 +1913,9 @@ 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 $path0 $path1 $path2 -- $modsA -- $path3 $path4 $path5 -- $modsB -- \
+ $code0 $msg0 $code1 $msg1 $code2 $msg2 -- $confA -- $confB -- \
+ $out0 $out1 $out2
} -cleanup {
tcl::tm::path remove [file join $ZipMountPoint auto0 modules]
foreach path [lreverse $oldTm] {
@@ -1987,14 +1926,22 @@ test safe-9.20z {check module loading; zipfs} -setup {
safe::setAutoPathSync $SyncVal_TMP
}
} -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]*}\
+ {-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"
-
-test safe-9.21z {interpConfigure change the access path; check module loading; stale data case 1; zipfs} -setup {
+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} {
set SyncVal_TMP [safe::setAutoPathSync]
@@ -2004,31 +1951,36 @@ test safe-9.21z {interpConfigure change the access path; check module loading; s
foreach path $oldTm {
tcl::tm::path remove $path
}
- tcl::tm::path add [file join $ZipMountPoint auto0 modules]
+ tcl::tm::path add [file join $TestsDir auto0 modules]
} -body {
set i [safe::interpCreate -accessPath [list $tcl_library]]
# Inspect.
set confA [safe::interpConfigure $i]
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]]
- set path2 [::safe::interpFindInAccessPath $i [file join $ZipMountPoint auto0 modules mod2]]
+ set path0 [::safe::interpFindInAccessPath $i [file join $TestsDir auto0 modules]]
+ set path1 [::safe::interpFindInAccessPath $i [file join $TestsDir auto0 modules mod1]]
+ set path2 [::safe::interpFindInAccessPath $i [file join $TestsDir auto0 modules mod2]]
+
+ # Force the interpreter to acquire pkg data which will soon become stale.
+ catch {interp eval $i {package require NOEXIST}}
+ catch {interp eval $i {package require mod1::NOEXIST}}
+ catch {interp eval $i {package require mod2::NOEXIST}}
# Add to access path.
# This injects more tokens, pushing modules to higher token numbers.
safe::interpConfigure $i -accessPath [list $tcl_library \
- [file join $ZipMountPoint auto0 auto1] \
- [file join $ZipMountPoint auto0 auto2]]
+ [file join $TestsDir auto0 auto1] \
+ [file join $TestsDir auto0 auto2]]
# Inspect.
set confB [safe::interpConfigure $i]
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]]
- set path5 [::safe::interpFindInAccessPath $i [file join $ZipMountPoint auto0 modules mod2]]
+ set path3 [::safe::interpFindInAccessPath $i [file join $TestsDir auto0 modules]]
+ set path4 [::safe::interpFindInAccessPath $i [file join $TestsDir auto0 modules mod1]]
+ set path5 [::safe::interpFindInAccessPath $i [file join $TestsDir auto0 modules mod2]]
- # Load pkg data.
+ # Refresh stale pkg data.
catch {interp eval $i {package require NOEXIST}}
catch {interp eval $i {package require mod1::NOEXIST}}
catch {interp eval $i {package require mod2::NOEXIST}}
@@ -2044,8 +1996,9 @@ test safe-9.21z {interpConfigure change the access path; check module loading; s
list $path0 $path1 $path2 -- $modsA -- $path3 $path4 $path5 -- $modsB -- \
$code0 $msg0 $code1 $msg1 $code2 $msg2 -- $confA -- $confB -- \
$out0 $out1 $out2
+
} -cleanup {
- tcl::tm::path remove [file join $ZipMountPoint auto0 modules]
+ tcl::tm::path remove [file join $TestsDir auto0 modules]
foreach path [lreverse $oldTm] {
tcl::tm::path add $path
}
@@ -2057,20 +2010,19 @@ test safe-9.21z {interpConfigure change the access path; check module loading; s
{\$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]}\
+ $TestsDir/auto0/modules \
+ $TestsDir/auto0/modules/mod1 \
+ $TestsDir/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]}\
+ $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"
-
-test safe-9.22z {interpConfigure change the access path; check module loading; stale data case 0; zipfs} -setup {
+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} {
set SyncVal_TMP [safe::setAutoPathSync]
@@ -2091,11 +2043,16 @@ test safe-9.22z {interpConfigure change the access path; check module loading; s
set path1 [::safe::interpFindInAccessPath $i [file join $ZipMountPoint auto0 modules mod1]]
set path2 [::safe::interpFindInAccessPath $i [file join $ZipMountPoint auto0 modules mod2]]
+ # Force the interpreter to acquire pkg data which will soon become stale.
+ catch {interp eval $i {package require NOEXIST}}
+ catch {interp eval $i {package require mod1::NOEXIST}}
+ catch {interp eval $i {package require mod2::NOEXIST}}
+
# Add to access path.
# This injects more tokens, pushing modules to higher token numbers.
safe::interpConfigure $i -accessPath [list $tcl_library \
- [file join $ZipMountPoint auto0 auto1] \
- [file join $ZipMountPoint auto0 auto2]]
+ [file join $ZipMountPoint auto0 auto1] \
+ [file join $ZipMountPoint auto0 auto2]]
# Inspect.
set confB [safe::interpConfigure $i]
@@ -2104,6 +2061,11 @@ test safe-9.22z {interpConfigure change the access path; check module loading; s
set path4 [::safe::interpFindInAccessPath $i [file join $ZipMountPoint auto0 modules mod1]]
set path5 [::safe::interpFindInAccessPath $i [file join $ZipMountPoint auto0 modules mod2]]
+ # Refresh stale pkg data.
+ catch {interp eval $i {package require NOEXIST}}
+ catch {interp eval $i {package require mod1::NOEXIST}}
+ catch {interp eval $i {package require mod2::NOEXIST}}
+
# Try to load the packages and run a command from each one.
set code0 [catch {interp eval $i {package require test0}} msg0]
set code1 [catch {interp eval $i {package require mod1::test1}} msg1]
@@ -2115,6 +2077,7 @@ test safe-9.22z {interpConfigure change the access path; check module loading; s
list $path0 $path1 $path2 -- $modsA -- $path3 $path4 $path5 -- $modsB -- \
$code0 $msg0 $code1 $msg1 $code2 $msg2 -- $confA -- $confB -- \
$out0 $out1 $out2
+
} -cleanup {
tcl::tm::path remove [file join $ZipMountPoint auto0 modules]
foreach path [lreverse $oldTm] {
@@ -2140,8 +2103,7 @@ test safe-9.22z {interpConfigure change the access path; check module loading; s
$ZipMountPoint/auto0/modules/mod2]}\
-statics 1 -nested 0 -deleteHook {}} --\
res0 res1 res2"
-
-test safe-9.23z {interpConfigure change the access path; check module loading; stale data case 3; zipfs} -setup {
+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} {
set SyncVal_TMP [safe::setAutoPathSync]
@@ -2151,16 +2113,16 @@ test safe-9.23z {interpConfigure change the access path; check module loading; s
foreach path $oldTm {
tcl::tm::path remove $path
}
- tcl::tm::path add [file join $ZipMountPoint auto0 modules]
+ tcl::tm::path add [file join $TestsDir auto0 modules]
} -body {
set i [safe::interpCreate -accessPath [list $tcl_library]]
# Inspect.
set confA [safe::interpConfigure $i]
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]]
- set path2 [::safe::interpFindInAccessPath $i [file join $ZipMountPoint auto0 modules mod2]]
+ set path0 [::safe::interpFindInAccessPath $i [file join $TestsDir auto0 modules]]
+ set path1 [::safe::interpFindInAccessPath $i [file join $TestsDir auto0 modules mod1]]
+ set path2 [::safe::interpFindInAccessPath $i [file join $TestsDir auto0 modules mod2]]
# Force the interpreter to acquire pkg data which will soon become stale.
catch {interp eval $i {package require NOEXIST}}
@@ -2170,20 +2132,15 @@ test safe-9.23z {interpConfigure change the access path; check module loading; s
# Add to access path.
# This injects more tokens, pushing modules to higher token numbers.
safe::interpConfigure $i -accessPath [list $tcl_library \
- [file join $ZipMountPoint auto0 auto1] \
- [file join $ZipMountPoint auto0 auto2]]
+ [file join $TestsDir auto0 auto1] \
+ [file join $TestsDir auto0 auto2]]
# Inspect.
set confB [safe::interpConfigure $i]
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]]
- set path5 [::safe::interpFindInAccessPath $i [file join $ZipMountPoint auto0 modules mod2]]
-
- # Refresh stale pkg data.
- catch {interp eval $i {package require NOEXIST}}
- catch {interp eval $i {package require mod1::NOEXIST}}
- catch {interp eval $i {package require mod2::NOEXIST}}
+ set path3 [::safe::interpFindInAccessPath $i [file join $TestsDir auto0 modules]]
+ set path4 [::safe::interpFindInAccessPath $i [file join $TestsDir auto0 modules mod1]]
+ set path5 [::safe::interpFindInAccessPath $i [file join $TestsDir auto0 modules mod2]]
# Try to load the packages and run a command from each one.
set code0 [catch {interp eval $i {package require test0}} msg0]
@@ -2196,9 +2153,8 @@ test safe-9.23z {interpConfigure change the access path; check module loading; s
list $path0 $path1 $path2 -- $modsA -- $path3 $path4 $path5 -- $modsB -- \
$code0 $msg0 $code1 $msg1 $code2 $msg2 -- $confA -- $confB -- \
$out0 $out1 $out2
-
} -cleanup {
- tcl::tm::path remove [file join $ZipMountPoint auto0 modules]
+ tcl::tm::path remove [file join $TestsDir auto0 modules]
foreach path [lreverse $oldTm] {
tcl::tm::path add $path
}
@@ -2210,19 +2166,18 @@ test safe-9.23z {interpConfigure change the access path; check module loading; s
{\$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]}\
+ $TestsDir/auto0/modules \
+ $TestsDir/auto0/modules/mod1 \
+ $TestsDir/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]}\
+ $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"
-
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} {
@@ -2764,7 +2719,7 @@ test safe-17.2 {Check that first element of slave auto_path (and access path) is
### 18. Tests for AutoSyncDefined without conventional AutoPathSync, i.e. with AutoPathSync off.
-test safe-18.1opt {cf. safe-7.1opt - tests that everything works at high level without conventional AutoPathSync, use pkg opt} -constraints AutoSyncDefined -setup {
+test safe-18.1 {cf. safe-7.1 - tests that everything works at high level without conventional AutoPathSync} -constraints AutoSyncDefined -setup {
# All ::safe commands are loaded at start of file.
set SyncExists [expr {[info commands ::safe::setAutoPathSync] ne {}}]
@@ -2778,7 +2733,7 @@ test safe-18.1opt {cf. safe-7.1opt - tests that everything works at high level w
# Without AutoPathSync, we need a more complete auto_path,
# because the slave will use the same value.
set lib1 [info library]
- set lib2 [file dirname $lib1]
+ set lib2 [file join $TestsDir auto0]
set ::auto_TMP $::auto_path
set ::auto_path [list $lib1 $lib2]
@@ -2788,18 +2743,17 @@ test safe-18.1opt {cf. safe-7.1opt - tests that everything works at high level w
# no error shall occur:
# (because the default access_path shall include 1st level sub dirs so
# package require in a slave works like in the master)
- set v [interp eval $i {package require opt}]
+ set v [interp eval $i {package require SafeTestPackage1}]
# no error shall occur:
- interp eval $i {::tcl::Lempty {a list}}
+ interp eval $i HeresPackage1
set v
} -cleanup {
safe::interpDelete $i
if {$SyncExists} {
safe::setAutoPathSync $SyncVal_TMP
}
-} -match glob -result 0.4.*
-
-test safe-18.1 {cf. safe-7.1 - tests that everything works at high level without conventional AutoPathSync} -constraints AutoSyncDefined -setup {
+} -match glob -result 1.2.3
+test safe-18.1z {cf. safe-7.1 - tests that everything works at high level without conventional AutoPathSync; zipfs} -constraints AutoSyncDefined -setup {
# All ::safe commands are loaded at start of file.
set SyncExists [expr {[info commands ::safe::setAutoPathSync] ne {}}]
@@ -2813,7 +2767,7 @@ test safe-18.1 {cf. safe-7.1 - tests that everything works at high level without
# Without AutoPathSync, we need a more complete auto_path,
# because the slave will use the same value.
set lib1 [info library]
- set lib2 [file join $TestsDir auto0]
+ set lib2 [file join $ZipMountPoint auto0]
set ::auto_TMP $::auto_path
set ::auto_path [list $lib1 $lib2]
@@ -2833,8 +2787,41 @@ test safe-18.1 {cf. safe-7.1 - tests that everything works at high level without
safe::setAutoPathSync $SyncVal_TMP
}
} -match glob -result 1.2.3
+test safe-18.1opt {cf. safe-7.1opt - tests that everything works at high level without conventional AutoPathSync, use pkg opt} -constraints AutoSyncDefined -setup {
+ # All ::safe commands are loaded at start of file.
+ set SyncExists [expr {[info commands ::safe::setAutoPathSync] ne {}}]
-test safe-18.2opt {cf. safe-7.2opt - tests specific path and interpFind/AddToAccessPath without conventional AutoPathSync, use pkg opt} -constraints AutoSyncDefined -setup {
+ if {$SyncExists} {
+ set SyncVal_TMP [safe::setAutoPathSync]
+ safe::setAutoPathSync 0
+ } else {
+ error {This test is meaningful only if the command ::safe::setAutoPathSync is defined}
+ }
+
+ # Without AutoPathSync, we need a more complete auto_path,
+ # because the slave will use the same value.
+ set lib1 [info library]
+ set lib2 [file dirname $lib1]
+ set ::auto_TMP $::auto_path
+ set ::auto_path [list $lib1 $lib2]
+
+ set i [safe::interpCreate]
+ set ::auto_path $::auto_TMP
+} -body {
+ # no error shall occur:
+ # (because the default access_path shall include 1st level sub dirs so
+ # package require in a slave works like in the master)
+ set v [interp eval $i {package require opt}]
+ # no error shall occur:
+ interp eval $i {::tcl::Lempty {a list}}
+ set v
+} -cleanup {
+ safe::interpDelete $i
+ if {$SyncExists} {
+ safe::setAutoPathSync $SyncVal_TMP
+ }
+} -match glob -result 0.4.*
+test safe-18.2 {cf. safe-7.2 - tests specific path and interpFind/AddToAccessPath without conventional AutoPathSync} -constraints AutoSyncDefined -setup {
# All ::safe commands are loaded at start of file.
set SyncExists [expr {[info commands ::safe::setAutoPathSync] ne {}}]
@@ -2852,21 +2839,25 @@ test safe-18.2opt {cf. safe-7.2opt - tests specific path and interpFind/AddToAcc
set token1 [safe::interpAddToAccessPath $i [info library]]
# should add as p* (not p1 if master has a module path)
set token2 [safe::interpAddToAccessPath $i "/dummy/unixlike/test/path"]
- # an error shall occur (opt is not anymore in the secure 0-level
+ # should add as p* (not p2 if master has a module path)
+ set token3 [safe::interpAddToAccessPath $i [file join $TestsDir auto0]]
+ # an error shall occur (SafeTestPackage1 is not anymore in the secure 0-level
# provided deep path)
- list $auto1 $token1 $token2 \
- [catch {interp eval $i {package require opt}} msg] $msg \
+ list $auto1 $token1 $token2 $token3 \
+ [catch {interp eval $i {package require SafeTestPackage1}} msg] $msg \
[safe::interpConfigure $i]\
[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]}\
+} -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 {} -autoPath [list $tcl_library]} {}"
-
-test safe-18.2 {cf. safe-7.2 - tests specific path and interpFind/AddToAccessPath without conventional AutoPathSync} -constraints AutoSyncDefined -setup {
+test safe-18.2z {cf. safe-7.2 - tests specific path and interpFind/AddToAccessPath without conventional AutoPathSync; zipfs} -constraints AutoSyncDefined -setup {
# All ::safe commands are loaded at start of file.
set SyncExists [expr {[info commands ::safe::setAutoPathSync] ne {}}]
@@ -2885,7 +2876,7 @@ test safe-18.2 {cf. safe-7.2 - tests specific path and interpFind/AddToAccessPat
# 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]]
# an error shall occur (SafeTestPackage1 is not anymore in the secure 0-level
# provided deep path)
list $auto1 $token1 $token2 $token3 \
@@ -2900,9 +2891,39 @@ test safe-18.2 {cf. safe-7.2 - tests specific path and interpFind/AddToAccessPat
1 {can't find package SafeTestPackage1}\
{-accessPath {[list $tcl_library \
*/dummy/unixlike/test/path \
- $TestsDir/auto0]}\
+ $ZipMountPoint/auto0]}\
-statics 0 -nested 1 -deleteHook {} -autoPath [list $tcl_library]} {}"
+test safe-18.2opt {cf. safe-7.2opt - tests specific path and interpFind/AddToAccessPath without conventional AutoPathSync, use pkg opt} -constraints AutoSyncDefined -setup {
+ # All ::safe commands are loaded at start of file.
+ set SyncExists [expr {[info commands ::safe::setAutoPathSync] ne {}}]
+ if {$SyncExists} {
+ set SyncVal_TMP [safe::setAutoPathSync]
+ safe::setAutoPathSync 0
+ } else {
+ error {This test is meaningful only if the command ::safe::setAutoPathSync is defined}
+ }
+} -body {
+ set i [safe::interpCreate -nostat -nested 1 -accessPath [list [info library]]]
+ set auto1 [interp eval $i {set ::auto_path}]
+ interp eval $i {set ::auto_path [list {$p(:0:)}]}
+ # 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 "/dummy/unixlike/test/path"]
+ # an error shall occur (opt is not anymore in the secure 0-level
+ # provided deep path)
+ list $auto1 $token1 $token2 \
+ [catch {interp eval $i {package require opt}} msg] $msg \
+ [safe::interpConfigure $i]\
+ [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 {} -autoPath [list $tcl_library]} {}"
test safe-18.3 {Check that default auto_path is the same as in the master interpreter without conventional AutoPathSync} -constraints AutoSyncDefined -setup {
# All ::safe commands are loaded at start of file.
set SyncExists [expr {[info commands ::safe::setAutoPathSync] ne {}}]
@@ -2931,8 +2952,7 @@ test safe-18.3 {Check that default auto_path is the same as in the master interp
safe::setAutoPathSync $SyncVal_TMP
}
} -result $::auto_path
-
-test safe-18.4opt {cf. safe-7.4opt - tests specific path and positive search and auto_path without conventional AutoPathSync, use pkg opt} -constraints AutoSyncDefined -setup {
+test safe-18.4 {cf. safe-7.4 - tests specific path and positive search and auto_path without conventional AutoPathSync} -constraints AutoSyncDefined -setup {
# All ::safe commands are loaded at start of file.
set SyncExists [expr {[info commands ::safe::setAutoPathSync] ne {}}]
@@ -2954,25 +2974,30 @@ test safe-18.4opt {cf. safe-7.4opt - tests specific path and positive search and
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 token2 [safe::interpAddToAccessPath $i [file join $TestsDir auto0]]
+
+ # should add as p* (not p2 if master has a module path)
+ set token3 [safe::interpAddToAccessPath $i [file join $TestsDir auto0 auto1]]
# should not have been changed by Safe Base:
set auto2 [interp eval $i {set ::auto_path}]
- # This time, unlike test safe-18.2opt and the try above, opt should be found:
- list $auto1 $auto2 $token1 $token2 \
- [catch {interp eval $i {package require opt}} msg] $msg \
+ set auto3 [interp eval $i [list set ::auto_path [list {$p(:0:)} $token2]]]
+
+ # This time, unlike test safe-18.2 and the try above, SafeTestPackage1 should be found:
+ list $auto1 $auto2 $token1 $token2 $token3 \
+ [catch {interp eval $i {package require SafeTestPackage1}} msg] $msg \
[safe::interpConfigure $i]\
[safe::interpDelete $i]
} -cleanup {
if {$SyncExists} {
safe::setAutoPathSync $SyncVal_TMP
}
-} -match glob -result "{} {{\$p(:0:)}} {\$p(:0:)} {\$p(:*:)} 0 0.4.*\
- {-accessPath {[list $tcl_library *$tcl_library/$pkgOptDir]}\
- -statics 0 -nested 1 -deleteHook {} -autoPath [list $tcl_library]} {}"
-
-test safe-18.4 {cf. safe-7.4 - tests specific path and positive search and auto_path without conventional AutoPathSync} -constraints AutoSyncDefined -setup {
+} -match glob -result "{} {{\$p(:0:)}} {\$p(:0:)} {\$p(:*:)} {\$p(:*:)} 0 1.2.3\
+ {-accessPath {[list $tcl_library *$TestsDir/auto0 $TestsDir/auto0/auto1]}\
+ -statics 0 -nested 1 -deleteHook {}\
+ -autoPath {[list $tcl_library $TestsDir/auto0]}} {}"
+test safe-18.4z {cf. safe-7.4 - tests specific path and positive search and auto_path without conventional AutoPathSync; zipfs} -constraints AutoSyncDefined -setup {
# All ::safe commands are loaded at start of file.
set SyncExists [expr {[info commands ::safe::setAutoPathSync] ne {}}]
@@ -2994,10 +3019,10 @@ test safe-18.4 {cf. safe-7.4 - tests specific path and positive search and 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 $TestsDir auto0]]
+ set token2 [safe::interpAddToAccessPath $i [file join $ZipMountPoint auto0]]
# should add as p* (not p2 if master has a module path)
- set token3 [safe::interpAddToAccessPath $i [file join $TestsDir auto0 auto1]]
+ set token3 [safe::interpAddToAccessPath $i [file join $ZipMountPoint auto0 auto1]]
# should not have been changed by Safe Base:
set auto2 [interp eval $i {set ::auto_path}]
@@ -3014,77 +3039,10 @@ test safe-18.4 {cf. safe-7.4 - tests specific path and positive search and auto_
safe::setAutoPathSync $SyncVal_TMP
}
} -match glob -result "{} {{\$p(:0:)}} {\$p(:0:)} {\$p(:*:)} {\$p(:*:)} 0 1.2.3\
- {-accessPath {[list $tcl_library *$TestsDir/auto0 $TestsDir/auto0/auto1]}\
+ {-accessPath {[list $tcl_library *$ZipMountPoint/auto0 $ZipMountPoint/auto0/auto1]}\
-statics 0 -nested 1 -deleteHook {}\
- -autoPath {[list $tcl_library $TestsDir/auto0]}} {}"
-
-test safe-18.5 {cf. safe-7.5 - tests positive and negative module loading without conventional AutoPathSync} -setup {
- # All ::safe commands are loaded at start of file.
- set SyncExists [expr {[info commands ::safe::setAutoPathSync] ne {}}]
-
- if {$SyncExists} {
- set SyncVal_TMP [safe::setAutoPathSync]
- safe::setAutoPathSync 0
- } else {
- error {This test is meaningful only if the command ::safe::setAutoPathSync is defined}
- }
-
- set i [safe::interpCreate]
-
- interp eval $i {
- package forget platform::shell
- package forget platform
- catch {namespace delete ::platform}
- }
-} -body {
- # Should raise an error (tests module ancestor directory rule)
- set code1 [catch {interp eval $i {package require shell}} msg1]
- # Should not raise an error
- set code2 [catch {interp eval $i {package require platform::shell}} msg2]
- return [list $code1 $msg1 $code2]
-} -cleanup {
- safe::interpDelete $i
- if {$SyncExists} {
- safe::setAutoPathSync $SyncVal_TMP
- }
-} -result {1 {can't find package shell} 0}
-
-test safe-18.1z {cf. safe-7.1 - tests that everything works at high level without conventional AutoPathSync; zipfs} -constraints AutoSyncDefined -setup {
- # All ::safe commands are loaded at start of file.
- set SyncExists [expr {[info commands ::safe::setAutoPathSync] ne {}}]
-
- if {$SyncExists} {
- set SyncVal_TMP [safe::setAutoPathSync]
- safe::setAutoPathSync 0
- } else {
- error {This test is meaningful only if the command ::safe::setAutoPathSync is defined}
- }
-
- # Without AutoPathSync, we need a more complete auto_path,
- # because the slave will use the same value.
- set lib1 [info library]
- set lib2 [file join $ZipMountPoint auto0]
- set ::auto_TMP $::auto_path
- set ::auto_path [list $lib1 $lib2]
-
- set i [safe::interpCreate]
- set ::auto_path $::auto_TMP
-} -body {
- # no error shall occur:
- # (because the default access_path shall include 1st level sub dirs so
- # package require in a slave works like in the master)
- set v [interp eval $i {package require SafeTestPackage1}]
- # no error shall occur:
- interp eval $i HeresPackage1
- set v
-} -cleanup {
- safe::interpDelete $i
- if {$SyncExists} {
- safe::setAutoPathSync $SyncVal_TMP
- }
-} -match glob -result 1.2.3
-
-test safe-18.2z {cf. safe-7.2 - tests specific path and interpFind/AddToAccessPath without conventional AutoPathSync; zipfs} -constraints AutoSyncDefined -setup {
+ -autoPath {[list $tcl_library $ZipMountPoint/auto0]}} {}"
+test safe-18.4opt {cf. safe-7.4opt - tests specific path and positive search and auto_path without conventional AutoPathSync, use pkg opt} -constraints AutoSyncDefined -setup {
# All ::safe commands are loaded at start of file.
set SyncExists [expr {[info commands ::safe::setAutoPathSync] ne {}}]
@@ -3096,32 +3054,34 @@ test safe-18.2z {cf. safe-7.2 - tests specific path and interpFind/AddToAccessPa
}
} -body {
set i [safe::interpCreate -nostat -nested 1 -accessPath [list [info library]]]
+
+ # should not have been set by Safe Base:
set auto1 [interp eval $i {set ::auto_path}]
+
interp eval $i {set ::auto_path [list {$p(:0:)}]}
+
# 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 "/dummy/unixlike/test/path"]
- # should add as p* (not p2 if master has a module path)
- set token3 [safe::interpAddToAccessPath $i [file join $ZipMountPoint auto0]]
- # an error shall occur (SafeTestPackage1 is not anymore in the secure 0-level
- # provided deep path)
- list $auto1 $token1 $token2 $token3 \
- [catch {interp eval $i {package require SafeTestPackage1}} msg] $msg \
+ set token2 [safe::interpAddToAccessPath $i [file join [info library] $pkgOptDir]]
+
+ # should not have been changed by Safe Base:
+ set auto2 [interp eval $i {set ::auto_path}]
+
+ # This time, unlike test safe-18.2opt and the try above, opt should be found:
+ list $auto1 $auto2 $token1 $token2 \
+ [catch {interp eval $i {package require opt}} msg] $msg \
[safe::interpConfigure $i]\
[safe::interpDelete $i]
} -cleanup {
if {$SyncExists} {
- safe::setAutoPathSync $SyncVal_TMP
+ 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 \
- $ZipMountPoint/auto0]}\
+} -match glob -result "{} {{\$p(:0:)}} {\$p(:0:)} {\$p(:*:)} 0 0.4.*\
+ {-accessPath {[list $tcl_library *$tcl_library/$pkgOptDir]}\
-statics 0 -nested 1 -deleteHook {} -autoPath [list $tcl_library]} {}"
-
-test safe-18.4z {cf. safe-7.4 - tests specific path and positive search and auto_path without conventional AutoPathSync; zipfs} -constraints AutoSyncDefined -setup {
+test safe-18.5 {cf. safe-7.5 - tests positive and negative module loading without conventional AutoPathSync} -setup {
# All ::safe commands are loaded at start of file.
set SyncExists [expr {[info commands ::safe::setAutoPathSync] ne {}}]
@@ -3131,41 +3091,27 @@ test safe-18.4z {cf. safe-7.4 - tests specific path and positive search and auto
} else {
error {This test is meaningful only if the command ::safe::setAutoPathSync is defined}
}
-} -body {
- set i [safe::interpCreate -nostat -nested 1 -accessPath [list [info library]]]
- # should not have been set by Safe Base:
- set auto1 [interp eval $i {set ::auto_path}]
-
- interp eval $i {set ::auto_path [list {$p(:0:)}]}
-
- # 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 $ZipMountPoint auto0]]
-
- # should add as p* (not p2 if master has a module path)
- set token3 [safe::interpAddToAccessPath $i [file join $ZipMountPoint auto0 auto1]]
-
- # should not have been changed by Safe Base:
- set auto2 [interp eval $i {set ::auto_path}]
-
- set auto3 [interp eval $i [list set ::auto_path [list {$p(:0:)} $token2]]]
+ set i [safe::interpCreate]
- # This time, unlike test safe-18.2 and the try above, SafeTestPackage1 should be found:
- list $auto1 $auto2 $token1 $token2 $token3 \
- [catch {interp eval $i {package require SafeTestPackage1}} msg] $msg \
- [safe::interpConfigure $i]\
- [safe::interpDelete $i]
+ interp eval $i {
+ package forget platform::shell
+ package forget platform
+ catch {namespace delete ::platform}
+ }
+} -body {
+ # Should raise an error (tests module ancestor directory rule)
+ set code1 [catch {interp eval $i {package require shell}} msg1]
+ # Should not raise an error
+ set code2 [catch {interp eval $i {package require platform::shell}} msg2]
+ return [list $code1 $msg1 $code2]
} -cleanup {
+ safe::interpDelete $i
if {$SyncExists} {
- safe::setAutoPathSync $SyncVal_TMP
+ safe::setAutoPathSync $SyncVal_TMP
}
-} -match glob -result "{} {{\$p(:0:)}} {\$p(:0:)} {\$p(:*:)} {\$p(:*:)} 0 1.2.3\
- {-accessPath {[list $tcl_library *$ZipMountPoint/auto0 $ZipMountPoint/auto0/auto1]}\
- -statics 0 -nested 1 -deleteHook {}\
- -autoPath {[list $tcl_library $ZipMountPoint/auto0]}} {}"
+} -result {1 {can't find package shell} 0}
+
### 19. Test tokenization of directories available to a slave.