aboutsummaryrefslogtreecommitdiff
path: root/test_pbuilder-modules
blob: d010c98e7547122dbfe760d42ee2f52a2f1b7378 (plain)
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
#!/bin/bash

if [ -n "$PBUILDER_CHECKOUT" ]; then
    . "$PBUILDER_CHECKOUT/testlib.sh"

    . "$PBUILDER_CHECKOUT/pbuilder-modules"
else
    # these currently don't need to be exported
    PBUILDER_TEST_ROOT="${PBUILDER_ROOT:-}"
    PBUILDER_TEST_PKGLIBDIR="${PBUILDER_PKGLIBDIR:-$PBUILDER_ROOT/usr/lib/pbuilder}"
    . "$PBUILDER_TEST_PKGLIBDIR/testlib.sh"

    . "$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

# 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

testlib_summary