summaryrefslogtreecommitdiffstats
path: root/tests/thread.test
diff options
context:
space:
mode:
authorJoe Mistachkin <joe@mistachkin.com>2015-06-05 19:56:12 (GMT)
committerJoe Mistachkin <joe@mistachkin.com>2015-06-05 19:56:12 (GMT)
commit9cfa94b1daf1b9021ee224de86999c051313161d (patch)
tree13506882aa27cdea8ae69d6d6434459d43a923c3 /tests/thread.test
parent810baa10b8d638d119581bcd0ed92f22145c50de (diff)
downloadtcl-9cfa94b1daf1b9021ee224de86999c051313161d.zip
tcl-9cfa94b1daf1b9021ee224de86999c051313161d.tar.gz
tcl-9cfa94b1daf1b9021ee224de86999c051313161d.tar.bz2
Add stress test.
Diffstat (limited to 'tests/thread.test')
-rw-r--r--tests/thread.test26
1 files changed, 26 insertions, 0 deletions
diff --git a/tests/thread.test b/tests/thread.test
index f32ef61..ee09020 100644
--- a/tests/thread.test
+++ b/tests/thread.test
@@ -1412,6 +1412,32 @@ test thread-7.37 {cancel: send async thread cancel nested catch inside pure insi
unset -nocomplain ::threadSawError ::threadError ::threadId ::threadIdStarted
} -result {{} 1 1 {eval unwound}}
+test thread-8.1 {threaded fork stress} -constraints {thread} -setup {
+ unset -nocomplain ::threadCount ::execCount ::threads ::thread
+ set ::threadCount 10
+ set ::execCount 10
+} -body {
+ set ::threads [list]
+ for {set i 0} {$i < $::threadCount} {incr i} {
+ lappend ::threads [thread::create -joinable [string map \
+ [list %execCount% $::execCount] {
+ proc execLs {} {
+ if {$::tcl_platform(platform) eq "windows"} then {
+ return [exec $::env(COMSPEC) /c DIR]
+ } else {
+ return [exec /bin/ls]
+ }
+ }
+ set j {%execCount%}; while {[incr j -1]} {execLs}
+ }]]
+ }
+ foreach ::thread $::threads {
+ thread::join $::thread
+ }
+} -cleanup {
+ unset -nocomplain ::threadCount ::execCount ::threads ::thread
+} -result {}
+
# cleanup
::tcltest::cleanupTests
return