diff options
author | stanton <stanton@noemail.net> | 1999-04-16 00:46:29 (GMT) |
---|---|---|
committer | stanton <stanton@noemail.net> | 1999-04-16 00:46:29 (GMT) |
commit | 98569293dc21e22480004e4e3f2ce85ec0bfd80f (patch) | |
tree | ce9959f2747257d98d52ec8d18bf3b0de99b9535 /tests/exec.test | |
parent | 6a4a1d8213f4de5bce0eaafa8f4d86117022bf1a (diff) | |
download | tcl-98569293dc21e22480004e4e3f2ce85ec0bfd80f.zip tcl-98569293dc21e22480004e4e3f2ce85ec0bfd80f.tar.gz tcl-98569293dc21e22480004e4e3f2ce85ec0bfd80f.tar.bz2 |
merged tcl 8.1 branch back into the main trunk
FossilOrigin-Name: f3b32fb71c9011ac220779bd9dbe5617c9dc87d9
Diffstat (limited to 'tests/exec.test')
-rw-r--r-- | tests/exec.test | 228 |
1 files changed, 130 insertions, 98 deletions
diff --git a/tests/exec.test b/tests/exec.test index d365b5d..ceb677b 100644 --- a/tests/exec.test +++ b/tests/exec.test @@ -6,24 +6,21 @@ # # Copyright (c) 1991-1994 The Regents of the University of California. # Copyright (c) 1994-1997 Sun Microsystems, Inc. +# Copyright (c) 1998-1999 by Scriptics Corporation. # # 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.2 1998/09/14 18:40:08 stanton Exp $ +# RCS: @(#) $Id: exec.test,v 1.3 1999/04/16 00:47:27 stanton Exp $ -if {[string compare test [info procs test]] == 1} then {source defs} - -# If exec is not defined just return with no error -# Some platforms like the Macintosh do not have the exec command -if {[info commands exec] == ""} { - puts "exec not implemented for this machine" - return -} -if {$testConfig(stdio) == 0} { - return +if {[lsearch [namespace children] ::tcltest] == -1} { + source [file join [pwd] [file dirname [info script]] defs.tcl] } +# All tests require the "exec" command. +# Skip them if exec is not defined. +set ::tcltest::testConfig(execCommandExists) [expr {[info commands exec] != ""}] + set f [open echo w] puts $f { puts -nonewline [lindex $argv 0] @@ -104,71 +101,71 @@ close $f # Basic operations. -test exec-1.1 {basic exec operation} { +test exec-1.1 {basic exec operation} {execCommandExists stdio} { exec $tcltest echo a b c } "a b c" -test exec-1.2 {pipelining} { +test exec-1.2 {pipelining} {execCommandExists stdio} { exec $tcltest echo a b c d | $tcltest cat | $tcltest cat } "a b c d" -test exec-1.3 {pipelining} { +test exec-1.3 {pipelining} {execCommandExists stdio} { set a [exec $tcltest echo a b c d | $tcltest cat | $tcltest 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} { +test exec-1.4 {long command lines} {execCommandExists stdio} { exec $tcltest echo $arg } $arg set arg {} # I/O redirection: input from Tcl command. -test exec-2.1 {redirecting input from immediate source} { +test exec-2.1 {redirecting input from immediate source} {execCommandExists stdio} { exec $tcltest cat << "Sample text" } {Sample text} -test exec-2.2 {redirecting input from immediate source} { +test exec-2.2 {redirecting input from immediate source} {execCommandExists stdio} { exec << "Sample text" $tcltest cat | $tcltest cat } {Sample text} -test exec-2.3 {redirecting input from immediate source} { +test exec-2.3 {redirecting input from immediate source} {execCommandExists stdio} { exec $tcltest cat << "Sample text" | $tcltest cat } {Sample text} -test exec-2.4 {redirecting input from immediate source} { +test exec-2.4 {redirecting input from immediate source} {execCommandExists stdio} { exec $tcltest cat | $tcltest cat << "Sample text" } {Sample text} -test exec-2.5 {redirecting input from immediate source} { +test exec-2.5 {redirecting input from immediate source} {execCommandExists stdio} { exec $tcltest cat "<<Joined to arrows" } {Joined to arrows} # I/O redirection: output to file. file delete gorp.file -test exec-3.1 {redirecting output to file} { +test exec-3.1 {redirecting output to file} {execCommandExists stdio} { exec $tcltest echo "Some simple words" > gorp.file exec $tcltest cat gorp.file } "Some simple words" -test exec-3.2 {redirecting output to file} { +test exec-3.2 {redirecting output to file} {execCommandExists stdio} { exec $tcltest echo "More simple words" | >gorp.file $tcltest cat | $tcltest cat exec $tcltest cat gorp.file } "More simple words" -test exec-3.3 {redirecting output to file} { +test exec-3.3 {redirecting output to file} {execCommandExists stdio} { exec > gorp.file $tcltest echo "Different simple words" | $tcltest cat | $tcltest cat exec $tcltest cat gorp.file } "Different simple words" -test exec-3.4 {redirecting output to file} { +test exec-3.4 {redirecting output to file} {execCommandExists stdio} { exec $tcltest echo "Some simple words" >gorp.file exec $tcltest cat gorp.file } "Some simple words" -test exec-3.5 {redirecting output to file} { +test exec-3.5 {redirecting output to file} {execCommandExists stdio} { exec $tcltest echo "First line" >gorp.file exec $tcltest echo "Second line" >> gorp.file exec $tcltest cat gorp.file } "First line\nSecond line" -test exec-3.6 {redirecting output to file} { +test exec-3.6 {redirecting output to file} {execCommandExists stdio} { exec $tcltest echo "First line" >gorp.file exec $tcltest echo "Second line" >>gorp.file exec $tcltest cat gorp.file } "First line\nSecond line" -test exec-3.7 {redirecting output to file} { +test exec-3.7 {redirecting output to file} {execCommandExists stdio} { set f [open gorp.file w] puts $f "Line 1" flush $f @@ -182,20 +179,20 @@ test exec-3.7 {redirecting output to file} { # I/O redirection: output and stderr to file. file delete gorp.file -test exec-4.1 {redirecting output and stderr to file} { +test exec-4.1 {redirecting output and stderr to file} {execCommandExists stdio} { exec $tcltest echo "test output" >& gorp.file exec $tcltest cat gorp.file } "test output" -test exec-4.2 {redirecting output and stderr to file} { +test exec-4.2 {redirecting output and stderr to file} {execCommandExists stdio} { list [exec $tcltest sh -c "echo foo bar 1>&2" >&gorp.file] \ [exec $tcltest cat gorp.file] } {{} {foo bar}} -test exec-4.3 {redirecting output and stderr to file} { +test exec-4.3 {redirecting output and stderr to file} {execCommandExists stdio} { exec $tcltest echo "first line" > gorp.file list [exec $tcltest sh -c "echo foo bar 1>&2" >>&gorp.file] \ [exec $tcltest cat gorp.file] } "{} {first line\nfoo bar}" -test exec-4.4 {redirecting output and stderr to file} { +test exec-4.4 {redirecting output and stderr to file} {execCommandExists stdio} { set f [open gorp.file w] puts $f "Line 1" flush $f @@ -205,7 +202,7 @@ test exec-4.4 {redirecting output and stderr to file} { close $f exec $tcltest cat gorp.file } "Line 1\nMore text\nEven more\nLine 3" -test exec-4.5 {redirecting output and stderr to file} { +test exec-4.5 {redirecting output and stderr to file} {execCommandExists stdio} { set f [open gorp.file w] puts $f "Line 1" flush $f @@ -219,28 +216,28 @@ test exec-4.5 {redirecting output and stderr to file} { # I/O redirection: input from file. exec $tcltest echo "Just a few thoughts" > gorp.file -test exec-5.1 {redirecting input from file} { +test exec-5.1 {redirecting input from file} {execCommandExists stdio} { exec $tcltest cat < gorp.file } {Just a few thoughts} -test exec-5.2 {redirecting input from file} { +test exec-5.2 {redirecting input from file} {execCommandExists stdio} { exec $tcltest cat | $tcltest cat < gorp.file } {Just a few thoughts} -test exec-5.3 {redirecting input from file} { +test exec-5.3 {redirecting input from file} {execCommandExists stdio} { exec $tcltest cat < gorp.file | $tcltest cat } {Just a few thoughts} -test exec-5.4 {redirecting input from file} { +test exec-5.4 {redirecting input from file} {execCommandExists stdio} { exec < gorp.file $tcltest cat | $tcltest cat } {Just a few thoughts} -test exec-5.5 {redirecting input from file} { +test exec-5.5 {redirecting input from file} {execCommandExists stdio} { exec $tcltest cat <gorp.file } {Just a few thoughts} -test exec-5.6 {redirecting input from file} { +test exec-5.6 {redirecting input from file} {execCommandExists stdio} { set f [open gorp.file r] set result [exec $tcltest cat <@ $f] close $f set result } {Just a few thoughts} -test exec-5.7 {redirecting input from file} { +test exec-5.7 {redirecting input from file} {execCommandExists stdio} { set f [open gorp.file r] set result [exec <@$f $tcltest cat] close $f @@ -249,25 +246,25 @@ test exec-5.7 {redirecting input from file} { # I/O redirection: standard error through a pipeline. -test exec-6.1 {redirecting stderr through a pipeline} { +test exec-6.1 {redirecting stderr through a pipeline} {execCommandExists stdio} { exec $tcltest sh -c "echo foo bar" |& $tcltest cat } "foo bar" -test exec-6.2 {redirecting stderr through a pipeline} { +test exec-6.2 {redirecting stderr through a pipeline} {execCommandExists stdio} { exec $tcltest sh -c "echo foo bar 1>&2" |& $tcltest cat } "foo bar" -test exec-6.3 {redirecting stderr through a pipeline} { +test exec-6.3 {redirecting stderr through a pipeline} {execCommandExists stdio} { exec $tcltest sh -c "echo foo bar 1>&2" \ |& $tcltest sh -c "echo second msg 1>&2 ; cat" |& $tcltest cat } "second msg\nfoo bar" # I/O redirection: combinations. -catch {exec rm -f gorp.file2} -test exec-7.1 {multiple I/O redirections} { +file delete gorp.file2 +test exec-7.1 {multiple I/O redirections} {execCommandExists stdio} { exec << "command input" > gorp.file2 $tcltest cat < gorp.file exec $tcltest cat gorp.file2 } {Just a few thoughts} -test exec-7.2 {multiple I/O redirections} { +test exec-7.2 {multiple I/O redirections} {execCommandExists stdio} { exec < gorp.file << "command input" $tcltest cat } {command input} @@ -278,125 +275,141 @@ 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} { +test exec-8.1 {long input and output} {execCommandExists stdio} { exec $tcltest cat << $a } $a +# More than 20 arguments to exec. + +test exec-8.1 {long input and output} {execCommandExists stdio} { + exec $tcltest 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} { +test exec-9.1 {commands returning errors} {execCommandExists stdio} { 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} { +test exec-9.2 {commands returning errors} {execCommandExists stdio} { string tolower [list [catch {exec $tcltest 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} { +test exec-9.3 {commands returning errors} {execCommandExists stdio} { list [catch {exec $tcltest sleep 1 | $tcltest exit 43 | $tcltest sleep 1} msg] $msg } {1 {child process exited abnormally}} -test exec-9.4 {commands returning errors} { +test exec-9.4 {commands returning errors} {execCommandExists stdio} { list [catch {exec $tcltest exit 43 | $tcltest echo "foo bar"} msg] $msg } {1 {foo bar child process exited abnormally}} -test exec-9.5 {commands returning errors} { +test exec-9.5 {commands returning errors} {execCommandExists stdio} { list [catch {exec gorp456 | $tcltest 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} { +test exec-9.6 {commands returning errors} {execCommandExists stdio} { list [catch {exec $tcltest sh -c "echo error msg 1>&2"} msg] $msg } {1 {error msg}} -test exec-9.7 {commands returning errors} { +test exec-9.7 {commands returning errors} {execCommandExists stdio} { list [catch {exec $tcltest sh -c "echo error msg 1>&2" \ | $tcltest sh -c "echo error msg 1>&2"} msg] $msg } {1 {error msg error msg}} +test exec-9.8 {commands returning errors} {execCommandExists stdio} { + set f [open err w] + puts $f { + puts stdout out + puts stderr err + } + close $f + list [catch {exec $tcltest 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} { +test exec-10.1 {errors in exec invocation} {execCommandExists stdio} { list [catch {exec} msg] $msg } {1 {wrong # args: should be "exec ?switches? arg ?arg ...?"}} -test exec-10.2 {errors in exec invocation} { +test exec-10.2 {errors in exec invocation} {execCommandExists stdio} { list [catch {exec | cat} msg] $msg } {1 {illegal use of | or |& in command}} -test exec-10.3 {errors in exec invocation} { +test exec-10.3 {errors in exec invocation} {execCommandExists stdio} { list [catch {exec cat |} msg] $msg } {1 {illegal use of | or |& in command}} -test exec-10.4 {errors in exec invocation} { +test exec-10.4 {errors in exec invocation} {execCommandExists stdio} { list [catch {exec cat | | cat} msg] $msg } {1 {illegal use of | or |& in command}} -test exec-10.5 {errors in exec invocation} { +test exec-10.5 {errors in exec invocation} {execCommandExists stdio} { list [catch {exec cat | |& cat} msg] $msg } {1 {illegal use of | or |& in command}} -test exec-10.6 {errors in exec invocation} { +test exec-10.6 {errors in exec invocation} {execCommandExists stdio} { list [catch {exec cat |&} msg] $msg } {1 {illegal use of | or |& in command}} -test exec-10.7 {errors in exec invocation} { +test exec-10.7 {errors in exec invocation} {execCommandExists stdio} { list [catch {exec cat <} msg] $msg } {1 {can't specify "<" as last word in command}} -test exec-10.8 {errors in exec invocation} { +test exec-10.8 {errors in exec invocation} {execCommandExists stdio} { list [catch {exec cat >} msg] $msg } {1 {can't specify ">" as last word in command}} -test exec-10.9 {errors in exec invocation} { +test exec-10.9 {errors in exec invocation} {execCommandExists stdio} { list [catch {exec cat <<} msg] $msg } {1 {can't specify "<<" as last word in command}} -test exec-10.10 {errors in exec invocation} { +test exec-10.10 {errors in exec invocation} {execCommandExists stdio} { list [catch {exec cat >>} msg] $msg } {1 {can't specify ">>" as last word in command}} -test exec-10.11 {errors in exec invocation} { +test exec-10.11 {errors in exec invocation} {execCommandExists stdio} { list [catch {exec cat >&} msg] $msg } {1 {can't specify ">&" as last word in command}} -test exec-10.12 {errors in exec invocation} { +test exec-10.12 {errors in exec invocation} {execCommandExists stdio} { list [catch {exec cat >>&} msg] $msg } {1 {can't specify ">>&" as last word in command}} -test exec-10.13 {errors in exec invocation} { +test exec-10.13 {errors in exec invocation} {execCommandExists stdio} { list [catch {exec cat >@} msg] $msg } {1 {can't specify ">@" as last word in command}} -test exec-10.14 {errors in exec invocation} { +test exec-10.14 {errors in exec invocation} {execCommandExists stdio} { list [catch {exec cat <@} msg] $msg } {1 {can't specify "<@" as last word in command}} -test exec-10.15 {errors in exec invocation} { +test exec-10.15 {errors in exec invocation} {execCommandExists stdio} { 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} { +test exec-10.16 {errors in exec invocation} {execCommandExists stdio} { 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} { +test exec-10.17 {errors in exec invocation} {execCommandExists stdio} { 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 gorp.file w] -test exec-10.18 {errors in exec invocation} { +test exec-10.18 {errors in exec invocation} {execCommandExists stdio} { list [catch {exec cat <@ $f} msg] $msg } "1 {channel \"$f\" wasn't opened for reading}" close $f set f [open gorp.file r] -test exec-10.19 {errors in exec invocation} { +test exec-10.19 {errors in exec invocation} {execCommandExists stdio} { 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} { +test exec-10.20 {errors in exec invocation} {execCommandExists stdio} { 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} { +test exec-10.21 {errors in exec invocation} {execCommandExists stdio} { list [catch {exec $tcltest 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} { +test exec-11.1 {commands in background} {execCommandExists stdio} { set x [lindex [time {exec $tcltest sleep 2 &}] 0] expr $x<1000000 } 1 -test exec-11.2 {commands in background} { +test exec-11.2 {commands in background} {execCommandExists stdio} { list [catch {exec $tcltest echo a &b} msg] $msg } {0 {a &b}} -test exec-11.3 {commands in background} { +test exec-11.3 {commands in background} {execCommandExists stdio} { llength [exec $tcltest sleep 1 &] } 1 -test exec-11.4 {commands in background} { +test exec-11.4 {commands in background} {execCommandExists stdio} { llength [exec $tcltest sleep 1 | $tcltest sleep 1 | $tcltest sleep 1 &] } 3 -test exec-11.5 {commands in background} { +test exec-11.5 {commands in background} {execCommandExists stdio} { set f [open gorp.file w] puts $f { catch { exec [info nameofexecutable] echo foo & } } close $f @@ -407,7 +420,8 @@ test exec-11.5 {commands in background} { # they eventually die. exec $tcltest sleep 3 -test exec-12.1 {reaping background processes} {unixOnly nonPortable} { +test exec-12.1 {reaping background processes} \ + {execCommandExists stdio unixOnly nonPortable} { for {set i 0} {$i < 20} {incr i} { exec echo foo > /dev/null & } @@ -415,7 +429,8 @@ test exec-12.1 {reaping background processes} {unixOnly nonPortable} { catch {exec ps | fgrep "echo foo" | fgrep -v fgrep | wc} msg lindex $msg 0 } 0 -test exec-12.2 {reaping background processes} {unixOnly nonPortable} { +test exec-12.2 {reaping background processes} \ + {execCommandExists stdio 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] @@ -423,7 +438,8 @@ test exec-12.2 {reaping background processes} {unixOnly nonPortable} { catch {exec ps | fgrep -i "sleep" | fgrep -i -v fgrep | wc} msg list $x [lindex $msg 0] } {3 0} -test exec-12.3 {reaping background processes} {unixOnly nonPortable} { +test exec-12.3 {reaping background processes} \ + {execCommandExists stdio unixOnly nonPortable} { exec sleep 1000 & exec sleep 1000 & set x [exec ps | fgrep "sleep" | fgrep -v fgrep] @@ -446,13 +462,13 @@ test exec-12.3 {reaping background processes} {unixOnly nonPortable} { # Make sure "errorCode" is set correctly. -test exec-13.1 {setting errorCode variable} { +test exec-13.1 {setting errorCode variable} {execCommandExists stdio} { list [catch {exec $tcltest cat < a/b/c} msg] [string tolower $errorCode] } {1 {posix enoent {no such file or directory}}} -test exec-13.2 {setting errorCode variable} { +test exec-13.2 {setting errorCode variable} {execCommandExists stdio} { list [catch {exec $tcltest cat > a/b/c} msg] [string tolower $errorCode] } {1 {posix enoent {no such file or directory}}} -test exec-13.3 {setting errorCode variable} { +test exec-13.3 {setting errorCode variable} {execCommandExists stdio} { set x [catch {exec _weird_cmd_} msg] list $x [string tolower $msg] [lindex $errorCode 0] \ [string tolower [lrange $errorCode 2 end]] @@ -460,39 +476,39 @@ test exec-13.3 {setting errorCode variable} { # Switches before the first argument -test exec-14.1 {-keepnewline switch} { +test exec-14.1 {-keepnewline switch} {execCommandExists stdio} { exec -keepnewline $tcltest echo foo } "foo\n" -test exec-14.2 {-keepnewline switch} { +test exec-14.2 {-keepnewline switch} {execCommandExists stdio} { list [catch {exec -keepnewline} msg] $msg } {1 {wrong # args: should be "exec ?switches? arg ?arg ...?"}} -test exec-14.3 {unknown switch} { +test exec-14.3 {unknown switch} {execCommandExists stdio} { list [catch {exec -gorp} msg] $msg } {1 {bad switch "-gorp": must be -keepnewline or --}} -test exec-14.4 {-- switch} { +test exec-14.4 {-- switch} {execCommandExists stdio} { 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} { +test exec-15.1 {standard error redirection} {execCommandExists stdio} { exec $tcltest echo "First line" > gorp.file list [exec $tcltest sh -c "echo foo bar 1>&2" 2> gorp.file] \ [exec $tcltest cat gorp.file] } {{} {foo bar}} -test exec-15.2 {standard error redirection} { +test exec-15.2 {standard error redirection} {execCommandExists stdio} { list [exec $tcltest sh -c "echo foo bar 1>&2" \ | $tcltest echo biz baz >gorp.file 2> gorp.file2] \ [exec $tcltest cat gorp.file] \ [exec $tcltest cat gorp.file2] } {{} {biz baz} {foo bar}} -test exec-15.3 {standard error redirection} { +test exec-15.3 {standard error redirection} {execCommandExists stdio} { list [exec $tcltest sh -c "echo foo bar 1>&2" \ | $tcltest echo biz baz 2>gorp.file > gorp.file2] \ [exec $tcltest cat gorp.file] \ [exec $tcltest cat gorp.file2] } {{} {foo bar} {biz baz}} -test exec-15.4 {standard error redirection} { +test exec-15.4 {standard error redirection} {execCommandExists stdio} { set f [open gorp.file w] puts $f "Line 1" flush $f @@ -503,19 +519,19 @@ test exec-15.4 {standard error redirection} { } {Line 1 foo bar Line 3} -test exec-15.5 {standard error redirection} { +test exec-15.5 {standard error redirection} {execCommandExists stdio} { exec $tcltest echo "First line" > gorp.file exec $tcltest sh -c "echo foo bar 1>&2" 2>> gorp.file exec $tcltest cat gorp.file } {First line foo bar} -test exec-15.6 {standard error redirection} { +test exec-15.6 {standard error redirection} {execCommandExists stdio} { exec $tcltest sh -c "echo foo bar 1>&2" > gorp.file2 2> gorp.file \ >& gorp.file 2> gorp.file2 | $tcltest echo biz baz list [exec $tcltest cat gorp.file] [exec $tcltest cat gorp.file2] } {{biz baz} {foo bar}} -test exec-16.1 {flush output before exec} { +test exec-16.1 {flush output before exec} {execCommandExists stdio} { set f [open gorp.file w] puts $f "First line" exec $tcltest echo "Second line" >@ $f @@ -525,7 +541,7 @@ test exec-16.1 {flush output before exec} { } {First line Second line Third line} -test exec-16.2 {flush output before exec} {} { +test exec-16.2 {flush output before exec} {execCommandExists stdio} { set f [open gorp.file w] puts $f "First line" exec $tcltest << {puts stderr {Second line}} >&@ $f > gorp.file2 @@ -536,7 +552,7 @@ test exec-16.2 {flush output before exec} {} { Second line Third line} -test exec-17.1 { inheriting standard I/O } { +test exec-17.1 { inheriting standard I/O } {execCommandExists stdio} { set f [open script w] puts $f {close stdout set f [open gorp.file w] @@ -553,5 +569,21 @@ test exec-17.1 { inheriting standard I/O } { } {{foobar }} +# cleanup file delete script gorp.file gorp.file2 file delete echo cat wc sh sleep exit +file delete err +::tcltest::cleanupTests +return + + + + + + + + + + + + |