summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorMichael Vogt <mvo@ubuntu.com>2015-05-22 17:01:03 +0200
committerMichael Vogt <mvo@ubuntu.com>2015-05-22 17:01:03 +0200
commit4fc6b7570c3e97b65c118b58cdf6729fa94c9b03 (patch)
treef952bb728b9c23f1eebc8f1a87f527ed7c9b0b36 /test
parent6bf93605fdb8e858d3f0a79a124c1d39f760094d (diff)
parent65759e00eff0513c34f584b99420b72fe0e5073e (diff)
Merge branch 'debian/sid' into debian/experimental
Conflicts: apt-pkg/pkgcache.h debian/changelog methods/https.cc methods/server.cc test/integration/test-apt-download-progress
Diffstat (limited to 'test')
-rwxr-xr-xtest/integration/test-apt-download-progress1
-rwxr-xr-xtest/integration/test-bug-782777-single-arch-weirdness72
-rwxr-xr-xtest/integration/test-bug-lp1445239-download-loop29
-rw-r--r--test/interactive-helper/aptwebserver.cc8
4 files changed, 106 insertions, 4 deletions
diff --git a/test/integration/test-apt-download-progress b/test/integration/test-apt-download-progress
index 07c5e09c5..65c438e8f 100755
--- a/test/integration/test-apt-download-progress
+++ b/test/integration/test-apt-download-progress
@@ -36,7 +36,6 @@ assertprogress apt-progress.log
msgtest 'download progress works via' 'https'
exec 3> apt-progress.log
testsuccess --nomsg apthelper download-file "https://localhost:4433/$TESTFILE" https-$TESTFILE $OPT -o Acquire::https::Dl-Limit=800
-assertprogress apt-progress.log
# cleanup
rm -f apt-progress*.log
diff --git a/test/integration/test-bug-782777-single-arch-weirdness b/test/integration/test-bug-782777-single-arch-weirdness
new file mode 100755
index 000000000..004903385
--- /dev/null
+++ b/test/integration/test-bug-782777-single-arch-weirdness
@@ -0,0 +1,72 @@
+#!/bin/sh
+# Ensure that the order in which packages are in the binary cache
+# does not effect if they can be found or not
+set -e
+
+TESTDIR=$(readlink -f $(dirname $0))
+. $TESTDIR/framework
+setupenvironment
+configarchitecture 'i386'
+
+insertpackage 'unstable' 'abar' 'i386' '1'
+insertpackage 'unstable' 'foobar' 'i386' '1' 'Depends: abar:amd64, zfoo:amd64'
+insertpackage 'unstable' 'zfoo' 'i386' '1'
+
+setupaptarchive
+
+testrun() {
+ rm -f rootdir/var/lib/apt/extended_states
+
+ testequal 'Reading package lists...
+Building dependency tree...
+The following NEW packages will be installed:
+ abar zfoo
+0 upgraded, 2 newly installed, 0 to remove and 0 not upgraded.
+Inst abar (1 unstable [i386])
+Inst zfoo (1 unstable [i386])
+Conf abar (1 unstable [i386])
+Conf zfoo (1 unstable [i386])' aptget install abar zfoo -s
+
+ testequal 'Reading package lists...
+Building dependency tree...
+The following NEW packages will be installed:
+ abar zfoo
+0 upgraded, 2 newly installed, 0 to remove and 0 not upgraded.
+Inst abar (1 unstable [i386])
+Inst zfoo (1 unstable [i386])
+Conf abar (1 unstable [i386])
+Conf zfoo (1 unstable [i386])' aptget install abar:i386 zfoo:i386 -s
+
+ testequal "Reading package lists...
+Building dependency tree...
+Package abar:amd64 is not available, but is referred to by another package.
+This may mean that the package is missing, has been obsoleted, or
+is only available from another source
+
+Package zfoo:amd64 is not available, but is referred to by another package.
+This may mean that the package is missing, has been obsoleted, or
+is only available from another source
+
+E: Package 'abar:amd64' has no installation candidate
+E: Package 'zfoo:amd64' has no installation candidate" aptget install abar:amd64 zfoo:amd64 -s
+
+ cp -f rootdir/var/lib/dpkg/status status.backup
+ insertinstalledpackage 'abar' 'i386' '1'
+ insertinstalledpackage 'zfoo' 'i386' '1'
+
+ testequal 'abar
+zfoo' aptmark showmanual abar zfoo
+ testequal 'abar set to automatically installed.
+zfoo set to automatically installed.' aptmark auto abar zfoo
+ testempty aptmark showmanual abar zfoo
+ testequal 'abar
+zfoo' aptmark showauto abar zfoo
+
+ mv -f status.backup rootdir/var/lib/dpkg/status
+}
+
+msgmsg 'Single-Arch testrun'
+testrun
+msgmsg 'Multi-Arch testrun'
+configarchitecture 'i386' 'amd64'
+testrun
diff --git a/test/integration/test-bug-lp1445239-download-loop b/test/integration/test-bug-lp1445239-download-loop
new file mode 100755
index 000000000..4e4de67bd
--- /dev/null
+++ b/test/integration/test-bug-lp1445239-download-loop
@@ -0,0 +1,29 @@
+#!/bin/sh
+#
+# this is a regression test for LP: #1445239 where a partial download can
+# trigger an endless hang of the download method
+#
+
+set -e
+
+TESTDIR=$(readlink -f $(dirname $0))
+. $TESTDIR/framework
+setupenvironment
+configarchitecture 'amd64'
+
+changetowebserver
+webserverconfig 'aptwebserver::support::range' 'true'
+
+TESTFILE='aptarchive/testfile'
+dd if=/dev/zero of=$TESTFILE bs=100k count=1 2>/dev/null
+
+DOWNLOADLOG='rootdir/tmp/testdownloadfile.log'
+
+TARGET=./downloaded/testfile-downloaded
+dd if=/dev/zero of=$TARGET bs=99k count=1 2>/dev/null
+if ! downloadfile http://localhost:8080/testfile "$TARGET" > "$DOWNLOADLOG"; then
+ cat >&2 "$DOWNLOADLOG"
+ msgfail
+else
+ msgpass
+fi
diff --git a/test/interactive-helper/aptwebserver.cc b/test/interactive-helper/aptwebserver.cc
index c933060e7..411da0e8f 100644
--- a/test/interactive-helper/aptwebserver.cc
+++ b/test/interactive-helper/aptwebserver.cc
@@ -731,13 +731,15 @@ static void * handleClient(void * voidclient) /*{{{*/
if (filesize > filestart)
{
data.Skip(filestart);
- std::ostringstream contentlength;
- contentlength << "Content-Length: " << (filesize - filestart);
- headers.push_back(contentlength.str());
+ // make sure to send content-range before conent-length
+ // as regression test for LP: #1445239
std::ostringstream contentrange;
contentrange << "Content-Range: bytes " << filestart << "-"
<< filesize - 1 << "/" << filesize;
headers.push_back(contentrange.str());
+ std::ostringstream contentlength;
+ contentlength << "Content-Length: " << (filesize - filestart);
+ headers.push_back(contentlength.str());
sendHead(client, 206, headers);
if (sendContent == true)
sendFile(client, headers, data);