summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorsebres <sebres@users.sourceforge.net>2025-03-07 09:58:57 (GMT)
committersebres <sebres@users.sourceforge.net>2025-03-07 09:58:57 (GMT)
commitd465d9bc0440d7750e83f0695f56572d38a324d6 (patch)
tree7e002aaf3627e7aa06e5ed0546752b986afc6d46
parent082cb4aeb2e74428e0b0298f9796dab53f2f28a8 (diff)
downloadtcl-d465d9bc0440d7750e83f0695f56572d38a324d6.zip
tcl-d465d9bc0440d7750e83f0695f56572d38a324d6.tar.gz
tcl-d465d9bc0440d7750e83f0695f56572d38a324d6.tar.bz2
cmdMZ.test: improve stability of timerate test for quadratic complexity (increase factor for check), also don't run this test on memory-debug builds (may be very time-consuming)
-rw-r--r--tests/cmdMZ.test12
1 files changed, 8 insertions, 4 deletions
diff --git a/tests/cmdMZ.test b/tests/cmdMZ.test
index 1d6a50b..fcd945c 100644
--- a/tests/cmdMZ.test
+++ b/tests/cmdMZ.test
@@ -25,6 +25,8 @@ namespace eval ::tcl::test::cmdMZ {
namespace import ::tcltest::testConstraint
namespace import ::tcltest::test
+ testConstraint memory [llength [info commands memory]]
+
if {[namespace which -command ::tcl::unsupported::timerate] ne ""} {
namespace import ::tcl::unsupported::timerate
}
@@ -487,7 +489,9 @@ test cmdMZ-6.12 {Tcl_TimeRateObjCmd: done optimization: nested call of self insi
}
list [lindex [timerate $m1 1000 5] 2] $x
} {5 20}
-test cmdMZ-6.13 {Tcl_TimeRateObjCmd: stability by O(n**2), avoid long execution time on growing iteration time} {
+test cmdMZ-6.13 {Tcl_TimeRateObjCmd: stability by O(n**2), avoid long execution time on growing iteration time} {!memory} {
+ # don't run this test on memory-debug builds - it seems to be very time-consuming there,
+ # what may led to an unexpectedly high increase by such complexity and it'd fail...
set result {}
# test the function with quadratic complexity (iteration growth 2x, 10x, 100x):
foreach e {2 10 100} {
@@ -498,10 +502,10 @@ test cmdMZ-6.13 {Tcl_TimeRateObjCmd: stability by O(n**2), avoid long execution
}} [set x [expr {$x*$e}]]
} 50]
lappend result "${e}x"
- # check it was too slow (it is OK to use factor 2 to prevent sporadic
- # errors on some slow systems or time issues, because if it is not fixed,
+ # check it was too slow (it is OK to use factor 10 to prevent sporadic
+ # errors on some slow systems or timing issues, because if it is not fixed,
# the execution time may grow hundreds and thousand times):
- if {[lindex $m1 6] > 50 * 2} {
+ if {[lindex $m1 6] > 50 * 10} {
lappend result "unexpected long: $m1"
}
}