File: test_install_copy.bats

package info (click to toggle)
dh-exec 0.30
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 324 kB
  • sloc: ansic: 530; perl: 178; makefile: 126; sh: 67
file content (140 lines) | stat: -rwxr-xr-x 3,840 bytes parent folder | download | duplicates (2)
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
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
## -*- shell-script -*-

load "test.lib"

setup () {
        td=$(mktemp -d --tmpdir=.)
        cd "${td}"

        nullfile=$(mktemp --tmpdir=.)
        touch ${nullfile}
}

teardown () {
        cd ..
        rm -rf "${td}"
}

@test "install: copying works" {
        run_dh_exec_with_input .install <<EOF
#! ${top_builddir}/src/dh-exec-install
${nullfile} => /var/lib/dh-exec/test-output
EOF

        [ -f "${nullfile}" ]
        expect_file "/var/lib/dh-exec/test-output"
}

@test "install: copying from debian/tmp works" {
    install -d debian/tmp
    touch debian/tmp/foo.test

    run_dh_exec_with_input .install <<EOF
#! ${top_builddir}/src/dh-exec-install
foo.test => /var/lib/dh-exec/test-output.foo
EOF

    ! [ -f debian/tmp/foo.test ]
    expect_file "/var/lib/dh-exec/test-output.foo"
}

@test "install: renaming preserves permissions" {
    chmod +x "${nullfile}"

    run_dh_exec_with_input .install <<EOF
#! ${top_builddir}/src/dh-exec-install
${nullfile} => /var/lib/dh-exec/test-executable
EOF

    [ -f "${nullfile}" ]
    expect_file -x "/var/lib/dh-exec/test-executable"
}

@test "install: renaming manpages gives dh_installmanpages-compatible output" {
    run_dh_exec_with_input .manpages <<EOF
#! ${top_builddir}/src/dh-exec-install
${nullfile} => /var/lib/dh-exec/foo.8
EOF

    [ -f "${nullfile}" ]
    expect_file "/var/lib/dh-exec/foo.8"
    ! expect_output " /var/lib/"
}

@test "install: DH_CONFIG_ACT_ON_PACKAGE is honored" {
    DH_CONFIG_ACT_ON_PACKAGES=another-package \
                             run_dh_exec_with_input package.install <<EOF
#! ${top_builddir}/src/dh-exec-install
${nullfile} => /var/lib/dh-exec/foo.8
EOF

    [ -f "${nullfile}" ]
    ! expect_file "/var/lib/dh-exec/foo.8"
    expect_output "${nullfile}"
}

@test "install: DH_CONFIG_ACT_ON_PACKAGE works on regexp-y packages too" {
    DH_CONFIG_ACT_ON_PACKAGES=package++ \
                             run_dh_exec_with_input package++.install <<EOF
#! ${top_builddir}/src/dh-exec-install
${nullfile} => /var/lib/dh-exec/foo.8
EOF

    [ -f "${nullfile}" ]
    expect_file "/var/lib/dh-exec/foo.8"
}

@test "install: debian/install works in presence of DH_CONFIG_ACT_ON_PACKAGE" {
    DH_CONFIG_ACT_ON_PACKAGES=package \
                             run_dh_exec_with_input install <<EOF
#! ${top_builddir}/src/dh-exec-install
${nullfile} => /var/lib/dh-exec/foo.8
EOF

    [ -f "${nullfile}" ]
    expect_file "/var/lib/dh-exec/foo.8"
}

@test "install: debian/manpages works in presence of DH_CONFIG_ACT_ON_PACKAGE" {
    DH_CONFIG_ACT_ON_PACKAGES=package \
                             run_dh_exec_with_input manpages <<EOF
#! ${top_builddir}/src/dh-exec-install
${nullfile} => /var/lib/dh-exec/foo.8
EOF

    [ -f "${nullfile}" ]
    expect_file "/var/lib/dh-exec/foo.8"
}

@test "install: DH_CONFIG_ACT_ON_PACKAGE works on packages with dots in their name too" {
    DH_CONFIG_ACT_ON_PACKAGES=libfoo1.0 \
                             run_dh_exec_with_input libfoo1.0.install <<EOF
#! ${top_builddir}/src/dh-exec-install
${nullfile} => /var/lib/dh-exec/foo.8
EOF

    [ -f "${nullfile}" ]
    expect_file "/var/lib/dh-exec/foo.8"
}

#@test "install: --fail-missing and binary-indep works" {
#    DH_INTERNAL_OPTIONS=-i DH_CONFIG_ACT_ON_PACKAGES=foo-data \
#                       run_dh_exec_with_input foo-tools.install <<EOF
##! ${top_builddir}/src/dh-exec-install
#${nullfile} => /usr/bin/foo
#EOF
#
#    [ -f "${nullfile}" ]
#    expect_file "/usr/bin/foo"
#}
#
#@test "install: --fail-missing and binary-arch works" {
#    DH_INTERNAL_OPTIONS=-a DH_CONFIG_ACT_ON_PACKAGES=foo-tools \
#                       run_dh_exec_with_input foo-data.install <<EOF
##! ${top_builddir}/src/dh-exec-install
#${nullfile} => /usr/share/foo-data/datafile
#EOF
#
#    [ -f "${nullfile}" ]
#    expect_file "/usr/share/foo-data/datafile"
#}