diff options
author | dgp <dgp@users.sourceforge.net> | 2002-07-10 11:56:44 (GMT) |
---|---|---|
committer | dgp <dgp@users.sourceforge.net> | 2002-07-10 11:56:44 (GMT) |
commit | b82fab03b6af98493600f93ab86254446957ffdd (patch) | |
tree | 1a37add20fefab1047a8268adf31e600b827891e /tests | |
parent | bf3a542777f9aa1164f705b7be08031012208d76 (diff) | |
download | tcl-b82fab03b6af98493600f93ab86254446957ffdd.zip tcl-b82fab03b6af98493600f93ab86254446957ffdd.tar.gz tcl-b82fab03b6af98493600f93ab86254446957ffdd.tar.bz2 |
* Cleaned up, constrained, and reduced the amount of [exec] usage
in the test suite.
Diffstat (limited to 'tests')
-rw-r--r-- | tests/basic.test | 32 | ||||
-rw-r--r-- | tests/compile.test | 25 | ||||
-rw-r--r-- | tests/encoding.test | 24 | ||||
-rw-r--r-- | tests/env.test | 34 | ||||
-rw-r--r-- | tests/event.test | 31 | ||||
-rw-r--r-- | tests/exec.test | 392 | ||||
-rw-r--r-- | tests/io.test | 9 | ||||
-rw-r--r-- | tests/ioCmd.test | 4 | ||||
-rw-r--r-- | tests/regexp.test | 11 | ||||
-rw-r--r-- | tests/regexpComp.test | 9 | ||||
-rw-r--r-- | tests/socket.test | 75 | ||||
-rwxr-xr-x | tests/tcltest.test | 20 | ||||
-rw-r--r-- | tests/unixInit.test | 98 | ||||
-rw-r--r-- | tests/winDde.test | 12 | ||||
-rw-r--r-- | tests/winPipe.test | 92 |
15 files changed, 422 insertions, 446 deletions
diff --git a/tests/basic.test b/tests/basic.test index 61429b3..52c1484 100644 --- a/tests/basic.test +++ b/tests/basic.test @@ -15,22 +15,16 @@ # See the file "license.terms" for information on usage and redistribution # of this file, and for a DISCLAIMER OF ALL WARRANTIES. # -# RCS: @(#) $Id: basic.test,v 1.22 2002/07/04 16:52:07 msofer Exp $ +# RCS: @(#) $Id: basic.test,v 1.23 2002/07/10 11:56:44 dgp Exp $ # -if {[lsearch [namespace children] ::tcltest] == -1} { - package require tcltest 2 - namespace import -force ::tcltest::* -} +package require tcltest 2 +namespace import -force ::tcltest::* -::tcltest::testConstraint testcmdtoken \ - [llength [info commands testcmdtoken]] -::tcltest::testConstraint testcmdtrace \ - [llength [info commands testcmdtrace]] -::tcltest::testConstraint testcreatecommand \ - [llength [info commands testcreatecommand]] -::tcltest::testConstraint exec \ - [llength [info commands exec]] +testConstraint testcmdtoken [llength [info commands testcmdtoken]] +testConstraint testcmdtrace [llength [info commands testcmdtrace]] +testConstraint testcreatecommand [llength [info commands testcreatecommand]] +testConstraint exec [llength [info commands exec]] # This variable needs to be changed when the major or minor version number for # Tcl changes. @@ -561,10 +555,10 @@ test basic-44.1 {Tcl_GlobalEval} {emptyTest} { test basic-45.1 {Tcl_SetRecursionLimit: see interp.test} {emptyTest} { } {} -test basic-46.1 {Tcl_AllowExceptions: exception return not allowed} {exec} { +test basic-46.1 {Tcl_AllowExceptions: exception return not allowed} {stdio} { catch {close $f} set res [catch { - set f [open |[list [info nameofexecutable]] w+] + set f [open |[list [interpreter]] w+] fconfigure $f -buffering line puts $f {fconfigure stdout -buffering line} puts $f continue @@ -591,7 +585,7 @@ test basic-46.2 {Tcl_AllowExceptions: exception return not allowed} {exec} { puts hello break } BREAKtest] - set res [list [catch {exec [info nameofexecutable] $fName} msg] $msg] + set res [list [catch {exec [interpreter] $fName} msg] $msg] removeFile BREAKtest regsub {"[^ ]*BREAKtest"} $res {"BREAKtest"} res set res @@ -607,7 +601,7 @@ test basic-46.3 {Tcl_AllowExceptions: exception return not allowed} {exec} { patch break } BREAKtest] - set res [list [catch {exec [info nameofexecutable] $fName} msg] $msg] + set res [list [catch {exec [interpreter] $fName} msg] $msg] removeFile BREAKtest regsub {"[^ ]*BREAKtest"} $res {"BREAKtest"} res set res @@ -620,7 +614,7 @@ test basic-46.4 {Tcl_AllowExceptions: exception return not allowed} {exec} { set fName [makeFile { foo [set a 1] [break] } BREAKtest] - set res [list [catch {exec [info nameofexecutable] $fName} msg] $msg] + set res [list [catch {exec [interpreter] $fName} msg] $msg] removeFile BREAKtest regsub {"[^ ]*BREAKtest"} $res {"BREAKtest"} res set res @@ -635,7 +629,7 @@ test basic-46.5 {Tcl_AllowExceptions: exception return not allowed} {exec} { set fName [makeFile { return -code return } BREAKtest] - set res [list [catch {exec [info nameofexecutable] $fName} msg] $msg] + set res [list [catch {exec [interpreter] $fName} msg] $msg] removeFile BREAKtest regsub {"[^ ]*BREAKtest"} $res {"BREAKtest"} res set res diff --git a/tests/compile.test b/tests/compile.test index 0583222..a5abce7 100644 --- a/tests/compile.test +++ b/tests/compile.test @@ -11,12 +11,10 @@ # See the file "license.terms" for information on usage and redistribution # of this file, and for a DISCLAIMER OF ALL WARRANTIES. # -# RCS: @(#) $Id: compile.test,v 1.21 2002/06/22 04:19:47 dgp Exp $ +# RCS: @(#) $Id: compile.test,v 1.22 2002/07/10 11:56:44 dgp Exp $ -if {[lsearch [namespace children] ::tcltest] == -1} { - package require tcltest 2 - namespace import -force ::tcltest::* -} +package require tcltest 2 +namespace import -force ::tcltest::* # The following tests are very incomplete, although the rest of the # test suite covers this file fairly well. @@ -265,8 +263,8 @@ test compile-11.9 {Tcl_Append*: ensure Tcl_ResetResult is used properly} { # with TCL_MEM_DEBUG # # Special test for leak on interp delete [Bug 467523]. -::tcltest::testConstraint execCommandExists [expr {[info commands exec] != ""}] -::tcltest::testConstraint memDebug [expr {[info commands memory] != ""}] +::tcltest::testConstraint exec [llength [info commands exec]] +::tcltest::testConstraint memDebug [llength [info commands memory]] test compile-12.1 {testing literal leak on interp delete} {memDebug} { proc getbytes {} { @@ -288,8 +286,9 @@ test compile-12.1 {testing literal leak on interp delete} {memDebug} { set leak [expr {$end - $tmp}] } 0 # Special test for a memory error in a preliminary fix of [Bug 467523]. -# It requires executing a helpfile -test compile-12.2 {testing error on literal deletion} {memDebug execCommandExists} { +# It requires executing a helpfile. Presumably the child process is +# used because when this test fails, it crashes. +test compile-12.2 {testing error on literal deletion} {memDebug exec} { makeFile { for {set i 0} {$i < 5} {incr i} { namespace eval bar {} @@ -298,9 +297,9 @@ test compile-12.2 {testing error on literal deletion} {memDebug execCommandExist puts 0 } source.file set res [catch { - exec [info nameofexecutable] source.file + exec [interpreter] source.file }] - catch {::tcltest::removeFile source.file} + catch {removeFile source.file} set res } 0 # Test to catch buffer overrun in TclCompileTokens from buf 530320 @@ -314,14 +313,14 @@ test compile-12.3 {check for a buffer overrun} { # Special test for underestimating the maxStackSize required for a # compiled command. A failure will cause a segfault in the child # process. -test compile-13.1 {testing underestimate of maxStackSize in list cmd} {execCommandExists} { +test compile-13.1 {testing underestimate of maxStackSize in list cmd} {exec} { set body {set x [list} for {set i 0} {$i < 3000} {incr i} { append body " $i" } append body {]; puts OK} regsub BODY {proc crash {} {BODY}; crash} $body script - list [catch {exec [info nameofexecutable] << $script} msg] $msg + list [catch {exec [interpreter] << $script} msg] $msg } {0 OK} # cleanup diff --git a/tests/encoding.test b/tests/encoding.test index cf0392b..a0a76ce 100644 --- a/tests/encoding.test +++ b/tests/encoding.test @@ -8,12 +8,10 @@ # See the file "license.terms" for information on usage and redistribution # of this file, and for a DISCLAIMER OF ALL WARRANTIES. # -# RCS: @(#) $Id: encoding.test,v 1.14 2002/07/01 07:52:02 dgp Exp $ +# RCS: @(#) $Id: encoding.test,v 1.15 2002/07/10 11:56:44 dgp Exp $ -if {[lsearch [namespace children] ::tcltest] == -1} { - package require tcltest 2 - namespace import -force ::tcltest::* -} +package require tcltest 2 +namespace import -force ::tcltest::* proc toutf {args} { global x @@ -25,12 +23,8 @@ proc fromutf {args} { } # Some tests require the testencoding command - -::tcltest::testConstraint testencoding \ - [expr {[info commands testencoding] != {}}] -::tcltest::testConstraint exec \ - [llength [info commands exec]] - +testConstraint testencoding [llength [info commands testencoding]] +testConstraint exec [llength [info commands exec]] # TclInitEncodingSubsystem is tested by the rest of this file # TclFinalizeEncodingSubsystem is not currently tested @@ -382,7 +376,7 @@ test encoding-24.1 {EscapeFreeProc on open channels} -constraints { gets $f } iso2022.tcl] } -body { - exec $::tcltest::tcltest $file + exec [interpreter] $file } -cleanup { removeFile iso2022.tcl } -result {} @@ -397,12 +391,12 @@ test encoding-24.2 {EscapeFreeProc on open channels} -constraints { exit } iso2022.tcl] } -body { - viewable [exec $::tcltest::tcltest $file] + viewable [exec [interpreter] $file] } -cleanup { removeFile iso2022.tcl } -result "ab\x1b\$B8C\x1b\$(DD%\x1b(Bg (ab\\u001b\$B8C\\u001b\$(DD%\\u001b(Bg)" -test encoding-24.3 {EscapeFreeProc on open channels} {exec} { +test encoding-24.3 {EscapeFreeProc on open channels} {stdio} { # Bug #219314 - if we don't free escape encodings correctly on # channel closure, we go boom set file [makeFile { @@ -410,7 +404,7 @@ test encoding-24.3 {EscapeFreeProc on open channels} {exec} { set a "\u4e4e\u4e5e\u4e5f"; # 3 Japanese Kanji letters puts $a } iso2022.tcl] - set f [open "|[list $::tcltest::tcltest $file]"] + set f [open "|[list [interpreter] $file]"] fconfigure $f -encoding iso2022-jp set count [gets $f line] close $f diff --git a/tests/env.test b/tests/env.test index 1fbec90..5b7c76b 100644 --- a/tests/env.test +++ b/tests/env.test @@ -11,12 +11,10 @@ # See the file "license.terms" for information on usage and redistribution # of this file, and for a DISCLAIMER OF ALL WARRANTIES. # -# RCS: @(#) $Id: env.test,v 1.15 2002/07/05 10:38:42 dkf Exp $ +# RCS: @(#) $Id: env.test,v 1.16 2002/07/10 11:56:44 dgp Exp $ -if {[lsearch [namespace children] ::tcltest] == -1} { - package require tcltest 2 - namespace import -force ::tcltest::* -} +package require tcltest 2 +namespace import -force ::tcltest::* # # These tests will run on any platform (and indeed crashed @@ -58,7 +56,7 @@ test env-1.3 {reflection of env by "array names"} { # Some tests require the "exec" command. # Skip them if exec is not defined. -::tcltest::testConstraint execCommandExists [expr {[info commands exec] != ""}] +testConstraint exec [llength [info commands exec]] set printenvScript [makeFile { proc lrem {listname name} { @@ -86,9 +84,11 @@ set printenvScript [makeFile { exit } printenv] +# [exec] is required here to see the actual environment received +# by child processes. proc getenv {} { global printenvScript tcltest - catch {exec $::tcltest::tcltest $printenvScript} out + catch {exec [interpreter] $printenvScript} out if {$out == "child process exited abnormally"} { set out {} } @@ -111,30 +111,30 @@ foreach name {TCL_LIBRARY PATH LD_LIBRARY_PATH LIBPATH DISPLAY SHLIB_PATH} { } } -test env-2.1 {adding environment variables} {execCommandExists} { +test env-2.1 {adding environment variables} {exec} { getenv } {} set env(NAME1) "test string" -test env-2.2 {adding environment variables} {execCommandExists} { +test env-2.2 {adding environment variables} {exec} { getenv } {NAME1=test string} set env(NAME2) "more" -test env-2.3 {adding environment variables} {execCommandExists} { +test env-2.3 {adding environment variables} {exec} { getenv } {NAME1=test string NAME2=more} set env(XYZZY) "garbage" -test env-2.4 {adding environment variables} {execCommandExists} { +test env-2.4 {adding environment variables} {exec} { getenv } {NAME1=test string NAME2=more XYZZY=garbage} set env(NAME2) "new value" -test env-3.1 {changing environment variables} {execCommandExists} { +test env-3.1 {changing environment variables} {exec} { set result [getenv] unset env(NAME2) set result @@ -142,28 +142,28 @@ test env-3.1 {changing environment variables} {execCommandExists} { NAME2=new value XYZZY=garbage} -test env-4.1 {unsetting environment variables} {execCommandExists} { +test env-4.1 {unsetting environment variables} {exec} { set result [getenv] unset env(NAME1) set result } {NAME1=test string XYZZY=garbage} -test env-4.2 {unsetting environment variables} {execCommandExists} { +test env-4.2 {unsetting environment variables} {exec} { set result [getenv] unset env(XYZZY) set result } {XYZZY=garbage} -test env-4.3 {setting international environment variables} {execCommandExists} { +test env-4.3 {setting international environment variables} {exec} { set env(\ua7) \ub6 getenv } "\ua7=\ub6" -test env-4.4 {changing international environment variables} {execCommandExists} { +test env-4.4 {changing international environment variables} {exec} { set env(\ua7) \ua7 getenv } "\ua7=\ua7" -test env-4.5 {unsetting international environment variables} {execCommandExists} { +test env-4.5 {unsetting international environment variables} {exec} { set env(\ub6) \ua7 unset env(\ua7) set result [getenv] diff --git a/tests/event.test b/tests/event.test index 4278ba7..0cf627b 100644 --- a/tests/event.test +++ b/tests/event.test @@ -9,19 +9,14 @@ # See the file "license.terms" for information on usage and redistribution # of this file, and for a DISCLAIMER OF ALL WARRANTIES. # -# RCS: @(#) $Id: event.test,v 1.19 2002/07/05 10:38:42 dkf Exp $ +# RCS: @(#) $Id: event.test,v 1.20 2002/07/10 11:56:44 dgp Exp $ -if {[lsearch [namespace children] ::tcltest] == -1} { - package require tcltest 2 - namespace import -force ::tcltest::* -} +package require tcltest 2 +namespace import -force ::tcltest::* -::tcltest::testConstraint testfilehandler \ - [expr {[info commands testfilehandler] != {}}] -::tcltest::testConstraint testexithandler \ - [expr {[info commands testexithandler] != {}}] -::tcltest::testConstraint testfilewait \ - [expr {[info commands testfilewait] != {}}] +testConstraint testfilehandler [llength [info commands testfilehandler]] +testConstraint testexithandler [llength [info commands testexithandler]] +testConstraint testfilewait [llength [info commands testfilewait]] test event-1.1 {Tcl_CreateFileHandler, reading} {testfilehandler} { testfilehandler close @@ -286,7 +281,7 @@ test event-7.5 {correct behaviour when there is no bgerror [Bug 219142]} {exec} vwait a } - list [catch {exec [info nameofexecutable] << $script} errMsg] $errMsg + list [catch {exec [interpreter] << $script} errMsg] $errMsg } {1 {hello while executing "error hello" @@ -305,7 +300,7 @@ catch {rename bgerror {}} test event-8.1 {Tcl_CreateExitHandler procedure} {stdio testexithandler} { - set child [open |[list [info nameofexecutable]] r+] + set child [open |[list [interpreter]] r+] puts $child "testexithandler create 41; testexithandler create 4" puts $child "testexithandler create 6; exit" flush $child @@ -318,7 +313,7 @@ odd 41 } test event-9.1 {Tcl_DeleteExitHandler procedure} {stdio testexithandler} { - set child [open |[list [info nameofexecutable]] r+] + set child [open |[list [interpreter]] r+] puts $child "testexithandler create 41; testexithandler create 4" puts $child "testexithandler create 6; testexithandler delete 41" puts $child "testexithandler create 16; exit" @@ -331,7 +326,7 @@ even 6 even 4 } test event-9.2 {Tcl_DeleteExitHandler procedure} {stdio testexithandler} { - set child [open |[list [info nameofexecutable]] r+] + set child [open |[list [interpreter]] r+] puts $child "testexithandler create 41; testexithandler create 4" puts $child "testexithandler create 6; testexithandler delete 4" puts $child "testexithandler create 16; exit" @@ -344,7 +339,7 @@ even 6 odd 41 } test event-9.3 {Tcl_DeleteExitHandler procedure} {stdio testexithandler} { - set child [open |[list [info nameofexecutable]] r+] + set child [open |[list [interpreter]] r+] puts $child "testexithandler create 41; testexithandler create 4" puts $child "testexithandler create 6; testexithandler delete 6" puts $child "testexithandler create 16; exit" @@ -357,7 +352,7 @@ even 4 odd 41 } test event-9.4 {Tcl_DeleteExitHandler procedure} {stdio testexithandler} { - set child [open |[list [info nameofexecutable]] r+] + set child [open |[list [interpreter]] r+] puts $child "testexithandler create 41; testexithandler delete 41" puts $child "testexithandler create 16; exit" flush $child @@ -368,7 +363,7 @@ test event-9.4 {Tcl_DeleteExitHandler procedure} {stdio testexithandler} { } test event-10.1 {Tcl_Exit procedure} {stdio} { - set child [open |[list [info nameofexecutable]] r+] + set child [open |[list [interpreter]] r+] puts $child "exit 3" list [catch {close $child} msg] $msg [lindex $errorCode 0] \ [lindex $errorCode 2] diff --git a/tests/exec.test b/tests/exec.test index afe2889..30bac14 100644 --- a/tests/exec.test +++ b/tests/exec.test @@ -11,16 +11,14 @@ # See the file "license.terms" for information on usage and redistribution # of this file, and for a DISCLAIMER OF ALL WARRANTIES. # -# RCS: @(#) $Id: exec.test,v 1.12 2002/07/04 15:46:55 andreas_kupries Exp $ +# RCS: @(#) $Id: exec.test,v 1.13 2002/07/10 11:56:44 dgp Exp $ -if {[lsearch [namespace children] ::tcltest] == -1} { - package require tcltest 2 - namespace import -force ::tcltest::* -} +package require tcltest 2 +namespace import -force ::tcltest::* # All tests require the "exec" command. # Skip them if exec is not defined. -::tcltest::testConstraint execCommandExists [expr {[info commands exec] != ""}] +testConstraint exec [llength [info commands exec]] set path(echo) [makeFile { puts -nonewline [lindex $argv 0] @@ -95,46 +93,46 @@ set path(exit) [makeFile { # Basic operations. -test exec-1.1 {basic exec operation} {execCommandExists stdio} { - exec $::tcltest::tcltest $path(echo) a b c +test exec-1.1 {basic exec operation} {exec} { + exec [interpreter] $path(echo) a b c } "a b c" -test exec-1.2 {pipelining} {execCommandExists stdio} { - exec $::tcltest::tcltest $path(echo) a b c d | $::tcltest::tcltest $path(cat) | $::tcltest::tcltest $path(cat) +test exec-1.2 {pipelining} {exec stdio} { + exec [interpreter] $path(echo) a b c d | [interpreter] $path(cat) | [interpreter] $path(cat) } "a b c d" -test exec-1.3 {pipelining} {execCommandExists stdio} { - set a [exec $::tcltest::tcltest $path(echo) a b c d | $::tcltest::tcltest $path(cat) | $::tcltest::tcltest $path(wc)] +test exec-1.3 {pipelining} {exec stdio} { + set a [exec [interpreter] $path(echo) a b c d | [interpreter] $path(cat) | [interpreter] $path(wc)] list [scan $a "%d %d %d" b c d] $b $c } {3 1 4} set arg {12345678901234567890123456789012345678901234567890} set arg "$arg$arg$arg$arg$arg$arg" -test exec-1.4 {long command lines} {execCommandExists stdio} { - exec $::tcltest::tcltest $path(echo) $arg +test exec-1.4 {long command lines} {exec} { + exec [interpreter] $path(echo) $arg } $arg set arg {} # I/O redirection: input from Tcl command. -test exec-2.1 {redirecting input from immediate source} {execCommandExists stdio} { - exec $::tcltest::tcltest $path(cat) << "Sample text" +test exec-2.1 {redirecting input from immediate source} {exec stdio} { + exec [interpreter] $path(cat) << "Sample text" } {Sample text} -test exec-2.2 {redirecting input from immediate source} {execCommandExists stdio} { - exec << "Sample text" $::tcltest::tcltest $path(cat) | $::tcltest::tcltest $path(cat) +test exec-2.2 {redirecting input from immediate source} {exec stdio} { + exec << "Sample text" [interpreter] $path(cat) | [interpreter] $path(cat) } {Sample text} -test exec-2.3 {redirecting input from immediate source} {execCommandExists stdio} { - exec $::tcltest::tcltest $path(cat) << "Sample text" | $::tcltest::tcltest $path(cat) +test exec-2.3 {redirecting input from immediate source} {exec stdio} { + exec [interpreter] $path(cat) << "Sample text" | [interpreter] $path(cat) } {Sample text} -test exec-2.4 {redirecting input from immediate source} {execCommandExists stdio} { - exec $::tcltest::tcltest $path(cat) | $::tcltest::tcltest $path(cat) << "Sample text" +test exec-2.4 {redirecting input from immediate source} {exec stdio} { + exec [interpreter] $path(cat) | [interpreter] $path(cat) << "Sample text" } {Sample text} -test exec-2.5 {redirecting input from immediate source} {execCommandExists stdio} { - exec $::tcltest::tcltest $path(cat) "<<Joined to arrows" +test exec-2.5 {redirecting input from immediate source} {exec} { + exec [interpreter] $path(cat) "<<Joined to arrows" } {Joined to arrows} -test exec-2.6 {redirecting input from immediate source, with UTF} {execCommandExists stdio} { +test exec-2.6 {redirecting input from immediate source, with UTF} {exec} { # If this fails, it may give back: # "\uC3\uA9\uC3\uA0\uC3\uBC\uC3\uB1" # If it does, this means that the UTF -> external conversion did not # occur before writing out the temp file. - exec $::tcltest::tcltest $path(cat) << "\uE9\uE0\uFC\uF1" + exec [interpreter] $path(cat) << "\uE9\uE0\uFC\uF1" } "\uE9\uE0\uFC\uF1" # I/O redirection: output to file. @@ -142,125 +140,125 @@ test exec-2.6 {redirecting input from immediate source, with UTF} {execCommandEx set path(gorp.file) [makeFile {} gorp.file] removeFile gorp.file -test exec-3.1 {redirecting output to file} {execCommandExists stdio} { - exec $::tcltest::tcltest $path(echo) "Some simple words" > $path(gorp.file) - exec $::tcltest::tcltest $path(cat) $path(gorp.file) +test exec-3.1 {redirecting output to file} {exec} { + exec [interpreter] $path(echo) "Some simple words" > $path(gorp.file) + exec [interpreter] $path(cat) $path(gorp.file) } "Some simple words" -test exec-3.2 {redirecting output to file} {execCommandExists stdio} { - exec $::tcltest::tcltest $path(echo) "More simple words" | >$path(gorp.file) $::tcltest::tcltest $path(cat) | $::tcltest::tcltest $path(cat) - exec $::tcltest::tcltest $path(cat) $path(gorp.file) +test exec-3.2 {redirecting output to file} {exec stdio} { + exec [interpreter] $path(echo) "More simple words" | >$path(gorp.file) [interpreter] $path(cat) | [interpreter] $path(cat) + exec [interpreter] $path(cat) $path(gorp.file) } "More simple words" -test exec-3.3 {redirecting output to file} {execCommandExists stdio} { - exec > $path(gorp.file) $::tcltest::tcltest $path(echo) "Different simple words" | $::tcltest::tcltest $path(cat) | $::tcltest::tcltest $path(cat) - exec $::tcltest::tcltest $path(cat) $path(gorp.file) +test exec-3.3 {redirecting output to file} {exec stdio} { + exec > $path(gorp.file) [interpreter] $path(echo) "Different simple words" | [interpreter] $path(cat) | [interpreter] $path(cat) + exec [interpreter] $path(cat) $path(gorp.file) } "Different simple words" -test exec-3.4 {redirecting output to file} {execCommandExists stdio} { - exec $::tcltest::tcltest $path(echo) "Some simple words" >$path(gorp.file) - exec $::tcltest::tcltest $path(cat) $path(gorp.file) +test exec-3.4 {redirecting output to file} {exec} { + exec [interpreter] $path(echo) "Some simple words" >$path(gorp.file) + exec [interpreter] $path(cat) $path(gorp.file) } "Some simple words" -test exec-3.5 {redirecting output to file} {execCommandExists stdio} { - exec $::tcltest::tcltest $path(echo) "First line" >$path(gorp.file) - exec $::tcltest::tcltest $path(echo) "Second line" >> $path(gorp.file) - exec $::tcltest::tcltest $path(cat) $path(gorp.file) +test exec-3.5 {redirecting output to file} {exec} { + exec [interpreter] $path(echo) "First line" >$path(gorp.file) + exec [interpreter] $path(echo) "Second line" >> $path(gorp.file) + exec [interpreter] $path(cat) $path(gorp.file) } "First line\nSecond line" -test exec-3.6 {redirecting output to file} {execCommandExists stdio} { - exec $::tcltest::tcltest $path(echo) "First line" >$path(gorp.file) - exec $::tcltest::tcltest $path(echo) "Second line" >>$path(gorp.file) - exec $::tcltest::tcltest $path(cat) $path(gorp.file) +test exec-3.6 {redirecting output to file} {exec} { + exec [interpreter] $path(echo) "First line" >$path(gorp.file) + exec [interpreter] $path(echo) "Second line" >>$path(gorp.file) + exec [interpreter] $path(cat) $path(gorp.file) } "First line\nSecond line" -test exec-3.7 {redirecting output to file} {execCommandExists stdio} { +test exec-3.7 {redirecting output to file} {exec} { set f [open $path(gorp.file) w] puts $f "Line 1" flush $f - exec $::tcltest::tcltest $path(echo) "More text" >@ $f - exec $::tcltest::tcltest $path(echo) >@$f "Even more" + exec [interpreter] $path(echo) "More text" >@ $f + exec [interpreter] $path(echo) >@$f "Even more" puts $f "Line 3" close $f - exec $::tcltest::tcltest $path(cat) $path(gorp.file) + exec [interpreter] $path(cat) $path(gorp.file) } "Line 1\nMore text\nEven more\nLine 3" # I/O redirection: output and stderr to file. removeFile gorp.file -test exec-4.1 {redirecting output and stderr to file} {execCommandExists stdio} { - exec $::tcltest::tcltest $path(echo) "test output" >& $path(gorp.file) - exec $::tcltest::tcltest $path(cat) $path(gorp.file) +test exec-4.1 {redirecting output and stderr to file} {exec} { + exec [interpreter] $path(echo) "test output" >& $path(gorp.file) + exec [interpreter] $path(cat) $path(gorp.file) } "test output" -test exec-4.2 {redirecting output and stderr to file} {execCommandExists stdio} { - list [exec $::tcltest::tcltest $path(sh) -c "$path(echo) foo bar 1>&2" >&$path(gorp.file)] \ - [exec $::tcltest::tcltest $path(cat) $path(gorp.file)] +test exec-4.2 {redirecting output and stderr to file} {exec} { + list [exec [interpreter] $path(sh) -c "$path(echo) foo bar 1>&2" >&$path(gorp.file)] \ + [exec [interpreter] $path(cat) $path(gorp.file)] } {{} {foo bar}} -test exec-4.3 {redirecting output and stderr to file} {execCommandExists stdio} { - exec $::tcltest::tcltest $path(echo) "first line" > $path(gorp.file) - list [exec $::tcltest::tcltest $path(sh) -c "$path(echo) foo bar 1>&2" >>&$path(gorp.file)] \ - [exec $::tcltest::tcltest $path(cat) $path(gorp.file)] +test exec-4.3 {redirecting output and stderr to file} {exec} { + exec [interpreter] $path(echo) "first line" > $path(gorp.file) + list [exec [interpreter] $path(sh) -c "$path(echo) foo bar 1>&2" >>&$path(gorp.file)] \ + [exec [interpreter] $path(cat) $path(gorp.file)] } "{} {first line\nfoo bar}" -test exec-4.4 {redirecting output and stderr to file} {execCommandExists stdio} { +test exec-4.4 {redirecting output and stderr to file} {exec} { set f [open $path(gorp.file) w] puts $f "Line 1" flush $f - exec $::tcltest::tcltest $path(echo) "More text" >&@ $f - exec $::tcltest::tcltest $path(echo) >&@$f "Even more" + exec [interpreter] $path(echo) "More text" >&@ $f + exec [interpreter] $path(echo) >&@$f "Even more" puts $f "Line 3" close $f - exec $::tcltest::tcltest $path(cat) $path(gorp.file) + exec [interpreter] $path(cat) $path(gorp.file) } "Line 1\nMore text\nEven more\nLine 3" -test exec-4.5 {redirecting output and stderr to file} {execCommandExists stdio} { +test exec-4.5 {redirecting output and stderr to file} {exec} { set f [open $path(gorp.file) w] puts $f "Line 1" flush $f - exec >&@ $f $::tcltest::tcltest $path(sh) -c "$path(echo) foo bar 1>&2" - exec >&@$f $::tcltest::tcltest $path(sh) -c "$path(echo) xyzzy 1>&2" + exec >&@ $f [interpreter] $path(sh) -c "$path(echo) foo bar 1>&2" + exec >&@$f [interpreter] $path(sh) -c "$path(echo) xyzzy 1>&2" puts $f "Line 3" close $f - exec $::tcltest::tcltest $path(cat) $path(gorp.file) + exec [interpreter] $path(cat) $path(gorp.file) } "Line 1\nfoo bar\nxyzzy\nLine 3" # I/O redirection: input from file. -if { [set ::tcltest::testConstraints(execCommandExists)] } { -exec $::tcltest::tcltest $path(echo) "Just a few thoughts" > $path(gorp.file) +if { [set ::tcltest::testConstraints(exec)] } { +exec [interpreter] $path(echo) "Just a few thoughts" > $path(gorp.file) } -test exec-5.1 {redirecting input from file} {execCommandExists stdio} { - exec $::tcltest::tcltest $path(cat) < $path(gorp.file) +test exec-5.1 {redirecting input from file} {exec} { + exec [interpreter] $path(cat) < $path(gorp.file) } {Just a few thoughts} -test exec-5.2 {redirecting input from file} {execCommandExists stdio} { - exec $::tcltest::tcltest $path(cat) | $::tcltest::tcltest $path(cat) < $path(gorp.file) +test exec-5.2 {redirecting input from file} {exec stdio} { + exec [interpreter] $path(cat) | [interpreter] $path(cat) < $path(gorp.file) } {Just a few thoughts} -test exec-5.3 {redirecting input from file} {execCommandExists stdio} { - exec $::tcltest::tcltest $path(cat) < $path(gorp.file) | $::tcltest::tcltest $path(cat) +test exec-5.3 {redirecting input from file} {exec stdio} { + exec [interpreter] $path(cat) < $path(gorp.file) | [interpreter] $path(cat) } {Just a few thoughts} -test exec-5.4 {redirecting input from file} {execCommandExists stdio} { - exec < $path(gorp.file) $::tcltest::tcltest $path(cat) | $::tcltest::tcltest $path(cat) +test exec-5.4 {redirecting input from file} {exec stdio} { + exec < $path(gorp.file) [interpreter] $path(cat) | [interpreter] $path(cat) } {Just a few thoughts} -test exec-5.5 {redirecting input from file} {execCommandExists stdio} { - exec $::tcltest::tcltest $path(cat) <$path(gorp.file) +test exec-5.5 {redirecting input from file} {exec} { + exec [interpreter] $path(cat) <$path(gorp.file) } {Just a few thoughts} -test exec-5.6 {redirecting input from file} {execCommandExists stdio} { +test exec-5.6 {redirecting input from file} {exec} { set f [open $path(gorp.file) r] - set result [exec $::tcltest::tcltest $path(cat) <@ $f] + set result [exec [interpreter] $path(cat) <@ $f] close $f set result } {Just a few thoughts} -test exec-5.7 {redirecting input from file} {execCommandExists stdio} { +test exec-5.7 {redirecting input from file} {exec} { set f [open $path(gorp.file) r] - set result [exec <@$f $::tcltest::tcltest $path(cat)] + set result [exec <@$f [interpreter] $path(cat)] close $f set result } {Just a few thoughts} # I/O redirection: standard error through a pipeline. -test exec-6.1 {redirecting stderr through a pipeline} {execCommandExists stdio} { - exec $::tcltest::tcltest $path(sh) -c "$path(echo) foo bar" |& $::tcltest::tcltest $path(cat) +test exec-6.1 {redirecting stderr through a pipeline} {exec stdio} { + exec [interpreter] $path(sh) -c "$path(echo) foo bar" |& [interpreter] $path(cat) } "foo bar" -test exec-6.2 {redirecting stderr through a pipeline} {execCommandExists stdio} { - exec $::tcltest::tcltest $path(sh) -c "$path(echo) foo bar 1>&2" |& $::tcltest::tcltest $path(cat) +test exec-6.2 {redirecting stderr through a pipeline} {exec stdio} { + exec [interpreter] $path(sh) -c "$path(echo) foo bar 1>&2" |& [interpreter] $path(cat) } "foo bar" -test exec-6.3 {redirecting stderr through a pipeline} {execCommandExists stdio} { - exec $::tcltest::tcltest $path(sh) -c "$path(echo) foo bar 1>&2" \ - |& $::tcltest::tcltest $path(sh) -c "$path(echo) second msg 1>&2 ; $path(cat)" |& $::tcltest::tcltest $path(cat) +test exec-6.3 {redirecting stderr through a pipeline} {exec stdio} { + exec [interpreter] $path(sh) -c "$path(echo) foo bar 1>&2" \ + |& [interpreter] $path(sh) -c "$path(echo) second msg 1>&2 ; $path(cat)" |& [interpreter] $path(cat) } "second msg\nfoo bar" # I/O redirection: combinations. @@ -268,12 +266,12 @@ test exec-6.3 {redirecting stderr through a pipeline} {execCommandExists stdio} set path(gorp.file2) [makeFile {} gorp.file2] removeFile gorp.file2 -test exec-7.1 {multiple I/O redirections} {execCommandExists stdio} { - exec << "command input" > $path(gorp.file2) $::tcltest::tcltest $path(cat) < $path(gorp.file) - exec $::tcltest::tcltest $path(cat) $path(gorp.file2) +test exec-7.1 {multiple I/O redirections} {exec} { + exec << "command input" > $path(gorp.file2) [interpreter] $path(cat) < $path(gorp.file) + exec [interpreter] $path(cat) $path(gorp.file2) } {Just a few thoughts} -test exec-7.2 {multiple I/O redirections} {execCommandExists stdio} { - exec < $path(gorp.file) << "command input" $::tcltest::tcltest $path(cat) +test exec-7.2 {multiple I/O redirections} {exec} { + exec < $path(gorp.file) << "command input" [interpreter] $path(cat) } {command input} # Long input to command and output from command. @@ -283,158 +281,158 @@ set a [concat $a $a $a $a] set a [concat $a $a $a $a] set a [concat $a $a $a $a] set a [concat $a $a $a $a] -test exec-8.1 {long input and output} {execCommandExists stdio} { - exec $::tcltest::tcltest $path(cat) << $a +test exec-8.1 {long input and output} {exec} { + exec [interpreter] $path(cat) << $a } $a # More than 20 arguments to exec. -test exec-8.2 {long input and output} {execCommandExists stdio} { - exec $::tcltest::tcltest $path(echo) 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 +test exec-8.2 {long input and output} {exec} { + exec [interpreter] $path(echo) 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 } {1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23} # Commands that return errors. -test exec-9.1 {commands returning errors} {execCommandExists stdio} { +test exec-9.1 {commands returning errors} {exec} { set x [catch {exec gorp456} msg] list $x [string tolower $msg] [string tolower $errorCode] } {1 {couldn't execute "gorp456": no such file or directory} {posix enoent {no such file or directory}}} -test exec-9.2 {commands returning errors} {execCommandExists stdio} { - string tolower [list [catch {exec $::tcltest::tcltest echo foo | foo123} msg] $msg $errorCode] +test exec-9.2 {commands returning errors} {exec} { + string tolower [list [catch {exec [interpreter] echo foo | foo123} msg] $msg $errorCode] } {1 {couldn't execute "foo123": no such file or directory} {posix enoent {no such file or directory}}} -test exec-9.3 {commands returning errors} {execCommandExists stdio} { - list [catch {exec $::tcltest::tcltest $path(sleep) 1 | $::tcltest::tcltest $path(exit) 43 | $::tcltest::tcltest $path(sleep) 1} msg] $msg +test exec-9.3 {commands returning errors} {exec stdio} { + list [catch {exec [interpreter] $path(sleep) 1 | [interpreter] $path(exit) 43 | [interpreter] $path(sleep) 1} msg] $msg } {1 {child process exited abnormally}} -test exec-9.4 {commands returning errors} {execCommandExists stdio} { - list [catch {exec $::tcltest::tcltest $path(exit) 43 | $::tcltest::tcltest $path(echo) "foo bar"} msg] $msg +test exec-9.4 {commands returning errors} {exec stdio} { + list [catch {exec [interpreter] $path(exit) 43 | [interpreter] $path(echo) "foo bar"} msg] $msg } {1 {foo bar child process exited abnormally}} -test exec-9.5 {commands returning errors} {execCommandExists stdio} { - list [catch {exec gorp456 | $::tcltest::tcltest echo a b c} msg] [string tolower $msg] +test exec-9.5 {commands returning errors} {exec stdio} { + list [catch {exec gorp456 | [interpreter] echo a b c} msg] [string tolower $msg] } {1 {couldn't execute "gorp456": no such file or directory}} -test exec-9.6 {commands returning errors} {execCommandExists stdio} { - list [catch {exec $::tcltest::tcltest $path(sh) -c "$path(echo) error msg 1>&2"} msg] $msg +test exec-9.6 {commands returning errors} {exec} { + list [catch {exec [interpreter] $path(sh) -c "$path(echo) error msg 1>&2"} msg] $msg } {1 {error msg}} -test exec-9.7 {commands returning errors} {execCommandExists stdio} { - list [catch {exec $::tcltest::tcltest $path(sh) -c "$path(echo) error msg 1>&2" \ - | $::tcltest::tcltest $path(sh) -c "$path(echo) error msg 1>&2"} msg] $msg +test exec-9.7 {commands returning errors} {exec stdio} { + list [catch {exec [interpreter] $path(sh) -c "$path(echo) error msg 1>&2" \ + | [interpreter] $path(sh) -c "$path(echo) error msg 1>&2"} msg] $msg } {1 {error msg error msg}} set path(err) [makeFile {} err] -test exec-9.8 {commands returning errors} {execCommandExists stdio} { +test exec-9.8 {commands returning errors} {exec} { set f [open $path(err) w] puts $f { puts stdout out puts stderr err } close $f - list [catch {exec $::tcltest::tcltest $path(err)} msg] $msg + list [catch {exec [interpreter] $path(err)} msg] $msg } {1 {out err}} # Errors in executing the Tcl command, as opposed to errors in the # processes that are invoked. -test exec-10.1 {errors in exec invocation} {execCommandExists stdio} { +test exec-10.1 {errors in exec invocation} {exec} { list [catch {exec} msg] $msg } {1 {wrong # args: should be "exec ?switches? arg ?arg ...?"}} -test exec-10.2 {errors in exec invocation} {execCommandExists stdio} { +test exec-10.2 {errors in exec invocation} {exec} { list [catch {exec | cat} msg] $msg } {1 {illegal use of | or |& in command}} -test exec-10.3 {errors in exec invocation} {execCommandExists stdio} { +test exec-10.3 {errors in exec invocation} {exec} { list [catch {exec cat |} msg] $msg } {1 {illegal use of | or |& in command}} -test exec-10.4 {errors in exec invocation} {execCommandExists stdio} { +test exec-10.4 {errors in exec invocation} {exec} { list [catch {exec cat | | cat} msg] $msg } {1 {illegal use of | or |& in command}} -test exec-10.5 {errors in exec invocation} {execCommandExists stdio} { +test exec-10.5 {errors in exec invocation} {exec} { list [catch {exec cat | |& cat} msg] $msg } {1 {illegal use of | or |& in command}} -test exec-10.6 {errors in exec invocation} {execCommandExists stdio} { +test exec-10.6 {errors in exec invocation} {exec} { list [catch {exec cat |&} msg] $msg } {1 {illegal use of | or |& in command}} -test exec-10.7 {errors in exec invocation} {execCommandExists stdio} { +test exec-10.7 {errors in exec invocation} {exec} { list [catch {exec cat <} msg] $msg } {1 {can't specify "<" as last word in command}} -test exec-10.8 {errors in exec invocation} {execCommandExists stdio} { +test exec-10.8 {errors in exec invocation} {exec} { list [catch {exec cat >} msg] $msg } {1 {can't specify ">" as last word in command}} -test exec-10.9 {errors in exec invocation} {execCommandExists stdio} { +test exec-10.9 {errors in exec invocation} {exec} { list [catch {exec cat <<} msg] $msg } {1 {can't specify "<<" as last word in command}} -test exec-10.10 {errors in exec invocation} {execCommandExists stdio} { +test exec-10.10 {errors in exec invocation} {exec} { list [catch {exec cat >>} msg] $msg } {1 {can't specify ">>" as last word in command}} -test exec-10.11 {errors in exec invocation} {execCommandExists stdio} { +test exec-10.11 {errors in exec invocation} {exec} { list [catch {exec cat >&} msg] $msg } {1 {can't specify ">&" as last word in command}} -test exec-10.12 {errors in exec invocation} {execCommandExists stdio} { +test exec-10.12 {errors in exec invocation} {exec} { list [catch {exec cat >>&} msg] $msg } {1 {can't specify ">>&" as last word in command}} -test exec-10.13 {errors in exec invocation} {execCommandExists stdio} { +test exec-10.13 {errors in exec invocation} {exec} { list [catch {exec cat >@} msg] $msg } {1 {can't specify ">@" as last word in command}} -test exec-10.14 {errors in exec invocation} {execCommandExists stdio} { +test exec-10.14 {errors in exec invocation} {exec} { list [catch {exec cat <@} msg] $msg } {1 {can't specify "<@" as last word in command}} -test exec-10.15 {errors in exec invocation} {execCommandExists stdio} { +test exec-10.15 {errors in exec invocation} {exec} { list [catch {exec cat < a/b/c} msg] [string tolower $msg] } {1 {couldn't read file "a/b/c": no such file or directory}} -test exec-10.16 {errors in exec invocation} {execCommandExists stdio} { +test exec-10.16 {errors in exec invocation} {exec} { list [catch {exec cat << foo > a/b/c} msg] [string tolower $msg] } {1 {couldn't write file "a/b/c": no such file or directory}} -test exec-10.17 {errors in exec invocation} {execCommandExists stdio} { +test exec-10.17 {errors in exec invocation} {exec} { list [catch {exec cat << foo > a/b/c} msg] [string tolower $msg] } {1 {couldn't write file "a/b/c": no such file or directory}} set f [open $path(gorp.file) w] -test exec-10.18 {errors in exec invocation} {execCommandExists stdio} { +test exec-10.18 {errors in exec invocation} {exec} { list [catch {exec cat <@ $f} msg] $msg } "1 {channel \"$f\" wasn't opened for reading}" close $f set f [open $path(gorp.file) r] -test exec-10.19 {errors in exec invocation} {execCommandExists stdio} { +test exec-10.19 {errors in exec invocation} {exec} { list [catch {exec cat >@ $f} msg] $msg } "1 {channel \"$f\" wasn't opened for writing}" close $f -test exec-10.20 {errors in exec invocation} {execCommandExists stdio} { +test exec-10.20 {errors in exec invocation} {exec} { list [catch {exec ~non_existent_user/foo/bar} msg] $msg } {1 {user "non_existent_user" doesn't exist}} -test exec-10.21 {errors in exec invocation} {execCommandExists stdio} { - list [catch {exec $::tcltest::tcltest true | ~xyzzy_bad_user/x | false} msg] $msg +test exec-10.21 {errors in exec invocation} {exec} { + list [catch {exec [interpreter] true | ~xyzzy_bad_user/x | false} msg] $msg } {1 {user "xyzzy_bad_user" doesn't exist}} # Commands in background. -test exec-11.1 {commands in background} {execCommandExists stdio} { - set x [lindex [time {exec $::tcltest::tcltest $path(sleep) 2 &}] 0] +test exec-11.1 {commands in background} {exec} { + set x [lindex [time {exec [interpreter] $path(sleep) 2 &}] 0] expr $x<1000000 } 1 -test exec-11.2 {commands in background} {execCommandExists stdio} { - list [catch {exec $::tcltest::tcltest $path(echo) a &b} msg] $msg +test exec-11.2 {commands in background} {exec} { + list [catch {exec [interpreter] $path(echo) a &b} msg] $msg } {0 {a &b}} -test exec-11.3 {commands in background} {execCommandExists stdio} { - llength [exec $::tcltest::tcltest $path(sleep) 1 &] +test exec-11.3 {commands in background} {exec} { + llength [exec [interpreter] $path(sleep) 1 &] } 1 -test exec-11.4 {commands in background} {execCommandExists stdio} { - llength [exec $::tcltest::tcltest $path(sleep) 1 | $::tcltest::tcltest $path(sleep) 1 | $::tcltest::tcltest $path(sleep) 1 &] +test exec-11.4 {commands in background} {exec stdio} { + llength [exec [interpreter] $path(sleep) 1 | [interpreter] $path(sleep) 1 | [interpreter] $path(sleep) 1 &] } 3 -test exec-11.5 {commands in background} {execCommandExists stdio} { +test exec-11.5 {commands in background} {exec} { set f [open $path(gorp.file) w] puts $f [format { catch { exec [info nameofexecutable] %s foo & } } $path(echo)] close $f - string compare "foo" [exec $::tcltest::tcltest $path(gorp.file)] + string compare "foo" [exec [interpreter] $path(gorp.file)] } 0 # Make sure that background commands are properly reaped when # they eventually die. -if { [set ::tcltest::testConstraints(execCommandExists)] } { -exec $::tcltest::tcltest $path(sleep) 3 +if { [set ::tcltest::testConstraints(exec)] } { +exec [interpreter] $path(sleep) 3 } test exec-12.1 {reaping background processes} \ - {execCommandExists stdio unixOnly nonPortable} { + {exec unixOnly nonPortable} { for {set i 0} {$i < 20} {incr i} { exec echo foo > /dev/null & } @@ -443,7 +441,7 @@ test exec-12.1 {reaping background processes} \ lindex $msg 0 } 0 test exec-12.2 {reaping background processes} \ - {execCommandExists stdio unixOnly nonPortable} { + {exec unixOnly nonPortable} { exec sleep 2 | sleep 2 | sleep 2 & catch {exec ps | fgrep -i "sleep" | fgrep -i -v fgrep | wc} msg set x [lindex $msg 0] @@ -452,7 +450,7 @@ test exec-12.2 {reaping background processes} \ list $x [lindex $msg 0] } {3 0} test exec-12.3 {reaping background processes} \ - {execCommandExists stdio unixOnly nonPortable} { + {exec unixOnly nonPortable} { exec sleep 1000 & exec sleep 1000 & set x [exec ps | fgrep "sleep" | fgrep -v fgrep] @@ -475,13 +473,13 @@ test exec-12.3 {reaping background processes} \ # Make sure "errorCode" is set correctly. -test exec-13.1 {setting errorCode variable} {execCommandExists stdio} { - list [catch {exec $::tcltest::tcltest $path(cat) < a/b/c} msg] [string tolower $errorCode] +test exec-13.1 {setting errorCode variable} {exec} { + list [catch {exec [interpreter] $path(cat) < a/b/c} msg] [string tolower $errorCode] } {1 {posix enoent {no such file or directory}}} -test exec-13.2 {setting errorCode variable} {execCommandExists stdio} { - list [catch {exec $::tcltest::tcltest $path(cat) > a/b/c} msg] [string tolower $errorCode] +test exec-13.2 {setting errorCode variable} {exec} { + list [catch {exec [interpreter] $path(cat) > a/b/c} msg] [string tolower $errorCode] } {1 {posix enoent {no such file or directory}}} -test exec-13.3 {setting errorCode variable} {execCommandExists stdio} { +test exec-13.3 {setting errorCode variable} {exec} { set x [catch {exec _weird_cmd_} msg] list $x [string tolower $msg] [lindex $errorCode 0] \ [string tolower [lrange $errorCode 2 end]] @@ -489,85 +487,85 @@ test exec-13.3 {setting errorCode variable} {execCommandExists stdio} { # Switches before the first argument -test exec-14.1 {-keepnewline switch} {execCommandExists stdio} { - exec -keepnewline $::tcltest::tcltest $path(echo) foo +test exec-14.1 {-keepnewline switch} {exec} { + exec -keepnewline [interpreter] $path(echo) foo } "foo\n" -test exec-14.2 {-keepnewline switch} {execCommandExists stdio} { +test exec-14.2 {-keepnewline switch} {exec} { list [catch {exec -keepnewline} msg] $msg } {1 {wrong # args: should be "exec ?switches? arg ?arg ...?"}} -test exec-14.3 {unknown switch} {execCommandExists stdio} { +test exec-14.3 {unknown switch} {exec} { list [catch {exec -gorp} msg] $msg } {1 {bad switch "-gorp": must be -keepnewline or --}} -test exec-14.4 {-- switch} {execCommandExists stdio} { +test exec-14.4 {-- switch} {exec} { list [catch {exec -- -gorp} msg] [string tolower $msg] } {1 {couldn't execute "-gorp": no such file or directory}} # Redirecting standard error separately from standard output -test exec-15.1 {standard error redirection} {execCommandExists stdio} { - exec $::tcltest::tcltest $path(echo) "First line" > $path(gorp.file) - list [exec $::tcltest::tcltest $path(sh) -c "$path(echo) foo bar 1>&2" 2> $path(gorp.file)] \ - [exec $::tcltest::tcltest $path(cat) $path(gorp.file)] +test exec-15.1 {standard error redirection} {exec} { + exec [interpreter] $path(echo) "First line" > $path(gorp.file) + list [exec [interpreter] $path(sh) -c "$path(echo) foo bar 1>&2" 2> $path(gorp.file)] \ + [exec [interpreter] $path(cat) $path(gorp.file)] } {{} {foo bar}} -test exec-15.2 {standard error redirection} {execCommandExists stdio} { - list [exec $::tcltest::tcltest $path(sh) -c "$path(echo) foo bar 1>&2" \ - | $::tcltest::tcltest $path(echo) biz baz >$path(gorp.file) 2> $path(gorp.file2)] \ - [exec $::tcltest::tcltest $path(cat) $path(gorp.file)] \ - [exec $::tcltest::tcltest $path(cat) $path(gorp.file2)] +test exec-15.2 {standard error redirection} {exec stdio} { + list [exec [interpreter] $path(sh) -c "$path(echo) foo bar 1>&2" \ + | [interpreter] $path(echo) biz baz >$path(gorp.file) 2> $path(gorp.file2)] \ + [exec [interpreter] $path(cat) $path(gorp.file)] \ + [exec [interpreter] $path(cat) $path(gorp.file2)] } {{} {biz baz} {foo bar}} -test exec-15.3 {standard error redirection} {execCommandExists stdio} { - list [exec $::tcltest::tcltest $path(sh) -c "$path(echo) foo bar 1>&2" \ - | $::tcltest::tcltest $path(echo) biz baz 2>$path(gorp.file) > $path(gorp.file2)] \ - [exec $::tcltest::tcltest $path(cat) $path(gorp.file)] \ - [exec $::tcltest::tcltest $path(cat) $path(gorp.file2)] +test exec-15.3 {standard error redirection} {exec stdio} { + list [exec [interpreter] $path(sh) -c "$path(echo) foo bar 1>&2" \ + | [interpreter] $path(echo) biz baz 2>$path(gorp.file) > $path(gorp.file2)] \ + [exec [interpreter] $path(cat) $path(gorp.file)] \ + [exec [interpreter] $path(cat) $path(gorp.file2)] } {{} {foo bar} {biz baz}} -test exec-15.4 {standard error redirection} {execCommandExists stdio} { +test exec-15.4 {standard error redirection} {exec} { set f [open $path(gorp.file) w] puts $f "Line 1" flush $f - exec $::tcltest::tcltest $path(sh) -c "$path(echo) foo bar 1>&2" 2>@ $f + exec [interpreter] $path(sh) -c "$path(echo) foo bar 1>&2" 2>@ $f puts $f "Line 3" close $f - exec $::tcltest::tcltest $path(cat) $path(gorp.file) + exec [interpreter] $path(cat) $path(gorp.file) } {Line 1 foo bar Line 3} -test exec-15.5 {standard error redirection} {execCommandExists stdio} { - exec $::tcltest::tcltest $path(echo) "First line" > $path(gorp.file) - exec $::tcltest::tcltest $path(sh) -c "$path(echo) foo bar 1>&2" 2>> $path(gorp.file) - exec $::tcltest::tcltest $path(cat) $path(gorp.file) +test exec-15.5 {standard error redirection} {exec} { + exec [interpreter] $path(echo) "First line" > $path(gorp.file) + exec [interpreter] $path(sh) -c "$path(echo) foo bar 1>&2" 2>> $path(gorp.file) + exec [interpreter] $path(cat) $path(gorp.file) } {First line foo bar} -test exec-15.6 {standard error redirection} {execCommandExists stdio} { - exec $::tcltest::tcltest $path(sh) -c "$path(echo) foo bar 1>&2" > $path(gorp.file2) 2> $path(gorp.file) \ - >& $path(gorp.file) 2> $path(gorp.file2) | $::tcltest::tcltest $path(echo) biz baz - list [exec $::tcltest::tcltest $path(cat) $path(gorp.file)] [exec $::tcltest::tcltest $path(cat) $path(gorp.file2)] +test exec-15.6 {standard error redirection} {exec stdio} { + exec [interpreter] $path(sh) -c "$path(echo) foo bar 1>&2" > $path(gorp.file2) 2> $path(gorp.file) \ + >& $path(gorp.file) 2> $path(gorp.file2) | [interpreter] $path(echo) biz baz + list [exec [interpreter] $path(cat) $path(gorp.file)] [exec [interpreter] $path(cat) $path(gorp.file2)] } {{biz baz} {foo bar}} -test exec-16.1 {flush output before exec} {execCommandExists stdio} { +test exec-16.1 {flush output before exec} {exec} { set f [open $path(gorp.file) w] puts $f "First line" - exec $::tcltest::tcltest $path(echo) "Second line" >@ $f + exec [interpreter] $path(echo) "Second line" >@ $f puts $f "Third line" close $f - exec $::tcltest::tcltest $path(cat) $path(gorp.file) + exec [interpreter] $path(cat) $path(gorp.file) } {First line Second line Third line} -test exec-16.2 {flush output before exec} {execCommandExists stdio} { +test exec-16.2 {flush output before exec} {exec} { set f [open $path(gorp.file) w] puts $f "First line" - exec $::tcltest::tcltest << {puts stderr {Second line}} >&@ $f > $path(gorp.file2) + exec [interpreter] << {puts stderr {Second line}} >&@ $f > $path(gorp.file2) puts $f "Third line" close $f - exec $::tcltest::tcltest $path(cat) $path(gorp.file) + exec [interpreter] $path(cat) $path(gorp.file) } {First line Second line Third line} set path(script) [makeFile {} script] -test exec-17.1 { inheriting standard I/O } {execCommandExists stdio} { +test exec-17.1 { inheriting standard I/O } {exec} { set f [open $path(script) w] puts $f [format {close stdout set f [open %s w] @@ -576,7 +574,7 @@ test exec-17.1 { inheriting standard I/O } {execCommandExists stdio} { close $f } $path(gorp.file) $path(echo) $path(sleep)] close $f - catch {exec $::tcltest::tcltest $path(script)} result + catch {exec [interpreter] $path(script)} result set f [open $path(gorp.file) r] lappend result [read $f] close $f @@ -584,7 +582,7 @@ test exec-17.1 { inheriting standard I/O } {execCommandExists stdio} { } {{foobar }} -test exec-18.1 { exec cat deals with weird file names} {execCommandExists} { +test exec-18.1 { exec cat deals with weird file names} {exec} { set f "foo\[\{blah" set path(fooblah) [makeFile {} $f] set fout [open $path(fooblah) w] diff --git a/tests/io.test b/tests/io.test index 9ea9ada..07d96a5 100644 --- a/tests/io.test +++ b/tests/io.test @@ -12,7 +12,7 @@ # See the file "license.terms" for information on usage and redistribution # of this file, and for a DISCLAIMER OF ALL WARRANTIES. # -# RCS: @(#) $Id: io.test,v 1.35 2002/07/04 15:46:55 andreas_kupries Exp $ +# RCS: @(#) $Id: io.test,v 1.36 2002/07/10 11:56:44 dgp Exp $ if {[catch {package require tcltest 2}]} { puts stderr "Skipping tests in [info script]. tcltest 2 required." @@ -29,6 +29,7 @@ namespace eval ::tcl::test::io { namespace import ::tcltest::viewFile testConstraint testchannel [llength [info commands testchannel]] +testConstraint exec [llength [info commands exec]] # You need a *very* special environment to do some tests. In # particular, many file systems do not support large-files... @@ -1579,7 +1580,7 @@ test io-14.2 {Tcl_SetStdChannel and Tcl_GetStdChannel} { set path(test3) [makeFile {} test3] -test io-14.3 {Tcl_SetStdChannel & Tcl_GetStdChannel} {stdio} { +test io-14.3 {Tcl_SetStdChannel & Tcl_GetStdChannel} {exec} { set f [open $path(test1) w] puts $f [format { close stdin @@ -1608,7 +1609,7 @@ out } {err }} # This test relies on the fact that the smallest available fd is used first. -test io-14.4 {Tcl_SetStdChannel & Tcl_GetStdChannel} {unixOnly} { +test io-14.4 {Tcl_SetStdChannel & Tcl_GetStdChannel} {exec unixOnly} { set f [open $path(test1) w] puts $f [format { close stdin close stdout @@ -2660,7 +2661,7 @@ test io-29.32 {Tcl_WriteChars, background flush to slow reader} \ set result ok } } ok -test io-29.33 {Tcl_Flush, implicit flush on exit} {stdio} { +test io-29.33 {Tcl_Flush, implicit flush on exit} {exec} { set f [open $path(script) w] puts $f [format { set f [open "%s" w] diff --git a/tests/ioCmd.test b/tests/ioCmd.test index bbb2ff0..807d4bb 100644 --- a/tests/ioCmd.test +++ b/tests/ioCmd.test @@ -12,7 +12,7 @@ # See the file "license.terms" for information on usage and redistribution # of this file, and for a DISCLAIMER OF ALL WARRANTIES. # -# RCS: @(#) $Id: ioCmd.test,v 1.14 2002/07/04 15:46:55 andreas_kupries Exp $ +# RCS: @(#) $Id: ioCmd.test,v 1.15 2002/07/10 11:56:44 dgp Exp $ if {[lsearch [namespace children] ::tcltest] == -1} { package require tcltest @@ -22,8 +22,6 @@ if {[lsearch [namespace children] ::tcltest] == -1} { removeFile test1 removeFile pipe -set executable [list [info nameofexecutable]] - test iocmd-1.1 {puts command} { list [catch {puts} msg] $msg } {1 {wrong # args: should be "puts ?-nonewline? ?channelId? string"}} diff --git a/tests/regexp.test b/tests/regexp.test index c907b87..2bb017e 100644 --- a/tests/regexp.test +++ b/tests/regexp.test @@ -11,7 +11,7 @@ # See the file "license.terms" for information on usage and redistribution # of this file, and for a DISCLAIMER OF ALL WARRANTIES. # -# RCS: @(#) $Id: regexp.test,v 1.21 2002/07/05 10:38:43 dkf Exp $ +# RCS: @(#) $Id: regexp.test,v 1.22 2002/07/10 11:56:44 dgp Exp $ if {[lsearch [namespace children] ::tcltest] == -1} { package require tcltest @@ -433,10 +433,11 @@ test regexp-14.2 {CompileRegexp: regexp cache, different flags} { regexp -nocase $x bbba } 1 -# There is no exec on the Mac ... - -test regexp-14.3 {CompileRegexp: regexp cache, empty regexp and empty cache} {unixOrPc} { - exec $::tcltest::tcltest [makeFile {puts [regexp {} foo]} junk.tcl] +testConstraint exec [llength [info commands exec]] +test regexp-14.3 {CompileRegexp: regexp cache, empty regexp and empty cache} { + exec +} { + exec [interpreter] [makeFile {puts [regexp {} foo]} junk.tcl] } 1 test regexp-15.1 {regexp -start} { diff --git a/tests/regexpComp.test b/tests/regexpComp.test index 20492c9..3ae78b2 100644 --- a/tests/regexpComp.test +++ b/tests/regexpComp.test @@ -592,10 +592,11 @@ test regexp-14.2 {CompileRegexp: regexp cache, different flags} { } } 1 -# There is no exec on the Mac ... - -test regexp-14.3 {CompileRegexp: regexp cache, empty regexp and empty cache} {unixOrPc} { - exec $::tcltest::tcltest [makeFile {puts [regexp {} foo]} junk.tcl] +testConstraint exec [llength [info commands exec]] +test regexp-14.3 {CompileRegexp: regexp cache, empty regexp and empty cache} { + exec +} { + exec [interpreter] [makeFile {puts [regexp {} foo]} junk.tcl] } 1 test regexp-15.1 {regexp -start} { diff --git a/tests/socket.test b/tests/socket.test index e3b7cc7..1f95749 100644 --- a/tests/socket.test +++ b/tests/socket.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: socket.test,v 1.25 2002/07/08 22:01:41 andreas_kupries Exp $ +# RCS: @(#) $Id: socket.test,v 1.26 2002/07/10 11:56:45 dgp Exp $ # Running socket tests with a remote server: # ------------------------------------------ @@ -62,18 +62,13 @@ # listening at port 2048. If all fails, a message is printed and the tests # using the remote server are not performed. -if {[lsearch [namespace children] ::tcltest] == -1} { - package require tcltest - namespace import -force ::tcltest::* -} +package require tcltest 2 +namespace import -force ::tcltest::* # Some tests require the testthread and exec commands +testConstraint testthread [llength [info commands testthread]] +testConstraint exec [llength [info commands exec]] -set ::tcltest::testConstraints(testthread) \ - [expr {[info commands testthread] != {}}] -set ::tcltest::testConstraints(exec) [expr {[info commands exec] != {}}] - -# # If remoteServerIP or remoteServerPort are not set, check in the # environment variables for externally set values. # @@ -128,7 +123,7 @@ if {$doTestsWithRemoteServer} { set remoteFile [file join [pwd] [file dirname [info script]] \ remote.tcl] if {[catch {set remoteProcChan \ - [open "|[list $::tcltest::tcltest $remoteFile \ + [open "|[list [interpreter] $remoteFile \ -serverIsSilent \ -port $remoteServerPort \ -address $remoteServerIP]" \ @@ -143,7 +138,7 @@ if {$doTestsWithRemoteServer} { set doTestsWithRemoteServer 0 } } else { - set noRemoteTestReason "$msg $::tcltest::tcltest" + set noRemoteTestReason "$msg [interpreter]" set doTestsWithRemoteServer 0 } } @@ -269,7 +264,7 @@ test socket-2.1 {tcp connection} {socket stdio} { puts $x } close $f - set f [open "|[list $::tcltest::tcltest $path(script)]" r] + set f [open "|[list [interpreter] $path(script)]" r] gets $f x gets $f listen if {[catch {socket 127.0.0.1 $listen} msg]} { @@ -307,7 +302,7 @@ test socket-2.2 {tcp connection with client port specified} {socket stdio} { close $f } close $f - set f [open "|[list $::tcltest::tcltest $path(script)]" r] + set f [open "|[list [interpreter] $path(script)]" r] gets $f x gets $f listen global port @@ -342,7 +337,7 @@ test socket-2.3 {tcp connection with client interface specified} {socket stdio} close $f } close $f - set f [open "|[list $::tcltest::tcltest $path(script)]" r] + set f [open "|[list [interpreter] $path(script)]" r] gets $f x if {[catch {socket -myaddr 127.0.0.1 127.0.0.1 2830} sock]} { set x $sock @@ -374,7 +369,7 @@ test socket-2.4 {tcp connection with server interface specified} {socket stdio} close $f } close $f - set f [open "|[list $::tcltest::tcltest $path(script)]" r] + set f [open "|[list [interpreter] $path(script)]" r] gets $f x gets $f listen if {[catch {socket 127.0.0.1 $listen} sock]} { @@ -407,7 +402,7 @@ test socket-2.5 {tcp connection with redundant server port} {socket stdio} { close $f } close $f - set f [open "|[list $::tcltest::tcltest $path(script)]" r] + set f [open "|[list [interpreter] $path(script)]" r] gets $f x gets $f listen if {[catch {socket 127.0.0.1 $listen} sock]} { @@ -459,7 +454,7 @@ test socket-2.7 {echo server, one line} {socket stdio} { puts $x } close $f - set f [open "|[list $::tcltest::tcltest $path(script)]" r] + set f [open "|[list [interpreter] $path(script)]" r] gets $f gets $f listen set s [socket 127.0.0.1 $listen] @@ -500,7 +495,7 @@ test socket-2.8 {echo server, loop 50 times, single connection} {socket stdio} { close $f puts "done $i" } script - set f [open "|[list $::tcltest::tcltest $path(script)]" r] + set f [open "|[list [interpreter] $path(script)]" r] gets $f gets $f listen set s [socket 127.0.0.1 $listen] @@ -522,7 +517,7 @@ test socket-2.9 {socket conflict} {socket stdio} { set f [open $path(script) w] puts -nonewline $f "socket -server accept [lindex [fconfigure $s -sockname] 2]" close $f - set f [open "|[list $::tcltest::tcltest $path(script)]" r] + set f [open "|[list [interpreter] $path(script)]" r] gets $f after 100 set x [list [catch {close $f} msg]] @@ -594,7 +589,7 @@ test socket-3.1 {socket conflict} {socket stdio} { close $f } close $f - set f [open "|[list $::tcltest::tcltest $path(script)]" r+] + set f [open "|[list [interpreter] $path(script)]" r+] gets $f gets $f listen set x [list [catch {socket -server accept $listen} msg] \ @@ -638,7 +633,7 @@ test socket-3.2 {server with several clients} {socket stdio} { puts $x } close $f - set f [open "|[list $::tcltest::tcltest $path(script)]" r+] + set f [open "|[list [interpreter] $path(script)]" r+] set x [gets $f] gets $f listen set s1 [socket 127.0.0.1 $listen] @@ -679,11 +674,11 @@ test socket-4.1 {server with several clients} {socket stdio} { gets stdin } close $f - set p1 [open "|[list $::tcltest::tcltest $path(script)]" r+] + set p1 [open "|[list [interpreter] $path(script)]" r+] fconfigure $p1 -buffering line - set p2 [open "|[list $::tcltest::tcltest $path(script)]" r+] + set p2 [open "|[list [interpreter] $path(script)]" r+] fconfigure $p2 -buffering line - set p3 [open "|[list $::tcltest::tcltest $path(script)]" r+] + set p3 [open "|[list [interpreter] $path(script)]" r+] fconfigure $p3 -buffering line proc accept {s a p} { fconfigure $s -buffering line @@ -771,7 +766,7 @@ test socket-6.1 {accept callback error} {socket stdio} { socket 127.0.0.1 $port } close $f - set f [open "|[list $::tcltest::tcltest $path(script)]" r+] + set f [open "|[list [interpreter] $path(script)]" r+] proc bgerror args { global x set x $args @@ -804,7 +799,7 @@ test socket-7.1 {testing socket specific options} {socket stdio} { after cancel $timer } close $f - set f [open "|[list $::tcltest::tcltest $path(script)]" r] + set f [open "|[list [interpreter] $path(script)]" r] gets $f gets $f listen set s [socket 127.0.0.1 $listen] @@ -832,7 +827,7 @@ test socket-7.2 {testing socket specific options} {socket stdio} { after cancel $timer } close $f - set f [open "|[list $::tcltest::tcltest $path(script)]" r] + set f [open "|[list [interpreter] $path(script)]" r] gets $f gets $f listen set s [socket 127.0.0.1 $listen] @@ -1395,7 +1390,7 @@ test socket-11.13 {testing async write, async flush, async close} \ set path(script1) [makeFile {} script1] set path(script2) [makeFile {} script2] -test socket-12.1 {testing inheritance of server sockets} {socket exec} { +test socket-12.1 {testing inheritance of server sockets} {socket stdio exec} { removeFile script1 removeFile script2 @@ -1414,7 +1409,7 @@ test socket-12.1 {testing inheritance of server sockets} {socket exec} { # be closed unless script1 inherited it. set f [open $path(script2) w] - puts $f [list set tcltest $::tcltest::tcltest] + puts $f [list set tcltest [interpreter]] puts $f [format { set f [socket -server accept 0] puts [lindex [fconfigure $f -sockname] 2] @@ -1430,8 +1425,8 @@ test socket-12.1 {testing inheritance of server sockets} {socket exec} { # Launch script2 and wait 5 seconds - ### exec $::tcltest::tcltest script2 & - set p [open "|[list $::tcltest::tcltest $path(script2)]" r] + ### exec [interpreter] script2 & + set p [open "|[list [interpreter] $path(script2)]" r] gets $p listen after 5000 { set ok_to_proceed 1 } @@ -1451,7 +1446,7 @@ test socket-12.1 {testing inheritance of server sockets} {socket exec} { close $p set x } {server socket was not inherited} -test socket-12.2 {testing inheritance of client sockets} {socket exec} { +test socket-12.2 {testing inheritance of client sockets} {socket stdio exec} { removeFile script1 removeFile script2 @@ -1470,7 +1465,7 @@ test socket-12.2 {testing inheritance of client sockets} {socket exec} { # client socket, the socket will still be open. set f [open $path(script2) w] - puts $f [list set tcltest $::tcltest::tcltest] + puts $f [list set tcltest [interpreter]] puts $f [format { gets stdin port set f [socket 127.0.0.1 $port] @@ -1524,9 +1519,9 @@ test socket-12.2 {testing inheritance of client sockets} {socket exec} { after 10000 [list set failed 1] # Launch the script2 process - ### exec $::tcltest::tcltest script2 & + ### exec [interpreter] script2 & - set p [open "|[list $::tcltest::tcltest $path(script2)]" w] + set p [open "|[list [interpreter] $path(script2)]" w] puts $p [lindex [fconfigure $server -sockname] 2] ; flush $p vwait x @@ -1538,7 +1533,7 @@ test socket-12.2 {testing inheritance of client sockets} {socket exec} { close $p set x } {client socket was not inherited} -test socket-12.3 {testing inheritance of accepted sockets} {socket exec} { +test socket-12.3 {testing inheritance of accepted sockets} {socket stdio exec} { removeFile script1 removeFile script2 @@ -1550,7 +1545,7 @@ test socket-12.3 {testing inheritance of accepted sockets} {socket exec} { close $f set f [open $path(script2) w] - puts $f [list set tcltest $::tcltest::tcltest] + puts $f [list set tcltest [interpreter]] puts $f [format { set server [socket -server accept 0] puts stdout [lindex [fconfigure $server -sockname] 2] @@ -1567,8 +1562,8 @@ test socket-12.3 {testing inheritance of accepted sockets} {socket exec} { # Launch the script2 process and connect to it. See how long # the socket stays open - ## exec $::tcltest::tcltest script2 & - set p [open "|[list $::tcltest::tcltest $path(script2)]" r] + ## exec [interpreter] script2 & + set p [open "|[list [interpreter] $path(script2)]" r] gets $p listen after 1000 set ok_to_proceed 1 diff --git a/tests/tcltest.test b/tests/tcltest.test index b6c8392..7edc67a 100755 --- a/tests/tcltest.test +++ b/tests/tcltest.test @@ -6,7 +6,7 @@ # Copyright (c) 2000 by Ajuba Solutions # All rights reserved. # -# RCS: @(#) $Id: tcltest.test,v 1.30 2002/07/03 19:40:31 dgp Exp $ +# RCS: @(#) $Id: tcltest.test,v 1.31 2002/07/10 11:56:45 dgp Exp $ # Note that there are several places where the value of # tcltest::currentFailure is stored/reset in the -setup/-cleanup @@ -52,17 +52,19 @@ makeFile { } test.tcl cd [temporaryDirectory] +testConstraint exec [llength [info commands exec]] # test -help -test tcltest-1.1 {tcltest -help} {unixOrPc} { +# Child processes because -help [exit]s. +test tcltest-1.1 {tcltest -help} {exec} { set result [catch {exec [interpreter] test.tcl -help} msg] set result [catch {runCmd $cmd}] list $result [regexp Usage $msg] } {1 1} -test tcltest-1.2 {tcltest -help -something} {unixOrPc} { +test tcltest-1.2 {tcltest -help -something} {exec} { set result [catch {exec [interpreter] test.tcl -help -something} msg] list $result [regexp Usage $msg] } {1 1} -test tcltest-1.3 {tcltest -h} {unixOrPc} { +test tcltest-1.3 {tcltest -h} {exec} { set result [catch {exec [interpreter] test.tcl -h} msg] list $result [regexp Usage $msg] } {1 0} @@ -280,11 +282,11 @@ test tcltest-5.5 {InitConstraints: list of built-in constraints} \ -setup {tcltest::InitConstraints} \ -body { lsort [array names ::tcltest::testConstraints] } \ -result [lsort { - 95 98 asyncPipeClose eformat emptyTest hasIsoLocale interactive knownBug - mac macCrash macOnly macOrPc macOrUnix macOrWin nonBlockFiles nonPortable - notRoot nt pc pcCrash pcOnly root singleTestInterp socket stdio tempNotMac - tempNotPc tempNotUnix tempNotWin unix unixCrash unixExecs unixOnly unixOrPc - unixOrWin userInteraction win winCrash winOnly + 95 98 asyncPipeClose eformat emptyTest exec hasIsoLocale interactive + knownBug mac macCrash macOnly macOrPc macOrUnix macOrWin nonBlockFiles + nonPortable notRoot nt pc pcCrash pcOnly root singleTestInterp socket + stdio tempNotMac tempNotPc tempNotUnix tempNotWin unix unixCrash unixExecs + unixOnly unixOrPc unixOrWin userInteraction win winCrash winOnly }] # Removed this broken test. Its usage of [limitConstraints] was not diff --git a/tests/unixInit.test b/tests/unixInit.test index c015762..dc5336d 100644 --- a/tests/unixInit.test +++ b/tests/unixInit.test @@ -10,15 +10,12 @@ # 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.26 2002/05/08 06:31:50 dgp Exp $ +# RCS: @(#) $Id: unixInit.test,v 1.27 2002/07/10 11:56:45 dgp Exp $ -if {[lsearch [namespace children] ::tcltest] == -1} { - package require tcltest - namespace import -force ::tcltest::* -} +package require tcltest 2 +namespace import -force ::tcltest::* -set ::tcltest::testConstraints(notInstalledInTmp) \ - [string match /tmp/lib/* [info library]] +testConstraint notInstalledInTmp [string match /tmp/lib/* [info library]] if {[info exists env(TCL_LIBRARY)]} { set oldlibrary $env(TCL_LIBRARY) unset env(TCL_LIBRARY) @@ -26,32 +23,20 @@ if {[info exists env(TCL_LIBRARY)]} { catch {set oldlang $env(LANG)} set env(LANG) C -# Some tests will fail if they are run on a machine that doesn't have -# this Tcl version installed (as opposed to built) on it. -if {[catch { - set f [open "|[list $::tcltest::tcltest]" w+] - exec kill -PIPE [pid $f] - close $f -} msg]} { - set ::tcltest::testConstraints(installedTcl) 0 -} else { - set ::tcltest::testConstraints(installedTcl) 1 -} - -test unixInit-1.1 {TclpInitPlatform: ignore SIGPIPE} {unixOnly installedTcl} { +test unixInit-1.1 {TclpInitPlatform: ignore SIGPIPE} {unixOnly 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 $::tcltest::tcltest]" w+] + 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 $::tcltest::tcltest]" w+] + set f [open "|[list [interpreter]]" w+] puts $f "puts hi" flush $f gets $f @@ -64,11 +49,11 @@ test unixInit-1.1 {TclpInitPlatform: ignore SIGPIPE} {unixOnly installedTcl} { # 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. -test unixInit-1.2 {initialisation: standard channel type deduction} {unixOnly installedTcl} { +test unixInit-1.2 {initialisation: standard channel type deduction} {unixOnly stdio} { # pipe1 is a connection to a server that reports what port it # starts on, and delivers a constant string to the first client to # connect to that port before exiting. - set pipe1 [open "|[list $::tcltest::tcltest]" r+] + set pipe1 [open "|[list [interpreter]]" r+] puts $pipe1 { proc accept {channel host port} { puts $channel {puts [fconfigure stdin -peername]; exit} @@ -88,7 +73,7 @@ test unixInit-1.2 {initialisation: standard channel type deduction} {unixOnly in # These orders will tell it to print out the details about the # socket it is taking instructions from, hopefully identifying it # as a socket. Which is what this test is all about. - set pipe2 [open "|[list $::tcltest::tcltest <@$sock]" r] + set pipe2 [open "|[list [interpreter] <@$sock]" r] set result [gets $pipe2] # Clear any pending data; stops certain kinds of (non-important) errors @@ -112,7 +97,7 @@ test unixInit-1.2 {initialisation: standard channel type deduction} {unixOnly in } } {OK} -proc getlibpath "{program [list $::tcltest::tcltest]}" { +proc getlibpath [list [list program [interpreter]]] { set f [open "|[list $program]" w+] fconfigure $f -buffering none puts $f {puts $tcl_libPath; exit} @@ -123,8 +108,7 @@ proc getlibpath "{program [list $::tcltest::tcltest]}" { # Some tests require the testgetdefenc command -set ::tcltest::testConstraints(testgetdefenc) \ - [expr {[info commands testgetdefenc] != {}}] +testConstraint testgetdefenc [llength [info commands testgetdefenc]] test unixInit-2.0 {TclpInitLibraryPath: setting tclDefaultEncodingDir} \ {unixOnly testgetdefenc} { @@ -135,19 +119,19 @@ test unixInit-2.0 {TclpInitLibraryPath: setting tclDefaultEncodingDir} \ set path } {slappy} test unixInit-2.1 {TclpInitLibraryPath: value of installLib, developLib} \ - {unixOnly installedTcl} { + {unixOnly stdio} { set path [getlibpath] set installLib lib/tcl[info tclversion] set developLib tcl[info patchlevel]/library - set prefix [file dirname [file dirname $::tcltest::tcltest]] + 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] set x } {0 0} -test unixInit-2.2 {TclpInitLibraryPath: TCL_LIBRARY} {unixOnly installedTcl} { +test unixInit-2.2 {TclpInitLibraryPath: TCL_LIBRARY} {unixOnly stdio} { # ((str != NULL) && (str[0] != '\0')) set env(TCL_LIBRARY) sparkly @@ -157,7 +141,7 @@ test unixInit-2.2 {TclpInitLibraryPath: TCL_LIBRARY} {unixOnly installedTcl} { lindex $path 0 } "sparkly" test unixInit-2.3 {TclpInitLibraryPath: TCL_LIBRARY wrong version} \ - {unixOnly installedTcl} { + {unixOnly stdio} { # ((pathc > 0) && (strcasecmp(installLib + 4, pathv[pathc - 1]) != 0)) set env(TCL_LIBRARY) /a/b/tcl1.7 @@ -167,7 +151,7 @@ test unixInit-2.3 {TclpInitLibraryPath: TCL_LIBRARY wrong version} \ lrange $path 0 1 } [list /a/b/tcl1.7 /a/b/tcl[info tclversion]] test unixInit-2.4 {TclpInitLibraryPath: TCL_LIBRARY: INTL} \ - {unixOnly installedTcl} { + {unixOnly stdio} { # Child process translates env variable from native encoding. set env(TCL_LIBRARY) "\xa7" @@ -182,23 +166,37 @@ test unixInit-2.5 {TclpInitLibraryPath: compiled-in library path} \ # cannot test } {} test unixInit-2.6 {TclpInitLibraryPath: executable relative} \ - {unixOnly installedTcl} { - file delete -force /tmp/sparkly - file mkdir /tmp/sparkly/bin - file copy $::tcltest::tcltest /tmp/sparkly/bin/tcltest - - file mkdir /tmp/sparkly/lib/tcl[info tclversion] - close [open /tmp/sparkly/lib/tcl[info tclversion]/init.tcl w] - - set x [lrange [getlibpath /tmp/sparkly/bin/tcltest] 0 1] - file delete -force /tmp/sparkly + {unixOnly stdio} { + makeDirectory tmp + makeDirectory [file join tmp sparkly] + makeDirectory [file join tmp sparkly bin] + file copy [interpreter] [file join [temporaryDirectory] tmp sparkly \ + bin tcltest] + makeDirectory [file join tmp sparkly lib] + makeDirectory [file join tmp sparkly lib tcl[info tclversion]] + makeFile {} [file join tmp sparkly lib tcl[info tclversion] init.tcl] + + set x [lrange [getlibpath [file join [temporaryDirectory] tmp sparkly \ + bin tcltest]] 0 1] + removeFile [file join tmp sparkly lib tcl[info tclversion] init.tcl] + removeDirectory [file join tmp sparkly lib tcl[info tclversion]] + removeDirectory [file join tmp sparkly lib] + removeDirectory [file join tmp sparkly bin] + removeDirectory [file join tmp sparkly] + removeDirectory tmp set x -} [list /tmp/sparkly/lib/tcl[info tclversion] /tmp/lib/tcl[info tclversion]] +} [list [temporaryDirectory]/tmp/sparkly/lib/tcl[info tclversion] [temporaryDirectory]/tmp/lib/tcl[info tclversion]] test unixInit-2.7 {TclpInitLibraryPath: compiled-in library path} \ {emptyTest unixOnly} { # 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 +# these tests need paths near the "root" of the file system to present +# themselves. +# test unixInit-2.8 {TclpInitLibraryPath: all absolute pathtype} {unixOnly notInstalledInTmp} { # Checking for Bug 219416 # When a program that embeds the Tcl library, like tcltest, is @@ -218,7 +216,7 @@ test unixInit-2.8 {TclpInitLibraryPath: all absolute pathtype} {unixOnly notInst file delete -force /tmp/sparkly file delete -force /tmp/lib/tcl[info tclversion] file mkdir /tmp/sparkly - file copy $::tcltest::tcltest /tmp/sparkly/tcltest + file copy [interpreter] /tmp/sparkly/tcltest # Keep any existing /tmp/lib directory set deletelib 1 @@ -254,7 +252,7 @@ test unixInit-2.9 {TclpInitLibraryPath: paths relative to executable} { file delete -force /tmp/sparkly file delete -force /tmp/library file mkdir /tmp/sparkly - file copy $::tcltest::tcltest /tmp/sparkly/tcltest + file copy [interpreter] /tmp/sparkly/tcltest file mkdir /tmp/library/ close [open /tmp/library/init.tcl w] @@ -266,10 +264,10 @@ test unixInit-2.9 {TclpInitLibraryPath: paths relative to executable} { set x } [list /tmp/lib/tcl[info tclversion] /lib/tcl[info tclversion] \ /tmp/library /library /tcl[info patchlevel]/library] -test unixInit-3.1 {TclpSetInitialEncodings} {unixOnly installedTcl} { +test unixInit-3.1 {TclpSetInitialEncodings} {unixOnly stdio} { set env(LANG) C - set f [open "|[list $::tcltest::tcltest]" w+] + set f [open "|[list [interpreter]]" w+] fconfigure $f -buffering none puts $f {puts [encoding system]; exit} set enc [gets $f] @@ -278,12 +276,12 @@ test unixInit-3.1 {TclpSetInitialEncodings} {unixOnly installedTcl} { set enc } {iso8859-1} -test unixInit-3.2 {TclpSetInitialEncodings} {unixOnly installedTcl} { +test unixInit-3.2 {TclpSetInitialEncodings} {unixOnly stdio} { set env(LANG) japanese catch {set oldlc_all $env(LC_ALL)} set env(LC_ALL) japanese - set f [open "|[list $::tcltest::tcltest]" w+] + set f [open "|[list [interpreter]]" w+] fconfigure $f -buffering none puts $f {puts [encoding system]; exit} set enc [gets $f] diff --git a/tests/winDde.test b/tests/winDde.test index 5afae757..37d91ee 100644 --- a/tests/winDde.test +++ b/tests/winDde.test @@ -9,7 +9,7 @@ # See the file "license.terms" for information on usage and redistribution # of this file, and for a DISCLAIMER OF ALL WARRANTIES. # -# RCS: @(#) $Id: winDde.test,v 1.11 2001/08/22 23:56:14 hobbs Exp $ +# RCS: @(#) $Id: winDde.test,v 1.12 2002/07/10 11:56:45 dgp Exp $ if {[lsearch [namespace children] ::tcltest] == -1} { package require tcltest @@ -59,7 +59,7 @@ proc createChildProcess { ddeServerName } { } close $f - set f [open |[list $tcltest::tcltest $::scriptName] r] + set f [open |[list [interpreter] $::scriptName] r] gets $f return $f } @@ -112,7 +112,7 @@ test winDde-3.5 {DDE request locally} {pcOnly} { dde request -binary TclEval self a } "foo\x00" -test winDde-4.1 {DDE execute remotely} {pcOnly} { +test winDde-4.1 {DDE execute remotely} {stdio pcOnly} { set a "" set child [createChildProcess child] dde execute TclEval child {set a "foo"} @@ -121,7 +121,7 @@ test winDde-4.1 {DDE execute remotely} {pcOnly} { set a } "" -test winDde-4.2 {DDE execute remotely} {pcOnly} { +test winDde-4.2 {DDE execute remotely} {stdio pcOnly} { set a "" set child [createChildProcess child] dde execute -async TclEval child {set a "foo"} @@ -130,7 +130,7 @@ test winDde-4.2 {DDE execute remotely} {pcOnly} { set a } "" -test winDde-4.3 {DDE request locally} {pcOnly} { +test winDde-4.3 {DDE request locally} {stdio pcOnly} { set a "" set child [createChildProcess child] dde execute TclEval child {set a "foo"} @@ -140,7 +140,7 @@ test winDde-4.3 {DDE request locally} {pcOnly} { set a } foo -test winDde-4.4 {DDE eval locally} {pcOnly} { +test winDde-4.4 {DDE eval locally} {stdio pcOnly} { set a "" set child [createChildProcess child] set a [dde eval child set a "foo"] diff --git a/tests/winPipe.test b/tests/winPipe.test index 52eba11..28cec62 100644 --- a/tests/winPipe.test +++ b/tests/winPipe.test @@ -12,12 +12,12 @@ # See the file "license.terms" for information on usage and redistribution # of this file, and for a DISCLAIMER OF ALL WARRANTIES. # -# RCS: @(#) $Id: winPipe.test,v 1.18 2002/07/04 20:26:08 andreas_kupries Exp $ +# RCS: @(#) $Id: winPipe.test,v 1.19 2002/07/10 11:56:45 dgp Exp $ -if {[lsearch [namespace children] ::tcltest] == -1} { - package require tcltest - namespace import -force ::tcltest::* -} +package require tcltest +namespace import -force ::tcltest::* + +testConstraint exec [llength [info commands exec]] set bindir [file join [pwd] [file dirname [info nameofexecutable]]] set cat32 [file join $bindir cat32.exe] @@ -64,90 +64,90 @@ set path(more) [makeFile { set path(stdout) [makeFile {} stdout] set path(stderr) [makeFile {} stderr] -test winpipe-1.1 {32 bit comprehensive tests: from little file} {pcOnly stdio cat32} { +test winpipe-1.1 {32 bit comprehensive tests: from little file} {pcOnly exec cat32} { exec $cat32 < $path(little) > $path(stdout) 2> $path(stderr) list [contents $path(stdout)] [contents $path(stderr)] } {little stderr32} -test winpipe-1.2 {32 bit comprehensive tests: from big file} {pcOnly stdio cat32} { +test winpipe-1.2 {32 bit comprehensive tests: from big file} {pcOnly exec cat32} { exec $cat32 < $path(big) > $path(stdout) 2> $path(stderr) list [contents $path(stdout)] [contents $path(stderr)] } "{$big} stderr32" -test winpipe-1.3 {32 bit comprehensive tests: a little from pipe} {nt stdio cat32} { - exec $::tcltest::tcltest more < little | $cat32 > $path(stdout) 2> $path(stderr) +test winpipe-1.3 {32 bit comprehensive tests: a little from pipe} {nt exec cat32} { + exec [interpreter] more < little | $cat32 > $path(stdout) 2> $path(stderr) list [contents $path(stdout)] [contents $path(stderr)] } {little stderr32} -test winpipe-1.4 {32 bit comprehensive tests: a lot from pipe} {nt stdio cat32} { - exec $::tcltest::tcltest more < big | $cat32 > $path(stdout) 2> $path(stderr) +test winpipe-1.4 {32 bit comprehensive tests: a lot from pipe} {nt exec cat32} { + exec [interpreter] more < big | $cat32 > $path(stdout) 2> $path(stderr) list [contents $path(stdout)] [contents $path(stderr)] } "{$big} stderr32" -test winpipe-1.5 {32 bit comprehensive tests: a lot from pipe} {95 stdio cat32} { +test winpipe-1.5 {32 bit comprehensive tests: a lot from pipe} {95 exec cat32} { exec command /c type big |& $cat32 > $path(stdout) 2> $path(stderr) list [contents $path(stdout)] [contents $path(stderr)] } "{$big} stderr32" test winpipe-1.6 {32 bit comprehensive tests: from console} \ - {pcOnly stdio cat32 AllocConsole} { + {pcOnly cat32 AllocConsole} { # would block waiting for human input } {} -test winpipe-1.7 {32 bit comprehensive tests: from NUL} {pcOnly stdio cat32} { +test winpipe-1.7 {32 bit comprehensive tests: from NUL} {pcOnly exec cat32} { exec $cat32 < nul > $path(stdout) 2> $path(stderr) list [contents $path(stdout)] [contents $path(stderr)] } {{} stderr32} -test winpipe-1.8 {32 bit comprehensive tests: from socket} {pcOnly stdio cat32} { +test winpipe-1.8 {32 bit comprehensive tests: from socket} {pcOnly cat32} { # doesn't work } {} test winpipe-1.9 {32 bit comprehensive tests: from nowhere} \ - {pcOnly stdio cat32 .console} { + {pcOnly exec cat32 .console} { exec $cat32 > $path(stdout) 2> $path(stderr) list [contents $path(stdout)] [contents $path(stderr)] } {{} stderr32} test winpipe-1.10 {32 bit comprehensive tests: from file handle} \ - {pcOnly stdio cat32} { + {pcOnly exec cat32} { set f [open $path(little) r] exec $cat32 <@$f > $path(stdout) 2> $path(stderr) close $f list [contents $path(stdout)] [contents $path(stderr)] } {little stderr32} test winpipe-1.11 {32 bit comprehensive tests: read from application} \ - {pcOnly stdio cat32} { + {pcOnly exec cat32} { set f [open "|[list $cat32] < $path(little)" r] gets $f line catch {close $f} msg list $line $msg } {little stderr32} test winpipe-1.12 {32 bit comprehensive tests: a little to file} \ - {pcOnly stdio cat32} { + {pcOnly exec cat32} { exec $cat32 < $path(little) > $path(stdout) 2> $path(stderr) list [contents $path(stdout)] [contents $path(stderr)] } {little stderr32} test winpipe-1.13 {32 bit comprehensive tests: a lot to file} \ - {pcOnly stdio cat32} { + {pcOnly exec cat32} { exec $cat32 < $path(big) > $path(stdout) 2> $path(stderr) list [contents $path(stdout)] [contents $path(stderr)] } "{$big} stderr32" test winpipe-1.14 {32 bit comprehensive tests: a little to pipe} \ - {pcOnly stdio cat32} { - exec $cat32 < $path(little) | $::tcltest::tcltest $path(more) > $path(stdout) 2> $path(stderr) + {pcOnly exec stdio cat32} { + exec $cat32 < $path(little) | [interpreter] $path(more) > $path(stdout) 2> $path(stderr) list [contents $path(stdout)] [contents $path(stderr)] } {little stderr32} test winpipe-1.15 {32 bit comprehensive tests: a lot to pipe} \ - {pcOnly stdio cat32} { - exec $cat32 < $path(big) | $::tcltest::tcltest $path(more) > $path(stdout) 2> $path(stderr) + {pcOnly exec stdio cat32} { + exec $cat32 < $path(big) | [interpreter] $path(more) > $path(stdout) 2> $path(stderr) list [contents $path(stdout)] [contents $path(stderr)] } "{$big} stderr32" -test winpipe-1.16 {32 bit comprehensive tests: to console} {pcOnly stdio cat32} { +test winpipe-1.16 {32 bit comprehensive tests: to console} {pcOnly exec cat32} { catch {exec $cat32 << "You should see this\n" >@stdout} msg set msg } stderr32 -test winpipe-1.17 {32 bit comprehensive tests: to NUL} {pcOnly stdio cat32} { +test winpipe-1.17 {32 bit comprehensive tests: to NUL} {pcOnly exec cat32} { # some apps hang when sending a large amount to NUL. $cat32 isn't one. catch {exec $cat32 < $path(big) > nul} msg set msg } stderr32 test winpipe-1.18 {32 bit comprehensive tests: to nowhere} \ - {pcOnly stdio cat32 .console} { + {pcOnly exec cat32 .console} { exec $cat32 < $path(big) >&@stdout } {} -test winpipe-1.19 {32 bit comprehensive tests: to file handle} {pcOnly stdio cat32} { +test winpipe-1.19 {32 bit comprehensive tests: to file handle} {pcOnly exec cat32} { set f1 [open $path(stdout) w] set f2 [open $path(stderr) w] exec $cat32 < $path(little) >@$f1 2>@$f2 @@ -156,14 +156,14 @@ test winpipe-1.19 {32 bit comprehensive tests: to file handle} {pcOnly stdio cat list [contents $path(stdout)] [contents $path(stderr)] } {little stderr32} test winpipe-1.20 {32 bit comprehensive tests: write to application} \ - {pcOnly stdio cat32} { + {pcOnly exec cat32} { set f [open |[list $cat32 >$path(stdout)] w] puts -nonewline $f "foo" catch {close $f} msg list [contents $path(stdout)] $msg } {foo stderr32} test winpipe-1.21 {32 bit comprehensive tests: read/write application} \ - {pcOnly stdio cat32} { + {pcOnly exec cat32} { set f [open "|[list $cat32]" r+] puts $f $big puts $f \032 @@ -172,13 +172,13 @@ test winpipe-1.21 {32 bit comprehensive tests: read/write application} \ catch {close $f} set r } "bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb" -test winpipe-1.22 {Checking command.com for Win95/98 hanging} {95 stdio} { +test winpipe-1.22 {Checking command.com for Win95/98 hanging} {95 exec} { exec command.com /c dir /b set result 1 } 1 file delete more -test winpipe-4.1 {Tcl_WaitPid} {nt stdio cat32} { +test winpipe-4.1 {Tcl_WaitPid} {nt exec cat32} { proc readResults {f} { global x result if { [eof $f] } { @@ -208,10 +208,10 @@ catch {set env_temp $env(TEMP)} set env(TMP) c:/ set env(TEMP) c:/ -test winpipe-5.1 {TclpCreateTempFile: cleanup temp files} {pcOnly stdio} { +test winpipe-5.1 {TclpCreateTempFile: cleanup temp files} {pcOnly exec} { set x {} set existing [glob -nocomplain c:/tcl*.tmp] - exec $::tcltest::tcltest < nothing + exec [interpreter] < nothing foreach p [glob -nocomplain c:/tcl*.tmp] { if {[lsearch $existing $p] == -1} { lappend x $p @@ -219,38 +219,38 @@ test winpipe-5.1 {TclpCreateTempFile: cleanup temp files} {pcOnly stdio} { } set x } {} -test winpipe-5.2 {TclpCreateTempFile: TMP and TEMP not defined} {pcOnly stdio} { +test winpipe-5.2 {TclpCreateTempFile: TMP and TEMP not defined} {pcOnly exec} { set tmp $env(TMP) set temp $env(TEMP) unset env(TMP) unset env(TEMP) - exec $::tcltest::tcltest < nothing + exec [interpreter] < nothing set env(TMP) $tmp set env(TEMP) $temp set x {} } {} test winpipe-5.3 {TclpCreateTempFile: TMP specifies non-existent directory} \ - {pcOnly stdio} { + {pcOnly exec } { set tmp $env(TMP) set env(TMP) snarky - exec $::tcltest::tcltest < nothing + exec [interpreter] < nothing set env(TMP) $tmp set x {} } {} test winpipe-5.4 {TclpCreateTempFile: TEMP specifies non-existent directory} \ - {pcOnly stdio} { + {pcOnly exec} { set tmp $env(TMP) set temp $env(TEMP) unset env(TMP) set env(TEMP) snarky - exec $::tcltest::tcltest < nothing + exec [interpreter] < nothing set env(TMP) $tmp set env(TEMP) $temp set x {} } {} test winpipe-6.1 {PipeSetupProc & PipeCheckProc: read threads} \ - {pcOnly stdio cat32} { + {pcOnly exec cat32} { set f [open "|[list $cat32]" r+] fconfigure $f -blocking 0 fileevent $f writable { set x writable } @@ -270,7 +270,7 @@ test winpipe-6.1 {PipeSetupProc & PipeCheckProc: read threads} \ } {writable timeout readable {foobar } timeout 1 stderr32} test winpipe-6.2 {PipeSetupProc & PipeCheckProc: write threads} \ - {pcOnly stdio cat32} { + {pcOnly exec cat32} { set f [open "|[list $cat32]" r+] fconfigure $f -blocking 0 fileevent $f writable { set x writable } @@ -287,11 +287,11 @@ set path(echoArgs.tcl) [makeFile { puts "[list $argv0 $argv]" } echoArgs.tcl] -test winpipe-7.1 {BuildCommandLine: null arguments} {pcOnly stdio} { - exec $::tcltest::tcltest $path(echoArgs.tcl) foo "" bar +test winpipe-7.1 {BuildCommandLine: null arguments} {pcOnly exec} { + exec [interprter] $path(echoArgs.tcl) foo "" bar } [list $path(echoArgs.tcl) {foo {} bar}] -test winpipe-7.2 {BuildCommandLine: null arguments} {pcOnly stdio} { - exec $::tcltest::tcltest $path(echoArgs.tcl) foo \" bar +test winpipe-7.2 {BuildCommandLine: null arguments} {pcOnly exec} { + exec [interprter] $path(echoArgs.tcl) foo \" bar } [list $path(echoArgs.tcl) {foo {"} bar}] # restore old values for env(TMP) and env(TEMP) |