summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjan.nijtmans <nijtmans@users.sourceforge.net>2013-08-05 22:06:26 (GMT)
committerjan.nijtmans <nijtmans@users.sourceforge.net>2013-08-05 22:06:26 (GMT)
commitcee0f2ccd94dcacbfb501f4933aa409ac15eb120 (patch)
tree896ed6b8438f8442fc641420d303a652e429a5ba
parentaa01137e0e936cc97ab7ba3c80ab39b7772938f0 (diff)
parent715175092b503b0a5c1aa902be13f5c279f4551c (diff)
downloadtcl-bug_c4e230f29b.zip
tcl-bug_c4e230f29b.tar.gz
tcl-bug_c4e230f29b.tar.bz2
rebase against trunkbug_c4e230f29b
-rw-r--r--tests/unixForkEvent.test20
1 files changed, 15 insertions, 5 deletions
diff --git a/tests/unixForkEvent.test b/tests/unixForkEvent.test
index 120f362..3779c65 100644
--- a/tests/unixForkEvent.test
+++ b/tests/unixForkEvent.test
@@ -13,10 +13,9 @@ namespace import -force ::tcltest::*
testConstraint testfork [llength [info commands testfork]]
-# Test if the notifier thread is well initialized in a forked interpreter
-# by Tcl_InitNotifier
+# Test if the notifier thread is well initialized in a forked interpreter.
test unixforkevent-1.1 {fork and test writeable event} \
- -constraints {testfork nonPortable} \
+ -constraints testfork \
-body {
set myFolder [makeDirectory unixtestfork]
set pid [testfork]
@@ -24,17 +23,28 @@ test unixforkevent-1.1 {fork and test writeable event} \
# we are the forked process
set result initialized
set h [open [file join $myFolder test.txt] w]
+ # create a file event and a timeout which fires after 1 second
+ # if the file event did not fire
fileevent $h writable\
"set result writable;\
after cancel [after 1000 {set result timeout}]"
vwait result
close $h
+ # write result file
makeFile $result result.txt $myFolder
+ # write trigger file, that result file is fully written
+ makeFile "" trigger.txt $myFolder
exit
}
# we are the original process
- while {![file readable [file join $myFolder result.txt]]} {}
- viewFile result.txt $myFolder
+ # look over 1.5 seconds for the file creation by the forked process
+ for {set myTries 0} {$myTries < 15} {incr myTries} {
+ if {[file readable [file join $myFolder trigger.txt]]} {
+ return [viewFile result.txt $myFolder]
+ }
+ after 100
+ }
+ return "forked process stalled"
} \
-result {writable} \
-cleanup {