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

« back to all changes in this revision

Viewing changes to libdb/test/test076.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) 2000-2002
4
 
#       Sleepycat Software.  All rights reserved.
5
 
#
6
 
# $Id$
7
 
#
8
 
# TEST  test076
9
 
# TEST  Test creation of many small databases in a single environment. [#1528].
10
 
proc test076 { method { ndbs 1000  } { tnum 76 } args } {
11
 
        source ./include.tcl
12
 
 
13
 
        set args [convert_args $method $args]
14
 
        set encargs ""
15
 
        set args [split_encargs $args encargs]
16
 
        set omethod [convert_method $method]
17
 
 
18
 
        if { [is_record_based $method] == 1 } {
19
 
                set key ""
20
 
        } else {
21
 
                set key "key"
22
 
        }
23
 
        set data "datamoredatamoredata"
24
 
 
25
 
        # Create an env if we weren't passed one.
26
 
        set txnenv 0
27
 
        set eindex [lsearch -exact $args "-env"]
28
 
        if { $eindex == -1 } {
29
 
                set deleteenv 1
30
 
                env_cleanup $testdir
31
 
                set env [eval {berkdb_env -create -home} $testdir $encargs]
32
 
                error_check_good env [is_valid_env $env] TRUE
33
 
                set args "$args -env $env"
34
 
        } else {
35
 
                set deleteenv 0
36
 
                incr eindex
37
 
                set env [lindex $args $eindex]
38
 
                set txnenv [is_txnenv $env]
39
 
                if { $txnenv == 1 } {
40
 
                        append args " -auto_commit "
41
 
                        if { $ndbs == 1000 } {
42
 
                                set ndbs 100
43
 
                        }
44
 
                }
45
 
                set testdir [get_home $env]
46
 
        }
47
 
        puts -nonewline "Test0$tnum $method ($args): "
48
 
        puts -nonewline "Create $ndbs"
49
 
        puts " small databases in one env."
50
 
 
51
 
        cleanup $testdir $env
52
 
        set txn ""
53
 
 
54
 
        for { set i 1 } { $i <= $ndbs } { incr i } {
55
 
                set testfile test0$tnum.$i.db
56
 
 
57
 
                set db [eval {berkdb_open -create -mode 0644}\
58
 
                    $args $omethod $testfile]
59
 
                error_check_good db_open($i) [is_valid_db $db] TRUE
60
 
 
61
 
                if { $txnenv == 1 } {
62
 
                        set t [$env txn]
63
 
                        error_check_good txn [is_valid_txn $t $env] TRUE
64
 
                        set txn "-txn $t"
65
 
                }
66
 
                set ret [eval {$db put} $txn {$key$i \
67
 
                    [chop_data $method $data$i]}]
68
 
                error_check_good db_put($i) $ret 0
69
 
                if { $txnenv == 1 } {
70
 
                        error_check_good txn [$t commit] 0
71
 
                }
72
 
                error_check_good db_close($i) [$db close] 0
73
 
        }
74
 
 
75
 
        if { $deleteenv == 1 } {
76
 
                error_check_good env_close [$env close] 0
77
 
        }
78
 
 
79
 
        puts "\tTest0$tnum passed."
80
 
}