]> git.saurik.com Git - apt.git/blame - test/integration/test-external-installation-planner-protocol
Don't download "optional" files not in Release :/.
[apt.git] / test / integration / test-external-installation-planner-protocol
CommitLineData
dae19747
DK
1#!/bin/sh
2set -e
3
4TESTDIR="$(readlink -f "$(dirname "$0")")"
5. "$TESTDIR/framework"
6setupenvironment
87f99f6f 7configarchitecture 'amd64'
dae19747 8
87f99f6f 9buildsimplenativepackage 'libfoo' 'amd64' '3' 'experimental' 'Multi-Arch: same'
dae19747 10buildsimplenativepackage 'foo' 'all' '3' 'experimental' 'Depends: newstuff'
87f99f6f 11buildsimplenativepackage 'foo' 'all' '2' 'unstable' 'Depends: libfoo:amd64, stuff
dae19747 12Conflicts: bar, libfoo:i386
87f99f6f
DK
13Recommends: unrelated'
14buildsimplenativepackage 'libfoo' 'amd64' '2' 'unstable' 'Multi-Arch: same'
15buildsimplenativepackage 'unrelated-2' 'amd64' '2' 'unstable'
dae19747
DK
16insertinstalledpackage 'foo' 'all' '1'
17insertinstalledpackage 'bar' 'all' '1'
18insertinstalledpackage 'stuff' 'all' '1'
19insertinstalledpackage 'unrelated-1' 'all' '1'
20
21setupaptarchive --no-update
22
b4f91d4d 23EIPPLOG="${TMPWORKINGDIRECTORY}/rootdir/var/log/apt/eipp.log"
8e99b22c 24echo "Dir::Log::Planner \"$EIPPLOG\";" > ./rootdir/etc/apt/apt.conf.d/eipp-logging
b4f91d4d 25
dae19747 26testsuccess apt update
8e99b22c 27export APT_EDSP_DUMP_FILENAME="${TMPWORKINGDIRECTORY}/downloaded/dump.eipp"
b4f91d4d 28testfailure test -r "$EIPPLOG"
8e99b22c 29testfailure aptget install foo --planner dump -y
b4f91d4d 30testfailure test -r "$EIPPLOG"
dae19747
DK
31testfailure grep 'unrelated-2' "$APT_EDSP_DUMP_FILENAME"
32testsuccessequal '2' grep -c '^Package: foo$' "$APT_EDSP_DUMP_FILENAME"
33testsuccessequal '1' grep -c '^Package: libfoo$' "$APT_EDSP_DUMP_FILENAME"
8e99b22c 34testsuccessequal 'Planner: dump' grep '^Planner: ' "$APT_EDSP_DUMP_FILENAME"
b4f91d4d
DK
35
36testsuccess aptget install foo -s
37testsuccess aptget install foo -y
38testsuccess test -r "$EIPPLOG"
87f99f6f
DK
39testsuccessequal 'Request: EIPP 0.1
40Architecture: amd64
41Architectures: amd64
42Remove: bar:amd64
43Install: libfoo:amd64 foo:amd64
44Planner: internal' head -n 6 "$EIPPLOG"
8e99b22c 45aptinternalplanner < "$EIPPLOG" > planner.log || true
561a3557 46testsuccessequal 'Remove: 7
b4f91d4d 47Unpack: 2
28557f94 48Unpack: 4' grep -e '^Unpack:' -e '^Install:' -e '^Configure:' -e '^Remove:' planner.log
b4f91d4d
DK
49
50rm -f "$EIPPLOG"
51testsuccess aptget install foo -s --reinstall
52testsuccess aptget install foo -y --reinstall
53testsuccess test -r "$EIPPLOG"
87f99f6f
DK
54testsuccessequal 'Request: EIPP 0.1
55Architecture: amd64
56Architectures: amd64
57ReInstall: foo:amd64
58Planner: internal' head -n 5 "$EIPPLOG"
8e99b22c 59aptinternalplanner < "$EIPPLOG" > planner.log || true
28557f94 60testsuccessequal 'Unpack: 4' grep -e '^Unpack:' -e '^Install:' -e '^Configure:' -e '^Remove:' planner.log
f74d99c6 61
b4f91d4d
DK
62rm -f "$EIPPLOG"
63testsuccess aptget purge foo -s
64testsuccess aptget purge foo -y
65testsuccess test -r "$EIPPLOG"
87f99f6f
DK
66testsuccessequal 'Request: EIPP 0.1
67Architecture: amd64
68Architectures: amd64
69Remove: foo:amd64
70Planner: internal' head -n 5 "$EIPPLOG"
8e99b22c
DK
71aptinternalplanner < "$EIPPLOG" > planner.log || true
72testsuccessequal 'Remove: 4' grep -e '^Unpack:' -e '^Install:' -e '^Configure:' -e '^Remove:' planner.log
12b201da
DK
73
74testplannerfailuremsg() {
75 local PLANNER="rootdir/usr/lib/apt/planners/$1"
76 echo "$2" > "$PLANNER"
77 chmod +x "$PLANNER"
78 testfailuremsg "$3" apt install foo -s --planner $1
79}
80
81testplannerfailuremsg 'exit0withmsg' "#!/bin/sh
82echo 'Error: instant-exit
83Message: This planner exits instantly'
84exit 0" 'E: External planner failed with: This planner exits instantly'
85
86testplannerfailuremsg 'exit1withoutmsg' "#!/bin/sh
87exit 1" 'E: Sub-process exit1withoutmsg returned an error code (1)'
88
89testplannerfailuremsg 'exit1withmsg' "#!/bin/sh
90echo 'Error: instant-exit
91Message: This planner exits instantly'
92exit 1" 'E: External planner failed with: This planner exits instantly
93E: Sub-process exit1withmsg returned an error code (1)'