diff options
Diffstat (limited to 'test/integration')
-rw-r--r-- | test/integration/framework | 28 | ||||
-rwxr-xr-x | test/integration/test-apt-helper | 37 | ||||
-rwxr-xr-x | test/integration/test-apt-https-no-redirect | 5 |
3 files changed, 51 insertions, 19 deletions
diff --git a/test/integration/framework b/test/integration/framework index 911a4d742..d9bacef83 100644 --- a/test/integration/framework +++ b/test/integration/framework @@ -90,18 +90,18 @@ msgdone() { echo "${CDONE}DONE${CNORMAL}"; fi } - +getaptconfig() { + if [ -f ./aptconfig.conf ]; then + echo "./aptconfig.conf" + elif [ -f ../aptconfig.conf ]; then + echo "../aptconfig.conf" + fi +} runapt() { msgdebug "Executing: ${CCMD}$*${CDEBUG} " local CMD="$1" shift - if [ -f ./aptconfig.conf ]; then - MALLOC_PERTURB_=21 MALLOC_CHECK_=2 APT_CONFIG=aptconfig.conf LD_LIBRARY_PATH=${BUILDDIRECTORY} ${BUILDDIRECTORY}/$CMD "$@" - elif [ -f ../aptconfig.conf ]; then - MALLOC_PERTURB_=21 MALLOC_CHECK_=2 APT_CONFIG=../aptconfig.conf LD_LIBRARY_PATH=${BUILDDIRECTORY} ${BUILDDIRECTORY}/$CMD "$@" - else - MALLOC_PERTURB_=21 MALLOC_CHECK_=2 LD_LIBRARY_PATH=${BUILDDIRECTORY} ${BUILDDIRECTORY}/$CMD "$@" - fi + MALLOC_PERTURB_=21 MALLOC_CHECK_=2 APT_CONFIG="$(getaptconfig)" LD_LIBRARY_PATH=${BUILDDIRECTORY} ${BUILDDIRECTORY}/$CMD "$@" } aptconfig() { runapt apt-config "$@"; } aptcache() { runapt apt-cache "$@"; } @@ -112,7 +112,7 @@ aptkey() { runapt apt-key "$@"; } aptmark() { runapt apt-mark "$@"; } apt() { runapt apt "$@"; } apthelper() { - LD_LIBRARY_PATH=${APTHELPERBINDIR} ${APTHELPERBINDIR}/apt-helper "$@"; + APT_CONFIG="$(getaptconfig)" LD_LIBRARY_PATH=${APTHELPERBINDIR} ${APTHELPERBINDIR}/apt-helper "$@"; } aptwebserver() { LD_LIBRARY_PATH=${APTWEBSERVERBINDIR} ${APTWEBSERVERBINDIR}/aptwebserver "$@"; @@ -121,17 +121,11 @@ dpkg() { command dpkg --root=${TMPWORKINGDIRECTORY}/rootdir --force-not-root --force-bad-path --log=${TMPWORKINGDIRECTORY}/rootdir/var/log/dpkg.log "$@" } aptitude() { - if [ -f ./aptconfig.conf ]; then - APT_CONFIG=aptconfig.conf LD_LIBRARY_PATH=${BUILDDIRECTORY} command aptitude "$@" - elif [ -f ../aptconfig.conf ]; then - APT_CONFIG=../aptconfig.conf LD_LIBRARY_PATH=${BUILDDIRECTORY} command aptitude "$@" - else - LD_LIBRARY_PATH=${BUILDDIRECTORY} command aptitude "$@" - fi + APT_CONFIG="$(getaptconfig)" LD_LIBRARY_PATH=${BUILDDIRECTORY} command aptitude "$@" } gdb() { echo "gdb: run »$*«" - APT_CONFIG=aptconfig.conf LD_LIBRARY_PATH=${BUILDDIRECTORY} command gdb ${BUILDDIRECTORY}/$1 --args "$@" + APT_CONFIG="$(getaptconfig)" LD_LIBRARY_PATH=${BUILDDIRECTORY} command gdb ${BUILDDIRECTORY}/$1 --args "$@" } http() { LD_LIBRARY_PATH=${BUILDDIRECTORY} ${BUILDDIRECTORY}/methods/http diff --git a/test/integration/test-apt-helper b/test/integration/test-apt-helper new file mode 100755 index 000000000..37ed95181 --- /dev/null +++ b/test/integration/test-apt-helper @@ -0,0 +1,37 @@ +#!/bin/sh +set -e + +TESTDIR=$(readlink -f $(dirname $0)) +. $TESTDIR/framework + +setupenvironment +configarchitecture "i386" + +changetohttpswebserver + +echo "foo" > aptarchive/foo + +msgtest 'apt-file download-file md5sum' +apthelper -qq download-file http://localhost:8080/foo foo2 MD5Sum:d3b07384d113edec49eaa6238ad5ff00 && msgpass || msgfail +testfileequal foo2 'foo' + +msgtest 'apt-file download-file sha1' +apthelper -qq download-file http://localhost:8080/foo foo1 SHA1:f1d2d2f924e986ac86fdf7b36c94bcdf32beec15 && msgpass || msgfail +testfileequal foo1 'foo' + +msgtest 'apt-file download-file sha256' +apthelper -qq download-file http://localhost:8080/foo foo3 SHA256:b5bb9d8014a0f9b1d61e21e796d78dccdf1352f23cd32812f4850b878ae4944c && msgpass || msgfail +testfileequal foo3 'foo' + +msgtest 'apt-file download-file no-hash' +apthelper -qq download-file http://localhost:8080/foo foo4 && msgpass || msgfail +testfileequal foo4 'foo' + +msgtest 'apt-file download-file wrong hash' +if ! apthelper -qq download-file http://localhost:8080/foo foo5 MD5Sum:aabbcc 2>&1 2> download.stderr; then + msgpass +else + msgfail +fi +testfileequal download.stderr 'E: HashSum Failed' +testfileequal foo5.failed 'foo' diff --git a/test/integration/test-apt-https-no-redirect b/test/integration/test-apt-https-no-redirect index 0408c6832..99419d1cc 100755 --- a/test/integration/test-apt-https-no-redirect +++ b/test/integration/test-apt-https-no-redirect @@ -12,11 +12,12 @@ setupaptarchive --no-update changetohttpswebserver -o 'aptwebserver::redirect::replace::/redirectme/=http://localhost:8080/' +DOWNLOG='download-testfile.log' msgtest 'normal http download works' -downloadfile 'http://localhost:8080/pool/apt_1.0/changelog' changelog2 >/dev/null 2>/dev/null && msgpass || msgfail +downloadfile 'http://localhost:8080/pool/apt_1.0/changelog' changelog2 > "$DOWNLOG" && msgpass || msgfail msgtest 'normal https download works' -downloadfile 'https://localhost:4433/pool/apt_1.0/changelog' changelog >/dev/null 2>/dev/null && msgpass || msgfail +downloadfile 'https://localhost:4433/pool/apt_1.0/changelog' changelog > "$DOWNLOG" && msgpass || msgfail msgtest 'redirecting https to http does not work' downloadfile 'https://localhost:4433/redirectme/pool/apt_1.0/changelog' changelog3 2>&1 | grep "Protocol http not supported or disabled in libcurl" > /dev/null && msgpass || msgfail |