"Fossies" - the Fresh Open Source Software Archive

Member "apt-1.9.4/test/integration/test-apt-update-filesize-mismatch" (19 Sep 2019, 1673 Bytes) of package /linux/misc/apt-1.9.4.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) Bash source code syntax highlighting (style: standard) with prefixed line numbers. Alternatively you can here view or download the uninterpreted source code file.

    1 #!/bin/sh
    2 set -e
    3 
    4 TESTDIR="$(readlink -f "$(dirname "$0")")"
    5 . "$TESTDIR/framework"
    6 setupenvironment
    7 configarchitecture 'i386'
    8 configcompression 'gz'
    9 
   10 insertpackage 'testing' 'foo' 'all' '1'
   11 insertpackage 'testing' 'foo2' 'all' '1'
   12 insertsource 'testing' 'foo' 'all' '1'
   13 insertsource 'testing' 'foo2' 'all' '1'
   14 
   15 setupaptarchive --no-update
   16 changetowebserver
   17 
   18 find aptarchive \( -name 'Packages' -o -name 'Sources' -o -name 'Translation-en' \) -delete
   19 for release in $(find aptarchive -name 'Release'); do
   20     cp "$release" "${release}.backup"
   21 done
   22 
   23 testsuccess aptget update
   24 testsuccess aptcache show foo
   25 testsuccess aptget install foo -s
   26 
   27 for get in $(sed -n 's#^GET /\([^ ]\+\.gz\) HTTP.\+$#\1#p' aptarchive/webserver.log.client*.log); do
   28     for ext in '' '.gz'; do
   29         COMPRESSFILE="$get"
   30         get="${get}${ext}"
   31         FILE="$(basename "$get" '.gz')"
   32         msgmsg 'Test filesize mismatch with file' "$FILE"
   33         rm -rf rootdir/var/lib/apt/lists
   34 
   35         for release in $(find aptarchive -name 'Release'); do
   36             SIZE="$(awk "/$FILE\$/ { print \$2; exit }" "${release}.backup")"
   37             sed "s# $SIZE # $(($SIZE + 111)) #" "${release}.backup" > "$release"
   38         done
   39         signreleasefiles
   40 
   41         testfailure aptget update -o Debug::pkgAcquire::Worker=1
   42         cp rootdir/tmp/testfailure.output rootdir/tmp/update.output
   43         if [ -z "$ext" ]; then
   44             testsuccess grep -E "$(basename "$COMPRESSFILE" '.gz').*Hash Sum mismatch" rootdir/tmp/update.output
   45         else
   46             testsuccess grep -E "$(basename "$COMPRESSFILE" '.gz').*File has unexpected size" rootdir/tmp/update.output
   47         fi
   48         testfailure aptcache show foo
   49         testfailure aptget install foo -s
   50 
   51         testfailure aptcache show bar
   52         testfailure aptget install bar -s
   53     done
   54 done