#!/bin/sh
set -e
-TESTDIR=$(readlink -f $(dirname $0))
-. $TESTDIR/framework
+TESTDIR="$(readlink -f "$(dirname "$0")")"
+. "$TESTDIR/framework"
setupenvironment
configarchitecture 'amd64'
testdownloadfile() {
rm -f "$DOWNLOADLOG"
- msgtest "Testing download of file $2 with" "$1"
- if ! downloadfile "$2" "$3" > "$DOWNLOADLOG"; then
+ msgtest "Testing download of file $2 with" "$1 $5"
+ if ! downloadfile "$2" "$3" "$5" > "$DOWNLOADLOG"; then
cat >&2 "$DOWNLOADLOG"
msgfail
else
}
TESTFILE='aptarchive/testfile'
-cp -a ${TESTDIR}/framework $TESTFILE
-cp -a ${TESTDIR}/framework "${TESTFILE}2"
+cp -a "${TESTDIR}/framework" "$TESTFILE"
+cp -a "${TESTDIR}/framework" "${TESTFILE}2"
followuprequest() {
local DOWN='./downloaded/testfile'
testdownloadfile 'completely downloaded file' "${1}/testfile" "$DOWN" '='
testwebserverlaststatuscode '416' "$DOWNLOADLOG"
+ webserverconfig 'aptwebserver::support::content-range' 'false'
+ copysource $TESTFILE 1M $DOWN
+ testdownloadfile 'completely downloaded file' "${1}/testfile" "$DOWN" '=' "SHA1:$(sha1sum "$TESTFILE" | cut -d' ' -f 1)"
+ testwebserverlaststatuscode '416' "$DOWNLOADLOG"
+ webserverconfig 'aptwebserver::support::content-range' 'true'
+
copysource $TESTFILE 1M $DOWN
copysource "${TESTFILE}2" 20 "${DOWN}2"
msgtest 'Testing download of files with' 'completely downloaded file + partial file'
testrun "$1"
}
-serverconfigs 'http://localhost:8080'
+serverconfigs "http://localhost:${APTHTTPPORT}"
changetohttpswebserver
-serverconfigs 'https://localhost:4433'
+serverconfigs "https://localhost:${APTHTTPSPORT}"