File: test_debchange

package info (click to toggle)
devscripts 2.12.6%2Bdeb7u2
  • links: PTS, VCS
  • area: main
  • in suites: wheezy
  • size: 3,976 kB
  • sloc: perl: 15,544; sh: 5,482; python: 534; makefile: 170; ansic: 17
file content (89 lines) | stat: -rwxr-xr-x 3,322 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
#!/bin/sh

# Copyright (C) 2012, Benjamin Drung <bdrung@debian.org>
#
# Permission to use, copy, modify, and/or distribute this software for any
# purpose with or without fee is hereby granted, provided that the above
# copyright notice and this permission notice appear in all copies.
#
# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.

COMMAND="perl -I ${0%/*}/.. ${0%/*}/../scripts/debchange.pl"

. "${0%/*}/shunit2-helper-functions.sh"

success() {
    runCommand "-c ${SHUNIT_TMPDIR}/changelog $1" "" "" 0
}

checkVersion() {
    local start_param="$1"
    local param="$2"
    local start_version="$3"
    local expected_version="$4"
    rm -f ${SHUNIT_TMPDIR}/changelog
    success "--create $start_param --package test-package -v $start_version \"Devscripts Test Suite.\""
    success "$param \"Version test.\""
    local version=$(dpkg-parsechangelog -l${SHUNIT_TMPDIR}/changelog | sed -n 's/^Version: //p')
    assertEquals "\"dch $param\" from version $start_version" "$expected_version" "$version"
}

checkDebianDistribution() {
    checkVersion "--vendor Debian -D unstable" "--vendor Debian -i -D $1" "1.0-1" "1.0-2"
}

checkDebianVersion() {
    checkVersion "--vendor Debian -D unstable" "--vendor Debian $1" "$2" "$3"
}

checkUbuntuVersion() {
    checkVersion "--vendor Debian -D unstable" "--vendor Ubuntu $1" "$2" "$3"
}

testDebianDistributions() {
    checkDebianDistribution "experimental"
    checkDebianDistribution "oldstable"
    checkDebianDistribution "oldstable-proposed-updates"
    checkDebianDistribution "oldstable-security"
    checkDebianDistribution "proposed-updates"
    checkDebianDistribution "stable"
    checkDebianDistribution "stable-proposed-updates"
    checkDebianDistribution "stable-security"
    checkDebianDistribution "testing"
    checkDebianDistribution "testing-proposed-updates"
    checkDebianDistribution "testing-security"
    checkDebianDistribution "UNRELEASED"
}

testDebianIncrement() {
    checkDebianVersion "-i" "1.0-1" "1.0-2"
    checkDebianVersion "-i" "12" "13"
}

testUbuntuIncrement() {
    checkUbuntuVersion "-i" "12" "12ubuntu1"
    checkUbuntuVersion "-i" "3.4" "3.4ubuntu1"
    checkUbuntuVersion "-i" "3.4.5" "3.4.5ubuntu1"
    checkUbuntuVersion "-i" "5.6-7" "5.6-7ubuntu1"
    checkUbuntuVersion "-i" "5.6-7.1" "5.6-7.1ubuntu1"
    checkUbuntuVersion "-i" "5.6-7.1.8" "5.6-7.1.8ubuntu1"
    checkUbuntuVersion "-i" "2.13-14build5" "2.13-14ubuntu1"
    checkUbuntuVersion "-i" "0.45-2ubuntu3" "0.45-2ubuntu4"
    checkUbuntuVersion "-i" "0.45-2ubuntu3.1" "0.45-2ubuntu3.2"
    checkUbuntuVersion "-i" "0.45-2ubuntu3.1.0" "0.45-2ubuntu3.1.1"
}

testUbuntuRebuild() {
    checkUbuntuVersion "-R" "3.4" "3.4build1"
    checkUbuntuVersion "-R" "2.0-4" "2.0-4build1"
    checkUbuntuVersion "-R" "1.42-4ubuntu5" "1.42-4ubuntu6"
    checkUbuntuVersion "-R" "0.1-2build3" "0.1-2build4"
}

. shunit2