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

« back to all changes in this revision

Viewing changes to libdb/test/sdb007.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  subdb007
9
 
# TEST  Tests page size difference errors between subdbs.
10
 
# TEST  Test 3 different scenarios for page sizes.
11
 
# TEST  1.  Create/open with a default page size, 2nd subdb create with
12
 
# TEST      specified different one, should error.
13
 
# TEST  2.  Create/open with specific page size, 2nd subdb create with
14
 
# TEST      different one, should error.
15
 
# TEST  3.  Create/open with specified page size, 2nd subdb create with
16
 
# TEST      same specified size, should succeed.
17
 
# TEST  (4th combo of using all defaults is a basic test, done elsewhere)
18
 
proc subdb007 { method args } {
19
 
        source ./include.tcl
20
 
 
21
 
        set db2args [convert_args -btree $args]
22
 
        set args [convert_args $method $args]
23
 
        set omethod [convert_method $method]
24
 
 
25
 
        if { [is_queue $method] == 1 } {
26
 
                puts "Subdb007: skipping for method $method"
27
 
                return
28
 
        }
29
 
        set pgindex [lsearch -exact $args "-pagesize"]
30
 
        if { $pgindex != -1 } {
31
 
                puts "Subdb007: skipping for specific page sizes"
32
 
                return
33
 
        }
34
 
 
35
 
        puts "Subdb007: $method ($args) subdb tests with different page sizes"
36
 
 
37
 
        set txnenv 0
38
 
        set envargs ""
39
 
        set eindex [lsearch -exact $args "-env"]
40
 
        #
41
 
        # If we are using an env, then testfile should just be the db name.
42
 
        # Otherwise it is the test directory and the name.
43
 
        if { $eindex == -1 } {
44
 
                set testfile $testdir/subdb007.db
45
 
                set env NULL
46
 
        } else {
47
 
                set testfile subdb007.db
48
 
                incr eindex
49
 
                set env [lindex $args $eindex]
50
 
                set envargs " -env $env "
51
 
                set txnenv [is_txnenv $env]
52
 
                if { $txnenv == 1 } {
53
 
                        append args " -auto_commit "
54
 
                        append envargs " -auto_commit "
55
 
                        append db2args " -auto_commit "
56
 
                }
57
 
                set testdir [get_home $env]
58
 
        }
59
 
        set sub1 "sub1"
60
 
        set sub2 "sub2"
61
 
        cleanup $testdir $env
62
 
        set txn ""
63
 
 
64
 
        puts "\tSubdb007.a.0: create subdb with default page size"
65
 
        set db [eval {berkdb_open -create -mode 0644} \
66
 
            $args {$omethod $testfile $sub1}]
67
 
        error_check_good subdb [is_valid_db $db] TRUE
68
 
        #
69
 
        # Figure out what the default page size is so that we can
70
 
        # guarantee we create it with a different value.
71
 
        set statret [$db stat]
72
 
        set pgsz 0
73
 
        foreach pair $statret {
74
 
                set fld [lindex $pair 0]
75
 
                if { [string compare $fld {Page size}] == 0 } {
76
 
                        set pgsz [lindex $pair 1]
77
 
                }
78
 
        }
79
 
        error_check_good dbclose [$db close] 0
80
 
 
81
 
        if { $pgsz == 512 } {
82
 
                set pgsz2 2048
83
 
        } else {
84
 
                set pgsz2 512
85
 
        }
86
 
 
87
 
        puts "\tSubdb007.a.1: create 2nd subdb with specified page size"
88
 
        set stat [catch {eval {berkdb_open_noerr -create -btree} \
89
 
            $db2args {-pagesize $pgsz2 $testfile $sub2}} ret]
90
 
        error_check_good subdb:pgsz $stat 1
91
 
        error_check_good subdb:fail [is_substr $ret \
92
 
            "Different pagesize specified"] 1
93
 
 
94
 
        set ret [eval {berkdb dbremove} $envargs {$testfile}]
95
 
 
96
 
        puts "\tSubdb007.b.0: create subdb with specified page size"
97
 
        set db [eval {berkdb_open -create -mode 0644} \
98
 
            $args {-pagesize $pgsz2 $omethod $testfile $sub1}]
99
 
        error_check_good subdb [is_valid_db $db] TRUE
100
 
        set statret [$db stat]
101
 
        set newpgsz 0
102
 
        foreach pair $statret {
103
 
                set fld [lindex $pair 0]
104
 
                if { [string compare $fld {Page size}] == 0 } {
105
 
                        set newpgsz [lindex $pair 1]
106
 
                }
107
 
        }
108
 
        error_check_good pgsize $pgsz2 $newpgsz
109
 
        error_check_good dbclose [$db close] 0
110
 
 
111
 
        puts "\tSubdb007.b.1: create 2nd subdb with different page size"
112
 
        set stat [catch {eval {berkdb_open_noerr -create -btree} \
113
 
            $db2args {-pagesize $pgsz $testfile $sub2}} ret]
114
 
        error_check_good subdb:pgsz $stat 1
115
 
        error_check_good subdb:fail [is_substr $ret \
116
 
            "Different pagesize specified"] 1
117
 
 
118
 
        set ret [eval {berkdb dbremove} $envargs {$testfile}]
119
 
 
120
 
        puts "\tSubdb007.c.0: create subdb with specified page size"
121
 
        set db [eval {berkdb_open -create -mode 0644} \
122
 
            $args {-pagesize $pgsz2 $omethod $testfile $sub1}]
123
 
        error_check_good subdb [is_valid_db $db] TRUE
124
 
        error_check_good dbclose [$db close] 0
125
 
 
126
 
        puts "\tSubdb007.c.1: create 2nd subdb with same specified page size"
127
 
        set db [eval {berkdb_open -create -mode 0644} \
128
 
            $args {-pagesize $pgsz2 $omethod $testfile $sub2}]
129
 
        error_check_good subdb [is_valid_db $db] TRUE
130
 
        error_check_good dbclose [$db close] 0
131
 
 
132
 
}