diff options
author | Michael Vogt <mvo@ubuntu.com> | 2014-11-06 08:55:06 +0100 |
---|---|---|
committer | Michael Vogt <mvo@ubuntu.com> | 2014-11-06 08:55:06 +0100 |
commit | 9397ea947c23c0957a683152360909810340abce (patch) | |
tree | 6b29e35b9ef602c15d0aab20eefdec3138eb4692 /test | |
parent | 87ecd6a2d719aeaeedd99dd500b467e966376f1c (diff) | |
parent | 6e2261d0f250406058d66b360080aa986953ae19 (diff) |
Merge remote-tracking branch 'upstream/debian/experimental' into feature/no-more-acquire-guessing
Conflicts:
apt-pkg/acquire-item.cc
Diffstat (limited to 'test')
28 files changed, 615 insertions, 175 deletions
diff --git a/test/integration/framework b/test/integration/framework index d576712e5..153c5bb25 100644 --- a/test/integration/framework +++ b/test/integration/framework @@ -32,7 +32,7 @@ msgprintf() { printf "$START " "$1" shift while [ -n "$1" ]; do - printf "$MIDDLE " "$(echo "$1" | sed -e 's#^apt\([cgfs]\)#apt-\1#')" + printf "$MIDDLE " "$(echo "$1" | sed -e 's#^apt\([cfghs]\)#apt-\1#')" shift done fi @@ -57,9 +57,9 @@ msgskip() { msgfail() { if [ $# -gt 0 ]; then printf "${CFAIL}FAIL: $*${CNORMAL}\n" >&2; else printf "${CFAIL}FAIL${CNORMAL}\n" >&2; fi - if [ -n "$APT_DEBUG_TESTS" ]; then - bash - fi + if [ -n "$APT_DEBUG_TESTS" ]; then + $SHELL + fi EXIT_CODE=$((EXIT_CODE+1)); } @@ -77,12 +77,6 @@ if [ $MSGLEVEL -le 2 ]; then msgnmsg() { true; } msgtest() { true; } msgpass() { printf " ${CPASS}P${CNORMAL}"; } - msgskip() { printf " ${CWARNING}S${CNORMAL}" >&2; } - if [ -n "$CFAIL" ]; then - msgfail() { printf " ${CFAIL}FAIL${CNORMAL}" >&2; EXIT_CODE=$((EXIT_CODE+1)); } - else - msgfail() { printf " ###FAILED###" >&2; EXIT_CODE=$((EXIT_CODE+1)); } - fi fi if [ $MSGLEVEL -le 3 ]; then msginfo() { true; } @@ -184,10 +178,12 @@ setupenvironment() { addtrap "cd /; rm -rf $TMPWORKINGDIRECTORY;" msgninfo "Preparing environment for ${CCMD}$(basename $0)${CINFO} in ${TMPWORKINGDIRECTORY}… " + mkdir -m 700 "${TMPWORKINGDIRECTORY}/downloaded" if [ "$(id -u)" = '0' ]; then # relax permissions so that running as root with user switching works umask 022 - chmod o+rx "$TMPWORKINGDIRECTORY" + chmod 711 "$TMPWORKINGDIRECTORY" + chown _apt:root "${TMPWORKINGDIRECTORY}/downloaded" fi TESTDIRECTORY=$(readlink -f $(dirname $0)) @@ -662,40 +658,52 @@ buildaptftparchivedirectorystructure() { } insertpackage() { - local RELEASE="$1" + local RELEASES="$1" local NAME="$2" local ARCH="$3" local VERSION="$4" local DEPENDENCIES="$5" local PRIORITY="${6:-optional}" - local DESCRIPTION="${7:-"an autogenerated dummy ${NAME}=${VERSION}/${RELEASE} + local DESCRIPTION="${7:-"an autogenerated dummy ${NAME}=${VERSION}/${RELEASES} If you find such a package installed on your system, something went horribly wrong! They are autogenerated und used only by testcases and surf no other propose…"}" local ARCHS="" - for arch in $(getarchitecturesfromcommalist "$ARCH"); do - if [ "$arch" = 'all' -o "$arch" = 'none' ]; then - ARCHS="$(getarchitectures)" - else - ARCHS="$arch" + for RELEASE in $(printf '%s' "$RELEASES" | tr ',' '\n'); do + if [ "$RELEASE" = 'installed' ]; then + insertinstalledpackage "$2" "$3" "$4" "$5" "$6" "$7" + continue fi - for BUILDARCH in $ARCHS; do - local PPATH="aptarchive/dists/${RELEASE}/main/binary-${BUILDARCH}" - mkdir -p $PPATH aptarchive/dists/${RELEASE}/main/source - touch aptarchive/dists/${RELEASE}/main/source/Sources - local FILE="${PPATH}/Packages" - echo "Package: $NAME + for arch in $(getarchitecturesfromcommalist "$ARCH"); do + if [ "$arch" = 'all' -o "$arch" = 'none' ]; then + ARCHS="$(getarchitectures)" + else + ARCHS="$arch" + fi + for BUILDARCH in $ARCHS; do + local PPATH="aptarchive/dists/${RELEASE}/main/binary-${BUILDARCH}" + mkdir -p $PPATH + local FILE="${PPATH}/Packages" + echo "Package: $NAME Priority: $PRIORITY Section: other Installed-Size: 42 Maintainer: Joe Sixpack <joe@example.org>" >> $FILE - test "$arch" = 'none' || echo "Architecture: $arch" >> $FILE - echo "Version: $VERSION + test "$arch" = 'none' || echo "Architecture: $arch" >> $FILE + echo "Version: $VERSION Filename: pool/main/${NAME}/${NAME}_${VERSION}_${arch}.deb" >> $FILE - test -z "$DEPENDENCIES" || echo "$DEPENDENCIES" >> $FILE - echo "Description: $DESCRIPTION" >> $FILE - echo >> $FILE + test -z "$DEPENDENCIES" || echo "$DEPENDENCIES" >> $FILE + echo "Description: $(printf '%s' "$DESCRIPTION" | head -n 1)" >> $FILE + echo "Description-md5: $(printf '%s' "$DESCRIPTION" | md5sum | cut -d' ' -f 1)" >> $FILE + echo >> $FILE + done done + mkdir -p aptarchive/dists/${RELEASE}/main/source aptarchive/dists/${RELEASE}/main/i18n + touch aptarchive/dists/${RELEASE}/main/source/Sources + echo "Package: $NAME +Description-md5: $(printf '%s' "$DESCRIPTION" | md5sum | cut -d' ' -f 1) +Description-en: $DESCRIPTION +" >> aptarchive/dists/${RELEASE}/main/i18n/Translation-en done } @@ -771,7 +779,7 @@ buildaptarchivefromincoming() { buildaptarchivefromfiles() { msginfo "Build APT archive for ${CCMD}$(basename $0)${CINFO} based on prebuild files…" - find aptarchive -name 'Packages' -o -name 'Sources' | while read line; do + find aptarchive -name 'Packages' -o -name 'Sources' -o -name 'Translation-*' | while read line; do msgninfo "\t${line} file… " compressfile "$line" "$1" msgdone "info" @@ -942,23 +950,35 @@ signreleasefiles() { } webserverconfig() { - msgtest "Set webserver config option '${1}' to" "$2" + local NOCHECK=false + if [ "$1" = '--no-check' ]; then + NOCHECK=true + shift + fi local DOWNLOG='rootdir/tmp/download-testfile.log' - local STATUS='rootdir/tmp/webserverconfig.status' + local STATUS='downloaded/webserverconfig.status' rm -f "$STATUS" "$DOWNLOG" - if downloadfile "http://localhost:8080/_config/set/${1}/${2}" "$STATUS" > "$DOWNLOG"; then + local URI + if [ -n "$2" ]; then + msgtest "Set webserver config option '${1}' to" "$2" + URI="http://localhost:8080/_config/set/${1}/${2}" + else + msgtest 'Clear webserver config option' "${1}" + URI="http://localhost:8080/_config/clear/${1}" + fi + if downloadfile "$URI" "$STATUS" > "$DOWNLOG"; then msgpass else - cat "$DOWNLOG" "$STATUS" + cat "$DOWNLOG" "$STATUS" || true msgfail fi - testwebserverlaststatuscode '200' + $NOCHECK || testwebserverlaststatuscode '200' } rewritesourceslist() { local APTARCHIVE="file://$(readlink -f "${TMPWORKINGDIRECTORY}/aptarchive")" for LIST in $(find rootdir/etc/apt/sources.list.d/ -name 'apt-test-*.list'); do - sed -i $LIST -e "s#$APTARCHIVE#${1}#" -e "s#http://localhost:8080/#${1}#" -e "s#http://localhost:4433/#${1}#" + sed -i $LIST -e "s#$APTARCHIVE#${1}#" -e "s#http://localhost:8080/#${1}#" -e "s#https://localhost:4433/#${1}#" done } @@ -1045,7 +1065,7 @@ acquire::cdrom::autodetect 0;" > rootdir/etc/apt/apt.conf.d/00cdrom mv "${CD}" "${CD}-unmounted" # we don't want the disk to be modifiable addtrap 'prefix' "chmod -f -R +w $PWD/rootdir/media/cdrom/dists/ $PWD/rootdir/media/cdrom-unmounted/dists/ || true;" - chmod -R -w rootdir/media/cdrom-unmounted/dists + chmod -R 555 rootdir/media/cdrom-unmounted/dists } downloadfile() { @@ -1053,7 +1073,7 @@ downloadfile() { apthelper -o Debug::Acquire::${PROTO}=1 \ download-file "$1" "$2" 2>&1 || true # only if the file exists the download was successful - if [ -e "$2" ]; then + if [ -r "$2" ]; then return 0 else return 1 @@ -1061,7 +1081,7 @@ downloadfile() { } checkdiff() { - local DIFFTEXT="$(command diff -u "$@" | sed -e '/^---/ d' -e '/^+++/ d' -e '/^@@/ d')" + local DIFFTEXT="$(command diff -u "$@" 2>&1 | sed -e '/^---/ d' -e '/^+++/ d' -e '/^@@/ d')" if [ -n "$DIFFTEXT" ]; then echo >&2 echo >&2 "$DIFFTEXT" @@ -1202,6 +1222,36 @@ testmarkedauto() { aptmark showauto 2>&1 | checkdiff $COMPAREFILE - && msgpass || msgfail } +msgfailoutput() { + local MSG="$1" + local OUTPUT="$2" + shift 2 + echo >&2 + if [ "$1" = 'grep' ]; then + while [ -n "$2" ]; do shift; done + echo "#### Complete file: $1 ####" + cat >&2 "$1" || true + echo '#### grep output ####' + elif [ "$1" = 'test' ]; then + # doesn't support ! or non-file flags + msgfailoutputstatfile() { + local FILEFLAGS='^-[bcdefgGhkLOprsStuwx]$' + if expr match "$1" "$FILEFLAGS" >/dev/null; then + echo "#### stat(2) of file: $2 ####" + stat "$2" || true + fi + } + msgfailoutputstatfile "$2" "$3" + while [ -n "$5" ] && [ "$4" = '-o' -o "$4" = '-a' ]; do + shift 3 + msgfailoutputstatfile "$2" "$3" + done + echo '#### test output ####' + fi + cat >&2 $OUTPUT + msgfail "$MSG" +} + testsuccess() { if [ "$1" = '--nomsg' ]; then shift @@ -1211,10 +1261,10 @@ testsuccess() { local OUTPUT="${TMPWORKINGDIRECTORY}/rootdir/tmp/testsuccess.output" if "$@" >${OUTPUT} 2>&1; then if expr match "$1" '^apt.*' >/dev/null; then - if grep -q -E '^[WE]: ' "$OUTPUT"; then - echo >&2 - cat >&2 $OUTPUT - msgfail 'successful run, but output contains warnings/errors' + if grep -q -E ' runtime error: ' "$OUTPUT"; then + msgfailoutput 'compiler detected undefined behavior' "$OUTPUT" "$@" + elif grep -q -E '^[WE]: ' "$OUTPUT"; then + msgfailoutput 'successful run, but output contains warnings/errors' "$OUTPUT" "$@" else msgpass fi @@ -1223,9 +1273,7 @@ testsuccess() { fi else local EXITCODE=$? - echo >&2 - cat >&2 $OUTPUT - msgfail "exitcode $EXITCODE" + msgfailoutput "exitcode $EXITCODE" "$OUTPUT" "$@" fi aptautotest 'testsuccess' "$@" } @@ -1238,14 +1286,12 @@ testwarning() { local OUTPUT="${TMPWORKINGDIRECTORY}/rootdir/tmp/testsuccess.output" if "$@" >${OUTPUT} 2>&1; then if expr match "$1" '^apt.*' >/dev/null; then - if grep -q -E '^E: ' "$OUTPUT"; then - echo >&2 - cat >&2 $OUTPUT - msgfail 'successful run, but output contains errors' + if grep -q -E ' runtime error: ' "$OUTPUT"; then + msgfailoutput 'compiler detected undefined behavior' "$OUTPUT" "$@" + elif grep -q -E '^E: ' "$OUTPUT"; then + msgfailoutput 'successful run, but output contains errors' "$OUTPUT" "$@" elif ! grep -q -E '^W: ' "$OUTPUT"; then - echo >&2 - cat >&2 $OUTPUT - msgfail 'successful run, but output contains no warnings' + msgfailoutput 'successful run, but output contains no warnings' "$OUTPUT" "$@" else msgpass fi @@ -1269,16 +1315,14 @@ testfailure() { local OUTPUT="${TMPWORKINGDIRECTORY}/rootdir/tmp/testfailure.output" if "$@" >${OUTPUT} 2>&1; then local EXITCODE=$? - echo >&2 - cat >&2 $OUTPUT - msgfail "exitcode $EXITCODE" + msgfailoutput "exitcode $EXITCODE" "$OUTPUT" "$@" else local EXITCODE=$? if expr match "$1" '^apt.*' >/dev/null; then - if ! grep -q -E '^E: ' "$OUTPUT"; then - echo >&2 - cat >&2 $OUTPUT - msgfail "run failed with exitcode ${EXITCODE}, but with no errors" + if grep -q -E ' runtime error: ' "$OUTPUT"; then + msgfailoutput 'compiler detected undefined behavior' "$OUTPUT" "$@" + elif ! grep -q -E '^E: ' "$OUTPUT"; then + msgfailoutput "run failed with exitcode ${EXITCODE}, but with no errors" "$OUTPUT" "$@" else msgpass fi @@ -1307,11 +1351,10 @@ testaccessrights() { testwebserverlaststatuscode() { local DOWNLOG='rootdir/tmp/webserverstatus-testfile.log' - local STATUS='rootdir/tmp/webserverstatus-statusfile.log' + local STATUS='downloaded/webserverstatus-statusfile.log' rm -f "$DOWNLOG" "$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 + if downloadfile "http://localhost:8080/_config/find/aptwebserver::last-status-code" "$STATUS" > "$DOWNLOG" && [ "$(cat "$STATUS")" = "$1" ]; then msgpass else echo >&2 @@ -1353,20 +1396,20 @@ aptautotest() { shift 3 # save and restore the *.output files from other tests # as we might otherwise override them in these automatic tests - rm -rf rootdir/tmp-before - mv rootdir/tmp rootdir/tmp-before - mkdir rootdir/tmp + rm -rf ${TMPWORKINGDIRECTORY}/rootdir/tmp-before + mv ${TMPWORKINGDIRECTORY}/rootdir/tmp ${TMPWORKINGDIRECTORY}/rootdir/tmp-before + mkdir ${TMPWORKINGDIRECTORY}/rootdir/tmp $AUTOTEST "$TESTCALL" "$@" - rm -rf rootdir/tmp-aptautotest - mv rootdir/tmp rootdir/tmp-aptautotest - mv rootdir/tmp-before rootdir/tmp + rm -rf ${TMPWORKINGDIRECTORY}/rootdir/tmp-aptautotest + mv ${TMPWORKINGDIRECTORY}/rootdir/tmp ${TMPWORKINGDIRECTORY}/rootdir/tmp-aptautotest + mv ${TMPWORKINGDIRECTORY}/rootdir/tmp-before ${TMPWORKINGDIRECTORY}/rootdir/tmp fi } aptautotest_aptget_update() { if ! test -d "${TMPWORKINGDIRECTORY}/rootdir/var/lib/apt/lists"; then return; fi # all copied files are properly chmodded - find "${TMPWORKINGDIRECTORY}/rootdir/var/lib/apt/lists" -maxdepth 1 -type f | while read file; do + for file in $(find "${TMPWORKINGDIRECTORY}/rootdir/var/lib/apt/lists" -maxdepth 1 -type f); do testfilestats "$file" '%U:%G:%a' '=' "${USER}:${USER}:644" done } diff --git a/test/integration/run-tests b/test/integration/run-tests index c39a2ac68..6c6a37611 100755 --- a/test/integration/run-tests +++ b/test/integration/run-tests @@ -46,7 +46,11 @@ for testcase in $(run-parts --list $DIR | grep '/test-'); do if ! ${testcase}; then FAIL=$((FAIL+1)) FAILED_TESTS="$FAILED_TESTS $(basename $testcase)" - echo >&2 "$(basename $testcase) ... FAIL" + if [ "$MSGLEVEL" -le 2 ]; then + printf >&2 "\n${CHIGH}Running $(basename $testcase) -> FAILED${CRESET}" + else + echo >&2 "${CHIGH}Running $(basename $testcase) -> FAILED${CRESET}" + fi else PASS=$((PASS+1)) fi diff --git a/test/integration/test-apt-cdrom b/test/integration/test-apt-cdrom index 2220a290c..3a33219fe 100755 --- a/test/integration/test-apt-cdrom +++ b/test/integration/test-apt-cdrom @@ -21,7 +21,7 @@ echo 'Description-de: automatisch generiertes Testpaket testing=0.8.15/stable ' >> Translation-de compressfile Translation-de rm -f Translation-en Translation-de -chmod -R -w . +chmod -R 555 . cd - > /dev/null aptcdromlog() { @@ -99,6 +99,7 @@ Conf testing:i386 (0.8.15 stable [i386])' aptget install testing:i386 -s testsuccess aptget purge testing:i386 -y testdpkgnotinstalled testing:i386 + cd downloaded rm -f testing_0.8.15_amd64.deb testsuccess aptget download testing testsuccess test -s testing_0.8.15_amd64.deb @@ -108,6 +109,7 @@ Conf testing:i386 (0.8.15 stable [i386])' aptget install testing:i386 -s testsuccess aptget source testing --dsc-only -d testsuccess test -s testing_0.8.15.dsc rm -f testing_0.8.15.dsc + cd - >/dev/null } testcdromusage @@ -142,3 +144,8 @@ testcdromusage testsuccess aptget update testfileequal rootdir/tmp/testsuccess.output 'Reading package lists...' testcdromusage + +msgmsg 'Check that nothing touched our' 'CD-ROM' +for file in $(find rootdir/media/cdrom-unmounted/dists); do + testfilestats "$file" '%U:%G:%a' '=' "${USER}:${USER}:555" +done diff --git a/test/integration/test-apt-get-changelog b/test/integration/test-apt-get-changelog index 76a32a122..648dccf40 100755 --- a/test/integration/test-apt-get-changelog +++ b/test/integration/test-apt-get-changelog @@ -21,23 +21,28 @@ chmod -R -w rootdir/var/cache/apt/archives echo 'Apt::Changelogs::Server "http://localhost:8080/";' > rootdir/etc/apt/apt.conf.d/changelog.conf -testequal "'http://localhost:8080//pool/apt_1.0/changelog'" aptget changelog apt --print-uris +testequal "'http://localhost:8080/pool/apt_1.0/changelog'" aptget changelog apt --print-uris -testequal "'http://localhost:8080//pool/apt_1.0/changelog' -'http://localhost:8080//pool/apt_1.0/changelog'" aptget changelog apt apt --print-uris +testequal "'http://localhost:8080/pool/apt_1.0/changelog' +'http://localhost:8080/pool/apt_1.0/changelog'" aptget changelog apt apt --print-uris + +cd downloaded testsuccess aptget changelog apt -qq -testfileequal 'rootdir/tmp/testsuccess.output' "$(cat aptarchive/pool/apt_1.0/changelog)" +testfileequal '../rootdir/tmp/testsuccess.output' "$(cat ../aptarchive/pool/apt_1.0/changelog)" testsuccess aptget changelog apt -d -testfileequal 'apt.changelog' "$(cat aptarchive/pool/apt_1.0/changelog)" -rm -f apt.changelog aptarchive/pool/apt_1.0/changelog +testfileequal 'apt.changelog' "$(cat ../aptarchive/pool/apt_1.0/changelog)" +testfilestats 'apt.changelog' '%U:%G:%a' '=' "${USER}:${USER}:644" +rm -f apt.changelog ../aptarchive/pool/apt_1.0/changelog -testequal "$(cat aptarchive/pool/apt_1.0.changelog)" aptget changelog apt \ +testequal "$(cat ../aptarchive/pool/apt_1.0.changelog)" aptget changelog apt \ -qq -o APT::Changelogs::Server='http://not-on-the-main-server:8080/' testsuccess aptget changelog apt -d -testfileequal 'apt.changelog' "$(cat aptarchive/pool/apt_1.0.changelog)" -rm -f apt.changelog aptarchive/pool/apt_1.0.changelog +testfileequal 'apt.changelog' "$(cat ../aptarchive/pool/apt_1.0.changelog)" +testfilestats 'apt.changelog' '%U:%G:%a' '=' "${USER}:${USER}:644" +rm -f apt.changelog ../aptarchive/pool/apt_1.0.changelog -testequal 'E: changelog download failed' aptget changelog apt -qq -o APT::Changelogs::Server='http://not-on-the-main-server:8080/' +testequal 'E: changelog download failed' aptget changelog apt -qq -d -o APT::Changelogs::Server='http://not-on-the-main-server:8080/' +testfailure test -e apt.changelog diff --git a/test/integration/test-apt-get-clean b/test/integration/test-apt-get-clean index 98f7c84d0..457bff9d3 100755 --- a/test/integration/test-apt-get-clean +++ b/test/integration/test-apt-get-clean @@ -26,10 +26,10 @@ touch rootdir/var/cache/apt/archives/foo_4_all.deb testsuccess aptget clean -testsuccess test ! -e rootdir/var/lib/apt/lists/partial/http.debian.net_debian_dists_sid_main_i18n_Translation-en -testsuccess test ! -e rootdir/var/cache/apt/archives/foo_1_all.deb -testsuccess test ! -e rootdir/var/cache/apt/archives/foo_2_all.deb -testsuccess test ! -e rootdir/var/cache/apt/archives/foo_3_all.deb -testsuccess test ! -e rootdir/var/cache/apt/archives/foo_4_all.deb +testfailure test -e rootdir/var/lib/apt/lists/partial/http.debian.net_debian_dists_sid_main_i18n_Translation-en +testfailure test -e rootdir/var/cache/apt/archives/foo_1_all.deb +testfailure test -e rootdir/var/cache/apt/archives/foo_2_all.deb +testfailure test -e rootdir/var/cache/apt/archives/foo_3_all.deb +testfailure test -e rootdir/var/cache/apt/archives/foo_4_all.deb diff --git a/test/integration/test-apt-get-download b/test/integration/test-apt-get-download index 48086d808..6503bbd1c 100755 --- a/test/integration/test-apt-get-download +++ b/test/integration/test-apt-get-download @@ -44,7 +44,10 @@ testdownload() { } # normal case as "root" +OLDPWD="$(pwd)" +cd downloaded testdownload apt_2.0_all.deb apt +cd "$OLDPWD" # simulate normal user with non-existent root-owned directories rm -rf rootdir/var/cache/apt/archives/ @@ -52,14 +55,18 @@ mkdir rootdir/var/cache/apt/archives/ addtrap 'prefix' "chmod -f -R +w $PWD/rootdir/var/cache/apt/archives || true;" chmod -R -w rootdir/var/cache/apt/archives +OLDPWD="$(pwd)" +cd downloaded + # normal case(es) testdownload apt_1.0_all.deb apt stable testdownload apt_2.0_all.deb apt -DEBFILE="$(readlink -f aptarchive)/pool/apt_2.0_all.deb" +DEBFILE="$(readlink -f ../aptarchive)/pool/apt_2.0_all.deb" testequal "'file://${DEBFILE}' apt_2.0_all.deb $(stat -c%s $DEBFILE) SHA512:$(sha512sum $DEBFILE | cut -d' ' -f 1)" aptget download apt --print-uris # deb:677887 +testequal "E: Can't find a source to download version '1.0' of 'vrms:i386'" aptget download vrms --print-uris testequal "E: Can't find a source to download version '1.0' of 'vrms:i386'" aptget download vrms # deb:736962 @@ -74,6 +81,7 @@ testsuccess aptget download apt apt apt/unstable apt=2.0 testsuccess test -s apt_2.0_all.deb # restore "root" rights +cd "$OLDPWD" chmod -f -R +w $PWD/rootdir/var/cache/apt/archives rm -rf rootdir/var/cache/apt/archives/ @@ -86,5 +94,7 @@ testsuccess aptget install -d apt testsuccess test -s rootdir/var/cache/apt/archives/apt_2.0_all.deb testaccessrights 'aptarchive/pool/apt_2.0_all.deb' '644' mv aptarchive/pool/apt_2.0_all.deb aptarchive/pool/apt_2.0_all.deb.gone +cd downloaded testdownload apt_2.0_all.deb apt +cd "$OLDPWD" mv aptarchive/pool/apt_2.0_all.deb.gone aptarchive/pool/apt_2.0_all.deb diff --git a/test/integration/test-apt-get-source-authenticated b/test/integration/test-apt-get-source-authenticated index fedfc8308..f68c32386 100755 --- a/test/integration/test-apt-get-source-authenticated +++ b/test/integration/test-apt-get-source-authenticated @@ -25,7 +25,10 @@ testwarning aptget update --allow-insecure-repositories # this all should fail testfailure aptget install -y foo +cd downloaded testfailure aptget source foo - +testfailure test -e foo_2.0.dsc # allow overriding the warning -testsuccess aptget source --allow-unauthenticated foo +testsuccess aptget source --allow-unauthenticated foo -o Debug::pkgAcquire::Worker=1 +testsuccess test -s foo_2.0.dsc -a -L foo_2.0.dsc +testaccessrights 'foo_2.0.dsc' '777' diff --git a/test/integration/test-apt-get-upgrade b/test/integration/test-apt-get-upgrade index 5335c243a..d042e4fb7 100755 --- a/test/integration/test-apt-get-upgrade +++ b/test/integration/test-apt-get-upgrade @@ -8,23 +8,18 @@ setupenvironment configarchitecture "i386" # simple case -insertpackage 'stable' 'upgrade-simple' 'all' '1.0' +insertpackage 'stable,installed' 'upgrade-simple' 'all' '1.0' insertpackage 'unstable' 'upgrade-simple' 'all' '2.0' -insertinstalledpackage 'upgrade-simple' 'all' '1.0' # upgrade with a new dependency -insertpackage 'stable' 'upgrade-with-new-dep' 'all' '1.0' +insertpackage 'stable,installed' 'upgrade-with-new-dep' 'all' '1.0' insertpackage 'unstable' 'upgrade-with-new-dep' 'all' '2.0' 'Depends: new-dep' insertpackage 'stable' 'new-dep' 'all' '1.0' -insertinstalledpackage 'upgrade-with-new-dep' 'all' '1.0' # upgrade with conflict and a new pkg with higher priority than conflict -insertpackage 'stable' 'upgrade-with-conflict' 'all' '1.0' +insertpackage 'stable,installed' 'upgrade-with-conflict' 'all' '1.0' insertpackage 'unstable' 'upgrade-with-conflict' 'all' '2.0' 'Conflicts: conflicting-dep' 'standard' -insertpackage 'stable' 'conflicting-dep' 'all' '1.0' -insertinstalledpackage 'upgrade-with-conflict' 'all' '1.0' -insertinstalledpackage 'conflicting-dep' 'all' '1.0' - +insertpackage 'stable,installed' 'conflicting-dep' 'all' '1.0' setupaptarchive diff --git a/test/integration/test-apt-helper b/test/integration/test-apt-helper index 42c40bb9e..06e497ff7 100755 --- a/test/integration/test-apt-helper +++ b/test/integration/test-apt-helper @@ -13,23 +13,23 @@ test_apt_helper_download() { 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' + apthelper -qq download-file http://localhost:8080/foo downloaded/foo2 MD5Sum:d3b07384d113edec49eaa6238ad5ff00 && msgpass || msgfail + testfileequal downloaded/foo2 'foo' msgtest 'apt-file download-file' 'sha1' - apthelper -qq download-file http://localhost:8080/foo foo1 SHA1:f1d2d2f924e986ac86fdf7b36c94bcdf32beec15 && msgpass || msgfail - testfileequal foo1 'foo' + apthelper -qq download-file http://localhost:8080/foo downloaded/foo1 SHA1:f1d2d2f924e986ac86fdf7b36c94bcdf32beec15 && msgpass || msgfail + testfileequal downloaded/foo1 'foo' msgtest 'apt-file download-file' 'sha256' - apthelper -qq download-file http://localhost:8080/foo foo3 SHA256:b5bb9d8014a0f9b1d61e21e796d78dccdf1352f23cd32812f4850b878ae4944c && msgpass || msgfail - testfileequal foo3 'foo' + apthelper -qq download-file http://localhost:8080/foo downloaded/foo3 SHA256:b5bb9d8014a0f9b1d61e21e796d78dccdf1352f23cd32812f4850b878ae4944c && msgpass || msgfail + testfileequal downloaded/foo3 'foo' msgtest 'apt-file download-file' 'no-hash' - apthelper -qq download-file http://localhost:8080/foo foo4 && msgpass || msgfail - testfileequal foo4 'foo' + apthelper -qq download-file http://localhost:8080/foo downloaded/foo4 && msgpass || msgfail + testfileequal downloaded/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 + if ! apthelper -qq download-file http://localhost:8080/foo downloaded/foo5 MD5Sum:aabbcc 2>&1 2> download.stderr; then msgpass else msgfail @@ -37,7 +37,8 @@ test_apt_helper_download() { testfileequal download.stderr 'E: Failed to fetch http://localhost:8080/foo Hash Sum mismatch E: Download Failed' - testfileequal foo5.FAILED 'foo' + testfileequal downloaded/foo5.FAILED 'foo' + testfailure test -e downloaded/foo5 } test_apt_helper_detect_proxy() { diff --git a/test/integration/test-apt-key b/test/integration/test-apt-key index e6ac530a6..b6b7b7909 100755 --- a/test/integration/test-apt-key +++ b/test/integration/test-apt-key @@ -41,7 +41,7 @@ gpg: unchanged: 1' aptkey --fakeroot update testaptkeys 'pub 2048R/DBAC8DAE 2010-08-18' - testsuccess test ! -e rootdir/etc/apt/trusted.gpg + testfailure test -e rootdir/etc/apt/trusted.gpg testsuccess aptkey --fakeroot add ./keys/rexexpired.pub msgtest 'Check if trusted.gpg is created with permissions set to' '0644' if [ "$(stat -c '%a' rootdir/etc/apt/trusted.gpg )" = '644' ]; then @@ -78,7 +78,7 @@ pub 2048R/DBAC8DAE 2010-08-18' cp -a keys/joesixpack.pub rootdir/etc/apt/trusted.gpg.d/joesixpack.gpg testsuccess --nomsg aptkey --fakeroot del DBAC8DAE testempty aptkey list - testsuccess test ! -e rootdir/etc/apt/trusted.gpg.d/joesixpack.gpg + testfailure test -e rootdir/etc/apt/trusted.gpg.d/joesixpack.gpg testsuccess cmp keys/joesixpack.pub rootdir/etc/apt/trusted.gpg.d/joesixpack.gpg~ msgtest 'Test key removal with' 'long key ID' @@ -86,7 +86,7 @@ pub 2048R/DBAC8DAE 2010-08-18' cp -a keys/joesixpack.pub rootdir/etc/apt/trusted.gpg.d/joesixpack.gpg testsuccess --nomsg aptkey --fakeroot del 5A90D141DBAC8DAE testempty aptkey list - testsuccess test ! -e rootdir/etc/apt/trusted.gpg.d/joesixpack.gpg + testfailure test -e rootdir/etc/apt/trusted.gpg.d/joesixpack.gpg testsuccess cmp keys/joesixpack.pub rootdir/etc/apt/trusted.gpg.d/joesixpack.gpg~ msgtest 'Test key removal with' 'fingerprint' @@ -94,7 +94,7 @@ pub 2048R/DBAC8DAE 2010-08-18' cp -a keys/joesixpack.pub rootdir/etc/apt/trusted.gpg.d/joesixpack.gpg testsuccess --nomsg aptkey --fakeroot del 34A8E9D18DB320F367E8EAA05A90D141DBAC8DAE testempty aptkey list - testsuccess test ! -e rootdir/etc/apt/trusted.gpg.d/joesixpack.gpg + testfailure test -e rootdir/etc/apt/trusted.gpg.d/joesixpack.gpg testsuccess cmp keys/joesixpack.pub rootdir/etc/apt/trusted.gpg.d/joesixpack.gpg~ msgtest 'Test key removal with' 'single key in softlink' @@ -102,7 +102,7 @@ pub 2048R/DBAC8DAE 2010-08-18' ln -s $(readlink -f ./keys/joesixpack.pub) rootdir/etc/apt/trusted.gpg.d/joesixpack.gpg testsuccess --nomsg aptkey --fakeroot del DBAC8DAE testempty aptkey list - testsuccess test ! -e rootdir/etc/apt/trusted.gpg.d/joesixpack.gpg + testfailure test -e rootdir/etc/apt/trusted.gpg.d/joesixpack.gpg testsuccess test -L rootdir/etc/apt/trusted.gpg.d/joesixpack.gpg~ cleanplate @@ -125,7 +125,7 @@ pub 2048R/528144E2 2011-01-16' testsuccess --nomsg aptkey --fakeroot del DBAC8DAE testaptkeys 'pub 2048R/528144E2 2011-01-16' testsuccess cmp keys/testcase-multikey.pub rootdir/etc/apt/trusted.gpg.d/multikey.gpg~ - testsuccess test ! -L rootdir/etc/apt/trusted.gpg.d/multikey.gpg + testfailure test -L rootdir/etc/apt/trusted.gpg.d/multikey.gpg testsuccess test -L rootdir/etc/apt/trusted.gpg.d/multikey.gpg~ msgtest 'Test key removal with' 'multiple files including key' @@ -134,7 +134,7 @@ pub 2048R/528144E2 2011-01-16' cp -a keys/testcase-multikey.pub rootdir/etc/apt/trusted.gpg.d/multikey.gpg testsuccess --nomsg aptkey --fakeroot del DBAC8DAE testaptkeys 'pub 2048R/528144E2 2011-01-16' - testsuccess test ! -e rootdir/etc/apt/trusted.gpg.d/joesixpack.gpg + testfailure test -e rootdir/etc/apt/trusted.gpg.d/joesixpack.gpg testsuccess cmp keys/joesixpack.pub rootdir/etc/apt/trusted.gpg.d/joesixpack.gpg~ testsuccess cmp keys/testcase-multikey.pub rootdir/etc/apt/trusted.gpg.d/multikey.gpg~ diff --git a/test/integration/test-apt-update-filesize-mismatch b/test/integration/test-apt-update-filesize-mismatch new file mode 100755 index 000000000..f78b83b5f --- /dev/null +++ b/test/integration/test-apt-update-filesize-mismatch @@ -0,0 +1,50 @@ +#!/bin/sh +set -e + +TESTDIR=$(readlink -f $(dirname $0)) +. $TESTDIR/framework +setupenvironment +configarchitecture 'i386' +configcompression 'gz' + +insertpackage 'testing' 'foo' 'all' '1' +insertpackage 'testing' 'foo2' 'all' '1' +insertsource 'testing' 'foo' 'all' '1' +insertsource 'testing' 'foo2' 'all' '1' + +setupaptarchive --no-update +changetowebserver + +find aptarchive \( -name 'Packages' -o -name 'Sources' -o -name 'Translation-en' \) -delete +for release in $(find aptarchive -name 'Release'); do + cp "$release" "${release}.backup" +done + +testsuccess aptget update +testsuccess aptcache show foo +testsuccess aptget install foo -s + +for get in $(sed -n 's#^GET /\([^ ]\+\.gz\) HTTP.\+$#\1#p' aptarchive/webserver.log); do + for ext in '' '.gz'; do + COMPRESSFILE="$get" + get="${get}${ext}" + FILE="$(basename "$get" '.gz')" + msgmsg 'Test filesize mismatch with file' "$FILE" + rm -rf rootdir/var/lib/apt/lists + + for release in $(find aptarchive -name 'Release'); do + SIZE="$(awk "/$FILE\$/ { print \$2; exit }" "${release}.backup")" + sed "s# $SIZE # $(($SIZE + 111)) #" "${release}.backup" > "$release" + done + signreleasefiles + + testfailure aptget update -o Debug::pkgAcquire::Worker=1 + cp rootdir/tmp/testfailure.output rootdir/tmp/update.output + testsuccess grep -E "$(basename -s '.gz' "$COMPRESSFILE").*Hash Sum mismatch" rootdir/tmp/update.output + testfailure aptcache show foo + testfailure aptget install foo -s + + testfailure aptcache show bar + testfailure aptget install bar -s + done +done diff --git a/test/integration/test-apt-update-hashsum-mismatch b/test/integration/test-apt-update-hashsum-mismatch new file mode 100755 index 000000000..c2c5b3887 --- /dev/null +++ b/test/integration/test-apt-update-hashsum-mismatch @@ -0,0 +1,44 @@ +#!/bin/sh +set -e + +TESTDIR=$(readlink -f $(dirname $0)) +. $TESTDIR/framework +setupenvironment +configarchitecture 'i386' +configcompression 'gz' + +insertpackage 'testing' 'foo' 'all' '1' +insertpackage 'testing' 'foo2' 'all' '1' +insertsource 'testing' 'foo' 'all' '1' +insertsource 'testing' 'foo2' 'all' '1' + +setupaptarchive --no-update +changetowebserver + +echo 'Package: bar +Maintainer: Doctor Evil <evil@example.com> +Description: come to the dark side +' > aptarchive/DoctorEvil +compressfile aptarchive/DoctorEvil + +find aptarchive \( -name 'Packages' -o -name 'Sources' -o -name 'Translation-en' \) -delete + +testsuccess aptget update +testsuccess aptcache show foo +testsuccess aptget install foo -s + +for get in $(sed -n 's#^GET /\([^ ]\+\.gz\) HTTP.\+$#\1#p' aptarchive/webserver.log); do + msgmsg 'Test hashsum mismatch with file' "$get" + rm -rf rootdir/var/lib/apt/lists + webserverconfig 'aptwebserver::overwrite' '' + webserverconfig "aptwebserver::overwrite::$(printf '%s' "${get}" | sed 's#/#%2F#g' )::filename" '%2FDoctorEvil.gz' + + testfailure aptget update + cp rootdir/tmp/testfailure.output rootdir/tmp/update.output + testsuccess grep -E "$(basename -s '.gz' "$get").*Hash Sum mismatch" rootdir/tmp/update.output + testfailure aptcache show foo + testfailure aptget install foo -s + + testfailure aptcache show bar + testfailure aptget install bar -s +done diff --git a/test/integration/test-apt-update-ims b/test/integration/test-apt-update-ims index afae99563..5394a9f30 100755 --- a/test/integration/test-apt-update-ims +++ b/test/integration/test-apt-update-ims @@ -30,7 +30,7 @@ runtest() { # ensure that we still do a hash check on ims hit msgtest 'Test I-M-S' 'reverify' - aptget update -o Debug::pkgAcquire::Auth=1 2>&1 | grep -A1 'RecivedHash:' | grep -q -- '- SHA' && msgpass || msgfail + aptget update -o Debug::pkgAcquire::Auth=1 2>&1 | grep -A2 'RecivedHash:' | grep -q -- '- SHA' && msgpass || msgfail # ensure no leftovers in partial testfailure ls "rootdir/var/lib/apt/lists/partial/*" diff --git a/test/integration/test-apt-update-nofallback b/test/integration/test-apt-update-nofallback index 831fc67eb..e82a976a6 100755 --- a/test/integration/test-apt-update-nofallback +++ b/test/integration/test-apt-update-nofallback @@ -195,7 +195,7 @@ test_release_gpg_to_invalid_release_release_gpg() testequal "W: An error occurred during the signature verification. The repository is not updated and the previous index files will be used. GPG error: file: unstable Release.gpg: The following signatures were invalid: BADSIG 5A90D141DBAC8DAE Joe Sixpack (APT Testcases Dummy) <joe@example.org> -W: Failed to fetch file:${APTARCHIVE}/dists/unstable/Release.gpg +W: Failed to fetch file:${APTARCHIVE}/dists/unstable/Release.gpg The following signatures were invalid: BADSIG 5A90D141DBAC8DAE Joe Sixpack (APT Testcases Dummy) <joe@example.org> W: Some index files failed to download. They have been ignored, or old ones used instead." aptget update -qq diff --git a/test/integration/test-authentication-basic b/test/integration/test-authentication-basic new file mode 100755 index 000000000..21b024970 --- /dev/null +++ b/test/integration/test-authentication-basic @@ -0,0 +1,106 @@ +#!/bin/sh +set -e + +TESTDIR=$(readlink -f $(dirname $0)) +. $TESTDIR/framework + +setupenvironment +configarchitecture 'i386' + +insertpackage 'unstable' 'foo' 'all' '1' +setupaptarchive --no-update + +changetohttpswebserver --authorization="$(printf '%s' 'star:hunter2' | base64 )" + +echo 'See, when YOU type hunter2, it shows to us as *******' > aptarchive/bash + +testauthfailure() { + testfailure apthelper download-file "${1}/bash" ./downloaded/bash + # crappy test, but http and https output are wastely different… + testsuccess grep 401 rootdir/tmp/testfailure.output + testfailure test -s ./downloaded/bash +} + +testauthsuccess() { + testsuccess apthelper download-file "${1}/bash" ./downloaded/bash + testfileequal ./downloaded/bash "$(cat aptarchive/bash)" + testfilestats ./downloaded/bash '%U:%G:%a' '=' "${USER}:${USER}:644" + rm -f ./downloaded/bash + + # lets see if got/retains acceptable permissions + if [ -n "$AUTHCONF" ]; then + if [ "$(id -u)" = '0' ]; then + testfilestats "$AUTHCONF" '%U:%G:%a' '=' "_apt:root:600" + else + testfilestats "$AUTHCONF" '%U:%G:%a' '=' "${USER}:${USER}:600" + fi + fi + + rm -rf rootdir/var/lib/apt/lists + testsuccess aptget update + testequal 'Reading package lists... +Building dependency tree... +The following NEW packages will be installed: + foo +0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded. +Inst foo (1 unstable [all]) +Conf foo (1 unstable [all])' aptget install foo -s +} + +authfile() { + local AUTHCONF='rootdir/etc/apt/auth.conf' + rm -f "$AUTHCONF" + printf '%s' "$1" > "$AUTHCONF" + chmod 600 "$AUTHCONF" +} + +runtest() { + # unauthorized fails + authfile '' + testauthfailure "$1" + + # good auth + authfile 'machine localhost +login star +password hunter2' + testauthsuccess "$1" + + # bad auth + authfile 'machine localhost +login anonymous +password hunter2' + testauthfailure "$1" + + # 2 stanzas: unmatching + good auth + authfile 'machine debian.org +login debian +password jessie + +machine localhost +login star +password hunter2' + testauthsuccess "$1" +} + +msgmsg 'server basic auth' +rewritesourceslist 'http://localhost:8080' +runtest 'http://localhost:8080' +rewritesourceslist 'https://localhost:4433' +runtest 'https://localhost:4433' +rewritesourceslist 'http://localhost:8080' + +msgmsg 'proxy to server basic auth' +webserverconfig 'aptwebserver::request::absolute' 'uri' +export http_proxy='http://localhost:8080' +runtest 'http://localhost:8080' +unset http_proxy + +msgmsg 'proxy basic auth to server basic auth' +webserverconfig 'aptwebserver::proxy-authorization' "$(printf 'moon:deer2' | base64)" +export http_proxy='http://moon:deer2@localhost:8080' +runtest 'http://localhost:8080' + +msgmsg 'proxy basic auth to server' +authfile '' +webserverconfig 'aptwebserver::authorization' '' +testauthsuccess 'http://localhost:8080' diff --git a/test/integration/test-bug-617690-allow-unauthenticated-makes-all-untrusted b/test/integration/test-bug-617690-allow-unauthenticated-makes-all-untrusted index 164dca070..582e1bf5e 100755 --- a/test/integration/test-bug-617690-allow-unauthenticated-makes-all-untrusted +++ b/test/integration/test-bug-617690-allow-unauthenticated-makes-all-untrusted @@ -24,6 +24,7 @@ testfilemissing() { testrun() { rm -rf rootdir/var/lib/apt + cd downloaded if [ "$1" = 'trusted' ]; then testsuccess aptget update @@ -43,18 +44,19 @@ testrun() { testfileexists 'cool_1.0_i386.deb' fi - mv aptarchive/pool/cool_1.0_i386.deb aptarchive/pool/cool_1.0_i386.deb.bak - echo 'this is not a good package' > aptarchive/pool/cool_1.0_i386.deb + mv ../aptarchive/pool/cool_1.0_i386.deb ../aptarchive/pool/cool_1.0_i386.deb.bak + echo 'this is not a good package' > ../aptarchive/pool/cool_1.0_i386.deb testfailure aptget download cool testfilemissing cool_1.0_i386.deb testfailure aptget download cool --allow-unauthenticated # unauthenticated doesn't mean unchecked testfilemissing cool_1.0_i386.deb - rm -f aptarchive/pool/cool_1.0_i386.deb - mv aptarchive/pool/cool_1.0_i386.deb.bak aptarchive/pool/cool_1.0_i386.deb + rm -f ../aptarchive/pool/cool_1.0_i386.deb + mv ../aptarchive/pool/cool_1.0_i386.deb.bak ../aptarchive/pool/cool_1.0_i386.deb testsuccess aptget download cool --allow-unauthenticated testfileexists 'cool_1.0_i386.deb' + cd - >/dev/null } testrun 'trusted' diff --git a/test/integration/test-bug-738785-switch-protocol b/test/integration/test-bug-738785-switch-protocol index f450e5e5a..0f458e099 100755 --- a/test/integration/test-bug-738785-switch-protocol +++ b/test/integration/test-bug-738785-switch-protocol @@ -25,6 +25,7 @@ downloadfile 'http://localhost:8080/pool/apt_1.0/changelog' changelog >/dev/null echo 'Apt::Changelogs::Server "http://localhost:8080/redirectme";' > rootdir/etc/apt/apt.conf.d/changelog.conf testequal "'http://localhost:8080/redirectme/pool/apt_1.0/changelog'" aptget changelog apt --print-uris +cd downloaded testsuccess aptget changelog apt -d testsuccess test -s apt.changelog rm -f apt.changelog @@ -32,6 +33,7 @@ rm -f apt.changelog testsuccess aptget download apt testsuccess test -s apt_1.0_all.deb rm apt_1.0_all.deb +cd - >/dev/null testsuccess aptget install apt -y testdpkginstalled 'apt' @@ -49,15 +51,11 @@ rm https cd - >/dev/null echo "Dir::Bin::Methods \"${COPYMETHODS}\";" >> aptconfig.conf -if [ "$(id -u)" = '0' ]; then - testequal "Can't drop privileges for downloading as file '$(pwd)/apt_1.0_all.deb' couldn't be accessed by user '_apt'. -E: The method driver $(pwd)/rootdir/usr/lib/apt/methods/https could not be found. -N: Is the package apt-transport-https installed?" aptget download apt -q=0 -else - testequal "E: The method driver $(pwd)/rootdir/usr/lib/apt/methods/https could not be found. +cd downloaded +testequal "E: The method driver $(readlink -f './../')/rootdir/usr/lib/apt/methods/https could not be found. N: Is the package apt-transport-https installed?" aptget download apt -q=0 -fi -testsuccess test ! -e apt_1.0_all.deb +testfailure test -e apt_1.0_all.deb +cd - >/dev/null # revert to all methods rm -rf rootdir/$COPYMETHODS diff --git a/test/integration/test-bug-745036-new-foreign-invalidates-cache b/test/integration/test-bug-745036-new-foreign-invalidates-cache index 490cbecdd..2b7ee06ad 100755 --- a/test/integration/test-bug-745036-new-foreign-invalidates-cache +++ b/test/integration/test-bug-745036-new-foreign-invalidates-cache @@ -6,10 +6,8 @@ TESTDIR=$(readlink -f $(dirname $0)) setupenvironment configarchitecture 'amd64' -insertpackage 'unstable' 'cool-foo' 'amd64' '1.0' 'Depends: foo' -insertpackage 'unstable' 'foo' 'amd64' '1.0' 'Multi-Arch: foreign' -insertinstalledpackage 'cool-foo' 'amd64' '1.0' 'Depends: foo' -insertinstalledpackage 'foo' 'amd64' '1.0' 'Multi-Arch: foreign' +insertpackage 'unstable,installed' 'cool-foo' 'amd64' '1.0' 'Depends: foo' +insertpackage 'unstable,installed' 'foo' 'amd64' '1.0' 'Multi-Arch: foreign' setupaptarchive diff --git a/test/integration/test-bug-753297-upgradable b/test/integration/test-bug-753297-upgradable index 068704b3e..01395a095 100755 --- a/test/integration/test-bug-753297-upgradable +++ b/test/integration/test-bug-753297-upgradable @@ -16,8 +16,7 @@ Pin: release unstable Pin-Priority: 1 EOF -insertinstalledpackage 'foo' 'all' '1' -insertpackage 'testing' 'foo' 'all' '1' +insertpackage 'testing,installed' 'foo' 'all' '1' insertpackage 'testing-updates' 'foo' 'all' '2' insertpackage 'unstable' 'foo' 'all' '3' diff --git a/test/integration/test-compressed-indexes b/test/integration/test-compressed-indexes index 72b262e84..92e7c0e84 100755 --- a/test/integration/test-compressed-indexes +++ b/test/integration/test-compressed-indexes @@ -58,9 +58,11 @@ testrun() { msgpass fi msgtest 'Check if package is downloadable' + cd downloaded testsuccess --nomsg aptget download testpkg msgtest '\tdeb file is present'; testsuccess --nomsg test -f testpkg_1.0_i386.deb rm testpkg_1.0_i386.deb + cd - >/dev/null testequal 'Reading package lists... Building dependency tree... The following NEW packages will be installed: @@ -79,10 +81,12 @@ Conf testpkg (1.0 unstable [i386])' aptget install testpkg -s testequal "$GOODSHOWSRC" aptcache showsrc testpkg aptget clean msgtest 'Check if the source is aptgetable' + cd downloaded testsuccess --nomsg aptget source testpkg - msgtest '\tdsc file is present'; testsuccess --nomsg test -f testpkg_1.0.dsc - msgtest '\tdirectory is present'; testsuccess --nomsg test -d testpkg-1.0 + testsuccess test -s testpkg_1.0.dsc + testsuccess test -d testpkg-1.0 rm -rf testpkg-1.0* + cd - >/dev/null testequal "$(aptcache show testpkg -o Acquire::Languages=none) " aptcache dumpavail } diff --git a/test/integration/test-partial-file-support b/test/integration/test-partial-file-support index 5ab326def..98b2f242a 100755 --- a/test/integration/test-partial-file-support +++ b/test/integration/test-partial-file-support @@ -52,36 +52,37 @@ cp -a ${TESTDIR}/framework $TESTFILE testrun() { webserverconfig 'aptwebserver::support::range' 'true' + local DOWN='./downloaded/testfile' - copysource $TESTFILE 0 ./testfile - testdownloadfile 'no data' "${1}/testfile" './testfile' '=' + copysource $TESTFILE 0 $DOWN + testdownloadfile 'no data' "${1}/testfile" "$DOWN" '=' testwebserverlaststatuscode '200' "$DOWNLOADLOG" - copysource $TESTFILE 20 ./testfile - testdownloadfile 'valid partial data' "${1}/testfile" './testfile' '=' + copysource $TESTFILE 20 $DOWN + testdownloadfile 'valid partial data' "${1}/testfile" "$DOWN" '=' testwebserverlaststatuscode '206' "$DOWNLOADLOG" - copysource /dev/zero 20 ./testfile - testdownloadfile 'invalid partial data' "${1}/testfile" './testfile' '!=' + copysource /dev/zero 20 $DOWN + testdownloadfile 'invalid partial data' "${1}/testfile" "$DOWN" '!=' testwebserverlaststatuscode '206' "$DOWNLOADLOG" - copysource $TESTFILE 1M ./testfile - testdownloadfile 'completely downloaded file' "${1}/testfile" './testfile' '=' + copysource $TESTFILE 1M $DOWN + testdownloadfile 'completely downloaded file' "${1}/testfile" "$DOWN" '=' testwebserverlaststatuscode '416' "$DOWNLOADLOG" - copysource /dev/zero 1M ./testfile - testdownloadfile 'too-big partial file' "${1}/testfile" './testfile' '=' + copysource /dev/zero 1M $DOWN + testdownloadfile 'too-big partial file' "${1}/testfile" "$DOWN" '=' testwebserverlaststatuscode '200' "$DOWNLOADLOG" - copysource /dev/zero 20 ./testfile - touch ./testfile - testdownloadfile 'old data' "${1}/testfile" './testfile' '=' + copysource /dev/zero 20 $DOWN + touch $DOWN + testdownloadfile 'old data' "${1}/testfile" "$DOWN" '=' testwebserverlaststatuscode '200' "$DOWNLOADLOG" webserverconfig 'aptwebserver::support::range' 'false' - copysource $TESTFILE 20 ./testfile - testdownloadfile 'no server support' "${1}/testfile" './testfile' '=' + copysource $TESTFILE 20 $DOWN + testdownloadfile 'no server support' "${1}/testfile" "$DOWN" '=' testwebserverlaststatuscode '200' "$DOWNLOADLOG" } diff --git a/test/integration/test-prevent-markinstall-multiarch-same-versionscrew b/test/integration/test-prevent-markinstall-multiarch-same-versionscrew index 9d2ea2d5d..db97687ce 100755 --- a/test/integration/test-prevent-markinstall-multiarch-same-versionscrew +++ b/test/integration/test-prevent-markinstall-multiarch-same-versionscrew @@ -9,20 +9,17 @@ configarchitecture 'amd64' 'i386' 'armel' insertpackage 'stable' 'allarchs' 'all' '1' insertpackage 'unstable' 'allarchs' 'all' '2' -insertinstalledpackage 'fine' 'i386,amd64' '1' 'Multi-Arch: same' -insertpackage 'stable' 'fine' 'i386,amd64' '1' 'Multi-Arch: same' +insertpackage 'stable,installed' 'fine' 'i386,amd64' '1' 'Multi-Arch: same' insertpackage 'unstable' 'fine' 'amd64,i386' '2' 'Multi-Arch: same' insertinstalledpackage 'fine-installed' 'i386,amd64' '1' 'Multi-Arch: same' insertpackage 'stable' 'fine-installed' 'i386,amd64,armel' '1' 'Multi-Arch: same' insertpackage 'unstable' 'fine-installed' 'i386,amd64' '2' 'Multi-Arch: same' -insertinstalledpackage 'out-of-sync-native' 'i386,amd64' '1' 'Multi-Arch: same' -insertpackage 'stable' 'out-of-sync-native' 'i386,amd64' '1' 'Multi-Arch: same' +insertpackage 'stable,installed' 'out-of-sync-native' 'i386,amd64' '1' 'Multi-Arch: same' insertpackage 'unstable' 'out-of-sync-native' 'amd64' '2' 'Multi-Arch: same' -insertinstalledpackage 'out-of-sync-foreign' 'i386,amd64' '1' 'Multi-Arch: same' -insertpackage 'stable' 'out-of-sync-foreign' 'i386,amd64' '1' 'Multi-Arch: same' +insertpackage 'stable,installed' 'out-of-sync-foreign' 'i386,amd64' '1' 'Multi-Arch: same' insertpackage 'unstable' 'out-of-sync-foreign' 'i386' '2' 'Multi-Arch: same' insertinstalledpackage 'out-of-sync-gone-native' 'i386,amd64' '1' 'Multi-Arch: same' diff --git a/test/integration/test-sourceslist-trusted-options b/test/integration/test-sourceslist-trusted-options index 28415dd62..55d4e0233 100755 --- a/test/integration/test-sourceslist-trusted-options +++ b/test/integration/test-sourceslist-trusted-options @@ -20,6 +20,7 @@ foo/testing 2 amd64 foo/stable 1 amd64 ' apt list foo -a + cd downloaded rm -f foo_1_amd64.deb foo_2_amd64.deb testsuccess aptget download foo "$@" testsuccess test -s foo_1_amd64.deb -o -s foo_2_amd64.deb @@ -27,6 +28,7 @@ foo/stable 1 amd64 rm -f foo_1.dsc foo_2.dsc testsuccess aptget source foo --dsc-only -d "$@" testsuccess test -s foo_1.dsc -o -s foo_2.dsc + cd - >/dev/null } everythingfails() { @@ -39,18 +41,22 @@ foo/stable 1 amd64 foo E: Some packages could not be authenticated' + cd downloaded rm -f foo_1_amd64.deb foo_2_amd64.deb testfailure aptget download foo "$@" - testequal "$WARNING" tail -n 3 rootdir/tmp/testfailure.output + testequal "$WARNING" tail -n 3 ../rootdir/tmp/testfailure.output testfailure test -s foo_1_amd64.deb -o -s foo_2_amd64.deb rm -f foo_1.dsc foo_2.dsc testfailure aptget source foo --dsc-only -d "$@" - testequal "$WARNING" tail -n 3 rootdir/tmp/testfailure.output + testequal "$WARNING" tail -n 3 ../rootdir/tmp/testfailure.output testfailure test -s foo_1.dsc -o -s foo_2.dsc + cd - >/dev/null } cp -a rootdir/etc/apt/sources.list.d/ rootdir/etc/apt/sources.list.d.bak/ +echo 'Debug::Acquire::Transaction "true"; +Debug::pkgAcquire::Worker "true";' > rootdir/etc/apt/apt.conf.d/00debugging aptgetupdate() { rm -rf rootdir/var/lib/apt/lists diff --git a/test/integration/test-suggest-installed-multiarch-silbing b/test/integration/test-suggest-installed-multiarch-silbing index d55d250aa..89640a30c 100755 --- a/test/integration/test-suggest-installed-multiarch-silbing +++ b/test/integration/test-suggest-installed-multiarch-silbing @@ -9,8 +9,7 @@ configarchitecture 'amd64' 'i386' 'armel' insertinstalledpackage 'foo' 'i386' '1' insertpackage 'unstable' 'foo' 'amd64,i386' '1' -insertinstalledpackage 'foo2' 'i386' '1' -insertpackage 'unstable' 'foo2' 'i386' '1' +insertpackage 'unstable,installed' 'foo2' 'i386' '1' insertinstalledpackage 'foo3' 'amd64' '1' insertpackage 'unstable' 'foo3' 'amd64,i386' '1' diff --git a/test/integration/test-ubuntu-bug-1098738-apt-get-source-md5sum b/test/integration/test-ubuntu-bug-1098738-apt-get-source-md5sum index 8c9c9c767..574183b0a 100755 --- a/test/integration/test-ubuntu-bug-1098738-apt-get-source-md5sum +++ b/test/integration/test-ubuntu-bug-1098738-apt-get-source-md5sum @@ -141,6 +141,8 @@ setupaptarchive changetowebserver testsuccess aptget update +cd downloaded + testok() { rm -f ${1}_1.0.dsc ${1}_1.0.tar.gz testequal "Reading package lists... diff --git a/test/interactive-helper/aptwebserver.cc b/test/interactive-helper/aptwebserver.cc index 34476e1af..00004a524 100644 --- a/test/interactive-helper/aptwebserver.cc +++ b/test/interactive-helper/aptwebserver.cc @@ -157,9 +157,8 @@ static bool sendData(int const client, std::string const &data) /*{{{*/ } /*}}}*/ static void sendError(int const client, int const httpcode, std::string const &request,/*{{{*/ - bool content, std::string const &error = "") + bool content, std::string const &error = "", std::list<std::string> headers = std::list<std::string>()) { - std::list<std::string> headers; std::string response("<html><head><title>"); response.append(httpcodeToStr(httpcode)).append("</title></head>"); response.append("<body><h1>").append(httpcodeToStr(httpcode)).append("</h1>"); @@ -367,22 +366,88 @@ static bool parseFirstLine(int const client, std::string const &request,/*{{{*/ // Proxies require absolute uris, so this is a simple proxy-fake option std::string const absolute = _config->Find("aptwebserver::request::absolute", "uri,path"); - if (strncmp(host.c_str(), filename.c_str(), host.length()) == 0) + if (strncmp(host.c_str(), filename.c_str(), host.length()) == 0 && APT::String::Startswith(filename, "/_config/") == false) { if (absolute.find("uri") == std::string::npos) { sendError(client, 400, request, sendContent, "Request is absoluteURI, but configured to not accept that"); return false; } + // strip the host from the request to make it an absolute path filename.erase(0, host.length()); + + std::string const authConf = _config->Find("aptwebserver::proxy-authorization", ""); + std::string auth = LookupTag(request, "Proxy-Authorization", ""); + if (authConf.empty() != auth.empty()) + { + if (auth.empty()) + sendError(client, 407, request, sendContent, "Proxy requires authentication"); + else + sendError(client, 407, request, sendContent, "Client wants to authenticate to proxy, but proxy doesn't need it"); + return false; + } + if (authConf.empty() == false) + { + char const * const basic = "Basic "; + if (strncmp(auth.c_str(), basic, strlen(basic)) == 0) + { + auth.erase(0, strlen(basic)); + if (auth != authConf) + { + sendError(client, 407, request, sendContent, "Proxy-Authentication doesn't match"); + return false; + } + } + else + { + std::list<std::string> headers; + headers.push_back("Proxy-Authenticate: Basic"); + sendError(client, 407, request, sendContent, "Unsupported Proxy-Authentication Scheme", headers); + return false; + } + } } - else if (absolute.find("path") == std::string::npos) + else if (absolute.find("path") == std::string::npos && APT::String::Startswith(filename, "/_config/") == false) { sendError(client, 400, request, sendContent, "Request is absolutePath, but configured to not accept that"); return false; } + if (APT::String::Startswith(filename, "/_config/") == false) + { + std::string const authConf = _config->Find("aptwebserver::authorization", ""); + std::string auth = LookupTag(request, "Authorization", ""); + if (authConf.empty() != auth.empty()) + { + if (auth.empty()) + sendError(client, 401, request, sendContent, "Server requires authentication"); + else + sendError(client, 401, request, sendContent, "Client wants to authenticate to server, but server doesn't need it"); + return false; + } + if (authConf.empty() == false) + { + char const * const basic = "Basic "; + if (strncmp(auth.c_str(), basic, strlen(basic)) == 0) + { + auth.erase(0, strlen(basic)); + if (auth != authConf) + { + sendError(client, 401, request, sendContent, "Authentication doesn't match"); + return false; + } + } + else + { + std::list<std::string> headers; + headers.push_back("WWW-Authenticate: Basic"); + sendError(client, 401, request, sendContent, "Unsupported Authentication Scheme", headers); + return false; + } + } + } + size_t paramspos = filename.find('?'); if (paramspos != std::string::npos) { @@ -434,9 +499,11 @@ static bool parseFirstLine(int const client, std::string const &request,/*{{{*/ return true; } /*}}}*/ -static bool handleOnTheFlyReconfiguration(int const client, std::string const &request, std::vector<std::string> const &parts)/*{{{*/ +static bool handleOnTheFlyReconfiguration(int const client, std::string const &request, std::vector<std::string> parts)/*{{{*/ { size_t const pcount = parts.size(); + for (size_t i = 0; i < pcount; ++i) + parts[i] = DeQuoteString(parts[i]); if (pcount == 4 && parts[1] == "set") { _config->Set(parts[2], parts[3]); @@ -656,6 +723,8 @@ int main(int const argc, const char * argv[]) CommandLine::Args Args[] = { {0, "port", "aptwebserver::port", CommandLine::HasArg}, {0, "request-absolute", "aptwebserver::request::absolute", CommandLine::HasArg}, + {0, "authorization", "aptwebserver::authorization", CommandLine::HasArg}, + {0, "proxy-authorization", "aptwebserver::proxy-authorization", CommandLine::HasArg}, {'c',"config-file",0,CommandLine::ConfigFile}, {'o',"option",0,CommandLine::ArbItem}, {0,0,0,0} diff --git a/test/libapt/hashsums_test.cc b/test/libapt/hashsums_test.cc index 2159996ff..a19a0befd 100644 --- a/test/libapt/hashsums_test.cc +++ b/test/libapt/hashsums_test.cc @@ -163,30 +163,34 @@ TEST(HashSumsTest, FileBased) FileFd fd(__FILE__, FileFd::ReadOnly); EXPECT_TRUE(fd.IsOpen()); + std::string FileSize; + strprintf(FileSize, "%llu", fd.FileSize()); { Hashes hashes; hashes.AddFD(fd.Fd()); HashStringList list = hashes.GetHashStringList(); EXPECT_FALSE(list.empty()); - EXPECT_EQ(4, list.size()); + EXPECT_EQ(5, list.size()); EXPECT_EQ(md5.Value(), list.find("MD5Sum")->HashValue()); EXPECT_EQ(sha1.Value(), list.find("SHA1")->HashValue()); EXPECT_EQ(sha256.Value(), list.find("SHA256")->HashValue()); EXPECT_EQ(sha512.Value(), list.find("SHA512")->HashValue()); + EXPECT_EQ(FileSize, list.find("Checksum-FileSize")->HashValue()); } - unsigned long sz = fd.FileSize(); + unsigned long long sz = fd.FileSize(); fd.Seek(0); { Hashes hashes; hashes.AddFD(fd.Fd(), sz); HashStringList list = hashes.GetHashStringList(); EXPECT_FALSE(list.empty()); - EXPECT_EQ(4, list.size()); + EXPECT_EQ(5, list.size()); EXPECT_EQ(md5.Value(), list.find("MD5Sum")->HashValue()); EXPECT_EQ(sha1.Value(), list.find("SHA1")->HashValue()); EXPECT_EQ(sha256.Value(), list.find("SHA256")->HashValue()); EXPECT_EQ(sha512.Value(), list.find("SHA512")->HashValue()); + EXPECT_EQ(FileSize, list.find("Checksum-FileSize")->HashValue()); } fd.Seek(0); { @@ -279,37 +283,46 @@ TEST(HashSumsTest, HashStringList) EXPECT_EQ(NULL, list.find("")); EXPECT_EQ(NULL, list.find("MD5Sum")); + // empty lists aren't equal HashStringList list2; EXPECT_FALSE(list == list2); EXPECT_TRUE(list != list2); + // some hashes don't really contribute to usability + list.push_back(HashString("Checksum-FileSize", "29")); + EXPECT_FALSE(list.empty()); + EXPECT_FALSE(list.usable()); + Hashes hashes; hashes.Add("The quick brown fox jumps over the lazy dog"); list = hashes.GetHashStringList(); EXPECT_FALSE(list.empty()); EXPECT_TRUE(list.usable()); - EXPECT_EQ(4, list.size()); + EXPECT_EQ(5, list.size()); EXPECT_TRUE(NULL != list.find(NULL)); EXPECT_TRUE(NULL != list.find("")); EXPECT_TRUE(NULL != list.find("MD5Sum")); + EXPECT_TRUE(NULL != list.find("Checksum-FileSize")); EXPECT_TRUE(NULL == list.find("ROT26")); _config->Set("Acquire::ForceHash", "MD5Sum"); EXPECT_FALSE(list.empty()); EXPECT_TRUE(list.usable()); - EXPECT_EQ(4, list.size()); + EXPECT_EQ(5, list.size()); EXPECT_TRUE(NULL != list.find(NULL)); EXPECT_TRUE(NULL != list.find("")); EXPECT_TRUE(NULL != list.find("MD5Sum")); + EXPECT_TRUE(NULL != list.find("Checksum-FileSize")); EXPECT_TRUE(NULL == list.find("ROT26")); _config->Set("Acquire::ForceHash", "ROT26"); EXPECT_FALSE(list.empty()); EXPECT_FALSE(list.usable()); - EXPECT_EQ(4, list.size()); + EXPECT_EQ(5, list.size()); EXPECT_TRUE(NULL == list.find(NULL)); EXPECT_TRUE(NULL == list.find("")); EXPECT_TRUE(NULL != list.find("MD5Sum")); + EXPECT_TRUE(NULL != list.find("Checksum-FileSize")); EXPECT_TRUE(NULL == list.find("ROT26")); _config->Clear("Acquire::ForceHash"); diff --git a/test/libapt/strutil_test.cc b/test/libapt/strutil_test.cc index 8dd9114ec..9bc3c76fd 100644 --- a/test/libapt/strutil_test.cc +++ b/test/libapt/strutil_test.cc @@ -1,10 +1,13 @@ #include <config.h> #include <apt-pkg/strutl.h> +#include <apt-pkg/fileutl.h> #include <string> #include <vector> #include <gtest/gtest.h> +#include "file-helpers.h" + TEST(StrUtilTest,DeEscapeString) { // nothing special @@ -85,7 +88,7 @@ TEST(StrUtilTest,EndsWith) EXPECT_FALSE(Endswith("abcd", "x")); EXPECT_FALSE(Endswith("abcd", "abcndefg")); } -TEST(StrUtilTest,StartWith) +TEST(StrUtilTest,StartsWith) { using APT::String::Startswith; EXPECT_TRUE(Startswith("abcd", "a")); @@ -129,3 +132,84 @@ TEST(StrUtilTest,SubstVar) EXPECT_EQ(" bb a bb a bb a bb ", SubstVar(" aaa a aaa a aaa a aaa ", "aaa", "bb")); } +TEST(StrUtilTest,Base64Encode) +{ + EXPECT_EQ("QWxhZGRpbjpvcGVuIHNlc2FtZQ==", Base64Encode("Aladdin:open sesame")); + EXPECT_EQ("cGxlYXN1cmUu", Base64Encode("pleasure.")); + EXPECT_EQ("bGVhc3VyZS4=", Base64Encode("leasure.")); + EXPECT_EQ("ZWFzdXJlLg==", Base64Encode("easure.")); + EXPECT_EQ("YXN1cmUu", Base64Encode("asure.")); + EXPECT_EQ("c3VyZS4=", Base64Encode("sure.")); + EXPECT_EQ("dXJlLg==", Base64Encode("ure.")); + EXPECT_EQ("cmUu", Base64Encode("re.")); + EXPECT_EQ("ZS4=", Base64Encode("e.")); + EXPECT_EQ("Lg==", Base64Encode(".")); + EXPECT_EQ("", Base64Encode("")); +} +void ReadMessagesTestWithNewLine(char const * const nl, char const * const ab) +{ + SCOPED_TRACE(SubstVar(SubstVar(nl, "\n", "n"), "\r", "r") + " # " + ab); + FileFd fd; + std::string pkgA = "Package: pkgA\n" + "Version: 1\n" + "Size: 100\n" + "Description: aaa\n" + " aaa"; + std::string pkgB = "Package: pkgB\n" + "Version: 1\n" + "Flag: no\n" + "Description: bbb"; + std::string pkgC = "Package: pkgC\n" + "Version: 2\n" + "Flag: yes\n" + "Description:\n" + " ccc"; + + createTemporaryFile("readmessage", fd, NULL, (pkgA + nl + pkgB + nl + pkgC + nl).c_str()); + std::vector<std::string> list; + EXPECT_TRUE(ReadMessages(fd.Fd(), list)); + EXPECT_EQ(3, list.size()); + EXPECT_EQ(pkgA, list[0]); + EXPECT_EQ(pkgB, list[1]); + EXPECT_EQ(pkgC, list[2]); + + size_t const msgsize = 63990; + createTemporaryFile("readmessage", fd, NULL, NULL); + for (size_t j = 0; j < msgsize; ++j) + fd.Write(ab, strlen(ab)); + for (size_t i = 0; i < 21; ++i) + { + std::string msg; + strprintf(msg, "msgsize=%zu i=%zu", msgsize, i); + SCOPED_TRACE(msg); + fd.Seek((msgsize + (i - 1)) * strlen(ab)); + fd.Write(ab, strlen(ab)); + fd.Write(nl, strlen(nl)); + fd.Seek(0); + list.clear(); + EXPECT_TRUE(ReadMessages(fd.Fd(), list)); + EXPECT_EQ(1, list.size()); + EXPECT_EQ((msgsize + i) * strlen(ab), list[0].length()); + EXPECT_EQ(std::string::npos, list[0].find_first_not_of(ab)); + } + + list.clear(); + fd.Write(pkgA.c_str(), pkgA.length()); + fd.Write(nl, strlen(nl)); + fd.Seek(0); + EXPECT_TRUE(ReadMessages(fd.Fd(), list)); + EXPECT_EQ(2, list.size()); + EXPECT_EQ((msgsize + 20) * strlen(ab), list[0].length()); + EXPECT_EQ(std::string::npos, list[0].find_first_not_of(ab)); + EXPECT_EQ(pkgA, list[1]); + + + fd.Close(); +} +TEST(StrUtilTest,ReadMessages) +{ + ReadMessagesTestWithNewLine("\n\n", "a"); + ReadMessagesTestWithNewLine("\r\n\r\n", "a"); + ReadMessagesTestWithNewLine("\n\n", "ab"); + ReadMessagesTestWithNewLine("\r\n\r\n", "ab"); +} |