diff options
author | Steve Bennett <steveb@workware.net.au> | 2011-12-15 11:01:51 +1000 |
---|---|---|
committer | Steve Bennett <steveb@workware.net.au> | 2011-12-16 13:10:13 +1000 |
commit | d0ac7ddf7cd922aa4f9b691b6414c3c7f22b08f1 (patch) | |
tree | 5bb0e9a29afd1cf7d0c87f8feec592b65a946e3f | |
parent | 73d257c2f0389f860d7f8fe826feee89f56dfbbb (diff) | |
download | jimtcl-d0ac7ddf7cd922aa4f9b691b6414c3c7f22b08f1.zip jimtcl-d0ac7ddf7cd922aa4f9b691b6414c3c7f22b08f1.tar.gz jimtcl-d0ac7ddf7cd922aa4f9b691b6414c3c7f22b08f1.tar.bz2 |
Fix some tests so they run on mingw
exec and pid tests
-rw-r--r-- | tests/exec.test | 15 | ||||
-rw-r--r-- | tests/filecopy.test | 6 | ||||
-rw-r--r-- | tests/pid.test | 3 |
3 files changed, 13 insertions, 11 deletions
diff --git a/tests/exec.test b/tests/exec.test index 02d8c24..5a027f4 100644 --- a/tests/exec.test +++ b/tests/exec.test @@ -31,7 +31,8 @@ puts $f { after [expr {int($seconds * 1000)}] } close $f -catch {exec chmod +x sleepx} +#catch {exec chmod +x sleepx} +set sleepx [list [info nameofexecutable] sleepx] # Basic operations. @@ -236,7 +237,7 @@ test exec-9.2 {commands returning errors} { catch {exec echo foo | foo123} msg } {1} test exec-9.3 {commands returning errors} { - list [catch {exec ./sleepx 0.1 | false | ./sleepx 0.1} msg] + list [catch {exec {*}$sleepx 0.1 | false | {*}$sleepx 0.1} msg] } {1} test exec-9.4 {commands returning errors} jim { list [catch {exec false | echo "foo bar"} msg] $msg @@ -322,29 +323,29 @@ close $f # Commands in background. test exec-11.1 {commands in background} { - set x [lindex [time {exec ./sleepx 0.2 &}] 0] + set x [lindex [time {exec {*}$sleepx 0.2 &}] 0] expr $x<1000000 } 1 test exec-11.2 {commands in background} { list [catch {exec echo a &b} msg] $msg } {0 {a &b}} test exec-11.3 {commands in background} { - llength [exec ./sleepx 0.1 &] + llength [exec {*}$sleepx 0.1 &] } 1 test exec-11.4 {commands in background} { - llength [exec ./sleepx 0.1 | ./sleepx 0.1 | ./sleepx 0.1 &] + llength [exec {*}$sleepx 0.1 | {*}$sleepx 0.1 | {*}$sleepx 0.1 &] } 3 # Make sure that background commands are properly reaped when # they eventually die. -exec ./sleepx 0.3 +exec {*}$sleepx 0.3 test exec-12.1 {reaping background processes} -body { for {set i 0} {$i < 20} {incr i} { exec echo foo > exec.tmp1 & } - exec ./sleepx 0.1 + exec {*}$sleepx 0.1 catch {exec ps | fgrep "echo foo" | fgrep -v fgrep | wc} msg lindex $msg 0 } -cleanup { diff --git a/tests/filecopy.test b/tests/filecopy.test index 853649b..d64a2d9 100644 --- a/tests/filecopy.test +++ b/tests/filecopy.test @@ -55,9 +55,9 @@ test filecopy-2.3 "Source doesn't exist (-force)" { list [catch {file copy -force missing tempfile} msg] $msg } {1 {missing: No such file or directory}} -test filecopy-2.4 "Can't write to target (-force)" { - list [catch {file copy -force testio.in tempdir} msg] $msg -} {1 {tempdir: Is a directory}} +test filecopy-2.4 "Can't write to target (-force)" -body { + file copy -force testio.in tempdir +} -returnCodes error -match glob -result {tempdir: *} test filecopy-2.5 "Source doesn't exist and can't write to target (-force)" { list [catch {file copy -force missing tempdir} msg] $msg diff --git a/tests/pid.test b/tests/pid.test index d7aacda..1a978cd 100644 --- a/tests/pid.test +++ b/tests/pid.test @@ -20,10 +20,11 @@ needs cmd exec catch {package require regexp} testConstraint regexp [expr {[info commands regexp] ne {}}] testConstraint socket [expr {[info commands socket] ne {}}] +testConstraint getpid [expr {[catch pid] == 0}] file delete test1 -test pid-1.1 {pid command} regexp { +test pid-1.1 {pid command} {regexp getpid} { regexp {(^[0-9]+$)|(^0x[0-9a-fA-F]+$)} [pid] } 1 test pid-1.2 {pid command} {regexp socket} { |