diff options
author | Miguel Sofer <miguel.sofer@gmail.com> | 2007-12-05 19:25:09 (GMT) |
---|---|---|
committer | Miguel Sofer <miguel.sofer@gmail.com> | 2007-12-05 19:25:09 (GMT) |
commit | 23b63fa1bae88cf7965c0113afc1738d23b51dd4 (patch) | |
tree | 2436bbf83803f754caefa4f04dd4904f2b51d251 /tests | |
parent | 17fd365668a4dbca60cb9d949353bc47e9d6e356 (diff) | |
download | tcl-23b63fa1bae88cf7965c0113afc1738d23b51dd4.zip tcl-23b63fa1bae88cf7965c0113afc1738d23b51dd4.tar.gz tcl-23b63fa1bae88cf7965c0113afc1738d23b51dd4.tar.bz2 |
* tests/stack.test: made the tests for stack overflow not care
about which mechanism caused the error (interp's recursion limit
or C-stack depth detector).
Diffstat (limited to 'tests')
-rw-r--r-- | tests/stack.test | 27 |
1 files changed, 22 insertions, 5 deletions
diff --git a/tests/stack.test b/tests/stack.test index e09e9c1..aca6571 100644 --- a/tests/stack.test +++ b/tests/stack.test @@ -9,7 +9,7 @@ # See the file "license.terms" for information on usage and redistribution # of this file, and for a DISCLAIMER OF ALL WARRANTIES. # -# RCS: @(#) $Id: stack.test,v 1.20 2006/03/22 18:32:39 rmax Exp $ +# RCS: @(#) $Id: stack.test,v 1.21 2007/12/05 19:25:10 msofer Exp $ if {[lsearch [namespace children] ::tcltest] == -1} { package require tcltest 2 @@ -35,23 +35,40 @@ if {[testConstraint unix]} { } } -test stack-1.1 {maxNestingDepth reached on infinite recursion} {minStack2400} { +# +# Custom match to detect a stack overflow independently of the mechanism that +# triggered the error. +# + +customMatch stackOverflow StackOverflow +proc StackOverflow {- res} { + set msgList [list \ + "too many nested evaluations (infinite loop?)"\ + "out of stack space (infinite loop?)"] + expr {$res in $msgList} +} + +test stack-1.1 {maxNestingDepth reached on infinite recursion} -constraints { + minStack2400 +} -body { # do this in a sub process in case it segfaults exec [interpreter] << { proc recurse {} { recurse } catch { recurse } rv puts $rv } -} {too many nested evaluations (infinite loop?)} +} -match stackOverflow -test stack-2.1 {maxNestingDepth reached on infinite recursion} {minStack2400} { +test stack-2.1 {maxNestingDepth reached on infinite recursion} -constraints { + minStack2400 +} -body { # do this in a sub process in case it segfaults exec [interpreter] << { interp alias {} unknown {} notaknownproc catch { unknown } msg puts $msg } -} {too many nested evaluations (infinite loop?)} +} -match stackOverflow # Make sure that there is enough stack to run regexp even if we're # close to the recursion limit. [Bug 947070] [Patch 746378] |