]> git.saurik.com Git - apt.git/blame_incremental - test/integration/test-external-installation-planner-protocol
don't install new deps of candidates for kept back pkgs
[apt.git] / test / integration / test-external-installation-planner-protocol
... / ...
CommitLineData
1#!/bin/sh
2set -e
3
4TESTDIR="$(readlink -f "$(dirname "$0")")"
5. "$TESTDIR/framework"
6setupenvironment
7configarchitecture 'amd64'
8
9buildsimplenativepackage 'libfoo' 'amd64' '3' 'experimental' 'Multi-Arch: same'
10buildsimplenativepackage 'foo' 'all' '3' 'experimental' 'Depends: newstuff'
11buildsimplenativepackage 'foo' 'all' '2' 'unstable' 'Depends: libfoo:amd64, stuff
12Conflicts: bar, libfoo:i386
13Recommends: unrelated'
14buildsimplenativepackage 'libfoo' 'amd64' '2' 'unstable' 'Multi-Arch: same'
15buildsimplenativepackage 'unrelated-2' 'amd64' '2' 'unstable'
16insertinstalledpackage 'foo' 'all' '1'
17insertinstalledpackage 'bar' 'all' '1'
18insertinstalledpackage 'stuff' 'all' '1'
19insertinstalledpackage 'unrelated-1' 'all' '1'
20
21setupaptarchive --no-update
22
23EIPPLOG="${TMPWORKINGDIRECTORY}/rootdir/var/log/apt/eipp.log"
24echo "Dir::Log::Planner \"$EIPPLOG\";" > ./rootdir/etc/apt/apt.conf.d/eipp-logging
25
26testsuccess apt update
27export APT_EDSP_DUMP_FILENAME="${TMPWORKINGDIRECTORY}/downloaded/dump.eipp"
28testfailure test -r "$EIPPLOG"
29testfailure aptget install foo --planner dump -y
30testfailure test -r "$EIPPLOG"
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"
34testsuccessequal 'Planner: dump' grep '^Planner: ' "$APT_EDSP_DUMP_FILENAME"
35
36testsuccess aptget install foo -s
37testsuccess aptget install foo -y
38testsuccess test -r "$EIPPLOG"
39testsuccessequal 'Request: EIPP 0.1
40Architecture: amd64
41Architectures: amd64
42Remove: bar:amd64
43Install: libfoo:amd64 foo:amd64
44Planner: internal' head -n 6 "$EIPPLOG"
45aptinternalplanner < "$EIPPLOG" > planner.log || true
46testsuccessequal 'Remove: 7
47Unpack: 2
48Unpack: 4' grep -e '^Unpack:' -e '^Install:' -e '^Configure:' -e '^Remove:' planner.log
49
50rm -f "$EIPPLOG"
51testsuccess aptget install foo -s --reinstall
52testsuccess aptget install foo -y --reinstall
53testsuccess test -r "$EIPPLOG"
54testsuccessequal 'Request: EIPP 0.1
55Architecture: amd64
56Architectures: amd64
57ReInstall: foo:amd64
58Planner: internal' head -n 5 "$EIPPLOG"
59aptinternalplanner < "$EIPPLOG" > planner.log || true
60testsuccessequal 'Unpack: 4' grep -e '^Unpack:' -e '^Install:' -e '^Configure:' -e '^Remove:' planner.log
61
62rm -f "$EIPPLOG"
63testsuccess aptget purge foo -s
64testsuccess aptget purge foo -y
65testsuccess test -r "$EIPPLOG"
66testsuccessequal 'Request: EIPP 0.1
67Architecture: amd64
68Architectures: amd64
69Remove: foo:amd64
70Planner: internal' head -n 5 "$EIPPLOG"
71aptinternalplanner < "$EIPPLOG" > planner.log || true
72testsuccessequal 'Remove: 4' grep -e '^Unpack:' -e '^Install:' -e '^Configure:' -e '^Remove:' planner.log
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)'