| 1 | # |
|---|
| 2 | # winPipe.test -- |
|---|
| 3 | # |
|---|
| 4 | # This file contains a collection of tests for tclWinPipe.c |
|---|
| 5 | # |
|---|
| 6 | # Sourcing this file into Tcl runs the tests and generates output for errors. |
|---|
| 7 | # No output (except for one message) means no errors were found. |
|---|
| 8 | # |
|---|
| 9 | # Copyright (c) 1996 Sun Microsystems, Inc. |
|---|
| 10 | # Copyright (c) 1998-1999 by Scriptics Corporation. |
|---|
| 11 | # |
|---|
| 12 | # See the file "license.terms" for information on usage and redistribution |
|---|
| 13 | # of this file, and for a DISCLAIMER OF ALL WARRANTIES. |
|---|
| 14 | # |
|---|
| 15 | # RCS: @(#) $Id: winPipe.test,v 1.33 2006/11/03 15:31:26 dkf Exp $ |
|---|
| 16 | |
|---|
| 17 | package require tcltest |
|---|
| 18 | namespace import -force ::tcltest::* |
|---|
| 19 | unset -nocomplain path |
|---|
| 20 | |
|---|
| 21 | |
|---|
| 22 | set bindir [file join [pwd] [file dirname [info nameofexecutable]]] |
|---|
| 23 | set cat32 [file join $bindir cat32.exe] |
|---|
| 24 | |
|---|
| 25 | testConstraint exec [llength [info commands exec]] |
|---|
| 26 | testConstraint cat32 [file exists $cat32] |
|---|
| 27 | testConstraint AllocConsole [catch {puts console1 ""}] |
|---|
| 28 | testConstraint RealConsole [expr {![testConstraint AllocConsole]}] |
|---|
| 29 | |
|---|
| 30 | set big bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb\n |
|---|
| 31 | append big $big |
|---|
| 32 | append big $big |
|---|
| 33 | append big $big |
|---|
| 34 | append big $big |
|---|
| 35 | append big $big |
|---|
| 36 | append big $big |
|---|
| 37 | |
|---|
| 38 | set path(little) [makeFile {} little] |
|---|
| 39 | set f [open $path(little) w] |
|---|
| 40 | puts -nonewline $f "little" |
|---|
| 41 | close $f |
|---|
| 42 | |
|---|
| 43 | set path(big) [makeFile {} big] |
|---|
| 44 | set f [open $path(big) w] |
|---|
| 45 | puts -nonewline $f $big |
|---|
| 46 | close $f |
|---|
| 47 | |
|---|
| 48 | proc contents {file} { |
|---|
| 49 | set f [open $file r] |
|---|
| 50 | set r [read $f] |
|---|
| 51 | close $f |
|---|
| 52 | set r |
|---|
| 53 | } |
|---|
| 54 | |
|---|
| 55 | set path(more) [makeFile { |
|---|
| 56 | while {[eof stdin] == 0} { |
|---|
| 57 | puts -nonewline [read stdin] |
|---|
| 58 | } |
|---|
| 59 | } more] |
|---|
| 60 | |
|---|
| 61 | set path(stdout) [makeFile {} stdout] |
|---|
| 62 | set path(stderr) [makeFile {} stderr] |
|---|
| 63 | |
|---|
| 64 | test winpipe-1.1 {32 bit comprehensive tests: from little file} {win exec cat32} { |
|---|
| 65 | exec $cat32 < $path(little) > $path(stdout) 2> $path(stderr) |
|---|
| 66 | list [contents $path(stdout)] [contents $path(stderr)] |
|---|
| 67 | } {little stderr32} |
|---|
| 68 | test winpipe-1.2 {32 bit comprehensive tests: from big file} {win exec cat32} { |
|---|
| 69 | exec $cat32 < $path(big) > $path(stdout) 2> $path(stderr) |
|---|
| 70 | list [contents $path(stdout)] [contents $path(stderr)] |
|---|
| 71 | } "{$big} stderr32" |
|---|
| 72 | test winpipe-1.3 {32 bit comprehensive tests: a little from pipe} {win nt exec cat32} { |
|---|
| 73 | exec [interpreter] more < little | $cat32 > $path(stdout) 2> $path(stderr) |
|---|
| 74 | list [contents $path(stdout)] [contents $path(stderr)] |
|---|
| 75 | } {little stderr32} |
|---|
| 76 | test winpipe-1.4 {32 bit comprehensive tests: a lot from pipe} {win nt exec cat32} { |
|---|
| 77 | exec [interpreter] more < big | $cat32 > $path(stdout) 2> $path(stderr) |
|---|
| 78 | list [contents $path(stdout)] [contents $path(stderr)] |
|---|
| 79 | } "{$big} stderr32" |
|---|
| 80 | test winpipe-1.5 {32 bit comprehensive tests: a lot from pipe} {win 95 exec cat32} { |
|---|
| 81 | exec command /c type big |& $cat32 > $path(stdout) 2> $path(stderr) |
|---|
| 82 | list [contents $path(stdout)] [contents $path(stderr)] |
|---|
| 83 | } "{$big} stderr32" |
|---|
| 84 | test winpipe-1.6 {32 bit comprehensive tests: from console} \ |
|---|
| 85 | {win cat32 AllocConsole} { |
|---|
| 86 | # would block waiting for human input |
|---|
| 87 | } {} |
|---|
| 88 | test winpipe-1.7 {32 bit comprehensive tests: from NUL} {win exec cat32} { |
|---|
| 89 | exec $cat32 < nul > $path(stdout) 2> $path(stderr) |
|---|
| 90 | list [contents $path(stdout)] [contents $path(stderr)] |
|---|
| 91 | } {{} stderr32} |
|---|
| 92 | test winpipe-1.8 {32 bit comprehensive tests: from socket} {win cat32} { |
|---|
| 93 | # doesn't work |
|---|
| 94 | } {} |
|---|
| 95 | test winpipe-1.9 {32 bit comprehensive tests: from nowhere} \ |
|---|
| 96 | {win exec cat32 RealConsole} { |
|---|
| 97 | exec $cat32 > $path(stdout) 2> $path(stderr) |
|---|
| 98 | list [contents $path(stdout)] [contents $path(stderr)] |
|---|
| 99 | } {{} stderr32} |
|---|
| 100 | test winpipe-1.10 {32 bit comprehensive tests: from file handle} \ |
|---|
| 101 | {win exec cat32} { |
|---|
| 102 | set f [open $path(little) r] |
|---|
| 103 | exec $cat32 <@$f > $path(stdout) 2> $path(stderr) |
|---|
| 104 | close $f |
|---|
| 105 | list [contents $path(stdout)] [contents $path(stderr)] |
|---|
| 106 | } {little stderr32} |
|---|
| 107 | test winpipe-1.11 {32 bit comprehensive tests: read from application} \ |
|---|
| 108 | {win exec cat32} { |
|---|
| 109 | set f [open "|[list $cat32] < [list $path(little)]" r] |
|---|
| 110 | gets $f line |
|---|
| 111 | catch {close $f} msg |
|---|
| 112 | list $line $msg |
|---|
| 113 | } {little stderr32} |
|---|
| 114 | test winpipe-1.12 {32 bit comprehensive tests: a little to file} \ |
|---|
| 115 | {win exec cat32} { |
|---|
| 116 | exec $cat32 < $path(little) > $path(stdout) 2> $path(stderr) |
|---|
| 117 | list [contents $path(stdout)] [contents $path(stderr)] |
|---|
| 118 | } {little stderr32} |
|---|
| 119 | test winpipe-1.13 {32 bit comprehensive tests: a lot to file} \ |
|---|
| 120 | {win exec cat32} { |
|---|
| 121 | exec $cat32 < $path(big) > $path(stdout) 2> $path(stderr) |
|---|
| 122 | list [contents $path(stdout)] [contents $path(stderr)] |
|---|
| 123 | } "{$big} stderr32" |
|---|
| 124 | test winpipe-1.14 {32 bit comprehensive tests: a little to pipe} \ |
|---|
| 125 | {win exec stdio cat32} { |
|---|
| 126 | exec $cat32 < $path(little) | [interpreter] $path(more) > $path(stdout) 2> $path(stderr) |
|---|
| 127 | list [contents $path(stdout)] [contents $path(stderr)] |
|---|
| 128 | } {little stderr32} |
|---|
| 129 | test winpipe-1.15 {32 bit comprehensive tests: a lot to pipe} \ |
|---|
| 130 | {win exec stdio cat32} { |
|---|
| 131 | exec $cat32 < $path(big) | [interpreter] $path(more) > $path(stdout) 2> $path(stderr) |
|---|
| 132 | list [contents $path(stdout)] [contents $path(stderr)] |
|---|
| 133 | } "{$big} stderr32" |
|---|
| 134 | test winpipe-1.16 {32 bit comprehensive tests: to console} {win exec cat32} { |
|---|
| 135 | catch {exec $cat32 << "You should see this\n" >@stdout} msg |
|---|
| 136 | set msg |
|---|
| 137 | } stderr32 |
|---|
| 138 | test winpipe-1.17 {32 bit comprehensive tests: to NUL} {win exec cat32} { |
|---|
| 139 | # some apps hang when sending a large amount to NUL. $cat32 isn't one. |
|---|
| 140 | catch {exec $cat32 < $path(big) > nul} msg |
|---|
| 141 | set msg |
|---|
| 142 | } stderr32 |
|---|
| 143 | test winpipe-1.18 {32 bit comprehensive tests: to nowhere} \ |
|---|
| 144 | {win exec cat32 RealConsole} { |
|---|
| 145 | exec $cat32 < $path(big) >&@stdout |
|---|
| 146 | } {} |
|---|
| 147 | test winpipe-1.19 {32 bit comprehensive tests: to file handle} {win exec cat32} { |
|---|
| 148 | set f1 [open $path(stdout) w] |
|---|
| 149 | set f2 [open $path(stderr) w] |
|---|
| 150 | exec $cat32 < $path(little) >@$f1 2>@$f2 |
|---|
| 151 | close $f1 |
|---|
| 152 | close $f2 |
|---|
| 153 | list [contents $path(stdout)] [contents $path(stderr)] |
|---|
| 154 | } {little stderr32} |
|---|
| 155 | test winpipe-1.20 {32 bit comprehensive tests: write to application} \ |
|---|
| 156 | {win exec cat32} { |
|---|
| 157 | set f [open |[list $cat32 >$path(stdout)] w] |
|---|
| 158 | puts -nonewline $f "foo" |
|---|
| 159 | catch {close $f} msg |
|---|
| 160 | list [contents $path(stdout)] $msg |
|---|
| 161 | } {foo stderr32} |
|---|
| 162 | test winpipe-1.21 {32 bit comprehensive tests: read/write application} \ |
|---|
| 163 | {win exec cat32} { |
|---|
| 164 | set f [open "|[list $cat32]" r+] |
|---|
| 165 | puts $f $big |
|---|
| 166 | puts $f \032 |
|---|
| 167 | flush $f |
|---|
| 168 | set r [read $f 64] |
|---|
| 169 | catch {close $f} |
|---|
| 170 | set r |
|---|
| 171 | } "bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb" |
|---|
| 172 | test winpipe-1.22 {Checking command.com for Win95/98 hanging} {win 95 exec} { |
|---|
| 173 | exec command.com /c dir /b |
|---|
| 174 | set result 1 |
|---|
| 175 | } 1 |
|---|
| 176 | file delete more |
|---|
| 177 | |
|---|
| 178 | test winpipe-4.1 {Tcl_WaitPid} {win nt exec cat32} { |
|---|
| 179 | proc readResults {f} { |
|---|
| 180 | global x result |
|---|
| 181 | if { [eof $f] } { |
|---|
| 182 | close $f |
|---|
| 183 | set x 1 |
|---|
| 184 | } else { |
|---|
| 185 | set line [read $f ] |
|---|
| 186 | set result "$result$line" |
|---|
| 187 | } |
|---|
| 188 | } |
|---|
| 189 | |
|---|
| 190 | set f [open "|[list $cat32] < big 2> $path(stderr)" r] |
|---|
| 191 | fconfigure $f -buffering none -blocking 0 |
|---|
| 192 | fileevent $f readable "readResults $f" |
|---|
| 193 | set x 0 |
|---|
| 194 | set result "" |
|---|
| 195 | vwait x |
|---|
| 196 | list $result $x [contents $path(stderr)] |
|---|
| 197 | } "{$big} 1 stderr32" |
|---|
| 198 | test winpipe-4.2 {Tcl_WaitPid: return of exception codes, SIGFPE} {win exec} { |
|---|
| 199 | set f [open "|[list [interpreter]]" w+] |
|---|
| 200 | set pid [pid $f] |
|---|
| 201 | puts $f "testexcept float_underflow" |
|---|
| 202 | set status [catch {close $f}] |
|---|
| 203 | list $status [expr {$pid == [lindex $::errorCode 1]}] [lindex $::errorCode 2] |
|---|
| 204 | } {1 1 SIGFPE} |
|---|
| 205 | test winpipe-4.3 {Tcl_WaitPid: return of exception codes, SIGSEGV} {win exec} { |
|---|
| 206 | set f [open "|[list [interpreter]]" w+] |
|---|
| 207 | set pid [pid $f] |
|---|
| 208 | puts $f "testexcept access_violation" |
|---|
| 209 | set status [catch {close $f}] |
|---|
| 210 | list $status [expr {$pid == [lindex $::errorCode 1]}] [lindex $::errorCode 2] |
|---|
| 211 | } {1 1 SIGSEGV} |
|---|
| 212 | test winpipe-4.4 {Tcl_WaitPid: return of exception codes, SIGILL} {win exec} { |
|---|
| 213 | set f [open "|[list [interpreter]]" w+] |
|---|
| 214 | set pid [pid $f] |
|---|
| 215 | puts $f "testexcept illegal_instruction" |
|---|
| 216 | set status [catch {close $f}] |
|---|
| 217 | list $status [expr {$pid == [lindex $::errorCode 1]}] [lindex $::errorCode 2] |
|---|
| 218 | } {1 1 SIGILL} |
|---|
| 219 | test winpipe-4.5 {Tcl_WaitPid: return of exception codes, SIGINT} {win exec} { |
|---|
| 220 | set f [open "|[list [interpreter]]" w+] |
|---|
| 221 | set pid [pid $f] |
|---|
| 222 | puts $f "testexcept ctrl+c" |
|---|
| 223 | set status [catch {close $f}] |
|---|
| 224 | list $status [expr {$pid == [lindex $::errorCode 1]}] [lindex $::errorCode 2] |
|---|
| 225 | } {1 1 SIGINT} |
|---|
| 226 | |
|---|
| 227 | set path(nothing) [makeFile {} nothing] |
|---|
| 228 | close [open $path(nothing) w] |
|---|
| 229 | |
|---|
| 230 | catch {set env_tmp $env(TMP)} |
|---|
| 231 | catch {set env_temp $env(TEMP)} |
|---|
| 232 | |
|---|
| 233 | set env(TMP) c:/ |
|---|
| 234 | set env(TEMP) c:/ |
|---|
| 235 | |
|---|
| 236 | test winpipe-5.1 {TclpCreateTempFile: cleanup temp files} {win exec} { |
|---|
| 237 | set x {} |
|---|
| 238 | set existing [glob -nocomplain c:/tcl*.tmp] |
|---|
| 239 | exec [interpreter] < nothing |
|---|
| 240 | foreach p [glob -nocomplain c:/tcl*.tmp] { |
|---|
| 241 | if {[lsearch $existing $p] == -1} { |
|---|
| 242 | lappend x $p |
|---|
| 243 | } |
|---|
| 244 | } |
|---|
| 245 | set x |
|---|
| 246 | } {} |
|---|
| 247 | test winpipe-5.2 {TclpCreateTempFile: TMP and TEMP not defined} {win exec} { |
|---|
| 248 | set tmp $env(TMP) |
|---|
| 249 | set temp $env(TEMP) |
|---|
| 250 | unset env(TMP) |
|---|
| 251 | unset env(TEMP) |
|---|
| 252 | exec [interpreter] < nothing |
|---|
| 253 | set env(TMP) $tmp |
|---|
| 254 | set env(TEMP) $temp |
|---|
| 255 | set x {} |
|---|
| 256 | } {} |
|---|
| 257 | test winpipe-5.3 {TclpCreateTempFile: TMP specifies non-existent directory} \ |
|---|
| 258 | {win exec } { |
|---|
| 259 | set tmp $env(TMP) |
|---|
| 260 | set env(TMP) snarky |
|---|
| 261 | exec [interpreter] < nothing |
|---|
| 262 | set env(TMP) $tmp |
|---|
| 263 | set x {} |
|---|
| 264 | } {} |
|---|
| 265 | test winpipe-5.4 {TclpCreateTempFile: TEMP specifies non-existent directory} \ |
|---|
| 266 | {win exec} { |
|---|
| 267 | set tmp $env(TMP) |
|---|
| 268 | set temp $env(TEMP) |
|---|
| 269 | unset env(TMP) |
|---|
| 270 | set env(TEMP) snarky |
|---|
| 271 | exec [interpreter] < nothing |
|---|
| 272 | set env(TMP) $tmp |
|---|
| 273 | set env(TEMP) $temp |
|---|
| 274 | set x {} |
|---|
| 275 | } {} |
|---|
| 276 | |
|---|
| 277 | test winpipe-6.1 {PipeSetupProc & PipeCheckProc: read threads} \ |
|---|
| 278 | {win exec cat32} { |
|---|
| 279 | set f [open "|[list $cat32]" r+] |
|---|
| 280 | fconfigure $f -blocking 0 |
|---|
| 281 | fileevent $f writable { set x writable } |
|---|
| 282 | set x {} |
|---|
| 283 | vwait x |
|---|
| 284 | fileevent $f writable {} |
|---|
| 285 | fileevent $f readable { lappend x readable } |
|---|
| 286 | after 100 { lappend x timeout } |
|---|
| 287 | vwait x |
|---|
| 288 | puts $f foobar |
|---|
| 289 | flush $f |
|---|
| 290 | vwait x |
|---|
| 291 | lappend x [read $f] |
|---|
| 292 | after 100 { lappend x timeout } |
|---|
| 293 | vwait x |
|---|
| 294 | fconfigure $f -blocking 1 |
|---|
| 295 | lappend x [catch {close $f} msg] $msg |
|---|
| 296 | } {writable timeout readable {foobar |
|---|
| 297 | } timeout 1 stderr32} |
|---|
| 298 | test winpipe-6.2 {PipeSetupProc & PipeCheckProc: write threads} \ |
|---|
| 299 | {win exec cat32} { |
|---|
| 300 | set f [open "|[list $cat32]" r+] |
|---|
| 301 | fconfigure $f -blocking 0 |
|---|
| 302 | fileevent $f writable { set x writable } |
|---|
| 303 | set x {} |
|---|
| 304 | vwait x |
|---|
| 305 | puts -nonewline $f $big$big$big$big |
|---|
| 306 | flush $f |
|---|
| 307 | after 100 { lappend x timeout } |
|---|
| 308 | vwait x |
|---|
| 309 | lappend x [catch {close $f} msg] $msg |
|---|
| 310 | } {writable timeout 0 {}} |
|---|
| 311 | |
|---|
| 312 | set path(echoArgs.tcl) [makeFile { |
|---|
| 313 | puts "[list $argv0 $argv]" |
|---|
| 314 | } echoArgs.tcl] |
|---|
| 315 | |
|---|
| 316 | |
|---|
| 317 | ### validate the raw output of BuildCommandLine(). |
|---|
| 318 | ### |
|---|
| 319 | test winpipe-7.1 {BuildCommandLine: null arguments} {win exec} { |
|---|
| 320 | exec $env(COMSPEC) /c echo foo "" bar |
|---|
| 321 | } {foo "" bar} |
|---|
| 322 | test winpipe-7.2 {BuildCommandLine: null arguments} {win exec} { |
|---|
| 323 | exec $env(COMSPEC) /c echo foo {} bar |
|---|
| 324 | } {foo "" bar} |
|---|
| 325 | test winpipe-7.3 {BuildCommandLine: dbl quote quoting #1} {win exec} { |
|---|
| 326 | exec $env(COMSPEC) /c echo foo "\"" bar |
|---|
| 327 | } {foo \" bar} |
|---|
| 328 | test winpipe-7.4 {BuildCommandLine: dbl quote quoting #2} {win exec} { |
|---|
| 329 | exec $env(COMSPEC) /c echo foo {""} bar |
|---|
| 330 | } {foo \"\" bar} |
|---|
| 331 | test winpipe-7.5 {BuildCommandLine: dbl quote quoting #3} {win exec} { |
|---|
| 332 | exec $env(COMSPEC) /c echo foo "\" " bar |
|---|
| 333 | } {foo "\" " bar} |
|---|
| 334 | test winpipe-7.6 {BuildCommandLine: dbl quote quoting #4} {win exec} { |
|---|
| 335 | exec $env(COMSPEC) /c echo foo {a="b"} bar |
|---|
| 336 | } {foo a=\"b\" bar} |
|---|
| 337 | test winpipe-7.7 {BuildCommandLine: dbl quote quoting #5} {win exec} { |
|---|
| 338 | exec $env(COMSPEC) /c echo foo {a = "b"} bar |
|---|
| 339 | } {foo "a = \"b\"" bar} |
|---|
| 340 | test winpipe-7.8 {BuildCommandLine: dbl quote quoting #6} {win exec} { |
|---|
| 341 | exec $env(COMSPEC) /c echo {"hello"} {""hello""} {"""hello"""} {"\"hello\""} {he llo} "he \" llo" |
|---|
| 342 | } {\"hello\" \"\"hello\"\" \"\"\"hello\"\"\" \"\\\"hello\\\"\" "he llo" "he \" llo"} |
|---|
| 343 | test winpipe-7.9 {BuildCommandLine: N backslashes followed a quote rule #1} {win exec} { |
|---|
| 344 | exec $env(COMSPEC) /c echo foo \\ bar |
|---|
| 345 | } {foo \ bar} |
|---|
| 346 | test winpipe-7.10 {BuildCommandLine: N backslashes followed a quote rule #2} {win exec} { |
|---|
| 347 | exec $env(COMSPEC) /c echo foo \\\\ bar |
|---|
| 348 | } {foo \\ bar} |
|---|
| 349 | test winpipe-7.11 {BuildCommandLine: N backslashes followed a quote rule #3} {win exec} { |
|---|
| 350 | exec $env(COMSPEC) /c echo foo \\\ \\ bar |
|---|
| 351 | } {foo "\ \\" bar} |
|---|
| 352 | test winpipe-7.12 {BuildCommandLine: N backslashes followed a quote rule #4} {win exec} { |
|---|
| 353 | exec $env(COMSPEC) /c echo foo \\\ \\\\ bar |
|---|
| 354 | } {foo "\ \\\\" bar} |
|---|
| 355 | test winpipe-7.13 {BuildCommandLine: N backslashes followed a quote rule #5} {win exec} { |
|---|
| 356 | exec $env(COMSPEC) /c echo foo \\\ \\\\\\ bar |
|---|
| 357 | } {foo "\ \\\\\\" bar} |
|---|
| 358 | test winpipe-7.14 {BuildCommandLine: N backslashes followed a quote rule #6} {win exec} { |
|---|
| 359 | exec $env(COMSPEC) /c echo foo \\\ \\\" bar |
|---|
| 360 | } {foo "\ \\\"" bar} |
|---|
| 361 | test winpipe-7.15 {BuildCommandLine: N backslashes followed a quote rule #7} {win exec} { |
|---|
| 362 | exec $env(COMSPEC) /c echo foo \\\ \\\\\" bar |
|---|
| 363 | } {foo "\ \\\\\"" bar} |
|---|
| 364 | test winpipe-7.16 {BuildCommandLine: N backslashes followed a quote rule #8} {win exec} { |
|---|
| 365 | exec $env(COMSPEC) /c echo foo \\\ \\\\\\\" bar |
|---|
| 366 | } {foo "\ \\\\\\\"" bar} |
|---|
| 367 | test winpipe-7.17 {BuildCommandLine: special chars #4} {win exec} { |
|---|
| 368 | exec $env(COMSPEC) /c echo foo \{ bar |
|---|
| 369 | } "foo \{ bar" |
|---|
| 370 | test winpipe-7.18 {BuildCommandLine: special chars #5} {win exec} { |
|---|
| 371 | exec $env(COMSPEC) /c echo foo \} bar |
|---|
| 372 | } "foo \} bar" |
|---|
| 373 | |
|---|
| 374 | ### validate the pass-thru from BuildCommandLine() to the crt's parse_cmdline(). |
|---|
| 375 | ### |
|---|
| 376 | test winpipe-8.1 {BuildCommandLine/parse_cmdline pass-thru: null arguments} {win exec} { |
|---|
| 377 | exec [interpreter] $path(echoArgs.tcl) foo "" bar |
|---|
| 378 | } [list $path(echoArgs.tcl) [list foo {} bar]] |
|---|
| 379 | test winpipe-8.2 {BuildCommandLine/parse_cmdline pass-thru: null arguments} {win exec} { |
|---|
| 380 | exec [interpreter] $path(echoArgs.tcl) foo {} bar |
|---|
| 381 | } [list $path(echoArgs.tcl) [list foo {} bar]] |
|---|
| 382 | test winpipe-8.3 {BuildCommandLine/parse_cmdline pass-thru: dbl quote quoting #1} {win exec} { |
|---|
| 383 | exec [interpreter] $path(echoArgs.tcl) foo "\"" bar |
|---|
| 384 | } [list $path(echoArgs.tcl) [list foo "\"" bar]] |
|---|
| 385 | test winpipe-8.4 {BuildCommandLine/parse_cmdline pass-thru: dbl quote quoting #2} {win exec} { |
|---|
| 386 | exec [interpreter] $path(echoArgs.tcl) foo {""} bar |
|---|
| 387 | } [list $path(echoArgs.tcl) [list foo {""} bar]] |
|---|
| 388 | test winpipe-8.5 {BuildCommandLine/parse_cmdline pass-thru: dbl quote quoting #3} {win exec} { |
|---|
| 389 | exec [interpreter] $path(echoArgs.tcl) foo "\" " bar |
|---|
| 390 | } [list $path(echoArgs.tcl) [list foo "\" " bar]] |
|---|
| 391 | test winpipe-8.6 {BuildCommandLine/parse_cmdline pass-thru: dbl quote quoting #4} {win exec} { |
|---|
| 392 | exec [interpreter] $path(echoArgs.tcl) foo {a="b"} bar |
|---|
| 393 | } [list $path(echoArgs.tcl) [list foo {a="b"} bar]] |
|---|
| 394 | test winpipe-8.7 {BuildCommandLine/parse_cmdline pass-thru: dbl quote quoting #5} {win exec} { |
|---|
| 395 | exec [interpreter] $path(echoArgs.tcl) foo {a = "b"} bar |
|---|
| 396 | } [list $path(echoArgs.tcl) [list foo {a = "b"} bar]] |
|---|
| 397 | test winpipe-8.8 {BuildCommandLine/parse_cmdline pass-thru: dbl quote quoting #6} {win exec} { |
|---|
| 398 | exec [interpreter] $path(echoArgs.tcl) {"hello"} {""hello""} {"""hello"""} {"\"hello\""} {he llo} {he " llo} |
|---|
| 399 | } [list $path(echoArgs.tcl) [list {"hello"} {""hello""} {"""hello"""} {"\"hello\""} {he llo} {he " llo}]] |
|---|
| 400 | test winpipe-8.9 {BuildCommandLine/parse_cmdline pass-thru: N backslashes followed a quote rule #1} {win exec} { |
|---|
| 401 | exec [interpreter] $path(echoArgs.tcl) foo \\ bar |
|---|
| 402 | } [list $path(echoArgs.tcl) [list foo \\ bar]] |
|---|
| 403 | test winpipe-8.10 {BuildCommandLine/parse_cmdline pass-thru: N backslashes followed a quote rule #2} {win exec} { |
|---|
| 404 | exec [interpreter] $path(echoArgs.tcl) foo \\\\ bar |
|---|
| 405 | } [list $path(echoArgs.tcl) [list foo \\\\ bar]] |
|---|
| 406 | test winpipe-8.11 {BuildCommandLine/parse_cmdline pass-thru: N backslashes followed a quote rule #3} {win exec} { |
|---|
| 407 | exec [interpreter] $path(echoArgs.tcl) foo \\\ \\ bar |
|---|
| 408 | } [list $path(echoArgs.tcl) [list foo \\\ \\ bar]] |
|---|
| 409 | test winpipe-8.12 {BuildCommandLine/parse_cmdline pass-thru: N backslashes followed a quote rule #4} {win exec} { |
|---|
| 410 | exec [interpreter] $path(echoArgs.tcl) foo \\\ \\\\ bar |
|---|
| 411 | } [list $path(echoArgs.tcl) [list foo \\\ \\\\ bar]] |
|---|
| 412 | test winpipe-8.13 {BuildCommandLine/parse_cmdline pass-thru: N backslashes followed a quote rule #5} {win exec} { |
|---|
| 413 | exec [interpreter] $path(echoArgs.tcl) foo \\\ \\\\\\ bar |
|---|
| 414 | } [list $path(echoArgs.tcl) [list foo \\\ \\\\\\ bar]] |
|---|
| 415 | test winpipe-8.14 {BuildCommandLine/parse_cmdline pass-thru: N backslashes followed a quote rule #6} {win exec} { |
|---|
| 416 | exec [interpreter] $path(echoArgs.tcl) foo \\\ \\\" bar |
|---|
| 417 | } [list $path(echoArgs.tcl) [list foo \\\ \\\" bar]] |
|---|
| 418 | test winpipe-8.15 {BuildCommandLine/parse_cmdline pass-thru: N backslashes followed a quote rule #7} {win exec} { |
|---|
| 419 | exec [interpreter] $path(echoArgs.tcl) foo \\\ \\\\\" bar |
|---|
| 420 | } [list $path(echoArgs.tcl) [list foo \\\ \\\\\" bar]] |
|---|
| 421 | test winpipe-8.16 {BuildCommandLine/parse_cmdline pass-thru: N backslashes followed a quote rule #8} {win exec} { |
|---|
| 422 | exec [interpreter] $path(echoArgs.tcl) foo \\\ \\\\\\\" bar |
|---|
| 423 | } [list $path(echoArgs.tcl) [list foo \\\ \\\\\\\" bar]] |
|---|
| 424 | test winpipe-8.17 {BuildCommandLine/parse_cmdline pass-thru: special chars #1} {win exec} { |
|---|
| 425 | exec [interpreter] $path(echoArgs.tcl) foo \{ bar |
|---|
| 426 | } [list $path(echoArgs.tcl) [list foo \{ bar]] |
|---|
| 427 | test winpipe-8.18 {BuildCommandLine/parse_cmdline pass-thru: special chars #2} {win exec} { |
|---|
| 428 | exec [interpreter] $path(echoArgs.tcl) foo \} bar |
|---|
| 429 | } [list $path(echoArgs.tcl) [list foo \} bar]] |
|---|
| 430 | test winpipe-8.19 {ensure parse_cmdline isn't doing wildcard replacement} {win exec} { |
|---|
| 431 | exec [interpreter] $path(echoArgs.tcl) foo * makefile.?c bar |
|---|
| 432 | } [list $path(echoArgs.tcl) [list foo * makefile.?c bar]] |
|---|
| 433 | |
|---|
| 434 | # restore old values for env(TMP) and env(TEMP) |
|---|
| 435 | |
|---|
| 436 | if {[catch {set env(TMP) $env_tmp}]} { |
|---|
| 437 | unset env(TMP) |
|---|
| 438 | } |
|---|
| 439 | if {[catch {set env(TEMP) $env_temp}]} { |
|---|
| 440 | unset env(TEMP) |
|---|
| 441 | } |
|---|
| 442 | |
|---|
| 443 | # cleanup |
|---|
| 444 | file delete big little stdout stderr nothing echoArgs.tcl |
|---|
| 445 | ::tcltest::cleanupTests |
|---|
| 446 | return |
|---|