1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
|
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
|
-
|
}
} -result 0
} [namespace current]]
# Helpers for TIP 671 tests for invalid encoding in system API
# Specifically use /tmp for tests because on WSL [temporaryDirectory]
# on NTFS prevents creation of arbitrary byte sequences in names.
testConstraint utf8system [string equal [encoding system] utf-8]
if {[llength [auto_execok bash]]} {
testConstraint haveBash 1
}
set dir671 /tmp/tip-671-test
proc clean671 {} {
file delete -force $::dir671
|
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
|
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
|
+
+
+
+
-
-
+
+
+
+
-
-
+
+
+
-
+
|
proc test-tip671 {id comment body result args} {
set setup {
clean671; # In case left over from manual testing
set oldEnc [encoding system]
# The invalid bytes file name assumes utf-8
encoding system utf-8
}
if {[dict exists $args -setup]} {
append setup "\n[dict get $args -setup]"
dict unset args -setup
}
set cleanup {
clean671
encoding system $oldEnc
}
if {[dict exists $args -setup]} {
append setup "\n[dict get $args -setup]"
if {[dict exists $args -cleanup]} {
set cleanup "[dict get $args -cleanup]\n$cleanup"
dict unset args -cleanup
}
set constraints {unix haveBash}
if {[dict exists $args -cleanup]} {
set cleanup "[dict get $args -cleanup]\n$cleanup"
if {[dict exists $args -constraints]} {
lappend constraints {*}[dict get $args -constraints]
dict unset args -constraints
}
test tip671-$id "TIP 671 $comment" \
-constraints {unix haveBash} \
-constraints $constraints \
-setup $setup \
-cleanup $cleanup \
-body $body \
-result $result \
{*}$args
}
|
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
|
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
|
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
|
test-tip671 exec "exec" {
# Tests both program name as well as argument being invalid chars
set script "#!/bin/sh\necho \$1 | od -t x1\n"
set exe [mkfile671 $script]
file attributes $exe -permissions u+x
exec $exe [file tail $exe]
} {* e8 2e e9 0a*} -match glob
# Tests require the existence of one of the DLLs in the dltest directory.
set dltestDir [file join [file dirname [info nameofexecutable]] dltest]
testConstraint havePkgua [file readable \
[file join $dltestDir tcl9pkgua[info sharedlibextension]]]
test-tip671 load "load" {
set dll [lindex [glob -types f /tmp/tip-671-test/*] 0]
load $dll Pkgua
set loaded [info loaded]
set idx [lsearch -index 1 $loaded Pkgua]
set result [list [expr {$idx >= 0}]]
if {$idx >= 0} {
unload [lindex $loaded $idx 0]
lappend result [lsearch -index 1 [info loaded] Pkgua]
}
set result
} {1 -1} -setup {
set ext [info sharedlibextension]
set dltestDir [file join [file dirname [info nameofexecutable]] dltest]
file mkdir $::dir671
set shellCmd [string cat "cp " [file join $dltestDir tcl9pkgua$ext] " " [file join $::dir671 {$'\xe8'}] $ext]
exec {*}[auto_execok bash] -c $shellCmd
} -constraints {
havePkgua
}
# cleanup
catch {file delete -force C:/globTest}
cd [temporaryDirectory]
file delete -force globTest
cd $oldpwd
|