diff options
author | dkf <donal.k.fellows@manchester.ac.uk> | 2014-09-14 16:51:49 (GMT) |
---|---|---|
committer | dkf <donal.k.fellows@manchester.ac.uk> | 2014-09-14 16:51:49 (GMT) |
commit | 271b5469d26171f90501fd3dc1eea1bf2bd83b08 (patch) | |
tree | 390fd760e66cc765b1400f22af69dc5ef2a00f66 /tests/aaa_exit.test | |
parent | bbf5dede141290a90faaa2bbf2e8abba59d33c04 (diff) | |
parent | 7e17c358eb7a149fbec81f4c2e5d1adefcc90bdd (diff) | |
download | tcl-271b5469d26171f90501fd3dc1eea1bf2bd83b08.zip tcl-271b5469d26171f90501fd3dc1eea1bf2bd83b08.tar.gz tcl-271b5469d26171f90501fd3dc1eea1bf2bd83b08.tar.bz2 |
merge trunk
Diffstat (limited to 'tests/aaa_exit.test')
-rw-r--r-- | tests/aaa_exit.test | 54 |
1 files changed, 54 insertions, 0 deletions
diff --git a/tests/aaa_exit.test b/tests/aaa_exit.test new file mode 100644 index 0000000..3ba5167 --- /dev/null +++ b/tests/aaa_exit.test @@ -0,0 +1,54 @@ +# Commands covered: exit, emphasis on finalization hangs +# +# This file contains a collection of tests for one or more of the Tcl +# built-in commands. Sourcing this file into Tcl runs the tests and +# generates output for errors. No output means no errors were found. +# +# Copyright (c) 1991-1993 The Regents of the University of California. +# Copyright (c) 1994-1997 Sun Microsystems, Inc. +# Copyright (c) 1998-1999 by Scriptics Corporation. +# +# See the file "license.terms" for information on usage and redistribution +# of this file, and for a DISCLAIMER OF ALL WARRANTIES. + +if {[lsearch [namespace children] ::tcltest] == -1} { + package require tcltest 2 + namespace import -force ::tcltest::* +} + +test exit-1.1 {normal, quick exit} { + set f [open "|[interpreter] << \"exec [interpreter] << {set ::env(TCL_FINALIZE_ON_EXIT) 0;exit}\"" r] + set aft [after 1000 {set done "Quick exit hangs !!!"}] + fileevent $f readable {after cancel $aft;set done OK} + vwait done + if {$done != "OK"} { + fconfigure $f -blocking 0 + close $f + } else { + if {[catch {close $f} err]} { + set done "Quick exit misbehaves: $err" + } + } + set done +} OK + +test exit-1.2 {full-finalized exit} { + set f [open "|[interpreter] << \"exec [interpreter] << {set ::env(TCL_FINALIZE_ON_EXIT) 1;exit}\"" r] + set aft [after 1000 {set done "Full-finalized exit hangs !!!"}] + fileevent $f readable {after cancel $aft;set done OK} + vwait done + if {$done != "OK"} { + fconfigure $f -blocking 0 + close $f + } else { + if {[catch {close $f} err]} { + set done "Full-finalized exit misbehaves: $err" + } + } + set done +} OK + + +# cleanup +::tcltest::cleanupTests +return |