summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorDavid Kalnischkies <david@kalnischkies.de>2016-09-07 10:21:01 +0200
committerDavid Kalnischkies <david@kalnischkies.de>2016-09-07 10:21:01 +0200
commit12b201da7c1d5e2beceae796151e4ebedc5bae97 (patch)
treeb69e53430efa30b34bd678f4cefb6e53fa373120 /test
parent99fdd8034b4a5cdb0100a33d0b3d5e26079c1695 (diff)
edsp: try 2 to read responses even if writing failed
Commit b60c8a89c281f2bb945d426d2215cbf8f5760738 improved the situation, but due to inconsistency mostly for planners, not for solvers. As the idea of hiding errors if we show another error is a bit scary (as the extern error might be a followup of our intern error, rather than the reason for our intern error as it is at the moment) we don't discard the errors, but if we got an extern error we show them directly removing them from the error list at the end of the run – that list will contain the extern error which hopefully gives us the best of both worlds. The problem itself is the same as before: The externals exiting before apt is done talking to them. Reported-By: Johannes 'josch' Schauer on IRC
Diffstat (limited to 'test')
-rwxr-xr-xtest/integration/test-external-dependency-solver-protocol21
-rwxr-xr-xtest/integration/test-external-installation-planner-protocol21
2 files changed, 42 insertions, 0 deletions
diff --git a/test/integration/test-external-dependency-solver-protocol b/test/integration/test-external-dependency-solver-protocol
index 17a30cf2f..d126cd84b 100755
--- a/test/integration/test-external-dependency-solver-protocol
+++ b/test/integration/test-external-dependency-solver-protocol
@@ -262,3 +262,24 @@ EOF
chmod +x rootdir/usr/lib/apt/solvers/installall
testfailure apt full-upgrade -s --solver installall
testsuccess grep "is already installed!" rootdir/tmp/testfailure.output
+
+testsolverfailuremsg() {
+ local SOLVER="rootdir/usr/lib/apt/solvers/$1"
+ echo "$2" > "$SOLVER"
+ chmod +x "$SOLVER"
+ testfailuremsg "$3" apt full-upgrade -s --solver $1
+}
+
+testsolverfailuremsg 'exit0withmsg' "#!/bin/sh
+echo 'Error: instant-exit
+Message: This solver exits instantly'
+exit 0" 'E: External solver failed with: This solver exits instantly'
+
+testsolverfailuremsg 'exit1withoutmsg' "#!/bin/sh
+exit 1" 'E: Sub-process exit1withoutmsg returned an error code (1)'
+
+testsolverfailuremsg 'exit1withmsg' "#!/bin/sh
+echo 'Error: instant-exit
+Message: This solver exits instantly'
+exit 1" 'E: External solver failed with: This solver exits instantly
+E: Sub-process exit1withmsg returned an error code (1)'
diff --git a/test/integration/test-external-installation-planner-protocol b/test/integration/test-external-installation-planner-protocol
index 8d80930bc..03b2c4831 100755
--- a/test/integration/test-external-installation-planner-protocol
+++ b/test/integration/test-external-installation-planner-protocol
@@ -70,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)'