summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorpooryorick <com.digitalsmarties@pooryorick.com>2018-06-18 08:09:32 (GMT)
committerpooryorick <com.digitalsmarties@pooryorick.com>2018-06-18 08:09:32 (GMT)
commit155e8a1ad56291fb61f3578f3c7cda632556d1da (patch)
tree712b6519dd5dfe5e0404db6301bab7027786395a
parent625aca976acac85e85a36f68a3727d2eec785922 (diff)
downloadtcl-155e8a1ad56291fb61f3578f3c7cda632556d1da.zip
tcl-155e8a1ad56291fb61f3578f3c7cda632556d1da.tar.gz
tcl-155e8a1ad56291fb61f3578f3c7cda632556d1da.tar.bz2
Avoid valgrind "still reachable" reports stemming from early termination of
threads.
-rw-r--r--tests/async.test40
1 files changed, 29 insertions, 11 deletions
diff --git a/tests/async.test b/tests/async.test
index cb67cc2..e7fc45a 100644
--- a/tests/async.test
+++ b/tests/async.test
@@ -157,17 +157,24 @@ test async-4.1 {async interrupting bytecode sequence} -constraints {
}
} -body {
apply {{handle} {
- global aresult
- set aresult {Async event not delivered}
- testasync marklater $handle
- for {set i 0} {
- $i < 2500000 && $aresult eq "Async event not delivered"
- } {incr i} {
- nothing
- }
+ global aresult
+ set aresult {Async event not delivered}
+ testasync marklater $handle
+ # allow plenty of time to pass in case valgrind is running
+ set start [clock seconds]
+ while {
+ [clock seconds] - $start < 180 && $aresult eq "Async event not delivered"
+ } {
+ # be less busy
+ after 100
+ nothing
+ }
return $aresult
}} $hm
} -result {test pattern} -cleanup {
+ # give other threads some time to go way so that valgrind doesn't pick up
+ # "still reachable" cases from early thread termination
+ after 100
testasync delete $hm
}
test async-4.2 {async interrupting straight bytecode sequence} -constraints {
@@ -179,12 +186,20 @@ test async-4.2 {async interrupting straight bytecode sequence} -constraints {
global aresult
set aresult {Async event not delivered}
testasync marklater $handle
- for {set i 0} {
- $i < 2500000 && $aresult eq "Async event not delivered"
- } {incr i} {}
+ # allow plenty of time to pass in case valgrind is running
+ set start [clock seconds]
+ while {
+ [clock seconds] - $start < 180 && $aresult eq "Async event not delivered"
+ } {
+ # be less busy
+ after 100
+ }
return $aresult
}} $hm
} -result {test pattern} -cleanup {
+ # give other threads some time to go way so that valgrind doesn't pick up
+ # "still reachable" cases from early thread termination
+ after 100
testasync delete $hm
}
test async-4.3 {async interrupting loop-less bytecode sequence} -constraints {
@@ -201,6 +216,9 @@ test async-4.3 {async interrupting loop-less bytecode sequence} -constraints {
return $aresult
}]] $hm
} -result {test pattern} -cleanup {
+ # give other threads some time to go way so that valgrind doesn't pick up
+ # "still reachable" cases from early thread termination
+ after 100
testasync delete $hm
}