diff options
Diffstat (limited to 'tests/winPipe.test')
-rw-r--r-- | tests/winPipe.test | 101 |
1 files changed, 52 insertions, 49 deletions
diff --git a/tests/winPipe.test b/tests/winPipe.test index a445793..3e99625 100644 --- a/tests/winPipe.test +++ b/tests/winPipe.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: winPipe.test,v 1.16 2002/05/24 22:43:31 andreas_kupries Exp $ +# RCS: @(#) $Id: winPipe.test,v 1.17 2002/07/04 20:06:13 andreas_kupries Exp $ if {[lsearch [namespace children] ::tcltest] == -1} { package require tcltest @@ -38,11 +38,13 @@ append big $big append big $big append big $big -set f [open "little" w] +set path(little) [makeFile {} little] +set f [open $path(little) w] puts -nonewline $f "little" close $f -set f [open "big" w] +set path(big) [makeFile {} big] +set f [open $path(big) w] puts -nonewline $f $big close $f @@ -53,83 +55,84 @@ proc contents {file} { set r } -set f [open more w] -puts $f { +set path(more) [makeFile { while {[eof stdin] == 0} { puts -nonewline [read stdin] } -} -close $f +} more] + +set path(stdout) [makeFile {} stdout] +set path(stderr) [makeFile {} stderr] test winpipe-1.1 {32 bit comprehensive tests: from little file} {pcOnly stdio cat32} { - exec $cat32 < little > stdout 2> stderr - list [contents stdout] [contents stderr] + 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} { - exec $cat32 < big > stdout 2> stderr - list [contents stdout] [contents stderr] + 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 > stdout 2> stderr - list [contents stdout] [contents stderr] + exec $::tcltest::tcltest 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 > stdout 2> stderr - list [contents stdout] [contents stderr] + exec $::tcltest::tcltest 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} { - exec command /c type big |& $cat32 > stdout 2> stderr - list [contents stdout] [contents stderr] + 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} { # would block waiting for human input } {} test winpipe-1.7 {32 bit comprehensive tests: from NUL} {pcOnly stdio cat32} { - exec $cat32 < nul > stdout 2> stderr - list [contents stdout] [contents stderr] + 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} { # doesn't work } {} test winpipe-1.9 {32 bit comprehensive tests: from nowhere} \ {pcOnly stdio cat32 .console} { - exec $cat32 > stdout 2> stderr - list [contents stdout] [contents stderr] + 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} { - set f [open "little" r] - exec $cat32 <@$f > stdout 2> stderr + set f [open $path(little) r] + exec $cat32 <@$f > $path(stdout) 2> $path(stderr) close $f - list [contents stdout] [contents stderr] + list [contents $path(stdout)] [contents $path(stderr)] } {little stderr32} test winpipe-1.11 {32 bit comprehensive tests: read from application} \ {pcOnly stdio cat32} { - set f [open "|[list $cat32] < little" r] + 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} { - exec $cat32 < little > stdout 2> stderr - list [contents stdout] [contents stderr] + 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} { - exec $cat32 < big > stdout 2> stderr - list [contents stdout] [contents stderr] + 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 < little | $::tcltest::tcltest more > stdout 2> stderr - list [contents stdout] [contents stderr] + exec $cat32 < $path(little) | $::tcltest::tcltest $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 < big | $::tcltest::tcltest more > stdout 2> stderr - list [contents stdout] [contents stderr] + exec $cat32 < $path(big) | $::tcltest::tcltest $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} { catch {exec $cat32 << "You should see this\n" >@stdout} msg @@ -137,27 +140,27 @@ test winpipe-1.16 {32 bit comprehensive tests: to console} {pcOnly stdio cat32} } stderr32 test winpipe-1.17 {32 bit comprehensive tests: to NUL} {pcOnly stdio cat32} { # some apps hang when sending a large amount to NUL. $cat32 isn't one. - catch {exec $cat32 < big > nul} msg + catch {exec $cat32 < $path(big) > nul} msg set msg } stderr32 test winpipe-1.18 {32 bit comprehensive tests: to nowhere} \ {pcOnly stdio cat32 .console} { - exec $cat32 < big >&@stdout + exec $cat32 < $path(big) >&@stdout } {} test winpipe-1.19 {32 bit comprehensive tests: to file handle} {pcOnly stdio cat32} { - set f1 [open "stdout" w] - set f2 [open "stderr" w] - exec $cat32 < little >@$f1 2>@$f2 + set f1 [open $path(stdout) w] + set f2 [open $path(stderr) w] + exec $cat32 < $path(little) >@$f1 2>@$f2 close $f1 close $f2 - list [contents stdout] [contents stderr] + list [contents $path(stdout)] [contents $path(stderr)] } {little stderr32} test winpipe-1.20 {32 bit comprehensive tests: write to application} \ {pcOnly stdio cat32} { - set f [open |[list $cat32 >stdout] w] + set f [open |[list $cat32 >$path(stdout)] w] puts -nonewline $f "foo" catch {close $f} msg - list [contents stdout] $msg + list [contents $path(stdout)] $msg } {foo stderr32} test winpipe-1.21 {32 bit comprehensive tests: read/write application} \ {pcOnly stdio cat32} { @@ -187,13 +190,13 @@ test winpipe-4.1 {Tcl_WaitPid} {nt stdio cat32} { } } - set f [open "|[list $cat32] < big 2> stderr" r] + set f [open "|[list $cat32] < big 2> $path(stderr)" r] fconfigure $f -buffering none -blocking 0 fileevent $f readable "readResults $f" set x 0 set result "" vwait x - list $result $x [contents stderr] + list $result $x [contents $path(stderr)] } "{$big} 1 stderr32" close [open nothing w] @@ -279,16 +282,16 @@ test winpipe-6.2 {PipeSetupProc & PipeCheckProc: write threads} \ lappend x [catch {close $f} msg] $msg } {writable timeout 0 {}} -makeFile { +set path(echoArgs.tcl) [makeFile { puts "[list $argv0 $argv]" -} echoArgs.tcl +} echoArgs.tcl] test winpipe-7.1 {BuildCommandLine: null arguments} {pcOnly stdio} { - exec $::tcltest::tcltest echoArgs.tcl foo "" bar -} {echoArgs.tcl {foo {} bar}} + exec $::tcltest::tcltest $path(echoArgs.tcl) foo "" bar +} [list $path(echoArgs.tcl) {foo {} bar}] test winpipe-7.2 {BuildCommandLine: null arguments} {pcOnly stdio} { - exec $::tcltest::tcltest echoArgs.tcl foo \" bar -} {echoArgs.tcl {foo {"} bar}} + exec $::tcltest::tcltest $path(echoArgs.tcl) foo \" bar +} [list $path(echoArgs.tcl) {foo {"} bar}] # restore old values for env(TMP) and env(TEMP) |