summaryrefslogtreecommitdiffstats
path: root/tests/unixInit.test
diff options
context:
space:
mode:
Diffstat (limited to 'tests/unixInit.test')
-rw-r--r--tests/unixInit.test44
1 files changed, 4 insertions, 40 deletions
diff --git a/tests/unixInit.test b/tests/unixInit.test
index d2ebbfb..4c876c4 100644
--- a/tests/unixInit.test
+++ b/tests/unixInit.test
@@ -10,7 +10,7 @@
# See the file "license.terms" for information on usage and redistribution
# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
#
-# RCS: @(#) $Id: unixInit.test,v 1.48 2005/05/10 18:35:24 kennykb Exp $
+# RCS: @(#) $Id: unixInit.test,v 1.49 2006/03/21 11:12:29 dkf Exp $
package require tcltest 2.2
namespace import -force ::tcltest::*
@@ -20,27 +20,22 @@ set env(LANG) C
test unixInit-1.1 {TclpInitPlatform: ignore SIGPIPE} {unix stdio} {
set x {}
-
# Watch out for a race condition here. If tcltest is too slow to start
# then we'll kill it before it has a chance to set up its signal handler.
-
set f [open "|[list [interpreter]]" w+]
puts $f "puts hi"
flush $f
gets $f
exec kill -PIPE [pid $f]
lappend x [catch {close $f}]
-
set f [open "|[list [interpreter]]" w+]
puts $f "puts hi"
flush $f
gets $f
exec kill [pid $f]
lappend x [catch {close $f}]
-
set x
} {0 1}
-
# This test is really a test of code in tclUnixChan.c, but the
# channels are set up as part of initialisation of the interpreter so
# the test seems to me to fit here as well as anywhere else.
@@ -70,16 +65,13 @@ test unixInit-1.2 {initialisation: standard channel type deduction} {unix stdio}
# as a socket. Which is what this test is all about.
set pipe2 [open "|[list [interpreter] <@$sock]" r]
set result [gets $pipe2]
-
# Clear any pending data; stops certain kinds of (non-important) errors
fconfigure $pipe1 -blocking 0; gets $pipe1
fconfigure $pipe2 -blocking 0; gets $pipe2
-
# Close the pipes and the socket.
close $pipe2
close $pipe1
catch {close $sock}
-
# Can't use normal comparison, as hostname varies due to some
# installations having a messed up /etc/hosts file.
if {
@@ -105,7 +97,6 @@ test unixInit-2.0 {TclpInitLibraryPath: setting tclDefaultEncodingDir} {
testsetdefenc $origDir
set path
} {slappy}
-
test unixInit-2.1 {TclpInitLibraryPath: value of installLib, developLib} -setup {
unset -nocomplain oldlibrary
if {[info exists env(TCL_LIBRARY)]} {
@@ -114,11 +105,9 @@ test unixInit-2.1 {TclpInitLibraryPath: value of installLib, developLib} -setup
}
} -body {
set path [getlibpath]
-
set installLib lib/tcl[info tclversion]
set developLib tcl[info patchlevel]/library
set prefix [file dirname [file dirname [interpreter]]]
-
set x {}
lappend x [string compare [lindex $path 0] $prefix/$installLib]
lappend x [string compare [lindex $path 4] [file dirname $prefix]/$developLib]
@@ -129,19 +118,16 @@ test unixInit-2.1 {TclpInitLibraryPath: value of installLib, developLib} -setup
unset oldlibrary
}
} -result {0 0}
-
test unixInit-2.2 {TclpInitLibraryPath: TCL_LIBRARY} -setup {
unset -nocomplain oldlibrary
if {[info exists env(TCL_LIBRARY)]} {
set oldlibrary $env(TCL_LIBRARY)
}
} -body {
- # ((str != NULL) && (str[0] != '\0'))
-
+ # ((str != NULL) && (str[0] != '\0'))
set env(TCL_LIBRARY) sparkly
set path [getlibpath]
unset env(TCL_LIBRARY)
-
lindex $path 0
} -cleanup {
if {[info exists oldlibrary]} {
@@ -149,7 +135,6 @@ test unixInit-2.2 {TclpInitLibraryPath: TCL_LIBRARY} -setup {
unset oldlibrary
}
} -result "sparkly"
-
test unixInit-2.3 {TclpInitLibraryPath: TCL_LIBRARY wrong version} -setup {
unset -nocomplain oldlibrary
if {[info exists env(TCL_LIBRARY)]} {
@@ -157,11 +142,9 @@ test unixInit-2.3 {TclpInitLibraryPath: TCL_LIBRARY wrong version} -setup {
}
} -body {
# ((pathc > 0) && (strcasecmp(installLib + 4, pathv[pathc - 1]) != 0))
-
set env(TCL_LIBRARY) /a/b/tcl1.7
set path [getlibpath]
unset env(TCL_LIBRARY)
-
lrange $path 0 1
} -cleanup {
if {[info exists oldlibrary]} {
@@ -169,19 +152,16 @@ test unixInit-2.3 {TclpInitLibraryPath: TCL_LIBRARY wrong version} -setup {
unset oldlibrary
}
} -result [list /a/b/tcl1.7 /a/b/tcl[info tclversion]]
-
test unixInit-2.4 {TclpInitLibraryPath: TCL_LIBRARY: INTL} -setup {
if {[info exists env(TCL_LIBRARY)]} {
set oldlibrary $env(TCL_LIBRARY)
}
} -body {
# Child process translates env variable from native encoding.
-
set env(TCL_LIBRARY) "\xa7"
set x [lindex [getlibpath] 0]
unset env(TCL_LIBRARY)
unset env(LANG)
-
set x
} -cleanup {
if {[info exists oldlibrary]} {
@@ -192,7 +172,6 @@ test unixInit-2.4 {TclpInitLibraryPath: TCL_LIBRARY: INTL} -setup {
test unixInit-2.5 {TclpInitLibraryPath: compiled-in library path} {
# cannot test
} {}
-
test unixInit-2.6 {TclpInitLibraryPath: executable relative} -setup {
unset -nocomplain oldlibrary
if {[info exists env(TCL_LIBRARY)]} {
@@ -223,12 +202,10 @@ test unixInit-2.6 {TclpInitLibraryPath: executable relative} -setup {
unset oldlibrary
}
} -result [list [temporaryDirectory]/tmp/sparkly/lib/tcl[info tclversion] [temporaryDirectory]/tmp/lib/tcl[info tclversion]]
-
test unixInit-2.7 {TclpInitLibraryPath: compiled-in library path} {
# would need test command to get defaultLibDir and compare it to
# [lindex $auto_path end]
} {}
-
#
# The following two tests write to the directory /tmp/sparkly instead
# of to [temporaryDirectory]. This is because the failures tested by
@@ -260,7 +237,6 @@ test unixInit-2.8 {TclpInitLibraryPath: all absolute pathtype} -setup {
file delete -force /tmp/lib/tcl[info tclversion]
file mkdir /tmp/sparkly
file copy [interpreter] /tmp/sparkly/tcltest
-
# Keep any existing /tmp/lib directory
set deletelib 1
if {[file exists /tmp/lib]} {
@@ -270,13 +246,11 @@ test unixInit-2.8 {TclpInitLibraryPath: all absolute pathtype} -setup {
file delete -force /tmp/lib
}
}
-
# For a successful Tcl_Init, we need a [source]-able init.tcl in
# ../lib/tcl$version relative to the executable.
file mkdir /tmp/lib/tcl[info tclversion]
close [open /tmp/lib/tcl[info tclversion]/init.tcl w]
} -body {
-
# Check that all directories in the library path are absolute pathnames
set allAbsolute 1
foreach dir [getlibpath /tmp/sparkly/tcltest] {
@@ -285,7 +259,6 @@ test unixInit-2.8 {TclpInitLibraryPath: all absolute pathtype} -setup {
}
set allAbsolute
} -cleanup {
-
# Clean up temporary installation
file delete -force /tmp/sparkly
file delete -force /tmp/lib/tcl[info tclversion]
@@ -296,7 +269,6 @@ test unixInit-2.8 {TclpInitLibraryPath: all absolute pathtype} -setup {
unset oldlibrary
}
} -result 1
-
test unixInit-2.9 {TclpInitLibraryPath: paths relative to executable} -setup {
# Checking for Bug 438014
unset -nocomplain oldlibrary
@@ -308,7 +280,6 @@ test unixInit-2.9 {TclpInitLibraryPath: paths relative to executable} -setup {
file delete -force /tmp/library
file mkdir /tmp/sparkly
file copy [interpreter] /tmp/sparkly/tcltest
-
file mkdir /tmp/library/
close [open /tmp/library/init.tcl w]
} -body {
@@ -323,7 +294,6 @@ test unixInit-2.9 {TclpInitLibraryPath: paths relative to executable} -setup {
}
} -result [list /tmp/lib/tcl[info tclversion] /lib/tcl[info tclversion] \
/tmp/library /library /tcl[info patchlevel]/library]
-
test unixInit-2.10 {TclpInitLibraryPath: executable relative} -setup {
unset -nocomplain oldlibrary
if {[info exists env(TCL_LIBRARY)]} {
@@ -374,23 +344,19 @@ test unixInit-3.1 {TclpSetInitialEncodings} -constraints {
unix stdio
} -body {
set env(LANG) C
-
set f [open "|[list [interpreter]]" w+]
fconfigure $f -buffering none
puts $f {puts [encoding system]; exit}
set enc [gets $f]
close $f
unset env(LANG)
-
set enc
} -match regexp -result [expr {
($tcl_platform(os) eq "Darwin") ? "^utf-8$" : "^iso8859-15?$"}]
-
test unixInit-3.2 {TclpSetInitialEncodings} {unix stdio} {
set env(LANG) japanese
catch {set oldlc_all $env(LC_ALL)}
set env(LC_ALL) japanese
-
set f [open "|[list [interpreter]]" w+]
fconfigure $f -buffering none
puts $f {puts [encoding system]; exit}
@@ -399,7 +365,6 @@ test unixInit-3.2 {TclpSetInitialEncodings} {unix stdio} {
unset env(LANG)
unset env(LC_ALL)
catch {set env(LC_ALL) $oldlc_all}
-
set validEncodings [list euc-jp]
if {[string match HP-UX $tcl_platform(os)]} {
# Some older HP-UX systems need us to accept this as valid
@@ -409,10 +374,9 @@ test unixInit-3.2 {TclpSetInitialEncodings} {unix stdio} {
}
expr {[lsearch -exact $validEncodings $enc] < 0}
} 0
-
+
test unixInit-4.1 {TclpSetVariables} {unix} {
# just make sure they exist
-
set a [list $tcl_library $tcl_pkgPath $tcl_platform(os)]
set a [list $tcl_platform(osVersion) $tcl_platform(machine)]
set tcl_platform(platform)
@@ -426,7 +390,7 @@ test unixInit-6.1 {Tcl_SourceRCFile} {emptyTest unix} {
} {}
test unixInit-7.1 {closed standard channel: Bug 772288} -constraints {
- unix stdio
+ unix stdio
} -body {
set tclsh [interpreter]
set crash [makeFile {puts [open /dev/null]} crash.tcl]