summaryrefslogtreecommitdiff
path: root/test/integration/test-partial-file-support
diff options
context:
space:
mode:
authorMichael Vogt <mvo@debian.org>2014-04-01 13:57:22 +0200
committerMichael Vogt <mvo@debian.org>2014-04-01 13:57:22 +0200
commit8a1c9010137a8c49d9808f2db34b9ee277138986 (patch)
tree5ec5c0103cb896407d8c9542fac0ec8ab3313602 /test/integration/test-partial-file-support
parentfa55ccaa85ca8f85251300f5c5f574edc0c3ca71 (diff)
parent417e83d0d79637266e04c98189c62ce85bcdf737 (diff)
Merge branch 'debian/sid' into ubuntu/master
Conflicts: apt-pkg/deb/dpkgpm.cc debian/apt.auto-removal.sh debian/changelog vendor/debian/sources.list.in
Diffstat (limited to 'test/integration/test-partial-file-support')
-rwxr-xr-xtest/integration/test-partial-file-support43
1 files changed, 14 insertions, 29 deletions
diff --git a/test/integration/test-partial-file-support b/test/integration/test-partial-file-support
index 382789e68..5ab326def 100755
--- a/test/integration/test-partial-file-support
+++ b/test/integration/test-partial-file-support
@@ -13,17 +13,18 @@ copysource() {
touch -d "$(stat --format '%y' "${TESTFILE}")" "$3"
}
+DOWNLOADLOG='rootdir/tmp/testdownloadfile.log'
+
testdownloadfile() {
- local DOWNLOG='download-testfile.log'
- rm -f "$DOWNLOG"
+ rm -f "$DOWNLOADLOG"
msgtest "Testing download of file $2 with" "$1"
- if ! downloadfile "$2" "$3" > "$DOWNLOG"; then
- cat >&2 "$DOWNLOG"
+ if ! downloadfile "$2" "$3" > "$DOWNLOADLOG"; then
+ cat >&2 "$DOWNLOADLOG"
msgfail
else
msgpass
fi
- cat "$DOWNLOG" | while read field hash; do
+ cat "$DOWNLOADLOG" | while read field hash; do
local EXPECTED
case "$field" in
'MD5Sum-Hash:') EXPECTED="$(md5sum "$TESTFILE" | cut -d' ' -f 1)";;
@@ -40,28 +41,12 @@ testdownloadfile() {
if [ "$EXPECTED" "$4" "$hash" ]; then
msgpass
else
- cat >&2 "$DOWNLOG"
+ cat >&2 "$DOWNLOADLOG"
msgfail "expected: $EXPECTED ; got: $hash"
fi
done
}
-testwebserverlaststatuscode() {
- local DOWNLOG='download-testfile.log'
- rm -f "$DOWNLOG"
- local STATUS="$(mktemp)"
- addtrap "rm $STATUS;"
- msgtest 'Test last status code from the webserver was' "$1"
- downloadfile "http://localhost:8080/_config/find/aptwebserver::last-status-code" "$STATUS" > "$DOWNLOG"
- if [ "$(cat "$STATUS")" = "$1" ]; then
- msgpass
- else
- cat >&2 "$DOWNLOG"
- msgfail "Status was $(cat "$STATUS")"
- fi
-}
-
-
TESTFILE='aptarchive/testfile'
cp -a ${TESTDIR}/framework $TESTFILE
@@ -70,34 +55,34 @@ testrun() {
copysource $TESTFILE 0 ./testfile
testdownloadfile 'no data' "${1}/testfile" './testfile' '='
- testwebserverlaststatuscode '200'
+ testwebserverlaststatuscode '200' "$DOWNLOADLOG"
copysource $TESTFILE 20 ./testfile
testdownloadfile 'valid partial data' "${1}/testfile" './testfile' '='
- testwebserverlaststatuscode '206'
+ testwebserverlaststatuscode '206' "$DOWNLOADLOG"
copysource /dev/zero 20 ./testfile
testdownloadfile 'invalid partial data' "${1}/testfile" './testfile' '!='
- testwebserverlaststatuscode '206'
+ testwebserverlaststatuscode '206' "$DOWNLOADLOG"
copysource $TESTFILE 1M ./testfile
testdownloadfile 'completely downloaded file' "${1}/testfile" './testfile' '='
- testwebserverlaststatuscode '416'
+ testwebserverlaststatuscode '416' "$DOWNLOADLOG"
copysource /dev/zero 1M ./testfile
testdownloadfile 'too-big partial file' "${1}/testfile" './testfile' '='
- testwebserverlaststatuscode '200'
+ testwebserverlaststatuscode '200' "$DOWNLOADLOG"
copysource /dev/zero 20 ./testfile
touch ./testfile
testdownloadfile 'old data' "${1}/testfile" './testfile' '='
- testwebserverlaststatuscode '200'
+ testwebserverlaststatuscode '200' "$DOWNLOADLOG"
webserverconfig 'aptwebserver::support::range' 'false'
copysource $TESTFILE 20 ./testfile
testdownloadfile 'no server support' "${1}/testfile" './testfile' '='
- testwebserverlaststatuscode '200'
+ testwebserverlaststatuscode '200' "$DOWNLOADLOG"
}
testrun 'http://localhost:8080'