File: test_pbuilder-modules

package info (click to toggle)
pbuilder 0.231.3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 3,864 kB
  • sloc: sh: 5,731; xml: 1,755; makefile: 249; ansic: 11
file content (79 lines) | stat: -rwxr-xr-x 1,698 bytes parent folder | download | duplicates (4)
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
#!/bin/bash

TD="$(dirname "$0")"
LOGLEVEL=I
USECOLORS=no
. "$TD/testlib.sh"
if [ -n "$PBUILDER_CHECKOUT" ]; then
    . "$PBUILDER_CHECKOUT/pbuilder-modules"
else
    . "$PBUILDER_TEST_PKGLIBDIR/pbuilder-modules"
fi

function test_information() {
    log "I: test"
    log "W: warning"
    log "E: error"
}
expect_output "I: test
W: warning
E: error" test_information
expect_stderr "W: warning
E: error" test_information

function test_log() {
    log.d "debug"  # this should not be printed in LOGLEVEL=I (the default)
    log.i "info"
    log.w "warn"
    log.e "error"
}
expect_output "I: info
W: warn
E: error" test_log
expect_stderr "W: warn
E: error" test_log
LOGLEVEL=D
expect_output "D: debug
I: info
W: warn
E: error" test_log
USECOLORS=yes
expect_output "$(printf "\033[0;34mD: debug\033[0m
\033[0mI: info\033[0m
\033[1;33mW: warn\033[0m
\033[0;31mE: error\033[0m")" test_log

# return to regular/stable output
LOGLEVEL=I
USECOLORS=no

# test the non-copy case
function test_conditional_cp_a() {
    (
	TEMPDIR=$(mktemp -d)
	cd "${TEMPDIR}"
	touch "hoge"
	outdir=$(readlink -f "${TEMPDIR}/..")
	conditional_cp_a "hoge" "${outdir}" echo
    )
}
expect_output "I: file hoge is already in target, not copying." \
    test_conditional_cp_a

# test the copy case.
function test_conditional_cp_a_copy() {
    (
	cd /tmp
	outdir=/something-else
	conditional_cp_a "hoge" "${outdir}" echo
    )
}
expect_output "-a hoge /something-else" test_conditional_cp_a_copy


expect_output "The foo team <foo@ml.org>" get822field Maintainer "$TESTDATA_DIR/srccontrol1"
expect_output "
 Bar <bar@debian.org>,
 Foo Bar <foo.bar@debian.org>," get822field Uploaders "$TESTDATA_DIR/srccontrol1"

testlib_summary