summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/integration/framework47
-rw-r--r--test/integration/joesixpack.pubbin639 -> 639 bytes
-rw-r--r--test/integration/joesixpack.secbin1290 -> 1290 bytes
-rw-r--r--test/integration/keyrings/test-archive-keyring.pubbin979 -> 979 bytes
-rw-r--r--test/integration/keyrings/test-archive-keyring.secbin1355 -> 1642 bytes
-rw-r--r--test/integration/keyrings/test-master-keyring.pubbin1199 -> 1199 bytes
-rw-r--r--test/integration/keyrings/test-master-keyring.secbin2501 -> 2501 bytes
-rw-r--r--test/integration/marvinparanoid.pubbin629 -> 624 bytes
-rw-r--r--test/integration/marvinparanoid.secbin1280 -> 1275 bytes
-rw-r--r--test/integration/rexexpired.pubbin1200 -> 1191 bytes
-rw-r--r--test/integration/rexexpired.secbin2502 -> 2493 bytes
-rwxr-xr-xtest/integration/test-apt-get-install-deb35
-rwxr-xr-xtest/integration/test-apt-key42
-rwxr-xr-xtest/integration/test-apt-key-net-update9
-rwxr-xr-xtest/integration/test-apt-key-used-in-maintainerscript2
-rwxr-xr-xtest/integration/test-apt-update-transactions2
-rwxr-xr-xtest/integration/test-bug-623443-fail-on-bad-proxies5
-rwxr-xr-xtest/integration/test-bug-778375-server-has-no-reason-phrase1
-rwxr-xr-xtest/integration/test-bug-lp1445239-download-loop1
-rwxr-xr-xtest/integration/test-handle-redirect-as-used-mirror-change24
-rwxr-xr-xtest/integration/test-partial-file-support8
-rwxr-xr-xtest/integration/test-pdiff-usage29
-rwxr-xr-xtest/integration/test-releasefile-verification7
-rw-r--r--test/interactive-helper/aptwebserver.cc12
-rw-r--r--test/libapt/install_progress_test.cc7
-rw-r--r--test/libapt/srvrecs_test.cc10
-rw-r--r--test/libapt/stringview_test.cc20
27 files changed, 183 insertions, 78 deletions
diff --git a/test/integration/framework b/test/integration/framework
index 8a95d79bb..1e356ffaf 100644
--- a/test/integration/framework
+++ b/test/integration/framework
@@ -216,7 +216,7 @@ gdb() {
if [ "${CMD##*/}" = "$CMD" ]; then
CMD="${BUILDDIRECTORY}/${CMD}"
fi
- runapt command gdb --quiet -ex run "$CMD" --args "$CMD" "$@"
+ runapt command gdb --quiet -ex "directory '$SOURCEDIRECTORY'" -ex run "$CMD" --args "$CMD" "$@"
}
lastmodification() {
date -u -d "@$(stat -c '%Y' "${TMPWORKINGDIRECTORY}/$1")" -R
@@ -1856,49 +1856,24 @@ testwebserverlaststatuscode() {
msggroup
}
-createlistofkeys() {
- local OUTPUT="$1"
- shift
+mapkeynametokeyid() {
while [ -n "$1" ]; do
- # gpg 2.1.something starts printing [SC] at some point
- if grep -q ' rsa2048/' "$OUTPUT" && grep -qF '[SC]' "$OUTPUT"; then
- case "$1" in
- *Joe*|*Sixpack*) echo 'pub rsa2048/DBAC8DAE 2010-08-18 [SC]';;
- *Rex*|*Expired*) echo 'pub rsa2048/27CE74F9 2013-07-12 [SC] [expired: 2013-07-13]';;
- *Marvin*|*Paranoid*) echo 'pub rsa2048/528144E2 2011-01-16 [SC]';;
- oldarchive) echo 'pub rsa1024/F68C85A3 2013-12-19 [SC]';;
- newarchive) echo 'pub rsa2048/DBAC8DAE 2010-08-18 [SC]';;
- *) echo 'UNKNOWN KEY';;
- esac
- # gpg 2.1 has a slightly different output format
- elif grep -q ' rsa2048/' "$OUTPUT"; then
- case "$1" in
- *Joe*|*Sixpack*) echo 'pub rsa2048/DBAC8DAE 2010-08-18';;
- *Rex*|*Expired*) echo 'pub rsa2048/27CE74F9 2013-07-12 [expired: 2013-07-13]';;
- *Marvin*|*Paranoid*) echo 'pub rsa2048/528144E2 2011-01-16';;
- oldarchive) echo 'pub rsa1024/F68C85A3 2013-12-19';;
- newarchive) echo 'pub rsa2048/DBAC8DAE 2010-08-18';;
- *) echo 'UNKNOWN KEY';;
- esac
- else
- case "$1" in
- *Joe*|*Sixpack*) echo 'pub 2048R/DBAC8DAE 2010-08-18';;
- *Rex*|*Expired*) echo 'pub 2048R/27CE74F9 2013-07-12 [expired: 2013-07-13]';;
- *Marvin*|*Paranoid*) echo 'pub 2048R/528144E2 2011-01-16';;
- oldarchive) echo 'pub 1024R/F68C85A3 2013-12-19';;
- newarchive) echo 'pub 2048R/DBAC8DAE 2010-08-18';;
- *) echo 'UNKNOWN KEY';;
- esac
- fi
+ case "$1" in
+ *Joe*|*Sixpack*|newarchive) echo '5A90D141DBAC8DAE';;
+ *Rex*|*Expired*) echo '4BC0A39C27CE74F9';;
+ *Marvin*|*Paranoid*) echo 'E8525D47528144E2';;
+ oldarchive) echo 'FDD2DB85F68C85A3';;
+ *) echo 'UNKNOWN KEY';;
+ esac
shift
done
}
testaptkeys() {
local OUTPUT="${TMPWORKINGDIRECTORY}/rootdir/tmp/aptkeylist.output"
- if ! aptkey list | grep '^pub' > "$OUTPUT"; then
+ if ! aptkey list --with-colon | grep '^pub' | cut -d':' -f 5 > "$OUTPUT"; then
echo -n > "$OUTPUT"
fi
- testfileequal "$OUTPUT" "$(createlistofkeys "$OUTPUT" "$@")"
+ testfileequal "$OUTPUT" "$(mapkeynametokeyid "$@")"
}
pause() {
diff --git a/test/integration/joesixpack.pub b/test/integration/joesixpack.pub
index 2b40b97b6..cad056104 100644
--- a/test/integration/joesixpack.pub
+++ b/test/integration/joesixpack.pub
Binary files differ
diff --git a/test/integration/joesixpack.sec b/test/integration/joesixpack.sec
index 92aaada76..0dc5cd8f6 100644
--- a/test/integration/joesixpack.sec
+++ b/test/integration/joesixpack.sec
Binary files differ
diff --git a/test/integration/keyrings/test-archive-keyring.pub b/test/integration/keyrings/test-archive-keyring.pub
index d8d9d472b..325174086 100644
--- a/test/integration/keyrings/test-archive-keyring.pub
+++ b/test/integration/keyrings/test-archive-keyring.pub
Binary files differ
diff --git a/test/integration/keyrings/test-archive-keyring.sec b/test/integration/keyrings/test-archive-keyring.sec
index aece750e8..001f79569 100644
--- a/test/integration/keyrings/test-archive-keyring.sec
+++ b/test/integration/keyrings/test-archive-keyring.sec
Binary files differ
diff --git a/test/integration/keyrings/test-master-keyring.pub b/test/integration/keyrings/test-master-keyring.pub
index 33aa16796..9809d3259 100644
--- a/test/integration/keyrings/test-master-keyring.pub
+++ b/test/integration/keyrings/test-master-keyring.pub
Binary files differ
diff --git a/test/integration/keyrings/test-master-keyring.sec b/test/integration/keyrings/test-master-keyring.sec
index 9cb33176c..c5c5bfd5f 100644
--- a/test/integration/keyrings/test-master-keyring.sec
+++ b/test/integration/keyrings/test-master-keyring.sec
Binary files differ
diff --git a/test/integration/marvinparanoid.pub b/test/integration/marvinparanoid.pub
index 9a59c2e40..866dc1492 100644
--- a/test/integration/marvinparanoid.pub
+++ b/test/integration/marvinparanoid.pub
Binary files differ
diff --git a/test/integration/marvinparanoid.sec b/test/integration/marvinparanoid.sec
index ff54e8680..ace09f735 100644
--- a/test/integration/marvinparanoid.sec
+++ b/test/integration/marvinparanoid.sec
Binary files differ
diff --git a/test/integration/rexexpired.pub b/test/integration/rexexpired.pub
index 5ab2e489a..2d2c81c83 100644
--- a/test/integration/rexexpired.pub
+++ b/test/integration/rexexpired.pub
Binary files differ
diff --git a/test/integration/rexexpired.sec b/test/integration/rexexpired.sec
index dc00168cd..c431fd908 100644
--- a/test/integration/rexexpired.sec
+++ b/test/integration/rexexpired.sec
Binary files differ
diff --git a/test/integration/test-apt-get-install-deb b/test/integration/test-apt-get-install-deb
index 3aacc301d..5f2877dfd 100755
--- a/test/integration/test-apt-get-install-deb
+++ b/test/integration/test-apt-get-install-deb
@@ -64,6 +64,23 @@ Remv foo:i386 [1.0]
Inst foo (1.0 local-deb [amd64])
Conf foo (1.0 local-deb [amd64])" aptget install ./incoming/foo_1.0_amd64.deb -s
+testsuccessequal 'Reading package lists...
+Building dependency tree...
+Reading state information...
+0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.' aptget install --with-source ./incoming/foo_1.0_amd64.deb -s
+
+testsuccessequal 'Reading package lists...
+Building dependency tree...
+Reading state information...
+The following packages will be REMOVED:
+ foo:i386
+The following NEW packages will be installed:
+ foo
+0 upgraded, 1 newly installed, 1 to remove and 0 not upgraded.
+Remv foo:i386 [1.0]
+Inst foo (1.0 local-deb [amd64])
+Conf foo (1.0 local-deb [amd64])' aptget install --with-source ./incoming/foo_1.0_amd64.deb foo -s
+
# Check that installing the local deb works if it is not the candidate
echo "Package: foo
Pin: version 1.0
@@ -133,3 +150,21 @@ fi
sed -i -e '/^Depends: foo/ d' rootdir/var/lib/dpkg/status
testsuccess aptget install -y ./incoming/pkg-as-it-should-be_0_all.deb
testfailure grep 'is already the newest version' rootdir/tmp/testsuccess.output
+testsuccess apt purge -y pkg-as-it-should-be
+
+echo "Package: pkg-as-it-should-be
+Architecture: all
+Version: 0
+Installed-Size: 2903
+Filename: incoming/pkg-as-it-should-be_0_all.deb
+Size: $(stat -c %s incoming/pkg-as-it-should-be_0_all.deb)
+SHA256: $(sha256sum incoming/pkg-as-it-should-be_0_all.deb | cut -d' ' -f 1)
+" > Packages
+testdpkgnotinstalled 'pkg-as-it-should-be'
+testnopackage pkg-as-it-should-be
+testsuccess apt install --with-source ./Packages pkg-as-it-should-be -s
+testsuccess apt install --with-source ./Packages pkg-as-it-should-be --print-uris
+testsuccess apt show --with-source ./Packages pkg-as-it-should-be
+testequal 'Package: pkg-as-it-should-be' head -n1 rootdir/tmp/testsuccess.output
+testsuccess apt install -y --with-source ./Packages pkg-as-it-should-be
+testdpkginstalled 'pkg-as-it-should-be'
diff --git a/test/integration/test-apt-key b/test/integration/test-apt-key
index e777de1a4..759ce1487 100755
--- a/test/integration/test-apt-key
+++ b/test/integration/test-apt-key
@@ -41,7 +41,9 @@ APT::Key::RemovedKeys \"${KEYDIR}/rexexpired.pub\";" > "${ROOTDIR}/etc/apt/apt.c
msgtest 'Check that paths in finger output are not' 'double-slashed'
testfailure --nomsg grep '//' "${ROOTDIR}/tmp/testsuccess.output"
- testsuccessequal 'gpg: key DBAC8DAE: "Joe Sixpack (APT Testcases Dummy) <joe@example.org>" not changed
+ testequalor2 'gpg: key DBAC8DAE: "Joe Sixpack (APT Testcases Dummy) <joe@example.org>" not changed
+gpg: Total number processed: 1
+gpg: unchanged: 1' 'gpg: key 5A90D141DBAC8DAE: "Joe Sixpack (APT Testcases Dummy) <joe@example.org>" not changed
gpg: Total number processed: 1
gpg: unchanged: 1' aptkey --fakeroot update
@@ -114,6 +116,14 @@ gpg: unchanged: 1' aptkey --fakeroot update
testfailure test -e "${ROOTDIR}/etc/apt/trusted.gpg.d/joesixpack.gpg"
testsuccess cmp "${KEYDIR}/joesixpack.pub" "${ROOTDIR}/etc/apt/trusted.gpg.d/joesixpack.gpg~"
+ msgtest 'Test key removal with' 'spaced fingerprint'
+ cleanplate
+ cp -a "${KEYDIR}/joesixpack.pub" "${ROOTDIR}/etc/apt/trusted.gpg.d/joesixpack.gpg"
+ testsuccess --nomsg aptkey --fakeroot del '34A8 E9D1 8DB3 20F3 67E8 EAA0 5A90 D141 DBAC 8DAE'
+ testempty aptkey list
+ testfailure test -e "${ROOTDIR}/etc/apt/trusted.gpg.d/joesixpack.gpg"
+ testsuccess cmp "${KEYDIR}/joesixpack.pub" "${ROOTDIR}/etc/apt/trusted.gpg.d/joesixpack.gpg~"
+
msgtest 'Test key removal with' 'single key in softlink'
cleanplate
ln -s "$(readlink -f "${KEYDIR}/joesixpack.pub")" "${ROOTDIR}/etc/apt/trusted.gpg.d/joesixpack.gpg"
@@ -185,8 +195,9 @@ gpg: unchanged: 1' aptkey --fakeroot update
msgtest 'Test verify a file' 'with no sig'
testfailure --nomsg aptkey --quiet --readonly --keyring "${KEYDIR}/testcase-multikey.pub" verify "${SIGNATURE}" "${SIGNATURE}2"
- for GPGV in '' 'gpgv' 'gpgv2'; do
+ for GPGV in '' 'gpgv' 'gpgv1' 'gpgv2'; do
echo "APT::Key::GPGVCommand \"$GPGV\";" > "${ROOTDIR}/etc/apt/apt.conf.d/00gpgvcmd"
+ if [ -n "$GPGV" ] && ! command dpkg -l gnupg1 2>&1 | grep -q '^ii'; then continue; fi
msgtest 'Test verify a file' 'with all keys'
testsuccess --nomsg aptkey --quiet --readonly verify "${SIGNATURE}.gpg" "${SIGNATURE}"
@@ -229,8 +240,9 @@ gpg: unchanged: 1' aptkey --fakeroot update
adv --batch --yes -u 'Marvin' -u 'Joe' --armor --detach-sign --sign --output "${SIGNATURE}.gpg" "${SIGNATURE}"
testsuccess test -s "${SIGNATURE}.gpg" -a -s "${SIGNATURE}"
- for GPGV in '' 'gpgv' 'gpgv2'; do
+ for GPGV in '' 'gpgv' 'gpgv1' 'gpgv2'; do
echo "APT::Key::GPGVCommand \"$GPGV\";" > "${ROOTDIR}/etc/apt/apt.conf.d/00gpgvcmd"
+ if [ -n "$GPGV" ] && ! command dpkg -l gnupg1 2>&1 | grep -q '^ii'; then continue; fi
msgtest 'Test verify a doublesigned file' 'with all keys'
testsuccess --nomsg aptkey --quiet --readonly verify "${SIGNATURE}.gpg" "${SIGNATURE}"
@@ -265,11 +277,25 @@ gpg: unchanged: 1' aptkey --fakeroot update
}
setupgpgcommand() {
- echo "APT::Key::GPGCommand \"$1\";" > "${ROOTDIR}/etc/apt/apt.conf.d/00gpgcmd"
- msgmsg 'Force tests to be run with' "$1"
+ local GPGEXE;
+ if command dpkg -l gnupg1 2>&1 | grep -q '^ii'; then
+ if [ "$1" = '1' ]; then
+ GPGEXE='gpg1'
+ else
+ GPGEXE='gpg'
+ fi
+ else
+ if [ "$1" = '1' ]; then
+ GPGEXE='gpg'
+ else
+ GPGEXE='gpg2'
+ fi
+ fi
+ msgmsg 'Force tests to be run with' "$GPGEXE"
+ echo "APT::Key::GPGCommand \"$GPGEXE\";" > "${ROOTDIR}/etc/apt/apt.conf.d/00gpgcmd"
testsuccess aptkey --readonly adv --version
cp "${ROOTDIR}/tmp/testsuccess.output" "${TMPWORKINGDIRECTORY}/aptkey.version"
- testsuccess grep "^gpg (GnuPG) $2\." "${TMPWORKINGDIRECTORY}/aptkey.version"
+ testsuccess grep "^gpg (GnuPG) $1\." "${TMPWORKINGDIRECTORY}/aptkey.version"
}
# run with default (whatever this is) in current CWD with relative paths
@@ -285,7 +311,7 @@ cd inaccessible
chmod 600 ../inaccessible
testfilestats "${TMPWORKINGDIRECTORY}/inaccessible" '%a' '=' '600'
-setupgpgcommand 'gpg' '1'
+setupgpgcommand '1'
testrun
-setupgpgcommand 'gpg2' '2'
+setupgpgcommand '2'
testrun
diff --git a/test/integration/test-apt-key-net-update b/test/integration/test-apt-key-net-update
index 990fb5ad2..b9f716e10 100755
--- a/test/integration/test-apt-key-net-update
+++ b/test/integration/test-apt-key-net-update
@@ -24,14 +24,7 @@ echo 'APT::Key::Net-Update-Enabled "1";' >> ./aptconfig.conf
# test against the "real" webserver
testsuccess aptkey --fakeroot net-update
-testequalor2 'Checking for new archive signing keys now
-gpg: key F68C85A3: public key "Test Automatic Archive Signing Key <ftpmaster@example.com>" imported
-gpg: Total number processed: 1
-gpg: imported: 1 (RSA: 1)' 'Checking for new archive signing keys now
-gpg: key F68C85A3: public key "Test Automatic Archive Signing Key <ftpmaster@example.com>" imported
-gpg: Total number processed: 1
-gpg: imported: 1' cat rootdir/tmp/testsuccess.output
-
+testfailure grep 'not added' rootdir/tmp/testsuccess.output
testaptkeys 'oldarchive' 'newarchive'
# now try a different one
diff --git a/test/integration/test-apt-key-used-in-maintainerscript b/test/integration/test-apt-key-used-in-maintainerscript
index f7008084f..b5ed3279f 100755
--- a/test/integration/test-apt-key-used-in-maintainerscript
+++ b/test/integration/test-apt-key-used-in-maintainerscript
@@ -32,7 +32,7 @@ testdpkginstalled 'aptkeyuser-depends'
testfailure grep '^Warning: This will BREAK' apt.output
testsuccess grep '^Warning: apt-key' apt.output
-testsuccess apt install ./incoming/aptkeyuser-nodepends_*.changes -y
+testsuccess apt install --with-source ./incoming/aptkeyuser-nodepends_*.changes aptkeyuser-nodepends -y
cp rootdir/tmp/testsuccess.output apt.output
testdpkginstalled 'aptkeyuser-nodepends'
testsuccess grep '^Warning: This will BREAK' apt.output
diff --git a/test/integration/test-apt-update-transactions b/test/integration/test-apt-update-transactions
index d8154b283..ab678c133 100755
--- a/test/integration/test-apt-update-transactions
+++ b/test/integration/test-apt-update-transactions
@@ -82,7 +82,7 @@ testsetup 'file'
changetowebserver
webserverconfig 'aptwebserver::support::modified-since' 'false' "$1"
webserverconfig 'aptwebserver::support::last-modified' 'false' "$1" # curl is clever and sees hits here also
-webserverconfig 'aptwebserver::support::range' 'false' "$1"
+webserverconfig 'aptwebserver::response-header::Accept-Ranges' 'none' "$1"
testsetup 'http'
diff --git a/test/integration/test-bug-623443-fail-on-bad-proxies b/test/integration/test-bug-623443-fail-on-bad-proxies
index 04542e0cd..d91a3ab8b 100755
--- a/test/integration/test-bug-623443-fail-on-bad-proxies
+++ b/test/integration/test-bug-623443-fail-on-bad-proxies
@@ -29,5 +29,6 @@ testfailure apt update
unset http_proxy
testsuccess grep 'Unsupported proxy configured' rootdir/tmp/testfailure.output
-
-
+echo 'Acquire::http::Proxy "foo://example.org";
+Acquire::https::Proxy "DIRECT";' > rootdir/etc/apt/apt.conf.d/proxy.conf
+testsuccess apt update
diff --git a/test/integration/test-bug-778375-server-has-no-reason-phrase b/test/integration/test-bug-778375-server-has-no-reason-phrase
index bce41235f..28e31e069 100755
--- a/test/integration/test-bug-778375-server-has-no-reason-phrase
+++ b/test/integration/test-bug-778375-server-has-no-reason-phrase
@@ -11,6 +11,7 @@ echo 'found' > aptarchive/working
changetohttpswebserver -o 'aptwebserver::redirect::replace::/redirectme/=/' \
-o 'aptwebserver::httpcode::200=200' -o 'aptwebserver::httpcode::404=404' \
-o 'aptwebserver::httpcode::301=301'
+webserverconfig 'aptwebserver::empty-response-header::' 'foobar'
testdownload() {
rm -f downfile
diff --git a/test/integration/test-bug-lp1445239-download-loop b/test/integration/test-bug-lp1445239-download-loop
index a12d5252d..6802840a5 100755
--- a/test/integration/test-bug-lp1445239-download-loop
+++ b/test/integration/test-bug-lp1445239-download-loop
@@ -12,7 +12,6 @@ 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
diff --git a/test/integration/test-handle-redirect-as-used-mirror-change b/test/integration/test-handle-redirect-as-used-mirror-change
index 2f6431e66..2e8fbeff6 100755
--- a/test/integration/test-handle-redirect-as-used-mirror-change
+++ b/test/integration/test-handle-redirect-as-used-mirror-change
@@ -44,10 +44,28 @@ testsuccess apthelper download-file "http://localhost:${APTHTTPPORT}/redirectme/
testsuccess test -s inrelease
cd - >/dev/null
+webserverconfig "aptwebserver::redirect::replace::http://0.0.0.0:${APTHTTPPORT}/dists/unstable/InRelease" "http://0.0.0.0:${APTHTTPPORT}/storage/dists/unstable/InRelease"
+mkdir -p aptarchive/storage/dists/unstable
+mv aptarchive/dists/unstable/InRelease aptarchive/storage/dists/unstable
+rm -rf rootdir/var/lib/apt/lists
+testsuccessequal "Get:1 http://0.0.0.0:${APTHTTPPORT}/storage unstable InRelease [$(stat -c %s aptarchive/storage/dists/unstable/InRelease) B]
+Ign:2 http://0.0.0.0:${APTHTTPPORT}/storage unstable/main Sources
+ 404 Not Found
+Ign:3 http://0.0.0.0:${APTHTTPPORT}/storage unstable/main all Packages
+ 404 Not Found
+Ign:4 http://0.0.0.0:${APTHTTPPORT}/storage unstable/main Translation-en
+ 404 Not Found
+Get:2 http://0.0.0.0:${APTHTTPPORT} unstable/main Sources [$(stat -c %s aptarchive/dists/unstable/main/source/Sources.gz) B]
+Get:3 http://0.0.0.0:${APTHTTPPORT} unstable/main all Packages [$(stat -c %s aptarchive/dists/unstable/main/binary-all/Packages.gz) B]
+Get:4 http://0.0.0.0:${APTHTTPPORT} unstable/main Translation-en [$(stat -c %s aptarchive/dists/unstable/main/i18n/Translation-en.gz) B]
+Reading package lists...
+Building dependency tree...
+All packages are up to date." apt update
+
find aptarchive -name 'InRelease' -delete
rm -rf rootdir/var/lib/apt/lists
-testsuccessequal "Ign:1 http://0.0.0.0:${APTHTTPPORT} unstable InRelease
+testsuccessequal "Ign:1 http://0.0.0.0:${APTHTTPPORT}/storage unstable InRelease
404 Not Found
Get:2 http://0.0.0.0:${APTHTTPPORT} unstable Release [$(stat -c %s aptarchive/dists/unstable/Release) B]
Get:3 http://0.0.0.0:${APTHTTPPORT} unstable Release.gpg [$(stat -c %s aptarchive/dists/unstable/Release.gpg) B]
@@ -56,9 +74,7 @@ Get:5 http://0.0.0.0:${APTHTTPPORT} unstable/main all Packages [$(stat -c %s apt
Get:6 http://0.0.0.0:${APTHTTPPORT} unstable/main Translation-en [$(stat -c %s aptarchive/dists/unstable/main/i18n/Translation-en.gz) B]
Reading package lists..." aptget update
-testsuccessequal "Ign:1 http://0.0.0.0:${APTHTTPPORT} unstable InRelease
+testsuccessequal "Ign:1 http://0.0.0.0:${APTHTTPPORT}/storage unstable InRelease
404 Not Found
Hit:2 http://0.0.0.0:${APTHTTPPORT} unstable Release
Reading package lists..." aptget update
-
-
diff --git a/test/integration/test-partial-file-support b/test/integration/test-partial-file-support
index 1c5d120d8..9b5eed1e5 100755
--- a/test/integration/test-partial-file-support
+++ b/test/integration/test-partial-file-support
@@ -96,6 +96,7 @@ followuprequest() {
testrun() {
webserverconfig 'aptwebserver::support::range' 'true'
+ webserverconfig 'aptwebserver::response-header::Accept-Ranges' 'bytes'
local DOWN='./downloaded/testfile'
copysource $TESTFILE 0 $DOWN
@@ -125,7 +126,11 @@ testrun() {
testdownloadfile 'old data' "${1}/testfile" "$DOWN" '='
testwebserverlaststatuscode '200' "$DOWNLOADLOG"
- webserverconfig 'aptwebserver::support::range' 'false'
+ if [ "${1%%:*}" = 'https' ] && expr match "$1" "^.*/redirectme$" >/dev/null; then
+ webserverconfig 'aptwebserver::response-header::Accept-Ranges' 'none'
+ else
+ webserverconfig 'aptwebserver::support::range' 'false'
+ fi
copysource $TESTFILE 20 $DOWN
testdownloadfile 'no server support' "${1}/testfile" "$DOWN" '='
@@ -148,4 +153,5 @@ changetohttpswebserver
serverconfigs "https://localhost:${APTHTTPSPORT}"
webserverconfig 'aptwebserver::redirect::replace::/redirectme/' "https://localhost:${APTHTTPSPORT}/"
+serverconfigs "https://localhost:${APTHTTPSPORT}/redirectme"
serverconfigs "http://localhost:${APTHTTPPORT}/redirectme"
diff --git a/test/integration/test-pdiff-usage b/test/integration/test-pdiff-usage
index 39d847203..59a3fd8af 100755
--- a/test/integration/test-pdiff-usage
+++ b/test/integration/test-pdiff-usage
@@ -35,6 +35,7 @@ wasmergeused() {
fi
testsuccess apt update "$@"
+ #apt update "$@" 2>&1 | tee rootdir/tmp/testsuccess.output
msgtest 'No intermediate patch files' 'still exist'
local EDS="$(find rootdir/var/lib/apt/lists -name '*.ed' -o -name '*.ed.*')"
@@ -116,6 +117,34 @@ SHA256-Download:
testsuccessequal "$(cat "${PKGFILE}-new")
" aptcache show apt newstuff
+ msgmsg "Testcase: apply with compressed Index and one patch: $*"
+ cp "${PKGFILE}-new" aptarchive/Packages
+ compressfile 'aptarchive/Packages'
+ cat "$PATCHINDEX" | gzip > "${PATCHINDEX}.gz"
+ generatereleasefiles '+1hour'
+ signreleasefiles
+ find aptarchive -name 'Packages*' -type f -delete
+ rm "$PATCHINDEX"
+ rm -rf rootdir/var/lib/apt/lists
+ cp -a rootdir/var/lib/apt/lists-bak rootdir/var/lib/apt/lists
+ wasmergeused "$@"
+ testnopackage oldstuff
+ testsuccessequal "$(cat "${PKGFILE}-new")
+" aptcache show apt newstuff
+
+ msgmsg "Testcase: apply with by-hash compressed Index and one patch: $*"
+ local NORMAL="$(readlink -f "./aptarchive/Packages.diff")"
+ local BYHASH="${NORMAL}/by-hash/SHA256"
+ mkdir -p "${BYHASH}"
+ find "${NORMAL}/" -maxdepth 1 -name "Index*" -exec mv '{}' "$BYHASH" \;
+ ln -s "${BYHASH}/Index.gz" "${BYHASH}/$(sha256sum "${BYHASH}/Index.gz" | cut -f1 -d' ')"
+ rm -rf rootdir/var/lib/apt/lists
+ cp -a rootdir/var/lib/apt/lists-bak rootdir/var/lib/apt/lists
+ wasmergeused "$@" -o Acquire::By-Hash=force
+ testnopackage oldstuff
+ testsuccessequal "$(cat "${PKGFILE}-new")
+" aptcache show apt newstuff
+
msgmsg "Testcase: SHA1-only patches are not used: $*"
find aptarchive -name 'Packages*' -type f -delete
cp "${PKGFILE}-new" aptarchive/Packages
diff --git a/test/integration/test-releasefile-verification b/test/integration/test-releasefile-verification
index 82e48ffa8..20ca613da 100755
--- a/test/integration/test-releasefile-verification
+++ b/test/integration/test-releasefile-verification
@@ -12,8 +12,6 @@ buildaptarchive
setupflataptarchive
changetowebserver
-webserverconfig 'aptwebserver::support::range' 'false'
-
prepare() {
local DATE="${2:-now}"
if [ "$DATE" = 'now' ]; then
@@ -239,7 +237,7 @@ runtest() {
updatewithwarnings '^W: .* NO_PUBKEY'
sed -i "s#^\(deb\(-src\)\?\) \[signed-by=$MARVIN\] #\1 #" rootdir/etc/apt/sources.list.d/*
- local MARVIN="$(aptkey --keyring $MARVIN finger | grep 'Key fingerprint' | cut -d'=' -f 2 | tr -d ' ')"
+ local MARVIN="$(aptkey --keyring $MARVIN finger --with-colons | grep '^fpr' | cut -d':' -f 10)"
msgmsg 'Cold archive signed by bad keyid' 'Joe Sixpack'
rm -rf rootdir/var/lib/apt/lists
signreleasefiles 'Joe Sixpack'
@@ -263,7 +261,7 @@ runtest() {
" aptcache show apt
installaptold
- local SIXPACK="$(aptkey --keyring keys/joesixpack.pub finger | grep 'Key fingerprint' | cut -d'=' -f 2 | tr -d ' ')"
+ local SIXPACK="$(aptkey --keyring keys/joesixpack.pub finger --with-colons | grep '^fpr' | cut -d':' -f 10)"
msgmsg 'Cold archive signed by good keyids' 'Joe Sixpack'
rm -rf rootdir/var/lib/apt/lists
signreleasefiles 'Joe Sixpack'
@@ -273,7 +271,6 @@ runtest() {
" aptcache show apt
installaptold
- local SIXPACK="$(aptkey --keyring keys/joesixpack.pub finger | grep 'Key fingerprint' | cut -d'=' -f 2 | tr -d ' ')"
msgmsg 'Cold archive signed by good keyids' 'Joe Sixpack'
rm -rf rootdir/var/lib/apt/lists
sed -i "s#^\(deb\(-src\)\?\) \[signed-by=${SIXPACK},${MARVIN}\] #\1 [signed-by=${MARVIN},${SIXPACK}] #" rootdir/etc/apt/sources.list.d/*
diff --git a/test/interactive-helper/aptwebserver.cc b/test/interactive-helper/aptwebserver.cc
index 817760ec3..950a17bc1 100644
--- a/test/interactive-helper/aptwebserver.cc
+++ b/test/interactive-helper/aptwebserver.cc
@@ -122,6 +122,9 @@ static bool sendHead(int const client, int const httpcode, std::list<std::string
_config->Set("APTWebserver::Last-Status-Code", httpcode);
std::stringstream buffer;
+ auto const empties = _config->FindVector("aptwebserver::empty-response-header");
+ for (auto && e: empties)
+ buffer << e << ":" << std::endl;
_config->Dump(buffer, "aptwebserver::response-header", "%t: %v%n", false);
std::vector<std::string> addheaders = VectorizeString(buffer.str(), '\n');
for (std::vector<std::string>::const_iterator h = addheaders.begin(); h != addheaders.end(); ++h)
@@ -714,6 +717,15 @@ static void * handleClient(void * voidclient) /*{{{*/
condition.clear();
if (condition.empty() == false && strncmp(condition.c_str(), "bytes=", 6) == 0)
{
+ std::string ranges = ',' + _config->Find("aptwebserver::response-header::Accept-Ranges") + ',';
+ ranges.erase(std::remove(ranges.begin(), ranges.end(), ' '), ranges.end());
+ if (ranges.find(",bytes,") == std::string::npos)
+ {
+ // we handle it as an error here because we are a test server - a real one should just ignore it
+ sendError(client, 400, *m, sendContent, "Client does range requests we don't support", headers);
+ continue;
+ }
+
time_t cache;
std::string ifrange;
if (_config->FindB("aptwebserver::support::if-range", true) == true)
diff --git a/test/libapt/install_progress_test.cc b/test/libapt/install_progress_test.cc
index a70fc9261..b63b4716f 100644
--- a/test/libapt/install_progress_test.cc
+++ b/test/libapt/install_progress_test.cc
@@ -12,9 +12,14 @@ TEST(InstallProgressTest, FancyGetTextProgressStr)
EXPECT_EQ(60, p.GetTextProgressStr(0.5, 60).size());
EXPECT_EQ("[#.]", p.GetTextProgressStr(0.5, 4));
+ EXPECT_EQ("[..........]", p.GetTextProgressStr(0.0, 12));
EXPECT_EQ("[#.........]", p.GetTextProgressStr(0.1, 12));
+ EXPECT_EQ("[####......]", p.GetTextProgressStr(0.4999, 12));
+ EXPECT_EQ("[#####.....]", p.GetTextProgressStr(0.5001, 12));
EXPECT_EQ("[#########.]", p.GetTextProgressStr(0.9, 12));
+ EXPECT_EQ("[##########]", p.GetTextProgressStr(1.0, 12));
// deal with incorrect inputs gracefully (or should we die instead?)
- EXPECT_EQ("", p.GetTextProgressStr(-999, 12));
+ EXPECT_EQ("[..........]", p.GetTextProgressStr(-1.0, 12));
+ EXPECT_EQ("[##########]", p.GetTextProgressStr(2.0, 12));
}
diff --git a/test/libapt/srvrecs_test.cc b/test/libapt/srvrecs_test.cc
index b3fa8102d..5253b1c34 100644
--- a/test/libapt/srvrecs_test.cc
+++ b/test/libapt/srvrecs_test.cc
@@ -53,12 +53,19 @@ TEST(SrvRecTest,Randomness)
EXPECT_EQ(testLength*2, base2.size());
std::vector<SrvRec> first_pull;
+ auto const startingClock = clock();
for (unsigned int i = 0; i < testLength; ++i)
first_pull.push_back(PopFromSrvRecs(base1));
EXPECT_TRUE(base1.empty());
EXPECT_FALSE(first_pull.empty());
EXPECT_EQ(testLength, first_pull.size());
+ // busy-wait for a cpu-clock change as we use it as "random" value
+ if (startingClock != -1)
+ for (int i = 0; i < 100000; ++i)
+ if (startingClock != clock())
+ break;
+
std::vector<SrvRec> second_pull;
for (unsigned int i = 0; i < testLength; ++i)
second_pull.push_back(PopFromSrvRecs(base2));
@@ -69,7 +76,8 @@ TEST(SrvRecTest,Randomness)
EXPECT_EQ(first_pull.size(), second_pull.size());
EXPECT_TRUE(std::all_of(first_pull.begin(), first_pull.end(), [](SrvRec const &R) { return R.priority == 20; }));
EXPECT_TRUE(std::all_of(second_pull.begin(), second_pull.end(), [](SrvRec const &R) { return R.priority == 20; }));
- EXPECT_FALSE(std::equal(first_pull.begin(), first_pull.end(), second_pull.begin()));
+ if (startingClock != -1 && startingClock != clock())
+ EXPECT_FALSE(std::equal(first_pull.begin(), first_pull.end(), second_pull.begin()));
EXPECT_TRUE(std::all_of(base2.begin(), base2.end(), [](SrvRec const &R) { return R.priority == 30; }));
}
diff --git a/test/libapt/stringview_test.cc b/test/libapt/stringview_test.cc
index a4b7d77e3..f215287d9 100644
--- a/test/libapt/stringview_test.cc
+++ b/test/libapt/stringview_test.cc
@@ -34,26 +34,28 @@ TEST(StringViewTest,EmptyString)
TEST(StringViewTest,FooString)
{
- constexpr APT::StringView defString("foo", 3);
+ constexpr APT::StringView defString("fooGARBAGE", 3);
static_assert( 3 == defString.length(), "def right size");
- EXPECT_EQ(defString.to_string(), defString.data());
+ EXPECT_EQ(0, defString.to_string().compare(0, defString.length(), defString.data(), 3));
APT::StringView strString{std::string{"foo"}};
EXPECT_EQ(3, strString.length());
- EXPECT_EQ(strString.to_string(), strString.data());
+ EXPECT_EQ(0, strString.to_string().compare(0, strString.length(), strString.data(), 3));
- constexpr char const * const charp = "foo";
+ constexpr char const * const charp = "fooGARBAGE";
constexpr APT::StringView charpString{charp, 3};
- EXPECT_EQ( 3, charpString.length());
- EXPECT_EQ(charpString.to_string(), charpString.data());
+ EXPECT_EQ(3, charpString.length());
+ EXPECT_EQ(0, charpString.to_string().compare(0, charpString.length(), charpString.data(), 3));
- APT::StringView charp2String{charp};
+ char * charp2 = strdup("foo");
+ APT::StringView charp2String{charp2};
EXPECT_EQ(3, charp2String.length());
- EXPECT_EQ(charp2String.to_string(), charp2String.data());
+ EXPECT_EQ(0, charp2String.to_string().compare(0, charp2String.length(), charp2String.data(), 3));
+ free(charp2);
const APT::StringView charaString{"foo"};
EXPECT_EQ(3, charaString.length());
- EXPECT_EQ(charaString.to_string(), charaString.data());
+ EXPECT_EQ(0, charaString.to_string().compare(0, charaString.length(), charaString.data(), 3));
EXPECT_TRUE(APT::StringView("foo") == "foo");
EXPECT_FALSE(APT::StringView("foo") != "foo");