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

« back to all changes in this revision

Viewing changes to libdb/test/test058.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  test058
9
 
# TEST  Verify that deleting and reading duplicates results in correct ordering.
10
 
proc test058 { method args } {
11
 
        source ./include.tcl
12
 
 
13
 
        #
14
 
        # If we are using an env, then skip this test.  It needs its own.
15
 
        set eindex [lsearch -exact $args "-env"]
16
 
        if { $eindex != -1 } {
17
 
                incr eindex
18
 
                set env [lindex $args $eindex]
19
 
                puts "Test058 skipping for env $env"
20
 
                return
21
 
        }
22
 
        set args [convert_args $method $args]
23
 
        set encargs ""
24
 
        set args [split_encargs $args encargs]
25
 
        set omethod [convert_method $method]
26
 
 
27
 
        if { [is_record_based $method] == 1 || [is_rbtree $method] == 1 } {
28
 
                puts "Test058: skipping for method $method"
29
 
                return
30
 
        }
31
 
        puts "Test058: $method delete dups after inserting after duped key."
32
 
 
33
 
        # environment
34
 
        env_cleanup $testdir
35
 
        set eflags "-create -txn $encargs -home $testdir"
36
 
        set env [eval {berkdb_env} $eflags]
37
 
        error_check_good env [is_valid_env $env] TRUE
38
 
 
39
 
        # db open
40
 
        set flags "-auto_commit -create -mode 0644 -dup -env $env $args"
41
 
        set db [eval {berkdb_open} $flags $omethod "test058.db"]
42
 
        error_check_good dbopen [is_valid_db $db] TRUE
43
 
 
44
 
        set tn ""
45
 
        set tid ""
46
 
        set tn [$env txn]
47
 
        set tflags "-txn $tn"
48
 
 
49
 
        puts "\tTest058.a: Adding 10 duplicates"
50
 
        # Add a bunch of dups
51
 
        for { set i 0 } { $i < 10 } {incr i} {
52
 
                set ret \
53
 
                    [eval {$db put} $tflags {doghouse $i"DUPLICATE_DATA_VALUE"}]
54
 
                error_check_good db_put $ret 0
55
 
        }
56
 
 
57
 
        puts "\tTest058.b: Adding key after duplicates"
58
 
        # Now add one more key/data AFTER the dup set.
59
 
        set ret [eval {$db put} $tflags {zebrahouse NOT_A_DUP}]
60
 
        error_check_good db_put $ret 0
61
 
 
62
 
        error_check_good txn_commit [$tn commit] 0
63
 
 
64
 
        set tn [$env txn]
65
 
        error_check_good txnbegin [is_substr $tn $env] 1
66
 
        set tflags "-txn $tn"
67
 
 
68
 
        # Now delete everything
69
 
        puts "\tTest058.c: Deleting duplicated key"
70
 
        set ret [eval {$db del} $tflags {doghouse}]
71
 
        error_check_good del $ret 0
72
 
 
73
 
        # Now reput everything
74
 
        set pad \
75
 
            abcdefghijklmnopqrtsuvabcdefghijklmnopqrtsuvabcdefghijklmnopqrtsuvabcdefghijklmnopqrtsuvabcdefghijklmnopqrtsuvabcdefghijklmnopqrtsuvabcdefghijklmnopqrtsuvabcdefghijklmnopqrtsuvabcdefghijklmnopqrtsuvabcdefghijklmnopqrtsuv
76
 
 
77
 
        puts "\tTest058.d: Reputting duplicates with big data vals"
78
 
        for { set i 0 } { $i < 10 } {incr i} {
79
 
                set ret [eval {$db put} \
80
 
                    $tflags {doghouse $i"DUPLICATE_DATA_VALUE"$pad}]
81
 
                error_check_good db_put $ret 0
82
 
        }
83
 
        error_check_good txn_commit [$tn commit] 0
84
 
 
85
 
        # Check duplicates for order
86
 
        set dbc [$db cursor]
87
 
        error_check_good db_cursor [is_substr $dbc $db] 1
88
 
 
89
 
        puts "\tTest058.e: Verifying that duplicates are in order."
90
 
        set i 0
91
 
        for { set ret [$dbc get -set doghouse] } \
92
 
            {$i < 10 && [llength $ret] != 0} \
93
 
            { set ret [$dbc get -nextdup] } {
94
 
                set data [lindex [lindex $ret 0] 1]
95
 
                error_check_good \
96
 
                    duplicate_value $data $i"DUPLICATE_DATA_VALUE"$pad
97
 
                incr i
98
 
        }
99
 
 
100
 
        error_check_good dbc_close [$dbc close] 0
101
 
        error_check_good db_close [$db close] 0
102
 
        reset_env $env
103
 
}