X-Git-Url: https://git.saurik.com/apt.git/blobdiff_plain/f883d2c3675eae2700e4cd1532c1a236cae69a4e..dabe9e2482180ada77d2adda2b3c03db22059fb8:/test/integration/test-external-installation-planner-protocol?ds=sidebyside diff --git a/test/integration/test-external-installation-planner-protocol b/test/integration/test-external-installation-planner-protocol index c499c53af..1d9abc901 100755 --- a/test/integration/test-external-installation-planner-protocol +++ b/test/integration/test-external-installation-planner-protocol @@ -2,18 +2,17 @@ set -e TESTDIR="$(readlink -f "$(dirname "$0")")" -NATIVE="$(command dpkg --print-architecture)" . "$TESTDIR/framework" setupenvironment -configarchitecture "${NATIVE}" +configarchitecture 'amd64' -buildsimplenativepackage 'libfoo' "${NATIVE}" '3' 'experimental' 'Multi-Arch: same' +buildsimplenativepackage 'libfoo' 'amd64' '3' 'experimental' 'Multi-Arch: same' buildsimplenativepackage 'foo' 'all' '3' 'experimental' 'Depends: newstuff' -buildsimplenativepackage 'foo' 'all' '2' 'unstable' "Depends: libfoo:$NATIVE, stuff +buildsimplenativepackage 'foo' 'all' '2' 'unstable' 'Depends: libfoo:amd64, stuff Conflicts: bar, libfoo:i386 -Recommends: unrelated" -buildsimplenativepackage 'libfoo' "${NATIVE}" '2' 'unstable' 'Multi-Arch: same' -buildsimplenativepackage 'unrelated-2' "${NATIVE}" '2' 'unstable' +Recommends: unrelated' +buildsimplenativepackage 'libfoo' 'amd64' '2' 'unstable' 'Multi-Arch: same' +buildsimplenativepackage 'unrelated-2' 'amd64' '2' 'unstable' insertinstalledpackage 'foo' 'all' '1' insertinstalledpackage 'bar' 'all' '1' insertinstalledpackage 'stuff' 'all' '1' @@ -37,40 +36,58 @@ testsuccessequal 'Planner: dump' grep '^Planner: ' "$APT_EDSP_DUMP_FILENAME" testsuccess aptget install foo -s testsuccess aptget install foo -y testsuccess test -r "$EIPPLOG" -testsuccessequal "Request: EIPP 0.1 -Architecture: ${NATIVE} -Architectures: ${NATIVE} -Remove: bar:${NATIVE} -Install: libfoo:${NATIVE} foo:${NATIVE} -Planner: internal" head -n 6 "$EIPPLOG" +testsuccessequal 'Request: EIPP 0.1 +Architecture: amd64 +Architectures: amd64 +Remove: bar:amd64 +Install: libfoo:amd64 foo:amd64 +Planner: internal' head -n 6 "$EIPPLOG" aptinternalplanner < "$EIPPLOG" > planner.log || true -testsuccessequal 'Remove: 6 +testsuccessequal 'Remove: 7 Unpack: 2 -Unpack: 4 -Configure: 2 -Configure: 4' grep -e '^Unpack:' -e '^Install:' -e '^Configure:' -e '^Remove:' planner.log +Unpack: 4' grep -e '^Unpack:' -e '^Install:' -e '^Configure:' -e '^Remove:' planner.log rm -f "$EIPPLOG" testsuccess aptget install foo -s --reinstall testsuccess aptget install foo -y --reinstall testsuccess test -r "$EIPPLOG" -testsuccessequal "Request: EIPP 0.1 -Architecture: ${NATIVE} -Architectures: ${NATIVE} -ReInstall: foo:${NATIVE} -Planner: internal" head -n 5 "$EIPPLOG" +testsuccessequal 'Request: EIPP 0.1 +Architecture: amd64 +Architectures: amd64 +ReInstall: foo:amd64 +Planner: internal' head -n 5 "$EIPPLOG" aptinternalplanner < "$EIPPLOG" > planner.log || true -testsuccessequal 'Unpack: 4 -Configure: 4' grep -e '^Unpack:' -e '^Install:' -e '^Configure:' -e '^Remove:' planner.log +testsuccessequal 'Unpack: 4' grep -e '^Unpack:' -e '^Install:' -e '^Configure:' -e '^Remove:' planner.log rm -f "$EIPPLOG" testsuccess aptget purge foo -s testsuccess aptget purge foo -y testsuccess test -r "$EIPPLOG" -testsuccessequal "Request: EIPP 0.1 -Architecture: ${NATIVE} -Architectures: ${NATIVE} -Remove: foo:${NATIVE} -Planner: internal" head -n 5 "$EIPPLOG" +testsuccessequal 'Request: EIPP 0.1 +Architecture: amd64 +Architectures: amd64 +Remove: foo:amd64 +Planner: internal' head -n 5 "$EIPPLOG" aptinternalplanner < "$EIPPLOG" > planner.log || true testsuccessequal 'Remove: 4' grep -e '^Unpack:' -e '^Install:' -e '^Configure:' -e '^Remove:' planner.log + +testplannerfailuremsg() { + local PLANNER="rootdir/usr/lib/apt/planners/$1" + echo "$2" > "$PLANNER" + chmod +x "$PLANNER" + testfailuremsg "$3" apt install foo -s --planner $1 +} + +testplannerfailuremsg 'exit0withmsg' "#!/bin/sh +echo 'Error: instant-exit +Message: This planner exits instantly' +exit 0" 'E: External planner failed with: This planner exits instantly' + +testplannerfailuremsg 'exit1withoutmsg' "#!/bin/sh +exit 1" 'E: Sub-process exit1withoutmsg returned an error code (1)' + +testplannerfailuremsg 'exit1withmsg' "#!/bin/sh +echo 'Error: instant-exit +Message: This planner exits instantly' +exit 1" 'E: External planner failed with: This planner exits instantly +E: Sub-process exit1withmsg returned an error code (1)'