~ubuntu-branches/ubuntu/natty/evolution-data-server/natty

« back to all changes in this revision

Viewing changes to libdb/test/dead003.tcl

  • Committer: Bazaar Package Importer
  • Author(s): Didier Roche
  • Date: 2010-05-17 17:02:06 UTC
  • mfrom: (1.1.79 upstream) (1.6.12 experimental)
  • Revision ID: james.westby@ubuntu.com-20100517170206-4ufr52vwrhh26yh0
Tags: 2.30.1-1ubuntu1
* Merge from debian experimental. Remaining change:
  (LP: #42199, #229669, #173703, #360344, #508494)
  + debian/control:
    - add Vcs-Bzr tag
    - don't use libgnome
    - Use Breaks instead of Conflicts against evolution 2.25 and earlier.
  + debian/evolution-data-server.install,
    debian/patches/45_libcamel_providers_version.patch:
    - use the upstream versioning, not a Debian-specific one 
  + debian/libedata-book1.2-dev.install, debian/libebackend-1.2-dev.install,
    debian/libcamel1.2-dev.install, debian/libedataserverui1.2-dev.install:
    - install html documentation
  + debian/rules:
    - don't build documentation it's shipped with the tarball

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# See the file LICENSE for redistribution information.
2
 
#
3
 
# Copyright (c) 1996-2002
4
 
#       Sleepycat Software.  All rights reserved.
5
 
#
6
 
# $Id$
7
 
#
8
 
# TEST  dead003
9
 
# TEST
10
 
# TEST  Same test as dead002, but explicitly specify DB_LOCK_OLDEST and
11
 
# TEST  DB_LOCK_YOUNGEST.  Verify the correct lock was aborted/granted.
12
 
proc dead003 { { procs "2 4 10" } {tests "ring clump" } } {
13
 
        source ./include.tcl
14
 
        global lock_curid
15
 
        global lock_maxid
16
 
 
17
 
        set detects { oldest youngest }
18
 
        puts "Dead003: Deadlock detector tests: $detects"
19
 
 
20
 
        # Create the environment.
21
 
        foreach d $detects {
22
 
                env_cleanup $testdir
23
 
                puts "\tDead003.a: creating environment for $d"
24
 
                set env [berkdb_env \
25
 
                    -create -mode 0644 -home $testdir -lock -lock_detect $d]
26
 
                error_check_good lock_env:open [is_valid_env $env] TRUE
27
 
 
28
 
                foreach t $tests {
29
 
                        foreach n $procs {
30
 
                                set pidlist ""
31
 
                                sentinel_init
32
 
                                set ret [$env lock_id_set \
33
 
                                     $lock_curid $lock_maxid]
34
 
                                error_check_good lock_id_set $ret 0
35
 
 
36
 
                                # Fire off the tests
37
 
                                puts "\tDead003: $n procs of test $t"
38
 
                                for { set i 0 } { $i < $n } { incr i } {
39
 
                                        set locker [$env lock_id]
40
 
                                        puts "$tclsh_path\
41
 
                                            test_path/ddscript.tcl $testdir \
42
 
                                            $t $locker $i $n >& \
43
 
                                            $testdir/dead003.log.$i"
44
 
                                        set p [exec $tclsh_path \
45
 
                                            $test_path/wrap.tcl \
46
 
                                            ddscript.tcl \
47
 
                                            $testdir/dead003.log.$i $testdir \
48
 
                                            $t $locker $i $n &]
49
 
                                        lappend pidlist $p
50
 
                                }
51
 
                                watch_procs $pidlist 5
52
 
 
53
 
                                # Now check output
54
 
                                set dead 0
55
 
                                set clean 0
56
 
                                set other 0
57
 
                                for { set i 0 } { $i < $n } { incr i } {
58
 
                                        set did [open $testdir/dead003.log.$i]
59
 
                                        while { [gets $did val] != -1 } {
60
 
                                                switch $val {
61
 
                                                        DEADLOCK { incr dead }
62
 
                                                        1 { incr clean }
63
 
                                                        default { incr other }
64
 
                                                }
65
 
                                        }
66
 
                                        close $did
67
 
                                }
68
 
                                dead_check $t $n 0 $dead $clean $other
69
 
                                #
70
 
                                # If we get here we know we have the
71
 
                                # correct number of dead/clean procs, as
72
 
                                # checked by dead_check above.  Now verify
73
 
                                # that the right process was the one.
74
 
                                puts "\tDead003: Verify $d locks were aborted"
75
 
                                set l ""
76
 
                                if { $d == "oldest" } {
77
 
                                        set l [expr $n - 1]
78
 
                                }
79
 
                                if { $d == "youngest" } {
80
 
                                        set l 0
81
 
                                }
82
 
                                set did [open $testdir/dead003.log.$l]
83
 
                                while { [gets $did val] != -1 } {
84
 
                                        error_check_good check_abort \
85
 
                                            $val 1
86
 
                                }
87
 
                                close $did
88
 
                        }
89
 
                }
90
 
 
91
 
                fileremove -f $testdir/dd.out
92
 
                # Remove log files
93
 
                for { set i 0 } { $i < $n } { incr i } {
94
 
                        fileremove -f $testdir/dead003.log.$i
95
 
                }
96
 
                error_check_good lock_env:close [$env close] 0
97
 
        }
98
 
}