~ubuntu-branches/ubuntu/maverick/evolution-data-server/maverick-proposed

« back to all changes in this revision

Viewing changes to libdb/test/sdb006.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) 1999-2002
4
 
#       Sleepycat Software.  All rights reserved.
5
 
#
6
 
# $Id$
7
 
#
8
 
# TEST  subdb006
9
 
# TEST  Tests intra-subdb join
10
 
# TEST
11
 
# TEST  We'll test 2-way, 3-way, and 4-way joins and figure that if those work,
12
 
# TEST  everything else does as well.  We'll create test databases called
13
 
# TEST  sub1.db, sub2.db, sub3.db, and sub4.db.  The number on the database
14
 
# TEST  describes the duplication -- duplicates are of the form 0, N, 2N, 3N,
15
 
# TEST  ...  where N is the number of the database.  Primary.db is the primary
16
 
# TEST  database, and sub0.db is the database that has no matching duplicates.
17
 
# TEST  All of these are within a single database.
18
 
#
19
 
# We should test this on all btrees, all hash, and a combination thereof
20
 
proc subdb006 {method {nentries 100} args } {
21
 
        source ./include.tcl
22
 
        global rand_init
23
 
 
24
 
        # NB: these flags are internal only, ok
25
 
        set args [convert_args $method $args]
26
 
        set omethod [convert_method $method]
27
 
 
28
 
        if { [is_record_based $method] == 1 || [is_rbtree $method] } {
29
 
                puts "\tSubdb006 skipping for method $method."
30
 
                return
31
 
        }
32
 
 
33
 
        set txnenv 0
34
 
        set eindex [lsearch -exact $args "-env"]
35
 
        #
36
 
        # If we are using an env, then testfile should just be the db name.
37
 
        # Otherwise it is the test directory and the name.
38
 
        if { $eindex == -1 } {
39
 
                set testfile $testdir/subdb006.db
40
 
                set env NULL
41
 
        } else {
42
 
                set testfile subdb006.db
43
 
                incr eindex
44
 
                set env [lindex $args $eindex]
45
 
                set txnenv [is_txnenv $env]
46
 
                if { $txnenv == 1 } {
47
 
                        append args " -auto_commit "
48
 
                        if { $nentries == 100 } {
49
 
                                # !!!
50
 
                                # nentries must be greater than the number
51
 
                                # of do_join_subdb calls below.
52
 
                                #
53
 
                                set nentries 35
54
 
                        }
55
 
                }
56
 
                set testdir [get_home $env]
57
 
        }
58
 
        berkdb srand $rand_init
59
 
 
60
 
        set oargs $args
61
 
        foreach opt {" -dup" " -dupsort"} {
62
 
                append args $opt
63
 
 
64
 
                puts "Subdb006: $method ( $args ) Intra-subdb join"
65
 
                set txn ""
66
 
                #
67
 
                # Get a cursor in each subdb and move past the end of each
68
 
                # subdb.  Make sure we don't end up in another subdb.
69
 
                #
70
 
                puts "\tSubdb006.a: Intra-subdb join"
71
 
 
72
 
                if { $env != "NULL" } {
73
 
                        set testdir [get_home $env]
74
 
                }
75
 
                cleanup $testdir $env
76
 
 
77
 
                set psize 8192
78
 
                set duplist {0 50 25 16 12}
79
 
                set numdb [llength $duplist]
80
 
                build_all_subdb $testfile [list $method] $psize \
81
 
                    $duplist $nentries $args
82
 
 
83
 
                # Build the primary
84
 
                puts "Subdb006: Building the primary database $method"
85
 
                set oflags "-create -mode 0644 [conv $omethod \
86
 
                    [berkdb random_int 1 2]]"
87
 
                set db [eval {berkdb_open} $oflags $oargs $testfile primary.db]
88
 
                error_check_good dbopen [is_valid_db $db] TRUE
89
 
                for { set i 0 } { $i < 1000 } { incr i } {
90
 
                        if { $txnenv == 1 } {
91
 
                                set t [$env txn]
92
 
                                error_check_good txn [is_valid_txn $t $env] TRUE
93
 
                                set txn "-txn $t"
94
 
                        }
95
 
                        set key [format "%04d" $i]
96
 
                        set ret [eval {$db put} $txn {$key stub}]
97
 
                        error_check_good "primary put" $ret 0
98
 
                        if { $txnenv == 1 } {
99
 
                                error_check_good txn [$t commit] 0
100
 
                        }
101
 
                }
102
 
                error_check_good "primary close" [$db close] 0
103
 
                set did [open $dict]
104
 
                gets $did str
105
 
                do_join_subdb $testfile primary.db "1 0" $str $oargs
106
 
                gets $did str
107
 
                do_join_subdb $testfile primary.db "2 0" $str $oargs
108
 
                gets $did str
109
 
                do_join_subdb $testfile primary.db "3 0" $str $oargs
110
 
                gets $did str
111
 
                do_join_subdb $testfile primary.db "4 0" $str $oargs
112
 
                gets $did str
113
 
                do_join_subdb $testfile primary.db "1" $str $oargs
114
 
                gets $did str
115
 
                do_join_subdb $testfile primary.db "2" $str $oargs
116
 
                gets $did str
117
 
                do_join_subdb $testfile primary.db "3" $str $oargs
118
 
                gets $did str
119
 
                do_join_subdb $testfile primary.db "4" $str $oargs
120
 
                gets $did str
121
 
                do_join_subdb $testfile primary.db "1 2" $str $oargs
122
 
                gets $did str
123
 
                do_join_subdb $testfile primary.db "1 2 3" $str $oargs
124
 
                gets $did str
125
 
                do_join_subdb $testfile primary.db "1 2 3 4" $str $oargs
126
 
                gets $did str
127
 
                do_join_subdb $testfile primary.db "2 1" $str $oargs
128
 
                gets $did str
129
 
                do_join_subdb $testfile primary.db "3 2 1" $str $oargs
130
 
                gets $did str
131
 
                do_join_subdb $testfile primary.db "4 3 2 1" $str $oargs
132
 
                gets $did str
133
 
                do_join_subdb $testfile primary.db "1 3" $str $oargs
134
 
                gets $did str
135
 
                do_join_subdb $testfile primary.db "3 1" $str $oargs
136
 
                gets $did str
137
 
                do_join_subdb $testfile primary.db "1 4" $str $oargs
138
 
                gets $did str
139
 
                do_join_subdb $testfile primary.db "4 1" $str $oargs
140
 
                gets $did str
141
 
                do_join_subdb $testfile primary.db "2 3" $str $oargs
142
 
                gets $did str
143
 
                do_join_subdb $testfile primary.db "3 2" $str $oargs
144
 
                gets $did str
145
 
                do_join_subdb $testfile primary.db "2 4" $str $oargs
146
 
                gets $did str
147
 
                do_join_subdb $testfile primary.db "4 2" $str $oargs
148
 
                gets $did str
149
 
                do_join_subdb $testfile primary.db "3 4" $str $oargs
150
 
                gets $did str
151
 
                do_join_subdb $testfile primary.db "4 3" $str $oargs
152
 
                gets $did str
153
 
                do_join_subdb $testfile primary.db "2 3 4" $str $oargs
154
 
                gets $did str
155
 
                do_join_subdb $testfile primary.db "3 4 1" $str $oargs
156
 
                gets $did str
157
 
                do_join_subdb $testfile primary.db "4 2 1" $str $oargs
158
 
                gets $did str
159
 
                do_join_subdb $testfile primary.db "0 2 1" $str $oargs
160
 
                gets $did str
161
 
                do_join_subdb $testfile primary.db "3 2 0" $str $oargs
162
 
                gets $did str
163
 
                do_join_subdb $testfile primary.db "4 3 2 1" $str $oargs
164
 
                gets $did str
165
 
                do_join_subdb $testfile primary.db "4 3 0 1" $str $oargs
166
 
 
167
 
                close $did
168
 
        }
169
 
}