1 # This file contains a collection of tests for the procedures in the file
2 # tclUnixNotify.c. Sourcing this file into Tcl runs the tests and
3 # generates output for errors. No output means no errors were found.
5 # Copyright (c) 1995-1997 Sun Microsystems, Inc.
6 # Copyright (c) 1998-1999 by Scriptics Corporation.
8 # See the file "license.terms" for information on usage and redistribution
9 # of this file, and for a DISCLAIMER OF ALL WARRANTIES.
11 package require tcltest 2.5
12 namespace import -force ::tcltest::*
14 testConstraint testfork [llength [info commands testfork]]
16 # Test if the notifier thread is well initialized in a forked interpreter
18 test unixforkevent-1.1 {fork and test writeable event} \
19 -constraints {testfork nonPortable} \
21 set myFolder [makeDirectory unixtestfork]
24 # we are the forked process
25 set result initialized
26 set h [open [file join $myFolder test.txt] w]
27 fileevent $h writable\
28 "set result writable;\
29 after cancel [after 1000 {set result timeout}]"
32 makeFile $result result.txt $myFolder
35 # we are the original process
36 while {![file readable [file join $myFolder result.txt]]} {}
37 viewFile result.txt $myFolder
41 catch { removeFolder $myFolder }
44 ::tcltest::cleanupTests