diff options
author | Michael Vogt <mvo@ubuntu.com> | 2014-04-04 15:36:42 +0200 |
---|---|---|
committer | Michael Vogt <mvo@ubuntu.com> | 2014-04-04 15:36:42 +0200 |
commit | 0a3b93fc3da95c5cbeb18b2d92738cbd50e95d83 (patch) | |
tree | 898ba69919e3abf774e847d9b6be0e8a3886dd98 /test/integration | |
parent | ce928105d7279c5604f034740b04dc6a745fb859 (diff) |
add test for binary cachedb and contents generation
Diffstat (limited to 'test/integration')
-rwxr-xr-x | test/integration/test-apt-ftparchive-cachedb | 93 | ||||
-rwxr-xr-x | test/integration/test-apt-ftparchive-src-cachedb (renamed from test/integration/test-apt-ftparchive) | 4 |
2 files changed, 94 insertions, 3 deletions
diff --git a/test/integration/test-apt-ftparchive-cachedb b/test/integration/test-apt-ftparchive-cachedb new file mode 100755 index 000000000..2a3bfce99 --- /dev/null +++ b/test/integration/test-apt-ftparchive-cachedb @@ -0,0 +1,93 @@ +#!/bin/sh +set -e + +ensure_correct_packages_file() { + testequal "Package: foo +Priority: optional +Section: others +Installed-Size: 29 +Maintainer: Joe Sixpack <joe@example.org> +Architecture: i386 +Version: 1 +Filename: pool/main/foo_1_i386.deb" head -n8 ./aptarchive/dists/test/main/binary-i386/Packages +} + +ensure_correct_contents_file() { + testequal "usr/bin/foo-i386 others/foo +usr/share/doc/foo/FEATURES others/foo +usr/share/doc/foo/changelog others/foo +usr/share/doc/foo/copyright others/foo" cat ./aptarchive/dists/test/Contents-i386 +} + +# +# main() +# +TESTDIR=$(readlink -f $(dirname $0)) +. $TESTDIR/framework +setupenvironment +configarchitecture "i386" + +mkdir -p aptarchive/dists/test/main/i18n/ +mkdir -p aptarchive/dists/test/main/source/ +mkdir -p aptarchive/dists/test/main/binary-i386 +mkdir -p aptarchive/pool/main + +mkdir aptarchive-overrides +mkdir aptarchive-cache +cat > ftparchive.conf <<"EOF" +Dir { + ArchiveDir "./aptarchive"; + OverrideDir "./aptarchive-overrides"; + CacheDir "./aptarchive-cache"; +}; + +Default { + Packages::Compress ". gzip bzip2"; + Contents::Compress ". gzip bzip2"; + LongDescription "false"; +}; + +TreeDefault { + BinCacheDB "packages-$(SECTION)-$(ARCH).db"; + + Directory "pool/$(SECTION)"; + SrcDirectory "pool/$(SECTION)"; + + Packages "$(DIST)/$(SECTION)/binary-$(ARCH)/Packages"; + Contents "$(DIST)/Contents-$(ARCH)"; +}; + +Tree "dists/test" { + Sections "main"; + Architectures "i386"; + +}; +EOF + +# build one pacakge +buildsimplenativepackage 'foo' 'i386' '1' 'test' +mv incoming/* aptarchive/pool/main/ + +# generate (empty cachedb) +aptftparchive generate ftparchive.conf -o APT::FTPArchive::ShowCacheMisses=1 2> stats-out.txt +ensure_correct_packages_file +ensure_correct_contents_file +testequal " Misses in Cache: 2 + dists/test/Contents-i386: New 402 B Misses in Cache: 0" grep Misses stats-out.txt + +# generate again +aptftparchive generate ftparchive.conf -o APT::FTPArchive::ShowCacheMisses=1 2> stats-out.txt +ensure_correct_packages_file +ensure_correct_contents_file +testequal " Misses in Cache: 0 + dists/test/Contents-i386: Misses in Cache: 0" grep Misses stats-out.txt + +# and again (with removing the Packages file) +rm -f ./aptarchive/dists/test/main/binary-i386/* +rm -f ./aptarchive/dists/test/Contents-i386 +aptftparchive generate ftparchive.conf -o APT::FTPArchive::ShowCacheMisses=1 2> stats-out.txt +ensure_correct_packages_file +ensure_correct_contents_file +testequal " Misses in Cache: 0 + dists/test/Contents-i386: New 402 B Misses in Cache: 0" grep Misses stats-out.txt + diff --git a/test/integration/test-apt-ftparchive b/test/integration/test-apt-ftparchive-src-cachedb index b05c15c47..3a5507c21 100755 --- a/test/integration/test-apt-ftparchive +++ b/test/integration/test-apt-ftparchive-src-cachedb @@ -125,9 +125,7 @@ TreeDefault { Directory "pool/$(SECTION)"; SrcDirectory "pool/$(SECTION)"; - Packages "$(DIST)/$(SECTION)/binary-$(ARCH)/Packages"; Sources "$(DIST)/$(SECTION)/source/Sources"; - Contents "$(DIST)/Contents-$(ARCH)"; }; Tree "dists/test" { @@ -138,7 +136,7 @@ Tree "dists/test" { EOF -# generate (no cachedb) +# generate (empty cachedb) aptftparchive generate apt-ftparchive.conf -o APT::FTPArchive::ShowCacheMisses=1 2> stats-out.txt testequal " Misses in Cache: 2" grep Misses stats-out.txt assert_correct_sources_file |