diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-27 06:14:41 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-27 06:14:41 +0000 |
commit | 549a391d6438e828001eeeaf235b080c054a7bf3 (patch) | |
tree | 1bb6b1ea5987fa167a1d13abe82209cc882dd94b /test/integration/test-apt-ftparchive-cachedb | |
parent | Initial commit. (diff) | |
download | apt-549a391d6438e828001eeeaf235b080c054a7bf3.tar.xz apt-549a391d6438e828001eeeaf235b080c054a7bf3.zip |
Adding upstream version 2.2.4.upstream/2.2.4upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'test/integration/test-apt-ftparchive-cachedb')
-rwxr-xr-x | test/integration/test-apt-ftparchive-cachedb | 103 |
1 files changed, 103 insertions, 0 deletions
diff --git a/test/integration/test-apt-ftparchive-cachedb b/test/integration/test-apt-ftparchive-cachedb new file mode 100755 index 0000000..73d762c --- /dev/null +++ b/test/integration/test-apt-ftparchive-cachedb @@ -0,0 +1,103 @@ +#!/bin/sh +set -e + +ensure_correct_packages_file() { + testequal "Package: foo +Architecture: i386 +Version: 1 +Priority: optional +Section: others +Maintainer: Joe Sixpack <joe@example.org> +$(dpkg-deb -I ./aptarchive/pool/main/foo_1_i386.deb | grep 'Installed-Size:' | sed 's#^ ##') +Filename: pool/main/foo_1_i386.deb" head -n8 ./aptarchive/dists/test/main/binary-i386/Packages +} + +ensure_correct_contents_file() { + testfileequal ./aptarchive/dists/test/Contents-i386 "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" +} + +# +# 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 package +buildsimplenativepackage 'foo' 'i386' '1' 'test' +mv incoming/* aptarchive/pool/main/ + +# generate (empty cachedb) +testsuccess aptftparchive generate ftparchive.conf -o APT::FTPArchive::ShowCacheMisses=1 +cp rootdir/tmp/testsuccess.output stats-out.txt +ensure_correct_packages_file +ensure_correct_contents_file +testsuccessequal ' Misses in Cache: 2 + dists/test/Contents-i386: New 402 B Misses in Cache: 0' grep Misses stats-out.txt + +# generate again +testsuccess aptftparchive generate ftparchive.conf -o APT::FTPArchive::ShowCacheMisses=1 +cp rootdir/tmp/testsuccess.output stats-out.txt +ensure_correct_packages_file +ensure_correct_contents_file +testsuccessequal ' 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 +testsuccess aptftparchive generate ftparchive.conf -o APT::FTPArchive::ShowCacheMisses=1 +cp rootdir/tmp/testsuccess.output stats-out.txt +ensure_correct_packages_file +ensure_correct_contents_file +testsuccessequal ' Misses in Cache: 0 + dists/test/Contents-i386: New 402 B Misses in Cache: 0' grep Misses stats-out.txt + +# and clean +rm -rf aptarchive/pool/main/* +testsuccessequal "packages-main-i386.db" aptftparchive clean ftparchive.conf +testsuccess aptftparchive clean ftparchive.conf -o Debug::APT::FTPArchive::Clean=1 +cp rootdir/tmp/testsuccess.output clean-out.txt +testsuccessequal "0 Number of unique keys in the tree" grep unique clean-out.txt +testsuccessequal "packages-main-i386.db" grep packages-main-i386.db clean-out.txt |