summaryrefslogtreecommitdiffstats
path: root/test/integration/test-apt-ftparchive
diff options
context:
space:
mode:
Diffstat (limited to '')
-rwxr-xr-xtest/integration/test-apt-ftparchive64
-rwxr-xr-xtest/integration/test-apt-ftparchive-by-hash70
-rwxr-xr-xtest/integration/test-apt-ftparchive-cachedb103
-rwxr-xr-xtest/integration/test-apt-ftparchive-cachedb-lp127446659
-rwxr-xr-xtest/integration/test-apt-ftparchive-notautomatic54
-rwxr-xr-xtest/integration/test-apt-ftparchive-src-cachedb191
6 files changed, 541 insertions, 0 deletions
diff --git a/test/integration/test-apt-ftparchive b/test/integration/test-apt-ftparchive
new file mode 100755
index 0000000..378b059
--- /dev/null
+++ b/test/integration/test-apt-ftparchive
@@ -0,0 +1,64 @@
+#!/bin/sh
+set -e
+
+TESTDIR="$(readlink -f "$(dirname "$0")")"
+. "$TESTDIR/framework"
+
+setupenvironment
+
+buildsimplenativepackage 'baz' 'all' '1'
+buildsimplenativepackage 'foo' 'all' '1'
+buildsimplenativepackage 'bar' 'all' '2'
+buildsimplenativepackage 'bar' 'all' '1'
+
+EXPECT_PKG='Package: bar
+Version: 1
+Package: bar
+Version: 2
+Package: baz
+Version: 1
+Package: foo
+Version: 1'
+EXPECT_SRC="$EXPECT_PKG"
+
+linkfiles() {
+ ln -s "../incoming/${2}.dsc" "${1}/${2}.dsc"
+ ln -s "../incoming/${2}.tar.xz" "${1}/${2}.tar.xz"
+ ln -s "../incoming/${2}_all.deb" "${1}/${2}_all.deb"
+}
+genoptions() {
+ echo 'baz_1'
+ echo 'foo_1'
+ echo 'bar_2'
+ echo 'bar_1'
+}
+gencombos() {
+ for a in $(genoptions); do
+ for b in $(genoptions); do
+ if [ "$a" = "$b" ]; then continue; fi
+ for c in $(genoptions); do
+ if [ "$a" = "$c" -o "$b" = "$c" ]; then continue; fi
+ for d in $(genoptions); do
+ if [ "$a" = "$d" -o "$b" = "$d" -o "$c" = "$d" ]; then continue; fi
+ echo "${a};${b};${c};${d}"
+ done
+ done
+ done
+ done
+}
+for combo in $(gencombos); do
+ msgmsg 'Running apt-ftparchive in configuration' "$combo"
+ incomedir="incoming${combo}"
+ mkdir "$incomedir"
+ for i in $(echo "$combo" | tr ';' '\n'); do
+ linkfiles "$incomedir" "$i"
+ done
+
+ testsuccess aptftparchive packages "$incomedir"
+ cp rootdir/tmp/testsuccess.output aptarchive/Packages
+ testsuccessequal "$EXPECT_PKG" grep -e '^Package: ' -e '^Version: ' aptarchive/Packages
+
+ testsuccess aptftparchive -qq sources "$incomedir"
+ cp rootdir/tmp/testsuccess.output aptarchive/Sources
+ testsuccessequal "$EXPECT_SRC" grep -e '^Package: ' -e '^Version: ' aptarchive/Sources
+done
diff --git a/test/integration/test-apt-ftparchive-by-hash b/test/integration/test-apt-ftparchive-by-hash
new file mode 100755
index 0000000..ccfc627
--- /dev/null
+++ b/test/integration/test-apt-ftparchive-by-hash
@@ -0,0 +1,70 @@
+#!/bin/sh
+set -e
+
+verify_by_hash() {
+ for hash_gen in SHA256:sha256sum SHA512:sha512sum; do
+ hash=$(echo ${hash_gen} | cut -f1 -d:)
+ gen=$(echo ${hash_gen} | cut -f2 -d:)
+ testsuccess stat aptarchive/dists/unstable/main/binary-i386/by-hash/$hash/$($gen aptarchive/dists/unstable/main/binary-i386/Packages | cut -f1 -d' ')
+ testsuccess stat aptarchive/dists/unstable/main/binary-i386/by-hash/$hash/$($gen aptarchive/dists/unstable/main/binary-i386/Packages.gz | cut -f1 -d' ')
+ done
+}
+
+#
+# main()
+#
+TESTDIR="$(readlink -f "$(dirname "$0")")"
+. "$TESTDIR/framework"
+setupenvironment
+configarchitecture 'i386'
+configcompression 'gz' '.'
+confighashes 'SHA256' 'SHA512'
+
+# enable by-hash in apt-ftparchive
+echo 'APT::FTPArchive::DoByHash "1";' >> aptconfig.conf
+
+# build one package
+buildsimplenativepackage 'foo' 'i386' '1' 'unstable'
+buildaptarchivefromincoming
+
+# verify initial run
+verify_by_hash
+previous_hash=$(sha256sum aptarchive/dists/unstable/main/binary-i386/Packages | cut -f1 -d' ')
+
+# insert new package
+buildsimplenativepackage 'bar' 'i386' '1' 'unstable'
+# and build again
+buildaptarchivefromincoming
+
+# ensure the new package packag is there
+testsuccess zgrep "Package: bar" aptarchive/dists/unstable/main/binary-i386/Packages.gz
+
+# ensure we have the by-hash stuff
+verify_by_hash
+
+# ensure the old hash is still there
+testsuccess stat aptarchive/dists/unstable/main/binary-i386/by-hash/SHA256/$previous_hash
+
+# ensure we have it in the Release file
+testsuccess grep "Acquire-By-Hash: yes" aptarchive/dists/unstable/*Release
+
+# now ensure gc work
+for i in $(seq 3); do
+ buildsimplenativepackage 'bar' 'i386' "$i" 'unstable'
+ buildaptarchivefromincoming
+done
+
+hash_count=$(ls aptarchive/dists/unstable/main/binary-i386/by-hash/SHA256/|wc -l)
+# we have 2 files (uncompressed, gz) per run, 5 runs in total
+# by default apt-ftparchive keeps three generations (current plus 2 older)
+msgtest "Check that gc for by-hash works… "
+if [ "$hash_count" = "6" ]; then
+ msgpass
+else
+ echo "Got $hash_count expected 6"
+ msgfail
+fi
+
+# ensure the current generation is still there
+verify_by_hash
+
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
diff --git a/test/integration/test-apt-ftparchive-cachedb-lp1274466 b/test/integration/test-apt-ftparchive-cachedb-lp1274466
new file mode 100755
index 0000000..b0bcae8
--- /dev/null
+++ b/test/integration/test-apt-ftparchive-cachedb-lp1274466
@@ -0,0 +1,59 @@
+#!/bin/sh
+set -e
+
+
+#
+# main()
+#
+TESTDIR="$(readlink -f "$(dirname "$0")")"
+. "$TESTDIR/framework"
+setupenvironment
+configarchitecture "i386"
+confighashes 'MD5' 'SHA1' 'SHA256' 'SHA512'
+
+db_dump=db_dump
+if command -v db_dump-5 >/dev/null 2>&1; then
+ db_dump=db_dump-5
+fi
+
+# gather the db and the deb, ensure mtime is not modified as its saved in the DB
+cp -p "$TESTDIR/deb-lp1274466-cachedb.deb" foo_1_i386.deb
+cp -p "$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
+testsuccessequal "Package: foo
+Architecture: i386
+Version: 1
+Priority: optional
+Section: others
+Maintainer: Joe Sixpack <joe@example.org>
+Installed-Size: 29
+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 and contains the new sha512
+$db_dump old-format.db > old-format.dump
+
+testsuccess grep 7da58ff901a40ecf42a730dc33198b182e9ba9ec98799fc2c2b6fabeeee40cc12a0e7cadb4b66764235c56e1009dbfe8a9a566fb1eedf47a992d1fff2cc3332c old-format.dump
+
+
diff --git a/test/integration/test-apt-ftparchive-notautomatic b/test/integration/test-apt-ftparchive-notautomatic
new file mode 100755
index 0000000..b2f65cc
--- /dev/null
+++ b/test/integration/test-apt-ftparchive-notautomatic
@@ -0,0 +1,54 @@
+#!/bin/sh
+set -e
+
+TESTDIR="$(readlink -f "$(dirname "$0")")"
+. "$TESTDIR/framework"
+setupenvironment
+configarchitecture 'i386'
+
+getnotautomaticfromsuite() {
+ case "$1" in
+ experimental|backports) echo 'yes';;
+ esac
+}
+getbutautomaticupgradesfromsuite() {
+ case "$1" in
+ backports) echo 'yes';;
+ esac
+}
+
+insertpackage 'unstable' 'foo' 'i386' '1'
+insertpackage 'backports' 'foo' 'i386' '3~bpo1'
+insertpackage 'experimental' 'foo' 'i386' '3'
+setupaptarchive
+
+# check no unstable NotAutomatic field
+testfailure grep "NotAutomatic:" aptarchive/dists/unstable/*Release
+# check backports NotAutomatic field
+testsuccess grep "NotAutomatic: yes" aptarchive/dists/backports/*Release
+# check experimental NotAutomatic field
+testsuccess grep "NotAutomatic: yes" aptarchive/dists/experimental/*Release
+
+# check no unstable ButAutomaticUpgrades field
+testfailure grep "ButAutomaticUpgrades:" aptarchive/dists/unstable/*Release
+# check backports ButAutomaticUpgrades field
+testsuccess grep "ButAutomaticUpgrades: yes" aptarchive/dists/backports/*Release
+# check no experimental ButAutomaticUpgrades field
+testfailure grep "ButAutomaticUpgrades:" aptarchive/dists/experimental/*Release
+
+testsuccessequal 'Reading package lists...
+Building dependency tree...
+The following NEW packages will be installed:
+ foo
+0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
+Inst foo (1 unstable [i386])
+Conf foo (1 unstable [i386])' apt install foo -s
+
+insertinstalledpackage 'foo' 'i386' '2'
+testsuccessequal 'Reading package lists...
+Building dependency tree...
+The following packages will be upgraded:
+ foo
+1 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
+Inst foo [2] (3~bpo1 backports [i386])
+Conf foo (3~bpo1 backports [i386])' apt install foo -s
diff --git a/test/integration/test-apt-ftparchive-src-cachedb b/test/integration/test-apt-ftparchive-src-cachedb
new file mode 100755
index 0000000..8bab1fd
--- /dev/null
+++ b/test/integration/test-apt-ftparchive-src-cachedb
@@ -0,0 +1,191 @@
+#!/bin/sh
+set -e
+
+assert_correct_sources_file() {
+ testsuccessequal "Package: bar
+Format: 3.0 (native)
+Binary: bar
+Architecture: all
+Version: 1.0
+Directory: pool/main
+Package-List:
+ bar deb admin extra
+Files:
+ 7b57dd065e51de5905288a5104d4bef5 406 bar_1.0.dsc
+ d41d8cd98f00b204e9800998ecf8427e 0 bar_1.0.tar.gz
+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
+Format: 3.0 (native)
+Binary: foo
+Architecture: all
+Version: 1.0
+Directory: pool/main
+Package-List:
+ foo deb admin extra
+Files:
+ d144826e6f02831c1933e910c92cd7e0 171 foo_1.0.dsc
+ d41d8cd98f00b204e9800998ecf8427e 0 foo_1.0.tar.gz
+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
+" aptsortpkgs ./aptarchive/dists/test/main/source/Sources -o APT::SortPkgs::Source=true
+}
+
+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 <<EOF
+
+-----BEGIN PGP SIGNATURE-----
+Version: GnuPG v1.4.11 (GNU/Linux)
+
+iEYEARECAAYFAk3k/VoACgkQliSD4VZixzQxlgCgpav7j68z48qNTDFuT9fLqwT5
+DFwAoIXatJFENEC371bMKTkUKlwZxQEk
+=iI9V
+-----END PGP SIGNATURE-----
+EOF
+ fi
+}
+
+create_clearsigned_source_files() {
+ NAME="$1"
+ create_source_files "$NAME" "CLEARSIGN"
+}
+
+#
+# main()
+#
+TESTDIR="$(readlink -f "$(dirname "$0")")"
+. "$TESTDIR/framework"
+setupenvironment
+configarchitecture "i386"
+confighashes 'MD5' 'SHA1' 'SHA256' 'SHA512'
+
+msgtest 'Test apt-ftparchive source with missing hashes in .dsc'
+
+mkdir -p aptarchive/pool/main
+create_source_files foo
+create_clearsigned_source_files bar
+
+mkdir -p aptarchive/dists/test/main/i18n/
+mkdir -p aptarchive/dists/test/main/source/
+
+mkdir aptarchive-overrides
+mkdir aptarchive-cache
+
+msgtest '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 && msgpass || msgfail
+testsuccess grep Misses stats-out.txt
+testfileequal '../rootdir/tmp/testsuccess.output' ' Misses in Cache: 2'
+cd ..
+assert_correct_sources_file
+
+msgtest '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 && msgpass || msgfail
+testsuccess grep Misses stats-out.txt
+testfileequal '../rootdir/tmp/testsuccess.output' ' Misses in Cache: 0'
+cd ..
+assert_correct_sources_file
+
+# get ready for the "apt-ftparchive generate" command
+cat > 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
+
+msgtest 'generate (empty cachedb)'
+testsuccess aptftparchive generate apt-ftparchive.conf -o APT::FTPArchive::ShowCacheMisses=1
+cp rootdir/tmp/testsuccess.output stats-out.txt
+testsuccess grep Misses stats-out.txt
+testfileequal rootdir/tmp/testsuccess.output ' Misses in Cache: 2'
+assert_correct_sources_file
+
+msgtest 'generate again out of the cache'
+rm -f ./aptarchive/dists/test/main/source/Sources
+testsuccess aptftparchive generate apt-ftparchive.conf -o APT::FTPArchive::ShowCacheMisses=1
+cp rootdir/tmp/testsuccess.output stats-out.txt
+testsuccess grep Misses stats-out.txt
+testfileequal rootdir/tmp/testsuccess.output ' Misses in Cache: 0'
+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 record in the DSC 'aptarchive/pool/invalid/invalid_1.0.dsc'" aptftparchive sources aptarchive/pool/invalid
+rm -f aptarchive/pool/invalid/invalid_1.0.dsc
+
+printf "meep: yes" > 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
+
+# ensure clean works
+rm -f aptarchive/pool/main/*
+testsuccess aptftparchive clean apt-ftparchive.conf -o Debug::APT::FTPArchive::Clean=1
+cp rootdir/tmp/testsuccess.output clean-out.txt
+testsuccess grep unique clean-out.txt
+testfileequal 'rootdir/tmp/testsuccess.output' "0 Number of unique keys in the tree"
+testsuccess grep sources-main.db clean-out.txt
+testfileequal 'rootdir/tmp/testsuccess.output' "sources-main.db"