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

« back to all changes in this revision

Viewing changes to libdb/test/update.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
 
source ./include.tcl
9
 
global update_dir
10
 
set update_dir "$test_path/update_test"
11
 
 
12
 
proc update { } {
13
 
        source ./include.tcl
14
 
        global update_dir
15
 
 
16
 
        foreach version [glob $update_dir/*] {
17
 
                regexp \[^\/\]*$ $version version
18
 
                foreach method [glob $update_dir/$version/*] {
19
 
                        regexp \[^\/\]*$ $method method
20
 
                        foreach file [glob $update_dir/$version/$method/*] {
21
 
                                regexp (\[^\/\]*)\.tar\.gz$ $file dummy name
22
 
                                foreach endianness {"le" "be"} {
23
 
                                        puts "Update:\
24
 
                                            $version $method $name $endianness"
25
 
                                        set ret [catch {_update $update_dir $testdir $version $method $name $endianness 1 1} message]
26
 
                                        if { $ret != 0 } {
27
 
                                                puts $message
28
 
                                        }
29
 
                                }
30
 
                        }
31
 
                }
32
 
        }
33
 
}
34
 
 
35
 
proc _update { source_dir temp_dir \
36
 
    version method file endianness do_db_load_test do_update_test } {
37
 
        source include.tcl
38
 
        global errorInfo
39
 
 
40
 
        cleanup $temp_dir NULL
41
 
 
42
 
        exec sh -c \
43
 
"gzcat $source_dir/$version/$method/$file.tar.gz | (cd $temp_dir && tar xf -)"
44
 
 
45
 
        if { $do_db_load_test } {
46
 
                set ret [catch \
47
 
                    {exec $util_path/db_load -f "$temp_dir/$file.dump" \
48
 
                    "$temp_dir/update.db"} message]
49
 
                error_check_good \
50
 
                    "Update load: $version $method $file $message" $ret 0
51
 
 
52
 
                set ret [catch \
53
 
                    {exec $util_path/db_dump -f "$temp_dir/update.dump" \
54
 
                    "$temp_dir/update.db"} message]
55
 
                error_check_good \
56
 
                    "Update dump: $version $method $file $message" $ret 0
57
 
 
58
 
                error_check_good "Update diff.1.1: $version $method $file" \
59
 
                    [filecmp "$temp_dir/$file.dump" "$temp_dir/update.dump"] 0
60
 
                error_check_good \
61
 
                    "Update diff.1.2: $version $method $file" $ret ""
62
 
        }
63
 
 
64
 
        if { $do_update_test } {
65
 
                set ret [catch \
66
 
                    {berkdb open -update "$temp_dir/$file-$endianness.db"} db]
67
 
                if { $ret == 1 } {
68
 
                        if { ![is_substr $errorInfo "version upgrade"] } {
69
 
                                set fnl [string first "\n" $errorInfo]
70
 
                                set theError \
71
 
                                    [string range $errorInfo 0 [expr $fnl - 1]]
72
 
                                error $theError
73
 
                        }
74
 
                } else {
75
 
                        error_check_good dbopen [is_valid_db $db] TRUE
76
 
                        error_check_good dbclose [$db close] 0
77
 
 
78
 
                        set ret [catch \
79
 
                            {exec $util_path/db_dump -f \
80
 
                            "$temp_dir/update.dump" \
81
 
                            "$temp_dir/$file-$endianness.db"} message]
82
 
                        error_check_good "Update\
83
 
                            dump: $version $method $file $message" $ret 0
84
 
 
85
 
                        error_check_good \
86
 
                            "Update diff.2: $version $method $file" \
87
 
                            [filecmp "$temp_dir/$file.dump" \
88
 
                            "$temp_dir/update.dump"] 0
89
 
                        error_check_good \
90
 
                            "Update diff.2: $version $method $file" $ret ""
91
 
                }
92
 
        }
93
 
}