From ce928105d7279c5604f034740b04dc6a745fb859 Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Fri, 4 Apr 2014 14:30:17 +0200 Subject: Implement CacheDB for source packages in apt-ftparchive --- test/integration/framework | 5 +- test/integration/test-apt-ftparchive | 164 +++++++++++++++++++++++++++++++++++ 2 files changed, 168 insertions(+), 1 deletion(-) create mode 100755 test/integration/test-apt-ftparchive (limited to 'test/integration') diff --git a/test/integration/framework b/test/integration/framework index 1c6f041b0..fae21eac4 100644 --- a/test/integration/framework +++ b/test/integration/framework @@ -128,7 +128,10 @@ dpkgcheckbuilddeps() { } gdb() { echo "gdb: run »$*«" - APT_CONFIG=aptconfig.conf LD_LIBRARY_PATH=${LIBRARYPATH} command gdb ${BUILDDIRECTORY}/$1 --args "$@" + CMD="$1" + shift + + APT_CONFIG=aptconfig.conf LD_LIBRARY_PATH=${LIBRARYPATH} command gdb ${BUILDDIRECTORY}/$CMD --args ${BUILDDIRECTORY}/$CMD "$@" } gpg() { # see apt-key for the whole trickery. Setup is done in setupenvironment diff --git a/test/integration/test-apt-ftparchive b/test/integration/test-apt-ftparchive new file mode 100755 index 000000000..b05c15c47 --- /dev/null +++ b/test/integration/test-apt-ftparchive @@ -0,0 +1,164 @@ +#!/bin/sh +set -e + +assert_correct_sources_file() { + testequal "Package: bar +Binary: bar +Version: 1.0 +Architecture: all +Format: 3.0 (native) +Directory: pool/main +Files: + 7b57dd065e51de5905288a5104d4bef5 406 bar_1.0.dsc + d41d8cd98f00b204e9800998ecf8427e 0 bar_1.0.tar.gz +Package-List: + bar deb admin extra +Checksums-Sha1: + 17a40b76715f393ab7fd6485c9392a02f1adf903 406 bar_1.0.dsc + da39a3ee5e6b4b0d3255bfef95601890afd80709 0 bar_1.0.tar.gz +Checksums-Sha256: + d9d7507f66a89258b6920aca47747d7a30e0e64b09ecabbf02b2efbdabf840a9 406 bar_1.0.dsc + e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855 0 bar_1.0.tar.gz +Checksums-Sha512: + ee0a9bfb6614159b45203fc29487d4f37387993ca0e6d6f27b80010498f3731d75753188ece307508ae9af0259bd11a6af15a1a38f0b87dbd5ea1273b7a7d53e 406 bar_1.0.dsc + cf83e1357eefb8bdf1542850d66d8007d620e4050b5715dc83f4a921d36ce9ce47d0d13c5d85f2b0ff8318d2877eec2f63b931bd47417a81a538327af927da3e 0 bar_1.0.tar.gz + +Package: foo +Binary: foo +Version: 1.0 +Architecture: all +Format: 3.0 (native) +Directory: pool/main +Files: + d144826e6f02831c1933e910c92cd7e0 171 foo_1.0.dsc + d41d8cd98f00b204e9800998ecf8427e 0 foo_1.0.tar.gz +Package-List: + foo deb admin extra +Checksums-Sha1: + 979306aa3ccff3d61bba062bb6977e2493c6f907 171 foo_1.0.dsc + da39a3ee5e6b4b0d3255bfef95601890afd80709 0 foo_1.0.tar.gz +Checksums-Sha256: + 8c780af8b5a6d5b3c2e2f9518940beebea52ac6d6ad7b52c082dc925cfe5b532 171 foo_1.0.dsc + e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855 0 foo_1.0.tar.gz +Checksums-Sha512: + 3da0240fd764657c2f3661b4d750578a9a99b0580591b133756379d48117ebda87a5ed2467f513200d6e7eaf51422cbe91c15720eef7fb4bba2cc8ff81ebc547 171 foo_1.0.dsc + cf83e1357eefb8bdf1542850d66d8007d620e4050b5715dc83f4a921d36ce9ce47d0d13c5d85f2b0ff8318d2877eec2f63b931bd47417a81a538327af927da3e 0 foo_1.0.tar.gz +" cat ./aptarchive/dists/test/main/source/Sources +} + +create_source_files() { + NAME="$1" + REQUEST_CLEARSIGN="$2" + + TARFILE="aptarchive/pool/main/${NAME}_1.0.tar.gz" + DSC_FILE="aptarchive/pool/main/${NAME}_1.0.dsc" + touch $TARFILE + if [ "$REQUEST_CLEARSIGN" = "CLEARSIGN" ]; then + printf -- "-----BEGIN PGP SIGNED MESSAGE-----\n\n" > $DSC_FILE + fi + cat >> $DSC_FILE << EOF +Format: 3.0 (native) +Source: $NAME +Binary: $NAME +Architecture: all +Version: 1.0 +Package-List: + $NAME deb admin extra +Files: + $(md5sum $TARFILE|cut -f1 -d' ') $(stat --print="%s" $TARFILE) ${NAME}_1.0.tar.gz +EOF + if [ "$REQUEST_CLEARSIGN" = "CLEARSIGN" ]; then + cat >> $DSC_FILE < apt-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"; + SrcCacheDB "sources-$(SECTION).db"; + + Directory "pool/$(SECTION)"; + SrcDirectory "pool/$(SECTION)"; + + Packages "$(DIST)/$(SECTION)/binary-$(ARCH)/Packages"; + Sources "$(DIST)/$(SECTION)/source/Sources"; + Contents "$(DIST)/Contents-$(ARCH)"; +}; + +Tree "dists/test" { + Sections "main"; + Architectures "source"; + +}; +EOF + + +# generate (no 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 + + +# generate again out of the cache +rm -f ./aptarchive/dists/test/main/source/Sources +aptftparchive generate apt-ftparchive.conf -o APT::FTPArchive::ShowCacheMisses=1 2> stats-out.txt +testequal " Misses in Cache: 0" grep Misses stats-out.txt +assert_correct_sources_file + +# generate invalid files +mkdir aptarchive/pool/invalid +printf "meep" > aptarchive/pool/invalid/invalid_1.0.dsc +testequal " +E: Could not find a Source entry in the DSC 'aptarchive/pool/invalid/invalid_1.0.dsc'" aptftparchive sources aptarchive/pool/invalid +rm -f aptarchive/pool/invalid/invalid_1.0.dsc + +dd if=/dev/zero of="aptarchive/pool/invalid/toobig_1.0.dsc" bs=1k count=129 2>/dev/null +testequal " +E: DSC file 'aptarchive/pool/invalid/toobig_1.0.dsc' is too large!" aptftparchive sources aptarchive/pool/invalid + + -- cgit v1.2.3 From 0a3b93fc3da95c5cbeb18b2d92738cbd50e95d83 Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Fri, 4 Apr 2014 15:36:42 +0200 Subject: add test for binary cachedb and contents generation --- test/integration/test-apt-ftparchive | 164 ----------------------- test/integration/test-apt-ftparchive-cachedb | 93 +++++++++++++ test/integration/test-apt-ftparchive-src-cachedb | 162 ++++++++++++++++++++++ 3 files changed, 255 insertions(+), 164 deletions(-) delete mode 100755 test/integration/test-apt-ftparchive create mode 100755 test/integration/test-apt-ftparchive-cachedb create mode 100755 test/integration/test-apt-ftparchive-src-cachedb (limited to 'test/integration') diff --git a/test/integration/test-apt-ftparchive b/test/integration/test-apt-ftparchive deleted file mode 100755 index b05c15c47..000000000 --- a/test/integration/test-apt-ftparchive +++ /dev/null @@ -1,164 +0,0 @@ -#!/bin/sh -set -e - -assert_correct_sources_file() { - testequal "Package: bar -Binary: bar -Version: 1.0 -Architecture: all -Format: 3.0 (native) -Directory: pool/main -Files: - 7b57dd065e51de5905288a5104d4bef5 406 bar_1.0.dsc - d41d8cd98f00b204e9800998ecf8427e 0 bar_1.0.tar.gz -Package-List: - bar deb admin extra -Checksums-Sha1: - 17a40b76715f393ab7fd6485c9392a02f1adf903 406 bar_1.0.dsc - da39a3ee5e6b4b0d3255bfef95601890afd80709 0 bar_1.0.tar.gz -Checksums-Sha256: - d9d7507f66a89258b6920aca47747d7a30e0e64b09ecabbf02b2efbdabf840a9 406 bar_1.0.dsc - e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855 0 bar_1.0.tar.gz -Checksums-Sha512: - ee0a9bfb6614159b45203fc29487d4f37387993ca0e6d6f27b80010498f3731d75753188ece307508ae9af0259bd11a6af15a1a38f0b87dbd5ea1273b7a7d53e 406 bar_1.0.dsc - cf83e1357eefb8bdf1542850d66d8007d620e4050b5715dc83f4a921d36ce9ce47d0d13c5d85f2b0ff8318d2877eec2f63b931bd47417a81a538327af927da3e 0 bar_1.0.tar.gz - -Package: foo -Binary: foo -Version: 1.0 -Architecture: all -Format: 3.0 (native) -Directory: pool/main -Files: - d144826e6f02831c1933e910c92cd7e0 171 foo_1.0.dsc - d41d8cd98f00b204e9800998ecf8427e 0 foo_1.0.tar.gz -Package-List: - foo deb admin extra -Checksums-Sha1: - 979306aa3ccff3d61bba062bb6977e2493c6f907 171 foo_1.0.dsc - da39a3ee5e6b4b0d3255bfef95601890afd80709 0 foo_1.0.tar.gz -Checksums-Sha256: - 8c780af8b5a6d5b3c2e2f9518940beebea52ac6d6ad7b52c082dc925cfe5b532 171 foo_1.0.dsc - e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855 0 foo_1.0.tar.gz -Checksums-Sha512: - 3da0240fd764657c2f3661b4d750578a9a99b0580591b133756379d48117ebda87a5ed2467f513200d6e7eaf51422cbe91c15720eef7fb4bba2cc8ff81ebc547 171 foo_1.0.dsc - cf83e1357eefb8bdf1542850d66d8007d620e4050b5715dc83f4a921d36ce9ce47d0d13c5d85f2b0ff8318d2877eec2f63b931bd47417a81a538327af927da3e 0 foo_1.0.tar.gz -" cat ./aptarchive/dists/test/main/source/Sources -} - -create_source_files() { - NAME="$1" - REQUEST_CLEARSIGN="$2" - - TARFILE="aptarchive/pool/main/${NAME}_1.0.tar.gz" - DSC_FILE="aptarchive/pool/main/${NAME}_1.0.dsc" - touch $TARFILE - if [ "$REQUEST_CLEARSIGN" = "CLEARSIGN" ]; then - printf -- "-----BEGIN PGP SIGNED MESSAGE-----\n\n" > $DSC_FILE - fi - cat >> $DSC_FILE << EOF -Format: 3.0 (native) -Source: $NAME -Binary: $NAME -Architecture: all -Version: 1.0 -Package-List: - $NAME deb admin extra -Files: - $(md5sum $TARFILE|cut -f1 -d' ') $(stat --print="%s" $TARFILE) ${NAME}_1.0.tar.gz -EOF - if [ "$REQUEST_CLEARSIGN" = "CLEARSIGN" ]; then - cat >> $DSC_FILE < apt-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"; - SrcCacheDB "sources-$(SECTION).db"; - - Directory "pool/$(SECTION)"; - SrcDirectory "pool/$(SECTION)"; - - Packages "$(DIST)/$(SECTION)/binary-$(ARCH)/Packages"; - Sources "$(DIST)/$(SECTION)/source/Sources"; - Contents "$(DIST)/Contents-$(ARCH)"; -}; - -Tree "dists/test" { - Sections "main"; - Architectures "source"; - -}; -EOF - - -# generate (no 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 - - -# generate again out of the cache -rm -f ./aptarchive/dists/test/main/source/Sources -aptftparchive generate apt-ftparchive.conf -o APT::FTPArchive::ShowCacheMisses=1 2> stats-out.txt -testequal " Misses in Cache: 0" grep Misses stats-out.txt -assert_correct_sources_file - -# generate invalid files -mkdir aptarchive/pool/invalid -printf "meep" > aptarchive/pool/invalid/invalid_1.0.dsc -testequal " -E: Could not find a Source entry in the DSC 'aptarchive/pool/invalid/invalid_1.0.dsc'" aptftparchive sources aptarchive/pool/invalid -rm -f aptarchive/pool/invalid/invalid_1.0.dsc - -dd if=/dev/zero of="aptarchive/pool/invalid/toobig_1.0.dsc" bs=1k count=129 2>/dev/null -testequal " -E: DSC file 'aptarchive/pool/invalid/toobig_1.0.dsc' is too large!" aptftparchive sources aptarchive/pool/invalid - - 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 +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-src-cachedb b/test/integration/test-apt-ftparchive-src-cachedb new file mode 100755 index 000000000..3a5507c21 --- /dev/null +++ b/test/integration/test-apt-ftparchive-src-cachedb @@ -0,0 +1,162 @@ +#!/bin/sh +set -e + +assert_correct_sources_file() { + testequal "Package: bar +Binary: bar +Version: 1.0 +Architecture: all +Format: 3.0 (native) +Directory: pool/main +Files: + 7b57dd065e51de5905288a5104d4bef5 406 bar_1.0.dsc + d41d8cd98f00b204e9800998ecf8427e 0 bar_1.0.tar.gz +Package-List: + bar deb admin extra +Checksums-Sha1: + 17a40b76715f393ab7fd6485c9392a02f1adf903 406 bar_1.0.dsc + da39a3ee5e6b4b0d3255bfef95601890afd80709 0 bar_1.0.tar.gz +Checksums-Sha256: + d9d7507f66a89258b6920aca47747d7a30e0e64b09ecabbf02b2efbdabf840a9 406 bar_1.0.dsc + e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855 0 bar_1.0.tar.gz +Checksums-Sha512: + ee0a9bfb6614159b45203fc29487d4f37387993ca0e6d6f27b80010498f3731d75753188ece307508ae9af0259bd11a6af15a1a38f0b87dbd5ea1273b7a7d53e 406 bar_1.0.dsc + cf83e1357eefb8bdf1542850d66d8007d620e4050b5715dc83f4a921d36ce9ce47d0d13c5d85f2b0ff8318d2877eec2f63b931bd47417a81a538327af927da3e 0 bar_1.0.tar.gz + +Package: foo +Binary: foo +Version: 1.0 +Architecture: all +Format: 3.0 (native) +Directory: pool/main +Files: + d144826e6f02831c1933e910c92cd7e0 171 foo_1.0.dsc + d41d8cd98f00b204e9800998ecf8427e 0 foo_1.0.tar.gz +Package-List: + foo deb admin extra +Checksums-Sha1: + 979306aa3ccff3d61bba062bb6977e2493c6f907 171 foo_1.0.dsc + da39a3ee5e6b4b0d3255bfef95601890afd80709 0 foo_1.0.tar.gz +Checksums-Sha256: + 8c780af8b5a6d5b3c2e2f9518940beebea52ac6d6ad7b52c082dc925cfe5b532 171 foo_1.0.dsc + e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855 0 foo_1.0.tar.gz +Checksums-Sha512: + 3da0240fd764657c2f3661b4d750578a9a99b0580591b133756379d48117ebda87a5ed2467f513200d6e7eaf51422cbe91c15720eef7fb4bba2cc8ff81ebc547 171 foo_1.0.dsc + cf83e1357eefb8bdf1542850d66d8007d620e4050b5715dc83f4a921d36ce9ce47d0d13c5d85f2b0ff8318d2877eec2f63b931bd47417a81a538327af927da3e 0 foo_1.0.tar.gz +" cat ./aptarchive/dists/test/main/source/Sources +} + +create_source_files() { + NAME="$1" + REQUEST_CLEARSIGN="$2" + + TARFILE="aptarchive/pool/main/${NAME}_1.0.tar.gz" + DSC_FILE="aptarchive/pool/main/${NAME}_1.0.dsc" + touch $TARFILE + if [ "$REQUEST_CLEARSIGN" = "CLEARSIGN" ]; then + printf -- "-----BEGIN PGP SIGNED MESSAGE-----\n\n" > $DSC_FILE + fi + cat >> $DSC_FILE << EOF +Format: 3.0 (native) +Source: $NAME +Binary: $NAME +Architecture: all +Version: 1.0 +Package-List: + $NAME deb admin extra +Files: + $(md5sum $TARFILE|cut -f1 -d' ') $(stat --print="%s" $TARFILE) ${NAME}_1.0.tar.gz +EOF + if [ "$REQUEST_CLEARSIGN" = "CLEARSIGN" ]; then + cat >> $DSC_FILE < apt-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"; + SrcCacheDB "sources-$(SECTION).db"; + + Directory "pool/$(SECTION)"; + SrcDirectory "pool/$(SECTION)"; + + Sources "$(DIST)/$(SECTION)/source/Sources"; +}; + +Tree "dists/test" { + Sections "main"; + Architectures "source"; + +}; +EOF + + +# 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 + + +# generate again out of the cache +rm -f ./aptarchive/dists/test/main/source/Sources +aptftparchive generate apt-ftparchive.conf -o APT::FTPArchive::ShowCacheMisses=1 2> stats-out.txt +testequal " Misses in Cache: 0" grep Misses stats-out.txt +assert_correct_sources_file + +# generate invalid files +mkdir aptarchive/pool/invalid +printf "meep" > aptarchive/pool/invalid/invalid_1.0.dsc +testequal " +E: Could not find a Source entry in the DSC 'aptarchive/pool/invalid/invalid_1.0.dsc'" aptftparchive sources aptarchive/pool/invalid +rm -f aptarchive/pool/invalid/invalid_1.0.dsc + +dd if=/dev/zero of="aptarchive/pool/invalid/toobig_1.0.dsc" bs=1k count=129 2>/dev/null +testequal " +E: DSC file 'aptarchive/pool/invalid/toobig_1.0.dsc' is too large!" aptftparchive sources aptarchive/pool/invalid + + -- cgit v1.2.3 From 53ba4e2c2dd29758be0a911489ca5c23e5107513 Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Fri, 4 Apr 2014 17:09:43 +0200 Subject: ensure clean works --- test/integration/test-apt-ftparchive-cachedb | 7 +++++++ test/integration/test-apt-ftparchive-src-cachedb | 6 ++++++ 2 files changed, 13 insertions(+) (limited to 'test/integration') diff --git a/test/integration/test-apt-ftparchive-cachedb b/test/integration/test-apt-ftparchive-cachedb index 2a3bfce99..147272a2c 100755 --- a/test/integration/test-apt-ftparchive-cachedb +++ b/test/integration/test-apt-ftparchive-cachedb @@ -91,3 +91,10 @@ 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 +# and clean +rm -rf aptarchive/pool/main/* +testequal "packages-main-i386.db" aptftparchive clean ftparchive.conf +aptftparchive clean ftparchive.conf -o Debug::APT::FTPArchive::Clean=1 > clean-out.txt 2>&1 +testequal "0 Number of unique keys in the tree" grep unique clean-out.txt +testequal "packages-main-i386.db" grep packages-main-i386.db clean-out.txt + diff --git a/test/integration/test-apt-ftparchive-src-cachedb b/test/integration/test-apt-ftparchive-src-cachedb index 3a5507c21..9cc0a98de 100755 --- a/test/integration/test-apt-ftparchive-src-cachedb +++ b/test/integration/test-apt-ftparchive-src-cachedb @@ -159,4 +159,10 @@ dd if=/dev/zero of="aptarchive/pool/invalid/toobig_1.0.dsc" bs=1k count=129 2>/d testequal " E: DSC file 'aptarchive/pool/invalid/toobig_1.0.dsc' is too large!" aptftparchive sources aptarchive/pool/invalid +# ensure clean works +rm -f aptarchive/pool/main/* +aptftparchive clean apt-ftparchive.conf -o Debug::APT::FTPArchive::Clean=1 > clean-out.txt 2>&1 +testequal "0 Number of unique keys in the tree" grep unique clean-out.txt +testequal "sources-main.db" grep sources-main.db clean-out.txt + -- cgit v1.2.3 From cf6bbca0a93b21ab7d3378f26dd9b57951a1d987 Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Mon, 7 Apr 2014 09:41:20 +0200 Subject: ensure "--db" also works with the new srcpkgdb --- test/integration/test-apt-ftparchive-src-cachedb | 27 +++++++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) (limited to 'test/integration') diff --git a/test/integration/test-apt-ftparchive-src-cachedb b/test/integration/test-apt-ftparchive-src-cachedb index 9cc0a98de..1af193632 100755 --- a/test/integration/test-apt-ftparchive-src-cachedb +++ b/test/integration/test-apt-ftparchive-src-cachedb @@ -105,6 +105,30 @@ mkdir -p aptarchive/dists/test/main/source/ mkdir aptarchive-overrides mkdir aptarchive-cache + + + +# generate with --db option +(cd aptarchive && aptftparchive --db ./test.db sources pool/main/ \ + -o APT::FTPArchive::ShowCacheMisses=1 \ + > dists/test/main/source/Sources \ + 2> stats-out.txt + testequal " Misses in Cache: 2" grep Misses stats-out.txt +) +assert_correct_sources_file + +# generate with --db option (again to ensure its in the cache) +(cd aptarchive && aptftparchive --db ./test.db sources pool/main/ \ + -o APT::FTPArchive::ShowCacheMisses=1 \ + > dists/test/main/source/Sources \ + 2> stats-out.txt + testequal " Misses in Cache: 0" grep Misses stats-out.txt +) +assert_correct_sources_file + + + +# get ready for the "apt-ftparchive generate" command cat > apt-ftparchive.conf <<"EOF" Dir { ArchiveDir "./aptarchive"; @@ -135,7 +159,6 @@ Tree "dists/test" { }; EOF - # 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 @@ -148,6 +171,8 @@ aptftparchive generate apt-ftparchive.conf -o APT::FTPArchive::ShowCacheMisses=1 testequal " Misses in Cache: 0" grep Misses stats-out.txt assert_correct_sources_file + + # generate invalid files mkdir aptarchive/pool/invalid printf "meep" > aptarchive/pool/invalid/invalid_1.0.dsc -- cgit v1.2.3 From b41713efc8f37d62f078bea850ef0a74e0af0103 Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Wed, 7 May 2014 21:03:45 +0200 Subject: show progress in run-tests --- test/integration/run-tests | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'test/integration') diff --git a/test/integration/run-tests b/test/integration/run-tests index 79d5d1a29..d700cc3fc 100755 --- a/test/integration/run-tests +++ b/test/integration/run-tests @@ -36,11 +36,12 @@ else CRESET='' fi +TOTAL="$(run-parts --list $DIR | grep '/test-' | wc -l)" for testcase in $(run-parts --list $DIR | grep '/test-'); do if [ "$MSGLEVEL" -le 2 ]; then echo -n "${CTEST}Testcase ${CHIGH}$(basename ${testcase})${CRESET}: " else - echo "${CTEST}Run Testcase ${CHIGH}$(basename ${testcase})${CRESET}" + echo "${CTEST}Run Testcase ($(($ALL+1))/${TOTAL}) ${CHIGH}$(basename ${testcase})${CRESET}" fi if ! ${testcase}; then FAIL=$((FAIL+1)) -- cgit v1.2.3 From bc1c9081e826c2c7f265f23d388ba868d5011f6a Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Thu, 15 May 2014 14:37:33 +0200 Subject: Never parse Version/Architecture tags in a Translation-$lang file Version/Architecture information in a Translation-$lang file is not allowed, so don't try to parse it. This is a fix for a bugreport where a Translation-en file contained the content of the regular Packages file (probably due to local FS corruption). This lead to strange error messages on file download. Thanks to Thomas Reusch for the report. --- .../test-apt-translation-has-no-packages | 41 ++++++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100755 test/integration/test-apt-translation-has-no-packages (limited to 'test/integration') diff --git a/test/integration/test-apt-translation-has-no-packages b/test/integration/test-apt-translation-has-no-packages new file mode 100755 index 000000000..bb2353a33 --- /dev/null +++ b/test/integration/test-apt-translation-has-no-packages @@ -0,0 +1,41 @@ +#!/bin/sh +# +# Due to corruption (local or network) a user might end up with a +# Translation-$lang file on disk that is actually a Packages file. In this +# case apt used to generate invalid package versions out of the +# Translation-$lang file (i.e. apt-cache policy foo) would show a version +# comming out of a Translation file. Downloading this versions fails as +# there is no acquire method available for the package +# +set -e + +TESTDIR=$(readlink -f $(dirname $0)) +. $TESTDIR/framework + +setupenvironment +configarchitecture "amd64" + +if [ ! -x ${BUILDDIRECTORY}/apt ]; then + msgmsg "No ${BUILDDIRECTORY}/apt" + msgskip + exit 0 +fi + +buildsimplenativepackage 'foo' 'all' '1.0' +setupaptarchive + +APTARCHIVE=$(readlink -f ./aptarchive) + +# corrupt the Translation-en file to look like a regular Packages file +rm rootdir/var/cache/apt/*.bin +cp $APTARCHIVE/dists/unstable/main/binary-amd64/Packages \ + rootdir/var/lib/apt/lists/*Translation-en + +# ensure that there is no Version for the package foo generated out of +# the corrupted Translation-en file +testequal "foo: + Installed: (none) + Candidate: 1.0 + Version table: + 1.0 0 + 500 file:$APTARCHIVE/ unstable/main amd64 Packages" aptcache policy foo -- cgit v1.2.3 From 6f22aa086954064b2ee58cd11b50832b242d54ad Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Sat, 10 May 2014 14:21:10 +0200 Subject: add an additional test for arch specific conflicts In bugreport #747261 I confirmed with this testcase that apt actually supports the requested architecture-specific conflicts already since 2012 with commit cef094c2ec8214b2783a2ac3aa70cf835381eae1. The old test only does simulations which are handy to check apt, this one builds 'real' packages to see if dpkg agrees with us. Git-Dch: Ignore --- .../test-bug-747261-arch-specific-conflicts | 36 ++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100755 test/integration/test-bug-747261-arch-specific-conflicts (limited to 'test/integration') diff --git a/test/integration/test-bug-747261-arch-specific-conflicts b/test/integration/test-bug-747261-arch-specific-conflicts new file mode 100755 index 000000000..bfb2d089f --- /dev/null +++ b/test/integration/test-bug-747261-arch-specific-conflicts @@ -0,0 +1,36 @@ +#!/bin/sh +set -e + +TESTDIR=$(readlink -f $(dirname $0)) +. $TESTDIR/framework +setupenvironment +configarchitecture 'amd64' 'sparc' 'armel' + +buildsimplenativepackage 'libc6' 'amd64,sparc,armel' '1' 'stable' 'Multi-Arch: same' +buildsimplenativepackage 'libc6-i386' 'amd64' '1' 'stable' 'Conflicts: libc6:sparc' + +setupaptarchive + +testsuccess aptget install 'libc6:amd64' 'libc6:sparc' -y +testdpkginstalled 'libc6:amd64' 'libc6:sparc' +testdpkgnotinstalled 'libc6-i386' 'libc6:armel' + +testsuccess aptget install libc6-i386 -y +testdpkginstalled 'libc6:amd64' 'libc6-i386' +testdpkgnotinstalled 'libc6:sparc' 'libc6:armel' + +testsuccess aptget install libc6:armel -y +testdpkginstalled 'libc6:amd64' 'libc6:armel' 'libc6-i386' +testdpkgnotinstalled 'libc6:sparc' + +testsuccess aptget install libc6:sparc -y +testdpkginstalled 'libc6:amd64' 'libc6:armel' 'libc6:sparc' +testdpkgnotinstalled 'libc6-i386' + +testsuccess aptget purge 'libc6:*' 'libc6-i386' -y +testdpkgnotinstalled 'libc6:amd64' 'libc6:armel' 'libc6:sparc' 'libc6-i386' + +# check that (the actually simpler) single arch is fine, too +configarchitecture 'amd64' +testfailure aptget install libc6:sparc -s +testsuccess aptget install libc6 libc6-i386 -y -- cgit v1.2.3 From 8f418981337503ff7abedd872f788b51bcdbc886 Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Tue, 22 Apr 2014 16:07:32 +0200 Subject: show upgradable packages after apt update Closes: 748389 --- test/integration/test-apt-cli-update | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100755 test/integration/test-apt-cli-update (limited to 'test/integration') diff --git a/test/integration/test-apt-cli-update b/test/integration/test-apt-cli-update new file mode 100755 index 000000000..8237bf03f --- /dev/null +++ b/test/integration/test-apt-cli-update @@ -0,0 +1,17 @@ +#!/bin/sh +set -e + +TESTDIR=$(readlink -f $(dirname $0)) +. $TESTDIR/framework + +setupenvironment +configarchitecture "i386" + +insertpackage 'unstable' 'foo' 'all' '2.0' +insertinstalledpackage 'foo' 'all' '1.0' + +setupaptarchive + +APTARCHIVE=$(readlink -f ./aptarchive) + +testequal "1 package can be upgraded. Run 'apt list --upgradable' to see it." apt update -q -- cgit v1.2.3 From a6fd378a9b2a541a18aeba722ecfedba9af567cb Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Thu, 8 May 2014 18:52:51 +0200 Subject: make test independent from the actual Install-Size Git-Dch: Ignore --- test/integration/test-apt-ftparchive-cachedb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'test/integration') diff --git a/test/integration/test-apt-ftparchive-cachedb b/test/integration/test-apt-ftparchive-cachedb index 147272a2c..0e1986bcd 100755 --- a/test/integration/test-apt-ftparchive-cachedb +++ b/test/integration/test-apt-ftparchive-cachedb @@ -5,7 +5,7 @@ ensure_correct_packages_file() { testequal "Package: foo Priority: optional Section: others -Installed-Size: 29 +$(dpkg-deb -I ./aptarchive/pool/main/foo_1_i386.deb | grep 'Installed-Size:' | sed 's#^ ##') Maintainer: Joe Sixpack Architecture: i386 Version: 1 @@ -25,7 +25,7 @@ usr/share/doc/foo/copyright others/foo" cat ./aptarchive/dists/test/Conte TESTDIR=$(readlink -f $(dirname $0)) . $TESTDIR/framework setupenvironment -configarchitecture "i386" +configarchitecture 'i386' mkdir -p aptarchive/dists/test/main/i18n/ mkdir -p aptarchive/dists/test/main/source/ -- cgit v1.2.3 From 0eb4af9d3d0c524c7afdc684238aa263ac287449 Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Sat, 17 May 2014 12:37:13 +0200 Subject: fix tight loop detection and temporary removes As outlined in #748355 apt segfaulted if it encountered a loop between a package pre-depending on a package conflicting with the previous as it ended up in an endless loop trying to unpack 'the other package'. In this specific case as an essential package is involved a lot of force needs to be applied, but can also be caused by 'normal' tight loops and highlights a problem in how we handle breaks which we want to avoid. The fix comes in multiple entangled changes: 1. All Smart* calls are guarded with loop detection. Some already had it, some had parts of it, some did it incorrect, and some didn't even try. 2. temporary removes to avoid a loop (which is done if a loop is detected) prevent the unpack of this looping package (we tried to unpack it to avoid the conflict/breaks, but due to a loop we couldn't, so we remove/deconfigure it instead which means we can't unpack it now) 3. handle conflicts and breaks very similar instead of duplicating most of the code. The only remaining difference is, as it should: deconfigure is enough for breaks, for conflicts we need the big hammer --- .../test-bug-618288-multiarch-same-lockstep | 19 ++++---- .../test-bug-673536-pre-depends-breaks-loop | 28 +++++++++--- test/integration/test-conflicts-loop | 6 ++- test/integration/test-essential-force-loopbreak | 51 ++++++++++++++++++++++ 4 files changed, 86 insertions(+), 18 deletions(-) create mode 100755 test/integration/test-essential-force-loopbreak (limited to 'test/integration') diff --git a/test/integration/test-bug-618288-multiarch-same-lockstep b/test/integration/test-bug-618288-multiarch-same-lockstep index e0305b64b..536124c2c 100755 --- a/test/integration/test-bug-618288-multiarch-same-lockstep +++ b/test/integration/test-bug-618288-multiarch-same-lockstep @@ -16,22 +16,23 @@ buildsimplenativepackage 'apt' 'i386' '2' 'unstable' 'Depends: libsame (= 2)' '' buildsimplenativepackage 'apt2' 'amd64' '2' 'unstable' 'Depends: libsame (= 2)' '' 'required' setupaptarchive -aptget dist-upgrade -s >output.apt 2>&1 +testsuccess aptget dist-upgrade -s -o Debug::pkgPackageManager=1 # order in switch libsame:{amd64,i386} are unpacked is irrelevant, as both are installed - but we need to do it together -LS_U_AMD="$(grep -o -n '^Inst libsame ' output.apt | cut -d: -f1)" -LS_U_INT="$(grep -o -n '^Inst libsame:i386 ' output.apt | cut -d: -f1)" -LS_C_AMD="$(grep -o -n '^Conf libsame ' output.apt | cut -d: -f1)" -LS_C_INT="$(grep -o -n '^Conf libsame:i386 ' output.apt | cut -d: -f1)" +OUTPUT=rootdir/tmp/testsuccess.output +LS_U_AMD="$(grep -o -n '^Inst libsame ' $OUTPUT | cut -d: -f1)" +LS_U_INT="$(grep -o -n '^Inst libsame:i386 ' $OUTPUT | cut -d: -f1)" +LS_C_AMD="$(grep -o -n '^Conf libsame ' $OUTPUT | cut -d: -f1)" +LS_C_INT="$(grep -o -n '^Conf libsame:i386 ' $OUTPUT | cut -d: -f1)" -msgtest 'Test if libsame:amd64 unpack before configure' +msgtest 'Test if' 'libsame:amd64 unpack before configure' test "$LS_U_AMD" -lt "$LS_C_AMD" && msgpass || msgfail -msgtest 'Test if libsame:i386 unpack before configure' +msgtest 'Test if' 'libsame:i386 unpack before configure' test "$LS_U_INT" -lt "$LS_C_INT" && msgpass || msgfail -msgtest 'Test if libsame:amd64 unpack is before libsame:i386 configure' +msgtest 'Test if' 'libsame:amd64 unpack is before libsame:i386 configure' test "$LS_U_AMD" -lt "$LS_C_INT" && msgpass || msgfail -msgtest 'Test if libsame:i386 unpack is before libsame:amd64 configure' +msgtest 'Test if' 'libsame:i386 unpack is before libsame:amd64 configure' test "$LS_U_INT" -lt "$LS_C_AMD" && msgpass || msgfail diff --git a/test/integration/test-bug-673536-pre-depends-breaks-loop b/test/integration/test-bug-673536-pre-depends-breaks-loop index f6a90b21f..21bd5e065 100755 --- a/test/integration/test-bug-673536-pre-depends-breaks-loop +++ b/test/integration/test-bug-673536-pre-depends-breaks-loop @@ -6,18 +6,32 @@ TESTDIR=$(readlink -f $(dirname $0)) setupenvironment configarchitecture 'native' -buildsimplenativepackage 'basic' 'native' '1' 'stable' +buildsimplenativepackage 'advanced' 'native' '1' 'stable' +buildsimplenativepackage 'advanced' 'native' '2' 'unstable' 'Pre-Depends: basic' buildsimplenativepackage 'basic' 'native' '2' 'unstable' 'Pre-Depends: common' -buildsimplenativepackage 'common' 'native' '2' 'unstable' 'Breaks: basic (<= 1)' + +buildsimplenativepackage 'common' 'native' '2~conflict' 'unstable-conflict' 'Conflicts: advanced (<= 1)' +buildsimplenativepackage 'common' 'native' '2~break' 'unstable-break' 'Conflicts: advanced (<= 1)' setupaptarchive # we check with 'real' packages here as the simulation reports a 'Conf broken' # which is technical correct for the simulation, but testing errormsg is ugly -testsuccess aptget install basic=1 -y -testdpkginstalled basic -testdpkgnotinstalled common +cp -a rootdir/var/lib/dpkg/status dpkg.status.backup + +testloopbreak() { + cp -a dpkg.status.backup rootdir/var/lib/dpkg/status + rm -f rootdir/var/lib/apt/extended_states + + + testsuccess aptget install advanced=1 -y -t "$1" -o Debug::pkgPackageManager=1 + testdpkginstalled advanced + testdpkgnotinstalled basic common + + testsuccess aptget dist-upgrade -y -t "$1" -o Debug::pkgPackageManager=1 + testdpkginstalled advanced basic common +} -testsuccess aptget dist-upgrade -y -testdpkginstalled basic common +testloopbreak 'unstable-break' +testloopbreak 'unstable-conflict' diff --git a/test/integration/test-conflicts-loop b/test/integration/test-conflicts-loop index 4978fe1e8..a2c411aaf 100755 --- a/test/integration/test-conflicts-loop +++ b/test/integration/test-conflicts-loop @@ -20,11 +20,13 @@ Building dependency tree... The following packages will be upgraded: openjdk-6-jre openjdk-6-jre-headless openjdk-6-jre-lib 3 upgraded, 0 newly installed, 0 to remove and 0 not upgraded. -Remv openjdk-6-jre [6b16-1.8-0ubuntu1] +Remv openjdk-6-jre-headless [6b16-1.8-0ubuntu1] Remv openjdk-6-jre-lib [6b16-1.8-0ubuntu1] -Inst openjdk-6-jre-headless [6b16-1.8-0ubuntu1] (6b20-1.9.8-0ubuntu1~10.04.1 unstable [i386]) Inst openjdk-6-jre [6b16-1.8-0ubuntu1] (6b20-1.9.8-0ubuntu1~10.04.1 unstable [i386]) Inst openjdk-6-jre-lib [6b16-1.8-0ubuntu1] (6b20-1.9.8-0ubuntu1~10.04.1 unstable [i386]) Conf openjdk-6-jre-lib (6b20-1.9.8-0ubuntu1~10.04.1 unstable [i386]) Conf openjdk-6-jre (6b20-1.9.8-0ubuntu1~10.04.1 unstable [i386]) +Inst openjdk-6-jre-headless [6b16-1.8-0ubuntu1] (6b20-1.9.8-0ubuntu1~10.04.1 unstable [i386]) Conf openjdk-6-jre-headless (6b20-1.9.8-0ubuntu1~10.04.1 unstable [i386])' aptget dist-upgrade -s -o APT::Immediate-Configure-All=true + +testsuccess aptget dist-upgrade -s -o Debug::pkgPackageManager=1 diff --git a/test/integration/test-essential-force-loopbreak b/test/integration/test-essential-force-loopbreak new file mode 100755 index 000000000..842dce61c --- /dev/null +++ b/test/integration/test-essential-force-loopbreak @@ -0,0 +1,51 @@ +#!/bin/sh +set -e + +TESTDIR=$(readlink -f $(dirname $0)) +. $TESTDIR/framework + +setupenvironment +configarchitecture 'amd64' + +insertinstalledpackage 'sysvinit' 'amd64' '1' 'Essential: yes' + +buildsimplenativepackage 'sysvinit' 'amd64' '2' 'sid' 'Pre-Depends: sysvinit-core | systemd-sysv +Essential: yes' +buildsimplenativepackage 'sysvinit-core' 'amd64' '2' 'sid' + +buildsimplenativepackage 'systemd-sysv' 'amd64' '2~conflict' 'sid-conflict' 'Conflicts: sysvinit (<< 2) +Breaks: sysvinit-core' + +buildsimplenativepackage 'systemd-sysv' 'amd64' '2~break' 'sid-break' 'Breaks: sysvinit (<< 2), sysvinit-core' + +setupaptarchive + +cp -a rootdir/var/lib/dpkg/status dpkg.status.backup + +testforcebreak() { + cp -a dpkg.status.backup rootdir/var/lib/dpkg/status + rm -f rootdir/var/lib/apt/extended_states + testequal 'Reading package lists... +Building dependency tree... +The following extra packages will be installed: + sysvinit +The following NEW packages will be installed: + systemd-sysv +The following packages will be upgraded: + sysvinit +1 upgraded, 1 newly installed, 0 to remove and 0 not upgraded. +E: This installation run will require temporarily removing the essential package sysvinit:amd64 due to a Conflicts/Pre-Depends loop. This is often bad, but if you really want to do it, activate the APT::Force-LoopBreak option. +E: Internal Error, Could not early remove sysvinit:amd64 (2)' aptget install systemd-sysv -t "$1" -s + # ensure that really nothing happens + testfailure aptget install systemd-sysv -y -t "$1" -o Debug::pkgPackageManager=1 + testdpkginstalled 'sysvinit' + testdpkgnotinstalled 'systemd-sysv' + + # with enough force however … + cp -a dpkg.status.backup rootdir/var/lib/dpkg/status + testsuccess aptget install systemd-sysv -y -t "$1" -o Debug::pkgPackageManager=1 -o APT::Force-LoopBreak=1 + testdpkginstalled 'sysvinit' 'systemd-sysv' +} + +testforcebreak 'sid-conflict' +testforcebreak 'sid-break' -- cgit v1.2.3 From e1a69e71efc0679815f722480169f16bf02622ab Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Mon, 12 May 2014 21:25:43 +0200 Subject: (try to) fix travis-ci build failures dpkg on Ubuntu 12.04 does not seem to support parsing arch-specific dependencies, so we try to detect if we face such a dpkg in the test. In the other test the order depends on libdb, which changes per arch, so we just run it through our sorting binary and be happy (hopefully). Git-Dch: Ignore --- test/integration/framework | 3 ++- test/integration/test-apt-ftparchive-src-cachedb | 10 +++++----- test/integration/test-bug-747261-arch-specific-conflicts | 15 +++++++++++++++ 3 files changed, 22 insertions(+), 6 deletions(-) (limited to 'test/integration') diff --git a/test/integration/framework b/test/integration/framework index eda3cebad..4f0a69994 100644 --- a/test/integration/framework +++ b/test/integration/framework @@ -36,7 +36,7 @@ msgndebug() { echo -n "${CDEBUG}D: $1${CNORMAL}"; } msgtest() { while [ -n "$1" ]; do echo -n "${CINFO}$1${CCMD} " - echo -n "$(echo "$2" | sed -e 's/^aptc/apt-c/' -e 's/^aptg/apt-g/' -e 's/^aptf/apt-f/')${CINFO} " + echo -n "$(echo "$2" | sed -e 's#^apt\([cgfs]\)#apt-\1#')${CINFO} " shift if [ -n "$1" ]; then shift; else break; fi done @@ -114,6 +114,7 @@ aptget() { runapt apt-get "$@"; } aptftparchive() { runapt apt-ftparchive "$@"; } aptkey() { runapt apt-key "$@"; } aptmark() { runapt apt-mark "$@"; } +aptsortpkgs() { runapt apt-sortpkgs "$@"; } apt() { runapt apt "$@"; } apthelper() { runapt "${APTHELPERBINDIR}/apt-helper" "$@"; } aptwebserver() { runapt "${APTWEBSERVERBINDIR}/aptwebserver" "$@"; } diff --git a/test/integration/test-apt-ftparchive-src-cachedb b/test/integration/test-apt-ftparchive-src-cachedb index 1af193632..adcca6217 100755 --- a/test/integration/test-apt-ftparchive-src-cachedb +++ b/test/integration/test-apt-ftparchive-src-cachedb @@ -3,9 +3,9 @@ set -e assert_correct_sources_file() { testequal "Package: bar -Binary: bar -Version: 1.0 Architecture: all +Version: 1.0 +Binary: bar Format: 3.0 (native) Directory: pool/main Files: @@ -24,9 +24,9 @@ Checksums-Sha512: cf83e1357eefb8bdf1542850d66d8007d620e4050b5715dc83f4a921d36ce9ce47d0d13c5d85f2b0ff8318d2877eec2f63b931bd47417a81a538327af927da3e 0 bar_1.0.tar.gz Package: foo -Binary: foo -Version: 1.0 Architecture: all +Version: 1.0 +Binary: foo Format: 3.0 (native) Directory: pool/main Files: @@ -43,7 +43,7 @@ Checksums-Sha256: Checksums-Sha512: 3da0240fd764657c2f3661b4d750578a9a99b0580591b133756379d48117ebda87a5ed2467f513200d6e7eaf51422cbe91c15720eef7fb4bba2cc8ff81ebc547 171 foo_1.0.dsc cf83e1357eefb8bdf1542850d66d8007d620e4050b5715dc83f4a921d36ce9ce47d0d13c5d85f2b0ff8318d2877eec2f63b931bd47417a81a538327af927da3e 0 foo_1.0.tar.gz -" cat ./aptarchive/dists/test/main/source/Sources +" aptsortpkgs ./aptarchive/dists/test/main/source/Sources } create_source_files() { diff --git a/test/integration/test-bug-747261-arch-specific-conflicts b/test/integration/test-bug-747261-arch-specific-conflicts index bfb2d089f..be971b89e 100755 --- a/test/integration/test-bug-747261-arch-specific-conflicts +++ b/test/integration/test-bug-747261-arch-specific-conflicts @@ -6,6 +6,21 @@ TESTDIR=$(readlink -f $(dirname $0)) setupenvironment configarchitecture 'amd64' 'sparc' 'armel' +msgtest 'Check that dpkg supports' 'arch-specific dependencies' +set +e +# this fails always, the question is just how it fails +dpkg-checkbuilddeps -d 'foobar:barfoo' /dev/null 2>/dev/null >/dev/null +RETURNCODE=$? +set -e +if [ "$RETURNCODE" != '1' ]; then + dpkg-checkbuilddeps -d 'foobar:barfoo' /dev/null || true + echo "Command had returncode: $RETURNCODE" + msgskip + exit 0 +else + msgpass +fi + buildsimplenativepackage 'libc6' 'amd64,sparc,armel' '1' 'stable' 'Multi-Arch: same' buildsimplenativepackage 'libc6-i386' 'amd64' '1' 'stable' 'Conflicts: libc6:sparc' -- cgit v1.2.3 From 1f6cf9e79742ea8e328ef2225b2f5217a9440216 Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Fri, 30 May 2014 18:01:47 +0200 Subject: support parsing EDSP requests Architecture{,s} stanza Adds also a small testcase for EDSP Git-Dch: Ignore --- test/integration/framework | 6 ++ .../test-external-dependency-solver-protocol | 65 ++++++++++++++++++++++ 2 files changed, 71 insertions(+) create mode 100755 test/integration/test-external-dependency-solver-protocol (limited to 'test/integration') diff --git a/test/integration/framework b/test/integration/framework index 4f0a69994..7959699fd 100644 --- a/test/integration/framework +++ b/test/integration/framework @@ -194,6 +194,12 @@ setupenvironment() { touch var/lib/dpkg/available mkdir -p usr/lib/apt ln -s ${METHODSDIR} usr/lib/apt/methods + if [ "$BUILDDIRECTORY" = "$LIBRARYPATH" ]; then + mkdir -p usr/lib/apt/solvers + ln -s "${BUILDDIRECTORY}/apt-dump-solver" usr/lib/apt/solvers/dump + ln -s "${BUILDDIRECTORY}/apt-internal-solver" usr/lib/apt/solvers/apt + echo "Dir::Bin::Solvers \"${TMPWORKINGDIRECTORY}/rootdir/usr/lib/apt/solvers\";" > etc/apt/apt.conf.d/externalsolver.conf + fi # use the autoremove from the BUILDDIRECTORY if its there, otherwise # system if [ -e ${BUILDDIRECTORY}/../../debian/apt.conf.autoremove ]; then diff --git a/test/integration/test-external-dependency-solver-protocol b/test/integration/test-external-dependency-solver-protocol new file mode 100755 index 000000000..129565993 --- /dev/null +++ b/test/integration/test-external-dependency-solver-protocol @@ -0,0 +1,65 @@ +#!/bin/sh +set -e + +TESTDIR=$(readlink -f $(dirname $0)) +. $TESTDIR/framework +setupenvironment +configarchitecture 'amd64' 'i386' + +insertinstalledpackage 'cool' 'all' '1' +insertinstalledpackage 'stuff' 'all' '1' + +insertpackage 'unstable' 'cool' 'all' '2' 'Multi-Arch: foreign' +insertpackage 'unstable' 'stuff' 'all' '2' 'Multi-Arch: foreign' +insertpackage 'unstable' 'coolstuff' 'i386,amd64' '2' 'Depends: cool, stuff' +insertpackage 'unstable' 'awesome' 'all' '2' 'Multi-Arch: foreign' +insertpackage 'unstable' 'awesomecoolstuff' 'i386' '2' 'Depends: coolstuff, awesome' + +insertpackage 'experimental' 'cool' 'all' '3' 'Multi-Arch: foreign' +insertpackage 'experimental' 'stuff' 'all' '3' 'Multi-Arch: foreign' +insertpackage 'experimental' 'coolstuff' 'i386,amd64' '3' 'Depends: cool, stuff' + +setupaptarchive + +rm -f /tmp/dump.edsp +testequal 'Reading package lists... +Building dependency tree... +Execute external solver... +The solver encountered an error of type: ERR_JUST_DUMPING +The following information might help you to understand what is wrong: +I am too dumb, i can just dump! +Please use one of my friends instead! + +E: External solver failed with: I am too dumb, i can just dump!' aptget install --solver dump coolstuff -s +testsuccess test -s /tmp/dump.edsp +rm -f /tmp/dump.edsp + +#FIXME: this should be unstable, but we don't support pinning yet +testequal 'Reading package lists... +Building dependency tree... +Execute external solver... +The following NEW packages will be installed: + coolstuff +0 upgraded, 1 newly installed, 0 to remove and 2 not upgraded. +Inst coolstuff (3 experimental [amd64]) +Conf coolstuff (3 experimental [amd64])' aptget install --solver apt coolstuff -s + +testsuccess aptget install awesomecoolstuff:i386 -s +testsuccess aptget install --solver apt awesomecoolstuff:i386 -s + +rm -f /tmp/dump.edsp +testfailure aptget install --solver dump awesomecoolstuff:i386 -s +testsuccess test -s /tmp/dump.edsp + +configarchitecture 'armel' +msgtest 'Test direct calling is okay for' 'apt-internal-solver' +cat /tmp/dump.edsp | runapt apt-internal-solver > solver.result 2>&1 || true +if [ "$(tail -n2 solver.result | head -n1 )" = "Message: Done" ]; then + msgpass +else + cat solver.result + msgfail +fi +rm -f /tmp/dump.edsp + +testfailure aptget install --solver apt awesomecoolstuff:i386 -s -- cgit v1.2.3 From 91a6f32eec508465e7ffafa6b3fef3bb59c719c0 Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Fri, 30 May 2014 19:18:25 +0200 Subject: show current/total testcase statistic also in concise mode Git-Dch: Ignore --- test/integration/run-tests | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'test/integration') diff --git a/test/integration/run-tests b/test/integration/run-tests index d700cc3fc..d39daeee5 100755 --- a/test/integration/run-tests +++ b/test/integration/run-tests @@ -39,7 +39,7 @@ fi TOTAL="$(run-parts --list $DIR | grep '/test-' | wc -l)" for testcase in $(run-parts --list $DIR | grep '/test-'); do if [ "$MSGLEVEL" -le 2 ]; then - echo -n "${CTEST}Testcase ${CHIGH}$(basename ${testcase})${CRESET}: " + echo -n "($(($ALL+1))/${TOTAL}) ${CTEST}Testcase ${CHIGH}$(basename ${testcase})${CRESET}: " else echo "${CTEST}Run Testcase ($(($ALL+1))/${TOTAL}) ${CHIGH}$(basename ${testcase})${CRESET}" fi -- cgit v1.2.3 From d91e3cfa1992599c088673ef68bcdfd4d0aedc85 Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Fri, 30 May 2014 23:15:28 +0200 Subject: use 'native' instead of 'amd64' as pkg arch Git-Dch: Ignore --- test/integration/test-essential-force-loopbreak | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) (limited to 'test/integration') diff --git a/test/integration/test-essential-force-loopbreak b/test/integration/test-essential-force-loopbreak index 842dce61c..d60c6cbd5 100755 --- a/test/integration/test-essential-force-loopbreak +++ b/test/integration/test-essential-force-loopbreak @@ -5,18 +5,18 @@ TESTDIR=$(readlink -f $(dirname $0)) . $TESTDIR/framework setupenvironment -configarchitecture 'amd64' +configarchitecture 'native' -insertinstalledpackage 'sysvinit' 'amd64' '1' 'Essential: yes' +insertinstalledpackage 'sysvinit' 'native' '1' 'Essential: yes' -buildsimplenativepackage 'sysvinit' 'amd64' '2' 'sid' 'Pre-Depends: sysvinit-core | systemd-sysv +buildsimplenativepackage 'sysvinit' 'native' '2' 'sid' 'Pre-Depends: sysvinit-core | systemd-sysv Essential: yes' -buildsimplenativepackage 'sysvinit-core' 'amd64' '2' 'sid' +buildsimplenativepackage 'sysvinit-core' 'native' '2' 'sid' -buildsimplenativepackage 'systemd-sysv' 'amd64' '2~conflict' 'sid-conflict' 'Conflicts: sysvinit (<< 2) +buildsimplenativepackage 'systemd-sysv' 'native' '2~conflict' 'sid-conflict' 'Conflicts: sysvinit (<< 2) Breaks: sysvinit-core' -buildsimplenativepackage 'systemd-sysv' 'amd64' '2~break' 'sid-break' 'Breaks: sysvinit (<< 2), sysvinit-core' +buildsimplenativepackage 'systemd-sysv' 'native' '2~break' 'sid-break' 'Breaks: sysvinit (<< 2), sysvinit-core' setupaptarchive @@ -25,7 +25,7 @@ cp -a rootdir/var/lib/dpkg/status dpkg.status.backup testforcebreak() { cp -a dpkg.status.backup rootdir/var/lib/dpkg/status rm -f rootdir/var/lib/apt/extended_states - testequal 'Reading package lists... + testequal "Reading package lists... Building dependency tree... The following extra packages will be installed: sysvinit @@ -34,8 +34,8 @@ The following NEW packages will be installed: The following packages will be upgraded: sysvinit 1 upgraded, 1 newly installed, 0 to remove and 0 not upgraded. -E: This installation run will require temporarily removing the essential package sysvinit:amd64 due to a Conflicts/Pre-Depends loop. This is often bad, but if you really want to do it, activate the APT::Force-LoopBreak option. -E: Internal Error, Could not early remove sysvinit:amd64 (2)' aptget install systemd-sysv -t "$1" -s +E: This installation run will require temporarily removing the essential package sysvinit:$(getarchitecture 'native') due to a Conflicts/Pre-Depends loop. This is often bad, but if you really want to do it, activate the APT::Force-LoopBreak option. +E: Internal Error, Could not early remove sysvinit:amd64 (2)" aptget install systemd-sysv -t "$1" -s # ensure that really nothing happens testfailure aptget install systemd-sysv -y -t "$1" -o Debug::pkgPackageManager=1 testdpkginstalled 'sysvinit' -- cgit v1.2.3 From a3f1d60cb75ab83f63a52a43c056a4752c8fdeb2 Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Fri, 30 May 2014 14:47:56 +0200 Subject: Show unauthenticated warning for source packages as well This will show the same unauthenticated warning for source packages as for binary packages and will not download a source package if it is unauthenticated. This can be overridden with --allow-unauthenticated Closes: #749795 --- test/integration/test-apt-get-source-authenticated | 31 ++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100755 test/integration/test-apt-get-source-authenticated (limited to 'test/integration') diff --git a/test/integration/test-apt-get-source-authenticated b/test/integration/test-apt-get-source-authenticated new file mode 100755 index 000000000..2cee13923 --- /dev/null +++ b/test/integration/test-apt-get-source-authenticated @@ -0,0 +1,31 @@ +#!/bin/sh +# +# Regression test for debian bug #749795. Ensure that we fail with +# a error if apt-get source foo will download a source that comes +# from a unauthenticated repository +# +set -e + +TESTDIR=$(readlink -f $(dirname $0)) +. $TESTDIR/framework + +setupenvironment +configarchitecture "i386" + +# a "normal" package with source and binary +buildsimplenativepackage 'foo' 'all' '2.0' + +setupaptarchive --no-update + +APTARCHIVE=$(readlink -f ./aptarchive) +rm -f $APTARCHIVE/dists/unstable/*Release* + +# update without authenticated InRelease file +testsuccess aptget update + +# this all should fail +testfailure aptget install -y foo +testfailure aptget source foo + +# allow overriding the warning +testsuccess aptget source --allow-unauthenticated foo -- cgit v1.2.3 From 243b2a381f4a12939d91084ecf100ee6d3dcb007 Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Wed, 4 Jun 2014 12:39:36 +0200 Subject: Add compat mode for old (32bit FileSize) CacheDB (LP: #1274466) --- test/integration/cachedb-lp1274466-old-format.db | Bin 0 -> 8192 bytes test/integration/deb-lp1274466-cachedb.deb | Bin 0 -> 1270 bytes .../test-apt-ftparchive-cachedb-lp1274466 | 51 +++++++++++++++++++++ 3 files changed, 51 insertions(+) create mode 100644 test/integration/cachedb-lp1274466-old-format.db create mode 100644 test/integration/deb-lp1274466-cachedb.deb create mode 100755 test/integration/test-apt-ftparchive-cachedb-lp1274466 (limited to 'test/integration') diff --git a/test/integration/cachedb-lp1274466-old-format.db b/test/integration/cachedb-lp1274466-old-format.db new file mode 100644 index 000000000..88da5f1ee Binary files /dev/null and b/test/integration/cachedb-lp1274466-old-format.db differ diff --git a/test/integration/deb-lp1274466-cachedb.deb b/test/integration/deb-lp1274466-cachedb.deb new file mode 100644 index 000000000..43d7ee6f1 Binary files /dev/null and b/test/integration/deb-lp1274466-cachedb.deb differ diff --git a/test/integration/test-apt-ftparchive-cachedb-lp1274466 b/test/integration/test-apt-ftparchive-cachedb-lp1274466 new file mode 100755 index 000000000..211740a53 --- /dev/null +++ b/test/integration/test-apt-ftparchive-cachedb-lp1274466 @@ -0,0 +1,51 @@ +#!/bin/sh +set -e + + +# +# main() +# +TESTDIR=$(readlink -f $(dirname $0)) +. $TESTDIR/framework +setupenvironment +configarchitecture "i386" + +# gather the db and the deb, ensure mtime is not modfied as its saved in the DB +cp -p $TESTDIR/deb-lp1274466-cachedb.deb foo_1_i386.deb +cp $TESTDIR/cachedb-lp1274466-old-format.db old-format.db + +# verify that the format is different +testsuccess aptftparchive --db new-format.db packages . +db_dump new-format.db > new-format.dump +db_dump old-format.db > old-format.dump +testfailure diff -u old-format.dump new-format.dump + +# ensure the new format as the sha512 +testsuccess grep 7da58ff901a40ecf42a730dc33198b182e9ba9ec98799fc2c2b6fabeeee40cc12a0e7cadb4b66764235c56e1009dbfe8a9a566fb1eedf47a992d1fff2cc3332c new-format.dump +# but the old format does not +testfailure grep 7da58ff901a40ecf42a730dc33198b182e9ba9ec98799fc2c2b6fabeeee40cc12a0e7cadb4b66764235c56e1009dbfe8a9a566fb1eedf47a992d1fff2cc3332c old-format.dump + +# regression test for corruption with previous generation of cachedb +testequal "Package: foo +Priority: optional +Section: others +Installed-Size: 29 +Maintainer: Joe Sixpack +Architecture: i386 +Version: 1 +Filename: ./foo_1_i386.deb +Size: 1270 +MD5sum: 85d0e908c1a897700e2c5dea72d7e3c0 +SHA1: 858b09169032b7925a0e463f46b6634243fc40ce +SHA256: 3750a2c9c6b5beee7f307564be3d51d3ec7cbb78fa4f0b47f84a7c41477bff59 +SHA512: 7da58ff901a40ecf42a730dc33198b182e9ba9ec98799fc2c2b6fabeeee40cc12a0e7cadb4b66764235c56e1009dbfe8a9a566fb1eedf47a992d1fff2cc3332c +Description: an autogenerated dummy foo=1/test + 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… +" aptftparchive --db old-format.db packages . + +# ensure that the db is updated +db_dump old-format.db > old-format.dump +testsuccess diff -u old-format.dump new-format.dump + -- cgit v1.2.3 From e41d3d7e25754f858b6dfe4dd841f4749f7f3ab1 Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Sat, 7 Jun 2014 22:46:37 +0200 Subject: do not revert candidate for protected packages In commit 21b3eac8 I promoted the check for installable dependencies to a pre-install check, which also reverts to a known good candidate (the installed version) if it fails. This revert was done even for user requested candidate switches which disabled our Broken detection so that install requests which are impossible to satisfy do not fail anymore, but print an (incomplete) solution proposal and then exit successfully. Closes: 745046 --- .../test-bug-745046-candidate-propagation-fails | 39 ++++++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100755 test/integration/test-bug-745046-candidate-propagation-fails (limited to 'test/integration') diff --git a/test/integration/test-bug-745046-candidate-propagation-fails b/test/integration/test-bug-745046-candidate-propagation-fails new file mode 100755 index 000000000..e4aa67a72 --- /dev/null +++ b/test/integration/test-bug-745046-candidate-propagation-fails @@ -0,0 +1,39 @@ +#!/bin/sh +set -e + +TESTDIR=$(readlink -f $(dirname $0)) +. $TESTDIR/framework + +setupenvironment +configarchitecture 'amd64' + +insertinstalledpackage 'gedit' 'amd64' '1' + +insertpackage 'unstable' 'gedit' 'amd64' '1' +insertpackage 'experimental' 'gedit' 'amd64' '2' 'Depends: common (>= 2)' + +setupaptarchive + +testequal "Reading package lists... +Building dependency tree... +Selected version '2' (experimental [amd64]) for 'gedit' +Some packages could not be installed. This may mean that you have +requested an impossible situation or if you are using the unstable +distribution that some required packages have not yet been created +or been moved out of Incoming. +The following information may help to resolve the situation: + +The following packages have unmet dependencies: + gedit : Depends: common (>= 2) but it is not installable +E: Unable to correct problems, you have held broken packages." aptget install gedit/experimental -sq=0 + +insertinstalledpackage 'common' 'amd64' '2' + +testequal "Reading package lists... +Building dependency tree... +Selected version '2' (experimental [amd64]) for 'gedit' +The following packages will be upgraded: + gedit +1 upgraded, 0 newly installed, 0 to remove and 0 not upgraded. +Inst gedit [1] (2 experimental [amd64]) +Conf gedit (2 experimental [amd64])" aptget install gedit/experimental -sq=0 -- cgit v1.2.3 From 4dde2b4285fc6288e44e915a0d7bc0faac114a2e Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Tue, 10 Jun 2014 14:12:12 +0200 Subject: support Acquire::GzipIndexes in dumpavail Closes: 742835 --- test/integration/test-compressed-indexes | 2 ++ 1 file changed, 2 insertions(+) (limited to 'test/integration') diff --git a/test/integration/test-compressed-indexes b/test/integration/test-compressed-indexes index 67ca0ba27..6671dd75a 100755 --- a/test/integration/test-compressed-indexes +++ b/test/integration/test-compressed-indexes @@ -67,6 +67,8 @@ testrun() { msgtest "\tdsc file is present"; testsuccess --nomsg test -f testpkg_1.0.dsc msgtest "\tdirectory is present"; testsuccess --nomsg test -d testpkg-1.0 rm -rf testpkg-1.0 + testequal "$(aptcache show testpkg -o Acquire::Languages=none) +" aptcache dumpavail } echo 'Acquire::GzipIndexes "false";' > rootdir/etc/apt/apt.conf.d/02compressindex -- cgit v1.2.3 From ea606ec43a364a8e471fd9502d79fe2dfeb6e4ba Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Tue, 10 Jun 2014 15:21:30 +0200 Subject: fix test/integration/test-apt-ftparchive-cachedb-lp1274466 in travis --- test/integration/test-apt-ftparchive-cachedb-lp1274466 | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'test/integration') diff --git a/test/integration/test-apt-ftparchive-cachedb-lp1274466 b/test/integration/test-apt-ftparchive-cachedb-lp1274466 index 211740a53..2a28d6ef0 100755 --- a/test/integration/test-apt-ftparchive-cachedb-lp1274466 +++ b/test/integration/test-apt-ftparchive-cachedb-lp1274466 @@ -12,7 +12,7 @@ configarchitecture "i386" # gather the db and the deb, ensure mtime is not modfied as its saved in the DB cp -p $TESTDIR/deb-lp1274466-cachedb.deb foo_1_i386.deb -cp $TESTDIR/cachedb-lp1274466-old-format.db old-format.db +cp -p $TESTDIR/cachedb-lp1274466-old-format.db old-format.db # verify that the format is different testsuccess aptftparchive --db new-format.db packages . @@ -45,7 +45,7 @@ Description: an autogenerated dummy foo=1/test und used only by testcases and surf no other propose… " aptftparchive --db old-format.db packages . -# ensure that the db is updated -db_dump old-format.db > old-format.dump -testsuccess diff -u old-format.dump new-format.dump +# ensure that the db is updated and contains the new sha512 +testsuccess grep 7da58ff901a40ecf42a730dc33198b182e9ba9ec98799fc2c2b6fabeeee40cc12a0e7cadb4b66764235c56e1009dbfe8a9a566fb1eedf47a992d1fff2cc3332c old-format.dump + -- cgit v1.2.3