summaryrefslogtreecommitdiffstats
path: root/tests/winPipe.test
diff options
context:
space:
mode:
authorstanton <stanton>1998-09-21 23:39:52 (GMT)
committerstanton <stanton>1998-09-21 23:39:52 (GMT)
commit494c2de3a748b449c69ce322a1a741f5a31fd4d5 (patch)
treec3ece48c0ae3f4ba54787e0e8e729b65752ef3f9 /tests/winPipe.test
parent7a698c0488d99c0af42022714638ae1ba2afaa49 (diff)
downloadtcl-494c2de3a748b449c69ce322a1a741f5a31fd4d5.zip
tcl-494c2de3a748b449c69ce322a1a741f5a31fd4d5.tar.gz
tcl-494c2de3a748b449c69ce322a1a741f5a31fd4d5.tar.bz2
Added contents of Tcl 8.1a2
Diffstat (limited to 'tests/winPipe.test')
-rw-r--r--tests/winPipe.test218
1 files changed, 119 insertions, 99 deletions
diff --git a/tests/winPipe.test b/tests/winPipe.test
index 404251f..a732343 100644
--- a/tests/winPipe.test
+++ b/tests/winPipe.test
@@ -2,7 +2,7 @@
# winPipe.test --
#
# This file contains a collection of tests for tclWinPipe.c
-
+#
# Sourcing this file into Tcl runs the tests and generates output for
# errors. No output means no errors were found.
#
@@ -11,9 +11,9 @@
# See the file "license.terms" for information on usage and redistribution
# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
#
-# SCCS: @(#) winPipe.test 1.11 97/10/09 17:06:16
+# SCCS: @(#) winPipe.test 1.15 97/12/22 18:13:59
-if {$tcl_platform(platform) != "windows"} {
+if {($tcl_platform(platform) != "windows") || ($testConfig(stdio) == 0)} {
return
}
@@ -28,7 +28,7 @@ if [catch {puts console1 ""}] {
set testConfig(.console) 1
}
-set big aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\n
+set big bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb\n
append big $big
append big $big
append big $big
@@ -51,108 +51,104 @@ proc contents {file} {
set r
}
+set f [open more w]
+puts $f {
+ while {[eof stdin] == 0} {
+ puts -nonewline [read stdin]
+ }
+}
+close $f
+
if {$testConfig(stdio) && [file exists $cat32]} {
test winpipe-1.1 {32 bit comprehensive tests: from little file} {
exec $cat32 < little > stdout 2> stderr
list [contents stdout] [contents stderr]
-} "little stderr32"
+} {little stderr32}
test winpipe-1.2 {32 bit comprehensive tests: from big file} {
exec $cat32 < big > stdout 2> stderr
list [contents stdout] [contents stderr]
} "{$big} stderr32"
test winpipe-1.3 {32 bit comprehensive tests: a little from pipe} {nt} {
- exec more < little | $cat32 > stdout 2> stderr
+ exec $tcltest more < little | $cat32 > stdout 2> stderr
list [contents stdout] [contents stderr]
-} "{little\n} stderr32"
-test winpipe-1.4 {32 bit comprehensive tests: a little from pipe} {95} {
- exec more < little |& $cat32 > stdout 2> stderr
- list [contents stdout] [contents stderr]
-} "{\nlittle} stderr32"
-test winpipe-1.5 {32 bit comprehensive tests: a lot from pipe} {nt} {
- exec more < big | $cat32 > stdout 2> stderr
+} {little stderr32}
+test winpipe-1.4 {32 bit comprehensive tests: a lot from pipe} {nt} {
+ exec $tcltest more < big | $cat32 > stdout 2> stderr
list [contents stdout] [contents stderr]
} "{$big} stderr32"
-test winpipe-1.6 {32 bit comprehensive tests: a lot from pipe} {95} {
+test winpipe-1.5 {32 bit comprehensive tests: a lot from pipe} {95} {
exec command /c type big |& $cat32 > stdout 2> stderr
list [contents stdout] [contents stderr]
} "{$big} stderr32"
-test winpipe-1.7 {32 bit comprehensive tests: from console} {AllocConsole} {
+test winpipe-1.6 {32 bit comprehensive tests: from console} {AllocConsole} {
# would block waiting for human input
} {}
-test winpipe-1.8 {32 bit comprehensive tests: from NUL} {
+test winpipe-1.7 {32 bit comprehensive tests: from NUL} {
exec $cat32 < nul > stdout 2> stderr
list [contents stdout] [contents stderr]
-} "{} stderr32"
-test winpipe-1.9 {32 bit comprehensive tests: from socket} {
+} {{} stderr32}
+test winpipe-1.8 {32 bit comprehensive tests: from socket} {
# doesn't work
} {}
-test winpipe-1.10 {32 bit comprehensive tests: from nowhere} {.console} {
+test winpipe-1.9 {32 bit comprehensive tests: from nowhere} {.console} {
exec $cat32 > stdout 2> stderr
list [contents stdout] [contents stderr]
-} "{} stderr32"
-test winpipe-1.11 {32 bit comprehensive tests: from file handle} {
+} {{} stderr32}
+test winpipe-1.10 {32 bit comprehensive tests: from file handle} {
set f [open "little" r]
exec $cat32 <@$f > stdout 2> stderr
close $f
list [contents stdout] [contents stderr]
-} "little stderr32"
-test winpipe-1.12 {32 bit comprehensive tests: read from application} {
+} {little stderr32}
+test winpipe-1.11 {32 bit comprehensive tests: read from application} {
set f [open "|$cat32 < little" r]
gets $f line
catch {close $f} msg
list $line $msg
-} "little stderr32"
-test winpipe-1.13 {32 bit comprehensive tests: a little to file} {
+} {little stderr32}
+test winpipe-1.12 {32 bit comprehensive tests: a little to file} {
exec $cat32 < little > stdout 2> stderr
list [contents stdout] [contents stderr]
-} "little stderr32"
-test winpipe-1.14 {32 bit comprehensive tests: a lot to file} {
+} {little stderr32}
+test winpipe-1.13 {32 bit comprehensive tests: a lot to file} {
exec $cat32 < big > stdout 2> stderr
list [contents stdout] [contents stderr]
} "{$big} stderr32"
-test winpipe-1.15 {32 bit comprehensive tests: a little to pipe} {nt} {
- exec $cat32 < little | more > stdout 2> stderr
- list [contents stdout] [contents stderr]
-} "{little\n} stderr32"
-test winpipe-1.16 {32 bit comprehensive tests: a little to pipe} {95} {
- exec $cat32 < little | more > stdout 2> stderr
+test winpipe-1.14 {32 bit comprehensive tests: a little to pipe} {
+ exec $cat32 < little | $tcltest more > stdout 2> stderr
list [contents stdout] [contents stderr]
-} "{\nlittle} stderr32"
-test winpipe-1.17 {32 bit comprehensive tests: a lot to pipe} {nt} {
- exec $cat32 < big | more > stdout 2> stderr
+} {little stderr32}
+test winpipe-1.15 {32 bit comprehensive tests: a lot to pipe} {
+ exec $cat32 < big | $tcltest more > stdout 2> stderr
list [contents stdout] [contents stderr]
-} "{$big\n} stderr32"
-test winpipe-1.18 {32 bit comprehensive tests: a lot to pipe} {95} {
- exec $cat32 < big | more > stdout 2> stderr
- list [contents stdout] [contents stderr]
-} "{\n$big} stderr32"
-test winpipe-1.19 {32 bit comprehensive tests: to console} {
+} "{$big} stderr32"
+test winpipe-1.16 {32 bit comprehensive tests: to console} {
catch {exec $cat32 << "You should see this\n" >@stdout} msg
set msg
} stderr32
-test winpipe-1.20 {32 bit comprehensive tests: to NUL} {
+test winpipe-1.17 {32 bit comprehensive tests: to NUL} {
# some apps hang when sending a large amount to NUL. $cat32 isn't one.
catch {exec $cat32 < big > nul} msg
set msg
} stderr32
-test winpipe-1.21 {32 bit comprehensive tests: to nowhere} {.console} {
+test winpipe-1.18 {32 bit comprehensive tests: to nowhere} {.console} {
exec $cat32 < big >&@stdout
} {}
-test winpipe-1.22 {32 bit comprehensive tests: to file handle} {
+test winpipe-1.19 {32 bit comprehensive tests: to file handle} {
set f1 [open "stdout" w]
set f2 [open "stderr" w]
exec $cat32 < little >@$f1 2>@$f2
close $f1
close $f2
list [contents stdout] [contents stderr]
-} "little stderr32"
-test winpipe-1.23 {32 bit comprehensive tests: write to application} {
+} {little stderr32}
+test winpipe-1.20 {32 bit comprehensive tests: write to application} {
set f [open "|$cat32 > stdout" w]
puts -nonewline $f "foo"
catch {close $f} msg
list [contents stdout] $msg
-} "foo stderr32"
-test winpipe-1.24 {32 bit comprehensive tests: read/write application} {
+} {foo stderr32}
+test winpipe-1.21 {32 bit comprehensive tests: read/write application} {
set f [open "|$cat32" r+]
puts $f $big
puts $f \032
@@ -160,7 +156,7 @@ test winpipe-1.24 {32 bit comprehensive tests: read/write application} {
set r [read $f 64]
catch {close $f}
set r
-} "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
+} "bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb"
}
set stderr16 "stderr16"
@@ -176,85 +172,73 @@ test winpipe-2.2 {16 bit comprehensive tests: from big file} {
exec $cat16 < big > stdout 2> stderr
list [contents stdout] [contents stderr]
} "{$big} $stderr16"
-test winpipe-2.3 {16 bit comprehensive tests: a little from pipe} {nt} {
- exec more < little | $cat16 > stdout 2> stderr
+test winpipe-2.3 {16 bit comprehensive tests: a little from pipe} {
+ exec $tcltest more < little | $cat16 > stdout 2> stderr
list [contents stdout] [contents stderr]
-} "{little\n} stderr16"
-test winpipe-2.4 {16 bit comprehensive tests: a little from pipe} {95} {
- exec more < little | $cat16 > stdout 2> stderr
- list [contents stdout] [contents stderr]
-} "{\nlittle} stderr16"
-test winpipe-2.5 {16 bit comprehensive tests: a lot from pipe} {nt} {
+} {little stderr16}
+test winpipe-2.4 {16 bit comprehensive tests: a lot from pipe} {nt} {
exec $cat16 < big | $cat16 > stdout 2> stderr
list [contents stdout] [contents stderr]
} "{$big} stderr16stderr16"
-test winpipe-2.6 {16 bit comprehensive tests: a lot from pipe} {95} {
- exec more < big | $cat16 > stdout 2> stderr
+test winpipe-2.5 {16 bit comprehensive tests: a lot from pipe} {95} {
+ exec $tcltest more < big | $cat16 > stdout 2> stderr
list [contents stdout] [contents stderr]
-} "{\n$big} stderr16"
-test winpipe-2.7 {16 bit comprehensive tests: from console} {AllocConsole} {
+} "{$big} stderr16"
+test winpipe-2.6 {16 bit comprehensive tests: from console} {AllocConsole} {
# would block waiting for human input
} {}
-test winpipe-2.8 {16 bit comprehensive tests: from NUL} {nt} {
+test winpipe-2.7 {16 bit comprehensive tests: from NUL} {nt} {
exec $cat16 < nul > stdout 2> stderr
list [contents stdout] [contents stderr]
} "{} stderr16"
-test winpipe-2.9 {16 bit comprehensive tests: from socket} {
+test winpipe-2.8 {16 bit comprehensive tests: from socket} {
# doesn't work
} {}
-test winpipe-2.10 {16 bit comprehensive tests: from nowhere} {.console} {
+test winpipe-2.9 {16 bit comprehensive tests: from nowhere} {.console} {
exec $cat16 > stdout 2> stderr
list [contents stdout] [contents stderr]
} "{} stderr16"
-test winpipe-2.11 {16 bit comprehensive tests: from file handle} {
+test winpipe-2.10 {16 bit comprehensive tests: from file handle} {
set f [open "little" r]
exec $cat16 <@$f > stdout 2> stderr
close $f
list [contents stdout] [contents stderr]
} "little $stderr16"
-test winpipe-2.12 {16 bit comprehensive tests: read from application} {
+test winpipe-2.11 {16 bit comprehensive tests: read from application} {
set f [open "|$cat16 < little" r]
gets $f line
catch {close $f} msg
list $line $msg
} "little $stderr16"
-test winpipe-2.13 {16 bit comprehensive tests: a little to file} {
+test winpipe-2.12 {16 bit comprehensive tests: a little to file} {
exec $cat16 < little > stdout 2> stderr
list [contents stdout] [contents stderr]
} "little $stderr16"
-test winpipe-2.14 {16 bit comprehensive tests: a lot to file} {
+test winpipe-2.13 {16 bit comprehensive tests: a lot to file} {
exec $cat16 < big > stdout 2> stderr
list [contents stdout] [contents stderr]
} "{$big} $stderr16"
-test winpipe-2.15 {16 bit comprehensive tests: a little to pipe} {nt} {
- catch {exec $cat16 < little | more > stdout 2> stderr}
- list [contents stdout] [contents stderr]
-} "{little\n} stderr16"
-test winpipe-2.16 {16 bit comprehensive tests: a little to pipe} {95} {
- exec $cat16 < little | more > stdout 2> stderr
+test winpipe-2.14 {16 bit comprehensive tests: a little to pipe} {
+ exec $cat16 < little | $tcltest more > stdout 2> stderr
list [contents stdout] [contents stderr]
-} "{\nlittle} stderr16"
-test winpipe-2.17 {16 bit comprehensive tests: a lot to pipe} {nt} {
- catch {exec $cat16 < big | more > stdout 2> stderr}
+} {little stderr16}
+test winpipe-2.15 {16 bit comprehensive tests: a lot to pipe} {
+ exec $cat16 < big | $tcltest more > stdout 2> stderr
list [contents stdout] [contents stderr]
-} "{$big\n} stderr16"
-test winpipe-2.18 {16 bit comprehensive tests: a lot to pipe} {95} {
- exec $cat16 < big | more > stdout 2> stderr
- list [contents stdout] [contents stderr]
-} "{\n$big} stderr16"
-test winpipe-2.19 {16 bit comprehensive tests: to console} {
+} "{$big} stderr16"
+test winpipe-2.16 {16 bit comprehensive tests: to console} {
catch {exec $cat16 << "You should see this\n" >@stdout} msg
set msg
} [lindex $stderr16 0]
-test winpipe-2.20 {16 bit comprehensive tests: to NUL} {nt} {
+test winpipe-2.17 {16 bit comprehensive tests: to NUL} {nt} {
# some apps hang when sending a large amount to NUL. cat16 isn't one.
catch {exec $cat16 < big > nul} msg
set msg
} stderr16
-test winpipe-2.21 {16 bit comprehensive tests: to nowhere} {.console} {
+test winpipe-2.18 {16 bit comprehensive tests: to nowhere} {.console} {
exec $cat16 < big >&@stdout
} {}
-test winpipe-2.22 {16 bit comprehensive tests: to file handle} {
+test winpipe-2.19 {16 bit comprehensive tests: to file handle} {
set f1 [open "stdout" w]
set f2 [open "stderr" w]
exec $cat16 < little >@$f1 2>@$f2
@@ -262,13 +246,13 @@ test winpipe-2.22 {16 bit comprehensive tests: to file handle} {
close $f2
list [contents stdout] [contents stderr]
} "little $stderr16"
-test winpipe-2.23 {16 bit comprehensive tests: write to application} {!win32s} {
+test winpipe-2.20 {16 bit comprehensive tests: write to application} {!win32s} {
set f [open "|$cat16 > stdout" w]
puts -nonewline $f "foo"
catch {close $f} msg
list [contents stdout] $msg
} "foo stderr16"
-test winpipe-2.24 {16 bit comprehensive tests: read/write application} {nt} {
+test winpipe-2.21 {16 bit comprehensive tests: read/write application} {nt} {
set f [open "|$cat16" r+]
puts $f $big
puts $f \032
@@ -276,7 +260,7 @@ test winpipe-2.24 {16 bit comprehensive tests: read/write application} {nt} {
set r [read $f 64]
catch {close $f}
set r
-} "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
+} "bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb"
}
test winpipe-3.1 {Tcl_WaitPid} {nt} {
@@ -308,18 +292,18 @@ catch {set env_temp $env(TEMP)}
set env(TMP) c:/
set env(TEMP) c:/
-test winpipe-3.1 {TclpCreateTempFile: cleanup temp files} {
+test winpipe-4.1 {TclpCreateTempFile: cleanup temp files} {
set x {}
set existing [glob -nocomplain c:/tcl*.tmp]
exec $tcltest < nothing
foreach p [glob -nocomplain c:/tcl*.tmp] {
- if {[lsearch $existing $p] != -1} {
+ if {[lsearch $existing $p] == -1} {
lappend x $p
}
}
set x
} {}
-test winpipe-3.2 {TclpCreateTempFile: TMP and TEMP not defined} {
+test winpipe-4.2 {TclpCreateTempFile: TMP and TEMP not defined} {
set tmp $env(TMP)
set temp $env(TEMP)
unset env(TMP)
@@ -329,14 +313,14 @@ test winpipe-3.2 {TclpCreateTempFile: TMP and TEMP not defined} {
set env(TEMP) $temp
set x {}
} {}
-test winpipe-3.3 {TclpCreateTempFile: TMP specifies non-existent directory} {
+test winpipe-4.3 {TclpCreateTempFile: TMP specifies non-existent directory} {
set tmp $env(TMP)
set env(TMP) snarky
exec $tcltest < nothing
set env(TMP) $tmp
set x {}
} {}
-test winpipe-3.3 {TclpCreateTempFile: TEMP specifies non-existent directory} {
+test winpipe-4.4 {TclpCreateTempFile: TEMP specifies non-existent directory} {
set tmp $env(TMP)
set temp $env(TEMP)
unset env(TMP)
@@ -347,13 +331,49 @@ test winpipe-3.3 {TclpCreateTempFile: TEMP specifies non-existent directory} {
set x {}
} {}
-# restore old values fro env(TMP) and env(TEMP)
+if {$testConfig(stdio) && [file exists $cat32]} {
+test winpipe-5.1 {PipeSetupProc & PipeCheckProc: read threads} {
+ set f [open "|$cat32" r+]
+ fconfigure $f -blocking 0
+ fileevent $f writable { set x writable }
+ set x {}
+ vwait x
+ fileevent $f writable {}
+ fileevent $f readable { lappend x readable }
+ after 100 { lappend x timeout }
+ vwait x
+ puts $f foobar
+ flush $f
+ vwait x
+ lappend x [read $f]
+ after 100 { lappend x timeout }
+ vwait x
+ lappend x [catch {close $f} msg] $msg
+} {writable timeout readable {foobar
+} timeout 1 stderr32}
+test winpipe-5.2 {PipeSetupProc & PipeCheckProc: write threads} {
+ set f [open "|$cat32" r+]
+ fconfigure $f -blocking 0
+ fileevent $f writable { set x writable }
+ set x {}
+ vwait x
+ puts -nonewline $f $big$big$big$big
+ flush $f
+ after 100 { lappend x timeout }
+ vwait x
+ lappend x [catch {close $f} msg] $msg
+} {writable timeout 0 {}}
+
+}
+
+# restore old values for env(TMP) and env(TEMP)
if {[catch {set env(TMP) $env_tmp}]} {
- unset $env(TMP)
+ unset env(TMP)
}
if {[catch {set env(TEMP) $env_temp}]} {
- unset $env(TEMP)
+ unset env(TEMP)
}
-file delete big little stdout stderr nothing
+file delete big little stdout stderr nothing cat
+return