]> git.saurik.com Git - apt.git/blobdiff - test/integration/test-pdiff-usage
add more parsing error checking for rred
[apt.git] / test / integration / test-pdiff-usage
index 4de07f1ad3d5c92c805cdbe1e771d840ceccd234..7a9f6496b5c8beda81363b02acce08661a03ae84 100755 (executable)
@@ -14,16 +14,7 @@ changetowebserver
 PKGFILE="${TESTDIR}/$(echo "$(basename $0)" | sed 's#^test-#Packages-#')"
 
 wasmergeused() {
-       msgtest 'Test for successful execution of' "$*"
-       local OUTPUT=$(mktemp)
-       addtrap "rm $OUTPUT;"
-       if aptget update "$@" >${OUTPUT} 2>&1; then
-               msgpass
-       else
-               echo
-               cat $OUTPUT
-               msgfail
-       fi
+       testsuccess aptget update "$@"
 
        msgtest 'No intermediate patch files' 'still exist'
        local EDS="$(find rootdir/var/lib/apt/lists -name '*.ed' -o -name '*.ed.*')"
@@ -36,7 +27,7 @@ wasmergeused() {
        fi
 
        msgtest 'Check if the right pdiff merger was used'
-       if grep -q '^pkgAcqIndexMergeDiffs::Done(): rred' $OUTPUT; then
+       if grep -q '^pkgAcqIndexMergeDiffs::Done(): rred' rootdir/tmp/testsuccess.output; then
                if echo "$*" | grep -q -- '-o Acquire::PDiffs::Merge=1'; then
                        msgpass
                else
@@ -56,7 +47,7 @@ testrun() {
        compressfile 'aptarchive/Packages'
        generatereleasefiles
        signreleasefiles
-       rm -rf aptarchive/Packages.diff rootdir/var/lib/apt/lists
+       rm -rf aptarchive/Packages.diff rootdir/var/lib/apt/lists rootdir/var/lib/apt/lists-bak
        testsuccess aptget update "$@"
        cp -a rootdir/var/lib/apt/lists rootdir/var/lib/apt/lists-bak
        testnopackage newstuff
@@ -96,6 +87,8 @@ SHA256-Patches:
        msgmsg "Testcase: index is already up-to-date: $*"
        find rootdir/var/lib/apt/lists -name '*diff_Index' -type f -delete
        testsuccess aptget update "$@"
+       testequal 'Hit http://localhost:8080  InRelease
+Reading package lists...' aptget update "$@" -o Debug::Acquire::Transaction=0 -o Debug::pkgAcquire::Diffs=0
        testsuccessequal "$(cat ${PKGFILE}-new)
 " aptcache show apt newstuff
 
@@ -172,11 +165,14 @@ SHA256-History:
 SHA256-Patches:
  e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855 19722 2010-08-18-2013.28
  $(sha256sum $PATCHFILE | cut -d' ' -f 1) $(stat -c%s $PATCHFILE) $(basename $PATCHFILE)" > $PATCHINDEX
-       echo 'I am Mallory and I change files' >> $PATCHFILE
+       # needs to look like a valid command, otherwise the parser will fail before hashes are checked
+       echo '1d' >> $PATCHFILE
        cat $PATCHFILE | gzip > ${PATCHFILE}.gz
        generatereleasefiles '+1hour'
        signreleasefiles
        testsuccess aptget update "$@"
+       cp -f rootdir/tmp/testsuccess.output rootdir/tmp/aptgetupdate.output
+       testsuccess grep 'have the expected hashsum' rootdir/tmp/aptgetupdate.output
        testnopackage oldstuff
        testsuccessequal "$(cat ${PKGFILE}-new)
 " aptcache show apt newstuff