X-Git-Url: https://git.saurik.com/apt.git/blobdiff_plain/87f99f6fa701d2557811134380c1f232cf07a422..e07f3d5a9ed2870a0e2909cc1e5e55e826086c53:/test/integration/test-external-installation-planner-protocol diff --git a/test/integration/test-external-installation-planner-protocol b/test/integration/test-external-installation-planner-protocol index bd3c99c32..1d9abc901 100755 --- a/test/integration/test-external-installation-planner-protocol +++ b/test/integration/test-external-installation-planner-protocol @@ -43,11 +43,9 @@ 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 @@ -59,8 +57,7 @@ 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 @@ -73,3 +70,24 @@ 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)'