head	1.2;
access;
symbols
	RPM_4_2_1:1.1.1.5
	RPM_4_2:1.1.1.5
	RPM_4_1_1:1.1.1.5
	RPM_4_1:1.1.1.4
	RPM_4_0_5:1.1.1.3
	RPM_4_0_4:1.1.1.2
	RPM_4_0_3:1.1.1.1
	RPM:1.1.1;
locks; strict;
comment	@# @;


1.2
date	2008.01.02.09.58.58;	author rse;	state dead;
branches;
next	1.1;
commitid	z4cpSiAhOCXk5PLs;

1.1
date	2001.07.23.20.45.41;	author rse;	state Exp;
branches
	1.1.1.1;
next	;

1.1.1.1
date	2001.07.23.20.45.41;	author rse;	state Exp;
branches;
next	1.1.1.2;

1.1.1.2
date	2002.01.08.01.45.19;	author rse;	state Exp;
branches;
next	1.1.1.3;

1.1.1.3
date	2003.01.18.13.49.10;	author rse;	state Exp;
branches;
next	1.1.1.4;

1.1.1.4
date	2001.10.15.03.47.28;	author rse;	state Exp;
branches;
next	1.1.1.5;

1.1.1.5
date	2003.01.18.14.05.14;	author rse;	state Exp;
branches;
next	;


desc
@@


1.2
log
@remove the ancient RPM 4.2.1 source tree copy
@
text
@# See the file LICENSE for redistribution information.
#
# Copyright (c) 1996-2001
#	Sleepycat Software.  All rights reserved.
#
# $Id: dead003.tcl,v 1.1 2001/07/23 20:45:41 rse Exp $
#
# Deadlock Test 3.
# Test DB_LOCK_OLDEST and DB_LOCK_YOUNGEST
# Identical to Test 2 except that we create the region with "detect on
# every wait" with first the "oldest" and then "youngest".
proc dead003 { { procs "2 4 10" } {tests "ring clump" } } {
	source ./include.tcl

	set detects { oldest youngest }
	puts "Dead003: Deadlock detector tests: $detects"

	# Create the environment.
	foreach d $detects {
		env_cleanup $testdir
		puts "\tDead003.a: creating environment for $d"
		set env [berkdb env \
		    -create -mode 0644 -home $testdir -lock -lock_detect $d]
		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 {
				sentinel_init

				# Fire off the tests
				puts "\tDead003: $n procs of test $t"
				for { set i 0 } { $i < $n } { incr i } {
					puts "$tclsh_path\
					    test_path/ddscript.tcl $testdir \
					    $t $i $i $n >& \
					    $testdir/dead003.log.$i"
					set p [exec $tclsh_path \
					    $test_path/wrap.tcl \
					    ddscript.tcl \
					    $testdir/dead003.log.$i $testdir \
					    $t $i $i $n &]
					lappend pidlist $p
				}
				watch_procs 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/dead003.log.$i]
					while { [gets $did val] != -1 } {
						switch $val {
							DEADLOCK { incr dead }
							1 { incr clean }
							default { incr other }
						}
					}
					close $did
				}
				dead_check $t $n $dead $clean $other
				#
				# If we get here we know we have the
				# correct number of dead/clean procs, as
				# checked by dead_check above.  Now verify
				# that the right process was the one.
				puts "\tDead003: Verify $d locks were aborted"
				set l ""
				if { $d == "oldest" } {
					set l [expr $n - 1]
				}
				if { $d == "youngest" } {
					set l 0
				}
				set did [open $testdir/dead003.log.$l]
				while { [gets $did val] != -1 } {
					error_check_good check_abort \
					    $val 1
				}
				close $did
			}
		}

		fileremove -f $testdir/dd.out
		# Remove log files
		for { set i 0 } { $i < $n } { incr i } {
			fileremove -f $testdir/dead003.log.$i
		}
	}
}
@


1.1
log
@Initial revision
@
text
@d6 1
a6 1
# $Id: dead003.tcl,v 1.10 2001/05/17 20:37:04 bostic Exp $
@


1.1.1.1
log
@Import: RPM 4.0.3
@
text
@@


1.1.1.2
log
@Import: RPM 4.0.4
@
text
@d6 1
a6 1
# Id: dead003.tcl,v 1.14 2001/10/10 16:22:09 ubell Exp 
d8 4
a11 4
# TEST	dead003
# TEST
# TEST	Same test as dead002, but explicitly specify DB_LOCK_OLDEST and
# TEST	DB_LOCK_YOUNGEST.  Verify the correct lock was aborted/granted.
a13 2
	global lock_curid
	global lock_maxid
d25 1
a30 3
				set ret [$env lock_id_set \
				     $lock_curid $lock_maxid]
				error_check_good lock_id_set $ret 0
a34 1
					set locker [$env lock_id]
d37 1
a37 1
					    $t $locker $i $n >& \
d43 1
a43 1
					    $t $locker $i $n &]
d63 1
a63 1
				dead_check $t $n 0 $dead $clean $other
a90 1
		error_check_good lock_env:close [$env close] 0
@


1.1.1.3
log
@Import: RPM 4.0.5
@
text
@d3 1
a3 1
# Copyright (c) 1996-2002
d6 1
a6 1
# Id: dead003.tcl,v 1.17 2002/09/05 17:23:05 sandstro Exp 
d24 1
a24 1
		set env [berkdb_env \
d29 1
a30 1
				set pidlist ""
d51 1
a51 1
				watch_procs $pidlist 5
@


1.1.1.4
log
@Import: RPM 4.1
@
text
@d3 1
a3 1
# Copyright (c) 1996-2001
d6 1
a6 1
# Id: dead003.tcl,v 1.14 2001/10/10 16:22:09 ubell Exp 
d24 1
a24 1
		set env [berkdb env \
a28 1
			set pidlist ""
d30 1
d51 1
a51 1
				watch_procs 5
@


1.1.1.5
log
@Import: RPM 4.1.1
@
text
@d3 1
a3 1
# Copyright (c) 1996-2002
d6 1
a6 1
# Id: dead003.tcl,v 1.17 2002/09/05 17:23:05 sandstro Exp 
d24 1
a24 1
		set env [berkdb_env \
d29 1
a30 1
				set pidlist ""
d51 1
a51 1
				watch_procs $pidlist 5
@


