summaryrefslogtreecommitdiff
path: root/bdb/test/dead002.tcl
diff options
context:
space:
mode:
Diffstat (limited to 'bdb/test/dead002.tcl')
-rw-r--r--bdb/test/dead002.tcl49
1 files changed, 28 insertions, 21 deletions
diff --git a/bdb/test/dead002.tcl b/bdb/test/dead002.tcl
index 83cc6c7d59b..bc19e7127e5 100644
--- a/bdb/test/dead002.tcl
+++ b/bdb/test/dead002.tcl
@@ -1,52 +1,58 @@
# See the file LICENSE for redistribution information.
#
-# Copyright (c) 1996, 1997, 1998, 1999, 2000
+# Copyright (c) 1996-2002
# Sleepycat Software. All rights reserved.
#
-# $Id: dead002.tcl,v 11.15 2000/08/25 14:21:50 sue Exp $
+# $Id: dead002.tcl,v 11.23 2002/09/05 17:23:05 sandstro Exp $
#
-# Deadlock Test 2.
-# Identical to Test 1 except that instead of running a standalone deadlock
-# detector, we create the region with "detect on every wait"
-proc dead002 { { procs "2 4 10" } {tests "ring clump" } } {
+# TEST dead002
+# TEST Same test as dead001, but use "detect on every collision" instead
+# TEST of separate deadlock detector.
+proc dead002 { { procs "2 4 10" } {tests "ring clump" } \
+ {timeout 0} {tnum 002} } {
source ./include.tcl
- puts "Dead002: Deadlock detector tests"
+ puts "Dead$tnum: Deadlock detector tests"
env_cleanup $testdir
# Create the environment.
- puts "\tDead002.a: creating environment"
- set env [berkdb env \
- -create -mode 0644 -home $testdir -lock -lock_detect default]
+ puts "\tDead$tnum.a: creating environment"
+ set lmode "default"
+ if { $timeout != 0 } {
+ set lmode "expire"
+ }
+ set env [berkdb_env \
+ -create -mode 0644 -home $testdir \
+ -lock -txn_timeout $timeout -lock_detect $lmode]
error_check_good lock_env:open [is_valid_env $env] TRUE
- error_check_good lock_env:close [$env close] 0
foreach t $tests {
- set pidlist ""
foreach n $procs {
+ set pidlist ""
sentinel_init
# Fire off the tests
- puts "\tDead002: $n procs of test $t"
+ puts "\tDead$tnum: $n procs of test $t"
for { set i 0 } { $i < $n } { incr i } {
+ set locker [$env lock_id]
puts "$tclsh_path $test_path/wrap.tcl \
- $testdir/dead002.log.$i \
- ddscript.tcl $testdir $t $i $i $n"
+ $testdir/dead$tnum.log.$i \
+ ddscript.tcl $testdir $t $locker $i $n"
set p [exec $tclsh_path \
$test_path/wrap.tcl \
- ddscript.tcl $testdir/dead002.log.$i \
- $testdir $t $i $i $n &]
+ ddscript.tcl $testdir/dead$tnum.log.$i \
+ $testdir $t $locker $i $n &]
lappend pidlist $p
}
- watch_procs 5
+ watch_procs $pidlist 5
# Now check output
set dead 0
set clean 0
set other 0
for { set i 0 } { $i < $n } { incr i } {
- set did [open $testdir/dead002.log.$i]
+ set did [open $testdir/dead$tnum.log.$i]
while { [gets $did val] != -1 } {
switch $val {
DEADLOCK { incr dead }
@@ -56,13 +62,14 @@ proc dead002 { { procs "2 4 10" } {tests "ring clump" } } {
}
close $did
}
- dead_check $t $n $dead $clean $other
+ dead_check $t $n $timeout $dead $clean $other
}
}
fileremove -f $testdir/dd.out
# Remove log files
for { set i 0 } { $i < $n } { incr i } {
- fileremove -f $testdir/dead002.log.$i
+ fileremove -f $testdir/dead$tnum.log.$i
}
+ error_check_good lock_env:close [$env close] 0
}