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

« back to all changes in this revision

Viewing changes to libdb/test/test045.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  test045
9
 
# TEST  Small random tester
10
 
# TEST          Runs a number of random add/delete/retrieve operations.
11
 
# TEST          Tests both successful conditions and error conditions.
12
 
# TEST
13
 
# TEST  Run the random db tester on the specified access method.
14
 
#
15
 
# Options are:
16
 
#       -adds <maximum number of keys before you disable adds>
17
 
#       -cursors <number of cursors>
18
 
#       -dataavg <average data size>
19
 
#       -delete <minimum number of keys before you disable deletes>
20
 
#       -dups <allow duplicates in file>
21
 
#       -errpct <Induce errors errpct of the time>
22
 
#       -init <initial number of entries in database>
23
 
#       -keyavg <average key size>
24
 
proc test045 { method {nops 10000} args } {
25
 
        source ./include.tcl
26
 
        global encrypt
27
 
 
28
 
        #
29
 
        # If we are using an env, then skip this test.  It needs its own.
30
 
        set eindex [lsearch -exact $args "-env"]
31
 
        if { $eindex != -1 } {
32
 
                incr eindex
33
 
                set env [lindex $args $eindex]
34
 
                puts "Test045 skipping for env $env"
35
 
                return
36
 
        }
37
 
        set args [convert_args $method $args]
38
 
        if { $encrypt != 0 } {
39
 
                puts "Test045 skipping for security"
40
 
                return
41
 
        }
42
 
        set omethod [convert_method $method]
43
 
 
44
 
        puts "Test045: Random tester on $method for $nops operations"
45
 
 
46
 
        # Set initial parameters
47
 
        set adds [expr $nops * 10]
48
 
        set cursors 5
49
 
        set dataavg 40
50
 
        set delete $nops
51
 
        set dups 0
52
 
        set errpct 0
53
 
        set init 0
54
 
        if { [is_record_based $method] == 1 } {
55
 
                set keyavg 10
56
 
        } else {
57
 
                set keyavg 25
58
 
        }
59
 
 
60
 
        # Process arguments
61
 
        set oargs ""
62
 
        for { set i 0 } { $i < [llength $args] } {incr i} {
63
 
                switch -regexp -- [lindex $args $i] {
64
 
                        -adds    { incr i; set adds [lindex $args $i] }
65
 
                        -cursors { incr i; set cursors [lindex $args $i] }
66
 
                        -dataavg { incr i; set dataavg [lindex $args $i] }
67
 
                        -delete  { incr i; set delete [lindex $args $i] }
68
 
                        -dups    { incr i; set dups [lindex $args $i] }
69
 
                        -errpct  { incr i; set errpct [lindex $args $i] }
70
 
                        -init    { incr i; set init [lindex $args $i] }
71
 
                        -keyavg  { incr i; set keyavg [lindex $args $i] }
72
 
                        -extent  { incr i;
73
 
                                    lappend oargs "-extent" "100" }
74
 
                        default  { lappend oargs [lindex $args $i] }
75
 
                }
76
 
        }
77
 
 
78
 
        # Create the database and and initialize it.
79
 
        set root $testdir/test045
80
 
        set f $root.db
81
 
        env_cleanup $testdir
82
 
 
83
 
        # Run the script with 3 times the number of initial elements to
84
 
        # set it up.
85
 
        set db [eval {berkdb_open \
86
 
             -create -mode 0644 $omethod} $oargs {$f}]
87
 
        error_check_good dbopen:$f [is_valid_db $db] TRUE
88
 
 
89
 
        set r [$db close]
90
 
        error_check_good dbclose:$f $r 0
91
 
 
92
 
        # We redirect standard out, but leave standard error here so we
93
 
        # can see errors.
94
 
 
95
 
        puts "\tTest045.a: Initializing database"
96
 
        if { $init != 0 } {
97
 
                set n [expr 3 * $init]
98
 
                exec $tclsh_path \
99
 
                    $test_path/dbscript.tcl $method $f $n \
100
 
                    1 $init $n $keyavg $dataavg $dups 0 -1 \
101
 
                    > $testdir/test045.init
102
 
        }
103
 
        # Check for test failure
104
 
        set e [findfail $testdir/test045.init]
105
 
        error_check_good "FAIL: error message(s) in init file" $e 0
106
 
 
107
 
        puts "\tTest045.b: Now firing off berkdb rand dbscript, running: "
108
 
        # Now the database is initialized, run a test
109
 
        puts "$tclsh_path\
110
 
            $test_path/dbscript.tcl $method $f $nops $cursors $delete $adds \
111
 
            $keyavg $dataavg $dups $errpct > $testdir/test045.log"
112
 
 
113
 
        exec $tclsh_path \
114
 
            $test_path/dbscript.tcl $method $f \
115
 
            $nops $cursors $delete $adds $keyavg \
116
 
            $dataavg $dups $errpct \
117
 
            > $testdir/test045.log
118
 
 
119
 
        # Check for test failure
120
 
        set e [findfail $testdir/test045.log]
121
 
        error_check_good "FAIL: error message(s) in log file" $e 0
122
 
 
123
 
}