From a537ce19f955f39ee62281bb12bc71a4c67bc635 Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Mon, 2 Dec 2013 08:01:00 +0100 Subject: first version with test --- test/integration/test-apt-sources-deb822 | 45 ++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100755 test/integration/test-apt-sources-deb822 (limited to 'test') diff --git a/test/integration/test-apt-sources-deb822 b/test/integration/test-apt-sources-deb822 new file mode 100755 index 000000000..cdf30c02a --- /dev/null +++ b/test/integration/test-apt-sources-deb822 @@ -0,0 +1,45 @@ +#!/bin/sh +set -e + +TESTDIR=$(readlink -f $(dirname $0)) +. $TESTDIR/framework + +setupenvironment +configarchitecture "i386" + +BASE="Type: deb +URL: http://ftp.debian.org/debian +Dist: stable +Section: main +Comment: Some random string + that can be very long" + +# simple case +echo "$BASE" > rootdir/etc/apt/sources.list + +testequal "'http://ftp.debian.org/debian/dists/stable/main/binary-i386/Packages.bz2' ftp.debian.org_debian_dists_stable_main_binary-i386_Packages 0 : +'http://ftp.debian.org/debian/dists/stable/main/i18n/Translation-en.bz2' ftp.debian.org_debian_dists_stable_main_i18n_Translation-en 0 : +'http://ftp.debian.org/debian/dists/stable/InRelease' ftp.debian.org_debian_dists_stable_InRelease 0 " aptget update --print-uris + + +# Two entries +echo "$BASE" > rootdir/etc/apt/sources.list +echo "" >> rootdir/etc/apt/sources.list +echo "$BASE" | sed s/stable/unstable/ >> rootdir/etc/apt/sources.list + +testequal "'http://ftp.debian.org/debian/dists/stable/main/binary-i386/Packages.bz2' ftp.debian.org_debian_dists_stable_main_binary-i386_Packages 0 : +'http://ftp.debian.org/debian/dists/stable/main/i18n/Translation-en.bz2' ftp.debian.org_debian_dists_stable_main_i18n_Translation-en 0 : +'http://ftp.debian.org/debian/dists/stable/InRelease' ftp.debian.org_debian_dists_stable_InRelease 0 +'http://ftp.debian.org/debian/dists/unstable/main/binary-i386/Packages.bz2' ftp.debian.org_debian_dists_unstable_main_binary-i386_Packages 0 : +'http://ftp.debian.org/debian/dists/unstable/main/i18n/Translation-en.bz2' ftp.debian.org_debian_dists_unstable_main_i18n_Translation-en 0 : +'http://ftp.debian.org/debian/dists/unstable/InRelease' ftp.debian.org_debian_dists_unstable_InRelease 0 " aptget update --print-uris + + +# ARCH option +echo "$BASE" > rootdir/etc/apt/sources.list +echo "Arch: amd64,armel" >> rootdir/etc/apt/sources.list + +testequal "'http://ftp.debian.org/debian/dists/stable/main/binary-amd64/Packages.bz2' ftp.debian.org_debian_dists_stable_main_binary-amd64_Packages 0 : +'http://ftp.debian.org/debian/dists/stable/main/binary-armel/Packages.bz2' ftp.debian.org_debian_dists_stable_main_binary-armel_Packages 0 : +'http://ftp.debian.org/debian/dists/stable/main/i18n/Translation-en.bz2' ftp.debian.org_debian_dists_stable_main_i18n_Translation-en 0 : +'http://ftp.debian.org/debian/dists/stable/InRelease' ftp.debian.org_debian_dists_stable_InRelease 0 " aptget update --print-uris -- cgit v1.2.3 From caeb19b796f7045f489dbce0bf681925d49136a9 Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Mon, 2 Dec 2013 08:21:49 +0100 Subject: add unittest for new sourceslist parser as well --- test/libapt/makefile | 6 +++++ test/libapt/sourcelist_test.cc | 52 ++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 58 insertions(+) create mode 100644 test/libapt/sourcelist_test.cc (limited to 'test') diff --git a/test/libapt/makefile b/test/libapt/makefile index 73403b24c..a8e053d6e 100644 --- a/test/libapt/makefile +++ b/test/libapt/makefile @@ -111,3 +111,9 @@ SLIBS = -lapt-pkg SOURCE = tagfile_test.cc include $(PROGRAM_H) +# test sourcelist +PROGRAM = SourceList${BASENAME} +SLIBS = -lapt-pkg +SOURCE = sourcelist_test.cc +include $(PROGRAM_H) + diff --git a/test/libapt/sourcelist_test.cc b/test/libapt/sourcelist_test.cc new file mode 100644 index 000000000..6e83d08e0 --- /dev/null +++ b/test/libapt/sourcelist_test.cc @@ -0,0 +1,52 @@ +#include +#include + +#include "assert.h" +#include +#include +#include + +char *tempfile = NULL; +int tempfile_fd = -1; + +void remove_tmpfile(void) +{ + if (tempfile_fd > 0) + close(tempfile_fd); + if (tempfile != NULL) { + unlink(tempfile); + free(tempfile); + } +} + +int main(int argc, char *argv[]) +{ + const char contents[] = "" + "Type: deb\n" + "URL: http://ftp.debian.org/debian\n" + "Dist: stable\n" + "Section: main\n" + "Comment: Some random string\n" + " that can be very long\n" + "\n" + "Type: deb\n" + "URL: http://ftp.debian.org/debian\n" + "Dist: unstable\n" + "Section: main non-free\n" + ; + + FileFd fd; + tempfile = strdup("apt-test.XXXXXXXX"); + tempfile_fd = mkstemp(tempfile); + + /* (Re-)Open (as FileFd), write and seek to start of the temp file */ + equals(fd.OpenDescriptor(tempfile_fd, FileFd::ReadWrite), true); + equals(fd.Write(contents, strlen(contents)), true); + equals(fd.Seek(0), true); + + pkgSourceList sources(tempfile); + equals(sources.size(), 2); + + /* clean up handled by atexit handler, so just return here */ + return 0; +} -- cgit v1.2.3 From 300b15e3456aff88b3016a8bac90a0ba8911db8f Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Mon, 2 Dec 2013 08:36:10 +0100 Subject: fix section adding --- test/integration/test-apt-sources-deb822 | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'test') diff --git a/test/integration/test-apt-sources-deb822 b/test/integration/test-apt-sources-deb822 index cdf30c02a..6e9700bb0 100755 --- a/test/integration/test-apt-sources-deb822 +++ b/test/integration/test-apt-sources-deb822 @@ -22,6 +22,16 @@ testequal "'http://ftp.debian.org/debian/dists/stable/main/binary-i386/Packages. 'http://ftp.debian.org/debian/dists/stable/InRelease' ftp.debian.org_debian_dists_stable_InRelease 0 " aptget update --print-uris +# two sections (we support both "," and " " as seperator) +echo "$BASE" | sed s/main/"main,contrib"/ > rootdir/etc/apt/sources.list + +testequal "'http://ftp.debian.org/debian/dists/stable/main/binary-i386/Packages.bz2' ftp.debian.org_debian_dists_stable_main_binary-i386_Packages 0 : +'http://ftp.debian.org/debian/dists/stable/contrib/binary-i386/Packages.bz2' ftp.debian.org_debian_dists_stable_contrib_binary-i386_Packages 0 : +'http://ftp.debian.org/debian/dists/stable/contrib/i18n/Translation-en.bz2' ftp.debian.org_debian_dists_stable_contrib_i18n_Translation-en 0 : +'http://ftp.debian.org/debian/dists/stable/main/i18n/Translation-en.bz2' ftp.debian.org_debian_dists_stable_main_i18n_Translation-en 0 : +'http://ftp.debian.org/debian/dists/stable/InRelease' ftp.debian.org_debian_dists_stable_InRelease 0 " aptget update --print-uris + + # Two entries echo "$BASE" > rootdir/etc/apt/sources.list echo "" >> rootdir/etc/apt/sources.list -- cgit v1.2.3 From 47d2bc78adb49f3182f9a3d7a4baea363e772d64 Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Fri, 6 Dec 2013 12:17:48 +0100 Subject: implement POC client-side merging of pdiffs via apt-file MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The idea of pdiffs is to avoid downloading the hole file by patching the existing index. This works very well, but becomes slow if a lot of patches needs to be applied to reconstruct an up-to-date index and in recent years more and more dinstall (or similar) runs are executed creating more and more pdiffs in the same amount of time, so pdiffs became less useful. The solution is simple: Reduce the amount of patches (which are very small) which need to be applied on top of the index we have available (which is usually pretty big). This can be done in two ways: Either merge the patches on the server-side so that the client has to download only one patch or the patches are all downloaded and merged on the client-side. The first needs a client who is doing one step at a time who can also skip patches if it needs (APT supports this for a long time now). The later is implemented by this commit, but depends on the server NOT merging the patches and the patches being in a strict order in which no patch is skipped. This is traditionally the case for dak, but other repository creators support merging – e.g. reprepro (which helpfully adds a flag indicating that the patches are merged). To support both or even mixes a client needs more information which isn't available for now. This POC uses the external diffindex-rred included in apt-file to do the heavy lifting of merging & applying all patches in one pass, hence to test this feature apt-file needs to be installed. --- test/integration/test-pdiff-usage | 147 ++++++++++++++++++++++++++++++++------ 1 file changed, 127 insertions(+), 20 deletions(-) (limited to 'test') diff --git a/test/integration/test-pdiff-usage b/test/integration/test-pdiff-usage index ac0563b7f..5a06e0ccb 100755 --- a/test/integration/test-pdiff-usage +++ b/test/integration/test-pdiff-usage @@ -5,39 +5,146 @@ TESTDIR=$(readlink -f $(dirname $0)) . $TESTDIR/framework setupenvironment -configarchitecture "i386" +configarchitecture 'i386' buildaptarchive setupflataptarchive changetowebserver -signreleasefiles -testsuccess aptget update -testnopackage newstuff PKGFILE="${TESTDIR}/$(echo "$(basename $0)" | sed 's#^test-#Packages-#')" -testequal "$(cat ${PKGFILE}) + +echo '#!/bin/sh +touch merge-was-used +/usr/bin/diffindex-rred "$@"' > extrred +chmod +x extrred +echo 'Dir::Bin::rred "./extrred";' > rootdir/etc/apt/apt.conf.d/99rred + +wasmergeused() { + testsuccess aptget update "$@" + msgtest 'Check if the right pdiff merger was used' + if [ -e ./merge-was-used ]; then + rm -f ./merge-was-used + if echo "$*" | grep -q -- '-o Acquire::PDiffs::Merge=1'; then + msgpass + else + msgfail "Merge shouldn't have been used, but was" + fi + elif echo "$*" | grep -q -- '-o Acquire::PDiffs::Merge=1'; then + msgfail "Merge should have been used, but wasn't" + else + msgpass + fi +} + +testrun() { + # setup the base + find aptarchive -name 'Packages*' -type f -delete + cp ${PKGFILE} aptarchive/Packages + compressfile 'aptarchive/Packages' + generatereleasefiles + signreleasefiles + rm -rf aptarchive/Packages.diff rootdir/var/lib/apt/lists + testsuccess aptget update "$@" + cp -a rootdir/var/lib/apt/lists rootdir/var/lib/apt/lists-bak + testnopackage newstuff + testequal "$(cat ${PKGFILE}) " aptcache show apt oldstuff -cp ${PKGFILE}-new aptarchive/Packages -compressfile 'aptarchive/Packages' -rm -rf aptarchive/Packages.diff -mkdir -p aptarchive/Packages.diff -PATCHFILE="aptarchive/Packages.diff/$(date +%Y-%m-%d-%H%M.%S)" -diff -e ${PKGFILE} ${PKGFILE}-new > ${PATCHFILE} || true -cat $PATCHFILE | gzip > ${PATCHFILE}.gz -PATCHINDEX="aptarchive/Packages.diff/Index" -echo "SHA1-Current: $(sha1sum ${PKGFILE}-new | cut -d' ' -f 1) $(stat -c%s ${PKGFILE}-new) + # apply with one patch + cp ${PKGFILE}-new aptarchive/Packages + compressfile 'aptarchive/Packages' + mkdir -p aptarchive/Packages.diff + PATCHFILE="aptarchive/Packages.diff/$(date +%Y-%m-%d-%H%M.%S)" + diff -e ${PKGFILE} ${PKGFILE}-new > ${PATCHFILE} || true + cat $PATCHFILE | gzip > ${PATCHFILE}.gz + PATCHINDEX='aptarchive/Packages.diff/Index' + echo "SHA1-Current: $(sha1sum ${PKGFILE}-new | cut -d' ' -f 1) $(stat -c%s ${PKGFILE}-new) SHA1-History: 9f4148e06d7faa37062994ff10d0c842d7017513 33053002 2010-08-18-2013.28 $(sha1sum $PKGFILE | cut -d' ' -f 1) $(stat -c%s $PKGFILE) $(basename $PATCHFILE) SHA1-Patches: 7651fc0ac57cd83d41c63195a9342e2db5650257 19722 2010-08-18-0814.28 $(sha1sum $PATCHFILE | cut -d' ' -f 1) $(stat -c%s $PATCHFILE) $(basename $PATCHFILE)" > $PATCHINDEX -generatereleasefiles '+1hour' -signreleasefiles -find aptarchive -name 'Packages*' -type f -delete -testsuccess aptget update + generatereleasefiles '+1hour' + signreleasefiles + find aptarchive -name 'Packages*' -type f -delete + wasmergeused "$@" + testnopackage oldstuff + testequal "$(cat ${PKGFILE}-new) +" aptcache show apt newstuff -testnopackage oldstuff -testequal "$(cat ${PKGFILE}-new) + # index is already up-to-date + find rootdir/var/lib/apt/lists -name '*.IndexDiff' -type f -delete + testsuccess aptget update "$@" + testequal "$(cat ${PKGFILE}-new) " aptcache show apt newstuff + + # apply with two patches + cp ${PKGFILE}-new aptarchive/Packages + echo ' +Package: futurestuff +Version: 1.0 +Architecture: i386 +Maintainer: Joe Sixpack +Installed-Size: 202 +Filename: pool/futurestuff_1.0_i386.deb +Size: 202200 +MD5sum: 311aeeaaae5ba33aff1ceaf3e1f76671 +SHA1: 3c695e028f7a1ae324deeaae5ba332desa81088c +SHA256: b46fd154615edaae5ba33c56a5cc0e7deaef23e2da3e4f129727fd660f28f050 +Description: some cool and shiny future stuff + This package will appear in the next next mirror update +Description-md5: d5f89fbbc2ce34c455dfee9b67d82b6b' >> aptarchive/Packages + + compressfile 'aptarchive/Packages' + PATCHFILE2="aptarchive/Packages.diff/$(date -d 'now + 1hour' '+%Y-%m-%d-%H%M.%S')" + diff -e ${PKGFILE}-new aptarchive/Packages > ${PATCHFILE2} || true + cat $PATCHFILE2 | gzip > ${PATCHFILE2}.gz + echo "SHA1-Current: $(sha1sum aptarchive/Packages | cut -d' ' -f 1) $(stat -c%s aptarchive/Packages) +SHA1-History: + 9f4148e06d7faa37062994ff10d0c842d7017513 33053002 2010-08-18-2013.28 + $(sha1sum ${PKGFILE} | cut -d' ' -f 1) $(stat -c%s ${PKGFILE}) $(basename ${PATCHFILE}) + $(sha1sum ${PKGFILE}-new | cut -d' ' -f 1) $(stat -c%s ${PKGFILE}-new) $(basename ${PATCHFILE2}) +SHA1-Patches: + 7651fc0ac57cd83d41c63195a9342e2db5650257 19722 2010-08-18-0814.28 + $(sha1sum $PATCHFILE | cut -d' ' -f 1) $(stat -c%s $PATCHFILE) $(basename $PATCHFILE) + $(sha1sum ${PATCHFILE2} | cut -d' ' -f 1) $(stat -c%s ${PATCHFILE2}) $(basename ${PATCHFILE2})" > $PATCHINDEX + generatereleasefiles '+2hour' + signreleasefiles + cp -a aptarchive/Packages Packages-future + find aptarchive -name 'Packages*' -type f -delete + rm -rf rootdir/var/lib/apt/lists + cp -a rootdir/var/lib/apt/lists-bak rootdir/var/lib/apt/lists + wasmergeused "$@" + testnopackage oldstuff + testequal "$(cat Packages-future) +" aptcache show apt newstuff futurestuff + + # patch applying fails, but successful fallback + rm -rf rootdir/var/lib/apt/lists + cp -a rootdir/var/lib/apt/lists-bak rootdir/var/lib/apt/lists + cp ${PKGFILE}-new aptarchive/Packages + compressfile 'aptarchive/Packages' + mkdir -p aptarchive/Packages.diff + PATCHFILE="aptarchive/Packages.diff/$(date +%Y-%m-%d-%H%M.%S)" + diff -e ${PKGFILE} ${PKGFILE}-new > ${PATCHFILE} || true + PATCHINDEX='aptarchive/Packages.diff/Index' + echo "SHA1-Current: $(sha1sum ${PKGFILE}-new | cut -d' ' -f 1) $(stat -c%s ${PKGFILE}-new) +SHA1-History: + 9f4148e06d7faa37062994ff10d0c842d7017513 33053002 2010-08-18-2013.28 + $(sha1sum $PKGFILE | cut -d' ' -f 1) $(stat -c%s $PKGFILE) $(basename $PATCHFILE) +SHA1-Patches: + 7651fc0ac57cd83d41c63195a9342e2db5650257 19722 2010-08-18-0814.28 + $(sha1sum $PATCHFILE | cut -d' ' -f 1) $(stat -c%s $PATCHFILE) $(basename $PATCHFILE)" > $PATCHINDEX + echo 'I am Mallory and I change files' >> $PATCHFILE + cat $PATCHFILE | gzip > ${PATCHFILE}.gz + generatereleasefiles '+1hour' + signreleasefiles + testsuccess aptget update "$@" + testnopackage oldstuff + testequal "$(cat ${PKGFILE}-new) +" aptcache show apt newstuff +} + +testrun -o Debug::pkgAcquire::Diffs=1 -o Debug::pkgAcquire::rred=1 -o Acquire::PDiffs::Merge=0 +testrun -o Debug::pkgAcquire::Diffs=1 -o Debug::pkgAcquire::rred=1 -o Acquire::PDiffs::Merge=1 -- cgit v1.2.3 From d2d68aaf5bc2211e9c488f2603ccb4e5fd591a6d Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Sat, 4 Jan 2014 15:39:04 +0100 Subject: improve tests --- test/integration/framework | 13 +++++++++++-- test/integration/test-apt-sources-deb822 | 21 ++++++++++++++++----- 2 files changed, 27 insertions(+), 7 deletions(-) (limited to 'test') diff --git a/test/integration/framework b/test/integration/framework index a28363768..6ada1e9cc 100644 --- a/test/integration/framework +++ b/test/integration/framework @@ -948,13 +948,22 @@ testempty() { test -z "$($* 2>&1)" && msgpass || msgfail } -testequal() { +testequalwithmsg() { + local MSG="$1" + shift local COMPAREFILE=$(mktemp) addtrap "rm $COMPAREFILE;" echo "$1" > $COMPAREFILE shift - msgtest "Test for equality of" "$*" + msgtest "$MSG" $* 2>&1 | checkdiff $COMPAREFILE - && msgpass || msgfail +} + +testequal() { + local EXPECTED="$1" + shift + local MSG="Test for equality of $*" + testequalwithmsg "$MSG" "$EXPECTED" $* } testequalor2() { diff --git a/test/integration/test-apt-sources-deb822 b/test/integration/test-apt-sources-deb822 index 6e9700bb0..24fb1bdb0 100755 --- a/test/integration/test-apt-sources-deb822 +++ b/test/integration/test-apt-sources-deb822 @@ -7,7 +7,17 @@ TESTDIR=$(readlink -f $(dirname $0)) setupenvironment configarchitecture "i386" -BASE="Type: deb +echo "deb http://ftp.debian.org/debian stable main" > rootdir/etc/apt/sources.list +testequalwithmsg "Old style sources.list works" "'http://ftp.debian.org/debian/dists/stable/main/binary-i386/Packages.bz2' ftp.debian.org_debian_dists_stable_main_binary-i386_Packages 0 : +'http://ftp.debian.org/debian/dists/stable/main/i18n/Translation-en.bz2' ftp.debian.org_debian_dists_stable_main_i18n_Translation-en 0 : +'http://ftp.debian.org/debian/dists/stable/InRelease' ftp.debian.org_debian_dists_stable_InRelease 0 " aptget update --print-uris + + +BASE="# some comment +# that contains a : as well +#Type: meep + +Type: deb URL: http://ftp.debian.org/debian Dist: stable Section: main @@ -17,7 +27,7 @@ Comment: Some random string # simple case echo "$BASE" > rootdir/etc/apt/sources.list -testequal "'http://ftp.debian.org/debian/dists/stable/main/binary-i386/Packages.bz2' ftp.debian.org_debian_dists_stable_main_binary-i386_Packages 0 : +testequalwithmsg "Simple deb822 sources.list works" "'http://ftp.debian.org/debian/dists/stable/main/binary-i386/Packages.bz2' ftp.debian.org_debian_dists_stable_main_binary-i386_Packages 0 : 'http://ftp.debian.org/debian/dists/stable/main/i18n/Translation-en.bz2' ftp.debian.org_debian_dists_stable_main_i18n_Translation-en 0 : 'http://ftp.debian.org/debian/dists/stable/InRelease' ftp.debian.org_debian_dists_stable_InRelease 0 " aptget update --print-uris @@ -25,7 +35,7 @@ testequal "'http://ftp.debian.org/debian/dists/stable/main/binary-i386/Packages. # two sections (we support both "," and " " as seperator) echo "$BASE" | sed s/main/"main,contrib"/ > rootdir/etc/apt/sources.list -testequal "'http://ftp.debian.org/debian/dists/stable/main/binary-i386/Packages.bz2' ftp.debian.org_debian_dists_stable_main_binary-i386_Packages 0 : +testequalwithmsg "Two sections deb822 sources.list work" "'http://ftp.debian.org/debian/dists/stable/main/binary-i386/Packages.bz2' ftp.debian.org_debian_dists_stable_main_binary-i386_Packages 0 : 'http://ftp.debian.org/debian/dists/stable/contrib/binary-i386/Packages.bz2' ftp.debian.org_debian_dists_stable_contrib_binary-i386_Packages 0 : 'http://ftp.debian.org/debian/dists/stable/contrib/i18n/Translation-en.bz2' ftp.debian.org_debian_dists_stable_contrib_i18n_Translation-en 0 : 'http://ftp.debian.org/debian/dists/stable/main/i18n/Translation-en.bz2' ftp.debian.org_debian_dists_stable_main_i18n_Translation-en 0 : @@ -37,7 +47,7 @@ echo "$BASE" > rootdir/etc/apt/sources.list echo "" >> rootdir/etc/apt/sources.list echo "$BASE" | sed s/stable/unstable/ >> rootdir/etc/apt/sources.list -testequal "'http://ftp.debian.org/debian/dists/stable/main/binary-i386/Packages.bz2' ftp.debian.org_debian_dists_stable_main_binary-i386_Packages 0 : +testequalwithmsg "Multiple entries in deb822 sources.list work" "'http://ftp.debian.org/debian/dists/stable/main/binary-i386/Packages.bz2' ftp.debian.org_debian_dists_stable_main_binary-i386_Packages 0 : 'http://ftp.debian.org/debian/dists/stable/main/i18n/Translation-en.bz2' ftp.debian.org_debian_dists_stable_main_i18n_Translation-en 0 : 'http://ftp.debian.org/debian/dists/stable/InRelease' ftp.debian.org_debian_dists_stable_InRelease 0 'http://ftp.debian.org/debian/dists/unstable/main/binary-i386/Packages.bz2' ftp.debian.org_debian_dists_unstable_main_binary-i386_Packages 0 : @@ -49,7 +59,8 @@ testequal "'http://ftp.debian.org/debian/dists/stable/main/binary-i386/Packages. echo "$BASE" > rootdir/etc/apt/sources.list echo "Arch: amd64,armel" >> rootdir/etc/apt/sources.list -testequal "'http://ftp.debian.org/debian/dists/stable/main/binary-amd64/Packages.bz2' ftp.debian.org_debian_dists_stable_main_binary-amd64_Packages 0 : +testequalwithmsg "Arch: option in deb822 sources.list works" "'http://ftp.debian.org/debian/dists/stable/main/binary-amd64/Packages.bz2' ftp.debian.org_debian_dists_stable_main_binary-amd64_Packages 0 : 'http://ftp.debian.org/debian/dists/stable/main/binary-armel/Packages.bz2' ftp.debian.org_debian_dists_stable_main_binary-armel_Packages 0 : 'http://ftp.debian.org/debian/dists/stable/main/i18n/Translation-en.bz2' ftp.debian.org_debian_dists_stable_main_i18n_Translation-en 0 : 'http://ftp.debian.org/debian/dists/stable/InRelease' ftp.debian.org_debian_dists_stable_InRelease 0 " aptget update --print-uris + -- cgit v1.2.3 From 4194c9aee2766845618ef0431fd4803b0467aab7 Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Sat, 4 Jan 2014 16:23:32 +0100 Subject: improve error message --- test/integration/test-apt-sources-deb822 | 30 ++++++++++++++++++++++-------- 1 file changed, 22 insertions(+), 8 deletions(-) (limited to 'test') diff --git a/test/integration/test-apt-sources-deb822 b/test/integration/test-apt-sources-deb822 index 24fb1bdb0..bacad1ed4 100755 --- a/test/integration/test-apt-sources-deb822 +++ b/test/integration/test-apt-sources-deb822 @@ -7,7 +7,9 @@ TESTDIR=$(readlink -f $(dirname $0)) setupenvironment configarchitecture "i386" -echo "deb http://ftp.debian.org/debian stable main" > rootdir/etc/apt/sources.list +SOURCES="rootdir/etc/apt/sources.list" + +echo "deb http://ftp.debian.org/debian stable main" > $SOURCES testequalwithmsg "Old style sources.list works" "'http://ftp.debian.org/debian/dists/stable/main/binary-i386/Packages.bz2' ftp.debian.org_debian_dists_stable_main_binary-i386_Packages 0 : 'http://ftp.debian.org/debian/dists/stable/main/i18n/Translation-en.bz2' ftp.debian.org_debian_dists_stable_main_i18n_Translation-en 0 : 'http://ftp.debian.org/debian/dists/stable/InRelease' ftp.debian.org_debian_dists_stable_InRelease 0 " aptget update --print-uris @@ -25,7 +27,7 @@ Comment: Some random string that can be very long" # simple case -echo "$BASE" > rootdir/etc/apt/sources.list +echo "$BASE" > $SOURCES testequalwithmsg "Simple deb822 sources.list works" "'http://ftp.debian.org/debian/dists/stable/main/binary-i386/Packages.bz2' ftp.debian.org_debian_dists_stable_main_binary-i386_Packages 0 : 'http://ftp.debian.org/debian/dists/stable/main/i18n/Translation-en.bz2' ftp.debian.org_debian_dists_stable_main_i18n_Translation-en 0 : @@ -33,7 +35,7 @@ testequalwithmsg "Simple deb822 sources.list works" "'http://ftp.debian.org/debi # two sections (we support both "," and " " as seperator) -echo "$BASE" | sed s/main/"main,contrib"/ > rootdir/etc/apt/sources.list +echo "$BASE" | sed s/main/"main,contrib"/ > $SOURCES testequalwithmsg "Two sections deb822 sources.list work" "'http://ftp.debian.org/debian/dists/stable/main/binary-i386/Packages.bz2' ftp.debian.org_debian_dists_stable_main_binary-i386_Packages 0 : 'http://ftp.debian.org/debian/dists/stable/contrib/binary-i386/Packages.bz2' ftp.debian.org_debian_dists_stable_contrib_binary-i386_Packages 0 : @@ -43,9 +45,9 @@ testequalwithmsg "Two sections deb822 sources.list work" "'http://ftp.debian.org # Two entries -echo "$BASE" > rootdir/etc/apt/sources.list -echo "" >> rootdir/etc/apt/sources.list -echo "$BASE" | sed s/stable/unstable/ >> rootdir/etc/apt/sources.list +echo "$BASE" > $SOURCES +echo "" >> $SOURCES +echo "$BASE" | sed s/stable/unstable/ >> $SOURCES testequalwithmsg "Multiple entries in deb822 sources.list work" "'http://ftp.debian.org/debian/dists/stable/main/binary-i386/Packages.bz2' ftp.debian.org_debian_dists_stable_main_binary-i386_Packages 0 : 'http://ftp.debian.org/debian/dists/stable/main/i18n/Translation-en.bz2' ftp.debian.org_debian_dists_stable_main_i18n_Translation-en 0 : @@ -56,11 +58,23 @@ testequalwithmsg "Multiple entries in deb822 sources.list work" "'http://ftp.deb # ARCH option -echo "$BASE" > rootdir/etc/apt/sources.list -echo "Arch: amd64,armel" >> rootdir/etc/apt/sources.list +echo "$BASE" > $SOURCES +echo "Arch: amd64,armel" >> $SOURCES testequalwithmsg "Arch: option in deb822 sources.list works" "'http://ftp.debian.org/debian/dists/stable/main/binary-amd64/Packages.bz2' ftp.debian.org_debian_dists_stable_main_binary-amd64_Packages 0 : 'http://ftp.debian.org/debian/dists/stable/main/binary-armel/Packages.bz2' ftp.debian.org_debian_dists_stable_main_binary-armel_Packages 0 : 'http://ftp.debian.org/debian/dists/stable/main/i18n/Translation-en.bz2' ftp.debian.org_debian_dists_stable_main_i18n_Translation-en 0 : 'http://ftp.debian.org/debian/dists/stable/InRelease' ftp.debian.org_debian_dists_stable_InRelease 0 " aptget update --print-uris +# invalid sources.list file +echo "deb http://ftp.debian.org" > $SOURCES + +testequalwithmsg "Invalid sources.list file gives proper error" "E: Malformed line 1 in source list $TMPWORKINGDIRECTORY/rootdir/etc/apt/sources.list (dist) +E: The list of sources could not be read." aptget update --print-uris + +echo "Type: deb +Dist: stable +" > $SOURCES + +testequalwithmsg "Invalid deb822 sources.list file gives proper error" "E: Malformed stanza 0 in source list $TMPWORKINGDIRECTORY/rootdir/etc/apt/sources.list (URI parse) +E: The list of sources could not be read." aptget update --print-uris -- cgit v1.2.3 From 9aaa45283b14c3c81641f3f3e38157a267b1e8f7 Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Wed, 15 Jan 2014 16:14:23 +0100 Subject: actually register the tempfile removal atexit Git-Dch: Ignore --- test/libapt/sourcelist_test.cc | 1 + 1 file changed, 1 insertion(+) (limited to 'test') diff --git a/test/libapt/sourcelist_test.cc b/test/libapt/sourcelist_test.cc index 6e83d08e0..adadae6a7 100644 --- a/test/libapt/sourcelist_test.cc +++ b/test/libapt/sourcelist_test.cc @@ -36,6 +36,7 @@ int main(int argc, char *argv[]) ; FileFd fd; + atexit(remove_tmpfile); tempfile = strdup("apt-test.XXXXXXXX"); tempfile_fd = mkstemp(tempfile); -- cgit v1.2.3 From 50bd6fd3794dd1f61185302129dc6cd218d20b98 Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Wed, 15 Jan 2014 17:23:05 +0100 Subject: integrate Anthonys rred with POC for client-side merge Providing the benefits of both without the downsides :) (ABI breaks or external dependencies) For this Anthonys rred is equipped with: - magic-filename-pickup of patches rather than explicit messages - use of FileFd instead of FILE* to get on-the-fly uncompress of the gzip compressed pdiff patches The acquire code in turn stops checking for apt-file's helper as our own rred is now clever enough for our needs. --- test/integration/test-pdiff-usage | 23 ++++++++++++++++------- 1 file changed, 16 insertions(+), 7 deletions(-) (limited to 'test') diff --git a/test/integration/test-pdiff-usage b/test/integration/test-pdiff-usage index 5a06e0ccb..ad31511b9 100755 --- a/test/integration/test-pdiff-usage +++ b/test/integration/test-pdiff-usage @@ -20,10 +20,19 @@ chmod +x extrred echo 'Dir::Bin::rred "./extrred";' > rootdir/etc/apt/apt.conf.d/99rred wasmergeused() { - testsuccess aptget update "$@" + msgtest 'Test for successful execution of' "$*" + local OUTPUT=$(mktemp) + addtrap "rm $OUTPUT;" + if aptget update "$@" >${OUTPUT} 2>&1; then + msgpass + else + echo + cat $OUTPUT + msgfail + fi + msgtest 'Check if the right pdiff merger was used' - if [ -e ./merge-was-used ]; then - rm -f ./merge-was-used + if grep -q '^pkgAcqIndexMergeDiffs::Done(): rred' $OUTPUT; then if echo "$*" | grep -q -- '-o Acquire::PDiffs::Merge=1'; then msgpass else @@ -50,7 +59,7 @@ testrun() { testequal "$(cat ${PKGFILE}) " aptcache show apt oldstuff - # apply with one patch + msgmsg 'Testcase: apply with one patch' cp ${PKGFILE}-new aptarchive/Packages compressfile 'aptarchive/Packages' mkdir -p aptarchive/Packages.diff @@ -73,13 +82,13 @@ SHA1-Patches: testequal "$(cat ${PKGFILE}-new) " aptcache show apt newstuff - # index is already up-to-date + msgmsg 'Testcase: index is already up-to-date' find rootdir/var/lib/apt/lists -name '*.IndexDiff' -type f -delete testsuccess aptget update "$@" testequal "$(cat ${PKGFILE}-new) " aptcache show apt newstuff - # apply with two patches + msgmsg 'Testcase: apply with two patches' cp ${PKGFILE}-new aptarchive/Packages echo ' Package: futurestuff @@ -120,7 +129,7 @@ SHA1-Patches: testequal "$(cat Packages-future) " aptcache show apt newstuff futurestuff - # patch applying fails, but successful fallback + msgmsg 'Testcase: patch applying fails, but successful fallback' rm -rf rootdir/var/lib/apt/lists cp -a rootdir/var/lib/apt/lists-bak rootdir/var/lib/apt/lists cp ${PKGFILE}-new aptarchive/Packages -- cgit v1.2.3 From f74a6fa120759d0a1bd4a5aff0dc2c50911b5407 Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Wed, 15 Jan 2014 18:44:47 +0100 Subject: rework some testcases to not spit out text Rework also uncovers two FIXMEs Git-Dch: Ignore --- test/integration/framework | 22 ++++---- test/integration/test-apt-progress-fd-conffile | 17 +++++-- test/integration/test-apt-sources-deb822 | 70 ++++++++++++++------------ test/integration/test-bug-728500-tempdir | 19 +++++-- 4 files changed, 77 insertions(+), 51 deletions(-) (limited to 'test') diff --git a/test/integration/framework b/test/integration/framework index 6ada1e9cc..2fe059280 100644 --- a/test/integration/framework +++ b/test/integration/framework @@ -948,22 +948,22 @@ testempty() { test -z "$($* 2>&1)" && msgpass || msgfail } -testequalwithmsg() { - local MSG="$1" - shift +testequal() { + local MSG='Test of equality of' + if [ "$1" = '--nomsg' ]; then + MSG='' + shift + fi + local COMPAREFILE=$(mktemp) addtrap "rm $COMPAREFILE;" echo "$1" > $COMPAREFILE shift - msgtest "$MSG" - $* 2>&1 | checkdiff $COMPAREFILE - && msgpass || msgfail -} -testequal() { - local EXPECTED="$1" - shift - local MSG="Test for equality of $*" - testequalwithmsg "$MSG" "$EXPECTED" $* + if [ -n "$MSG" ]; then + msgtest "$MSG" "$*" + fi + $* 2>&1 | checkdiff $COMPAREFILE - && msgpass || msgfail } testequalor2() { diff --git a/test/integration/test-apt-progress-fd-conffile b/test/integration/test-apt-progress-fd-conffile index 0b42b1b2f..085d5e871 100755 --- a/test/integration/test-apt-progress-fd-conffile +++ b/test/integration/test-apt-progress-fd-conffile @@ -32,12 +32,19 @@ testsuccess aptget install compiz-core=1.0 # fake conffile change echo "meep" >> rootdir/etc/compiz.conf/compiz.conf -# install +# FIXME: Is there really no way to see if dpkg actually prompts? +msgtest 'Test for successful execution of' 'apt-get install compiz-core=2.0' +OUTPUT=$(mktemp) +addtrap "rm $OUTPUT;" exec 3> apt-progress.log -echo n | aptget install compiz-core=2.0 -o APT::Status-Fd=3 -o Dpkg::Use-Pty=false +if aptget install compiz-core=2.0 -o APT::Status-Fd=3 -o Dpkg::Use-Pty=false -o dpkg::options::='--force-confold' >${OUTPUT} 2>&1; then + msgpass +else + echo + cat $OUTPUT + msgfail +fi # and ensure there is a conffile message in the file -msgtest "Conffile prompt in apt-progress.log" +msgtest 'Test status fd for an included' 'pmconffile msg' grep -q "pmconffile:/etc/compiz.conf/compiz.conf" apt-progress.log && msgpass || (cat apt-progress.log && msgfail) - -cat apt-progress.log \ No newline at end of file diff --git a/test/integration/test-apt-sources-deb822 b/test/integration/test-apt-sources-deb822 index bacad1ed4..8c022767f 100755 --- a/test/integration/test-apt-sources-deb822 +++ b/test/integration/test-apt-sources-deb822 @@ -5,17 +5,10 @@ TESTDIR=$(readlink -f $(dirname $0)) . $TESTDIR/framework setupenvironment -configarchitecture "i386" +configarchitecture 'i386' -SOURCES="rootdir/etc/apt/sources.list" - -echo "deb http://ftp.debian.org/debian stable main" > $SOURCES -testequalwithmsg "Old style sources.list works" "'http://ftp.debian.org/debian/dists/stable/main/binary-i386/Packages.bz2' ftp.debian.org_debian_dists_stable_main_binary-i386_Packages 0 : -'http://ftp.debian.org/debian/dists/stable/main/i18n/Translation-en.bz2' ftp.debian.org_debian_dists_stable_main_i18n_Translation-en 0 : -'http://ftp.debian.org/debian/dists/stable/InRelease' ftp.debian.org_debian_dists_stable_InRelease 0 " aptget update --print-uris - - -BASE="# some comment +SOURCES='rootdir/etc/apt/sources.list' +BASE='# some comment # that contains a : as well #Type: meep @@ -24,57 +17,72 @@ URL: http://ftp.debian.org/debian Dist: stable Section: main Comment: Some random string - that can be very long" + that can be very long' -# simple case -echo "$BASE" > $SOURCES -testequalwithmsg "Simple deb822 sources.list works" "'http://ftp.debian.org/debian/dists/stable/main/binary-i386/Packages.bz2' ftp.debian.org_debian_dists_stable_main_binary-i386_Packages 0 : +msgtest 'Test old-style sources.list' +echo "deb http://ftp.debian.org/debian stable main" > $SOURCES +testequal --nomsg "'http://ftp.debian.org/debian/dists/stable/main/binary-i386/Packages.bz2' ftp.debian.org_debian_dists_stable_main_binary-i386_Packages 0 : 'http://ftp.debian.org/debian/dists/stable/main/i18n/Translation-en.bz2' ftp.debian.org_debian_dists_stable_main_i18n_Translation-en 0 : -'http://ftp.debian.org/debian/dists/stable/InRelease' ftp.debian.org_debian_dists_stable_InRelease 0 " aptget update --print-uris +'http://ftp.debian.org/debian/dists/stable/InRelease' ftp.debian.org_debian_dists_stable_InRelease 0 " aptget update --print-uris -# two sections (we support both "," and " " as seperator) -echo "$BASE" | sed s/main/"main,contrib"/ > $SOURCES +msgtest 'Test simple deb822 sources.list' +echo "$BASE" > $SOURCES +testequal --nomsg "'http://ftp.debian.org/debian/dists/stable/main/binary-i386/Packages.bz2' ftp.debian.org_debian_dists_stable_main_binary-i386_Packages 0 : +'http://ftp.debian.org/debian/dists/stable/main/i18n/Translation-en.bz2' ftp.debian.org_debian_dists_stable_main_i18n_Translation-en 0 : +'http://ftp.debian.org/debian/dists/stable/InRelease' ftp.debian.org_debian_dists_stable_InRelease 0 " aptget update --print-uris -testequalwithmsg "Two sections deb822 sources.list work" "'http://ftp.debian.org/debian/dists/stable/main/binary-i386/Packages.bz2' ftp.debian.org_debian_dists_stable_main_binary-i386_Packages 0 : + +msgtest 'Test deb822 with two sections' 'seperated by comma' +echo "$BASE" | sed 's/main/main,contrib/' > $SOURCES +testequal --nomsg "'http://ftp.debian.org/debian/dists/stable/main/binary-i386/Packages.bz2' ftp.debian.org_debian_dists_stable_main_binary-i386_Packages 0 : 'http://ftp.debian.org/debian/dists/stable/contrib/binary-i386/Packages.bz2' ftp.debian.org_debian_dists_stable_contrib_binary-i386_Packages 0 : 'http://ftp.debian.org/debian/dists/stable/contrib/i18n/Translation-en.bz2' ftp.debian.org_debian_dists_stable_contrib_i18n_Translation-en 0 : 'http://ftp.debian.org/debian/dists/stable/main/i18n/Translation-en.bz2' ftp.debian.org_debian_dists_stable_main_i18n_Translation-en 0 : -'http://ftp.debian.org/debian/dists/stable/InRelease' ftp.debian.org_debian_dists_stable_InRelease 0 " aptget update --print-uris +'http://ftp.debian.org/debian/dists/stable/InRelease' ftp.debian.org_debian_dists_stable_InRelease 0 " aptget update --print-uris + +# FIXME: Advertised, but not supported at the moment +#msgtest 'Test deb822 with two sections' 'seperated by space' +#echo "$BASE" | sed 's/main/main contrib/' > $SOURCES +#testequal --nomsg "'http://ftp.debian.org/debian/dists/stable/main/binary-i386/Packages.bz2' ftp.debian.org_debian_dists_stable_main_binary-i386_Packages 0 : +#'http://ftp.debian.org/debian/dists/stable/contrib/binary-i386/Packages.bz2' ftp.debian.org_debian_dists_stable_contrib_binary-i386_Packages 0 : +#'http://ftp.debian.org/debian/dists/stable/contrib/i18n/Translation-en.bz2' ftp.debian.org_debian_dists_stable_contrib_i18n_Translation-en 0 : +#'http://ftp.debian.org/debian/dists/stable/main/i18n/Translation-en.bz2' ftp.debian.org_debian_dists_stable_main_i18n_Translation-en 0 : +#'http://ftp.debian.org/debian/dists/stable/InRelease' ftp.debian.org_debian_dists_stable_InRelease 0 " aptget update --print-uris -# Two entries + +msgtest 'Test deb822 with' 'two entries' echo "$BASE" > $SOURCES echo "" >> $SOURCES echo "$BASE" | sed s/stable/unstable/ >> $SOURCES - -testequalwithmsg "Multiple entries in deb822 sources.list work" "'http://ftp.debian.org/debian/dists/stable/main/binary-i386/Packages.bz2' ftp.debian.org_debian_dists_stable_main_binary-i386_Packages 0 : +testequal --nomsg "'http://ftp.debian.org/debian/dists/stable/main/binary-i386/Packages.bz2' ftp.debian.org_debian_dists_stable_main_binary-i386_Packages 0 : 'http://ftp.debian.org/debian/dists/stable/main/i18n/Translation-en.bz2' ftp.debian.org_debian_dists_stable_main_i18n_Translation-en 0 : 'http://ftp.debian.org/debian/dists/stable/InRelease' ftp.debian.org_debian_dists_stable_InRelease 0 'http://ftp.debian.org/debian/dists/unstable/main/binary-i386/Packages.bz2' ftp.debian.org_debian_dists_unstable_main_binary-i386_Packages 0 : 'http://ftp.debian.org/debian/dists/unstable/main/i18n/Translation-en.bz2' ftp.debian.org_debian_dists_unstable_main_i18n_Translation-en 0 : -'http://ftp.debian.org/debian/dists/unstable/InRelease' ftp.debian.org_debian_dists_unstable_InRelease 0 " aptget update --print-uris +'http://ftp.debian.org/debian/dists/unstable/InRelease' ftp.debian.org_debian_dists_unstable_InRelease 0 " aptget update --print-uris -# ARCH option +msgtest 'Test deb822' 'architecture option' echo "$BASE" > $SOURCES echo "Arch: amd64,armel" >> $SOURCES - -testequalwithmsg "Arch: option in deb822 sources.list works" "'http://ftp.debian.org/debian/dists/stable/main/binary-amd64/Packages.bz2' ftp.debian.org_debian_dists_stable_main_binary-amd64_Packages 0 : +testequal --nomsg "'http://ftp.debian.org/debian/dists/stable/main/binary-amd64/Packages.bz2' ftp.debian.org_debian_dists_stable_main_binary-amd64_Packages 0 : 'http://ftp.debian.org/debian/dists/stable/main/binary-armel/Packages.bz2' ftp.debian.org_debian_dists_stable_main_binary-armel_Packages 0 : 'http://ftp.debian.org/debian/dists/stable/main/i18n/Translation-en.bz2' ftp.debian.org_debian_dists_stable_main_i18n_Translation-en 0 : 'http://ftp.debian.org/debian/dists/stable/InRelease' ftp.debian.org_debian_dists_stable_InRelease 0 " aptget update --print-uris -# invalid sources.list file -echo "deb http://ftp.debian.org" > $SOURCES -testequalwithmsg "Invalid sources.list file gives proper error" "E: Malformed line 1 in source list $TMPWORKINGDIRECTORY/rootdir/etc/apt/sources.list (dist) +msgtest 'Test old-style sources.list file which has' 'malformed dist' +echo "deb http://ftp.debian.org" > $SOURCES +testequal --nomsg "E: Malformed line 1 in source list $TMPWORKINGDIRECTORY/rootdir/etc/apt/sources.list (dist) E: The list of sources could not be read." aptget update --print-uris + +msgtest 'Test deb822 sources.list file which has' 'malformed URI' echo "Type: deb Dist: stable " > $SOURCES - -testequalwithmsg "Invalid deb822 sources.list file gives proper error" "E: Malformed stanza 0 in source list $TMPWORKINGDIRECTORY/rootdir/etc/apt/sources.list (URI parse) +testequal --nomsg "E: Malformed stanza 0 in source list $TMPWORKINGDIRECTORY/rootdir/etc/apt/sources.list (URI parse) E: The list of sources could not be read." aptget update --print-uris diff --git a/test/integration/test-bug-728500-tempdir b/test/integration/test-bug-728500-tempdir index 0606538a1..0451fc1ed 100755 --- a/test/integration/test-bug-728500-tempdir +++ b/test/integration/test-bug-728500-tempdir @@ -7,12 +7,23 @@ TESTDIR=$(readlink -f $(dirname $0)) setupenvironment configarchitecture 'i386' -buildsimplenativepackage 'coolstuff' 'all' '1.0' 'unstable' +insertpackage 'unstable' 'coolstuff' 'all' '1.0' setupaptarchive changetowebserver -msgtest 'Test with incorect TMPDIR' +msgtest 'Test apt-get update with incorrect' 'TMPDIR' + +OUTPUT=$(mktemp) +addtrap "rm $OUTPUT;" export TMPDIR=/does-not-exists -aptget update && msgpass || msgfail -unset TMPDIR \ No newline at end of file +if aptget update >${OUTPUT} 2>&1; then + msgpass +else + echo + cat $OUTPUT + msgfail +fi +unset TMPDIR + +testequal 'coolstuff' aptcache pkgnames -- cgit v1.2.3 From db6594dfc508378b6d658aff2761da5406404238 Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Thu, 16 Jan 2014 08:03:24 +0100 Subject: remove "," in components again --- test/integration/test-apt-sources-deb822 | 11 ----------- 1 file changed, 11 deletions(-) (limited to 'test') diff --git a/test/integration/test-apt-sources-deb822 b/test/integration/test-apt-sources-deb822 index bacad1ed4..b110c1462 100755 --- a/test/integration/test-apt-sources-deb822 +++ b/test/integration/test-apt-sources-deb822 @@ -33,17 +33,6 @@ testequalwithmsg "Simple deb822 sources.list works" "'http://ftp.debian.org/debi 'http://ftp.debian.org/debian/dists/stable/main/i18n/Translation-en.bz2' ftp.debian.org_debian_dists_stable_main_i18n_Translation-en 0 : 'http://ftp.debian.org/debian/dists/stable/InRelease' ftp.debian.org_debian_dists_stable_InRelease 0 " aptget update --print-uris - -# two sections (we support both "," and " " as seperator) -echo "$BASE" | sed s/main/"main,contrib"/ > $SOURCES - -testequalwithmsg "Two sections deb822 sources.list work" "'http://ftp.debian.org/debian/dists/stable/main/binary-i386/Packages.bz2' ftp.debian.org_debian_dists_stable_main_binary-i386_Packages 0 : -'http://ftp.debian.org/debian/dists/stable/contrib/binary-i386/Packages.bz2' ftp.debian.org_debian_dists_stable_contrib_binary-i386_Packages 0 : -'http://ftp.debian.org/debian/dists/stable/contrib/i18n/Translation-en.bz2' ftp.debian.org_debian_dists_stable_contrib_i18n_Translation-en 0 : -'http://ftp.debian.org/debian/dists/stable/main/i18n/Translation-en.bz2' ftp.debian.org_debian_dists_stable_main_i18n_Translation-en 0 : -'http://ftp.debian.org/debian/dists/stable/InRelease' ftp.debian.org_debian_dists_stable_InRelease 0 " aptget update --print-uris - - # Two entries echo "$BASE" > $SOURCES echo "" >> $SOURCES -- cgit v1.2.3 From 7037aab52fc935298b033a4c7ba7ccb5b697622e Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Thu, 16 Jan 2014 16:25:33 +0100 Subject: * refactor to have a new virtual ParseStanza Have a similar ParseStanza() to the current ParseLine(). Rename the Architectures options in deb822 to make it more user friendly --- test/integration/test-apt-sources-deb822 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'test') diff --git a/test/integration/test-apt-sources-deb822 b/test/integration/test-apt-sources-deb822 index b110c1462..fcb6010c3 100755 --- a/test/integration/test-apt-sources-deb822 +++ b/test/integration/test-apt-sources-deb822 @@ -48,7 +48,7 @@ testequalwithmsg "Multiple entries in deb822 sources.list work" "'http://ftp.deb # ARCH option echo "$BASE" > $SOURCES -echo "Arch: amd64,armel" >> $SOURCES +echo "Architectures: amd64,armel" >> $SOURCES testequalwithmsg "Arch: option in deb822 sources.list works" "'http://ftp.debian.org/debian/dists/stable/main/binary-amd64/Packages.bz2' ftp.debian.org_debian_dists_stable_main_binary-amd64_Packages 0 : 'http://ftp.debian.org/debian/dists/stable/main/binary-armel/Packages.bz2' ftp.debian.org_debian_dists_stable_main_binary-armel_Packages 0 : -- cgit v1.2.3 From 796a0eff1acebe858632c344e77bfc3189b2244f Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Thu, 16 Jan 2014 17:00:56 +0100 Subject: rename "distribution" in sources.list to "suite" --- test/integration/test-apt-sources-deb822 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'test') diff --git a/test/integration/test-apt-sources-deb822 b/test/integration/test-apt-sources-deb822 index fcb6010c3..00ca102be 100755 --- a/test/integration/test-apt-sources-deb822 +++ b/test/integration/test-apt-sources-deb822 @@ -21,7 +21,7 @@ BASE="# some comment Type: deb URL: http://ftp.debian.org/debian -Dist: stable +Suite: stable Section: main Comment: Some random string that can be very long" @@ -62,7 +62,7 @@ testequalwithmsg "Invalid sources.list file gives proper error" "E: Malformed li E: The list of sources could not be read." aptget update --print-uris echo "Type: deb -Dist: stable +Suite: stable " > $SOURCES testequalwithmsg "Invalid deb822 sources.list file gives proper error" "E: Malformed stanza 0 in source list $TMPWORKINGDIRECTORY/rootdir/etc/apt/sources.list (URI parse) -- cgit v1.2.3 From a51fa92c521a6790446108a54ad1d9b6a16515ff Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Thu, 16 Jan 2014 17:03:07 +0100 Subject: rename URL to Uri in deb822-sources --- test/integration/test-apt-sources-deb822 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'test') diff --git a/test/integration/test-apt-sources-deb822 b/test/integration/test-apt-sources-deb822 index 00ca102be..edf52487c 100755 --- a/test/integration/test-apt-sources-deb822 +++ b/test/integration/test-apt-sources-deb822 @@ -20,7 +20,7 @@ BASE="# some comment #Type: meep Type: deb -URL: http://ftp.debian.org/debian +Uri: http://ftp.debian.org/debian Suite: stable Section: main Comment: Some random string -- cgit v1.2.3 From d73743ddae1228bcd409700d8d0ffbe26e2e6cd1 Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Thu, 16 Jan 2014 17:13:18 +0100 Subject: support multiple "Suite:" entries --- test/integration/test-apt-sources-deb822 | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'test') diff --git a/test/integration/test-apt-sources-deb822 b/test/integration/test-apt-sources-deb822 index edf52487c..67d119565 100755 --- a/test/integration/test-apt-sources-deb822 +++ b/test/integration/test-apt-sources-deb822 @@ -45,6 +45,14 @@ testequalwithmsg "Multiple entries in deb822 sources.list work" "'http://ftp.deb 'http://ftp.debian.org/debian/dists/unstable/main/i18n/Translation-en.bz2' ftp.debian.org_debian_dists_unstable_main_i18n_Translation-en 0 : 'http://ftp.debian.org/debian/dists/unstable/InRelease' ftp.debian.org_debian_dists_unstable_InRelease 0 " aptget update --print-uris +# two suite entries +echo "$BASE" | sed -e "s/stable/stable unstable/" > $SOURCES +testequalwithmsg "Two Suite entries deb822 sources.list work" "'http://ftp.debian.org/debian/dists/stable/main/binary-i386/Packages.bz2' ftp.debian.org_debian_dists_stable_main_binary-i386_Packages 0 : +'http://ftp.debian.org/debian/dists/stable/main/i18n/Translation-en.bz2' ftp.debian.org_debian_dists_stable_main_i18n_Translation-en 0 : +'http://ftp.debian.org/debian/dists/stable/InRelease' ftp.debian.org_debian_dists_stable_InRelease 0 +'http://ftp.debian.org/debian/dists/unstable/main/binary-i386/Packages.bz2' ftp.debian.org_debian_dists_unstable_main_binary-i386_Packages 0 : +'http://ftp.debian.org/debian/dists/unstable/main/i18n/Translation-en.bz2' ftp.debian.org_debian_dists_unstable_main_i18n_Translation-en 0 : +'http://ftp.debian.org/debian/dists/unstable/InRelease' ftp.debian.org_debian_dists_unstable_InRelease 0 " aptget update --print-uris # ARCH option echo "$BASE" > $SOURCES -- cgit v1.2.3 From 78766f46d043c1c1eeb9869db7e1c5b4093d5274 Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Thu, 16 Jan 2014 18:14:14 +0100 Subject: update libapt test --- test/libapt/sourcelist_test.cc | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'test') diff --git a/test/libapt/sourcelist_test.cc b/test/libapt/sourcelist_test.cc index 6e83d08e0..1d30bd85b 100644 --- a/test/libapt/sourcelist_test.cc +++ b/test/libapt/sourcelist_test.cc @@ -23,15 +23,15 @@ int main(int argc, char *argv[]) { const char contents[] = "" "Type: deb\n" - "URL: http://ftp.debian.org/debian\n" - "Dist: stable\n" + "Uri: http://ftp.debian.org/debian\n" + "Suite: stable\n" "Section: main\n" "Comment: Some random string\n" " that can be very long\n" "\n" "Type: deb\n" - "URL: http://ftp.debian.org/debian\n" - "Dist: unstable\n" + "Uri: http://ftp.debian.org/debian\n" + "Suite: unstable\n" "Section: main non-free\n" ; -- cgit v1.2.3 From 1410955589dc9f0eaa290907cac070b7ebf93b6a Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Fri, 17 Jan 2014 08:43:14 +0100 Subject: add missing integration test for "apt list" --- test/integration/framework | 10 +++++---- test/integration/test-apt-binary | 47 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 53 insertions(+), 4 deletions(-) create mode 100755 test/integration/test-apt-binary (limited to 'test') diff --git a/test/integration/framework b/test/integration/framework index a28363768..6620c78dd 100644 --- a/test/integration/framework +++ b/test/integration/framework @@ -99,6 +99,7 @@ aptconfig() { runapt apt-config $*; } aptcache() { runapt apt-cache $*; } aptcdrom() { runapt apt-cdrom $*; } aptget() { runapt apt-get $*; } +apt() { runapt apt $*; } aptftparchive() { runapt apt-ftparchive $*; } aptkey() { runapt apt-key $*; } aptmark() { runapt apt-mark $*; } @@ -202,6 +203,7 @@ setupenvironment() { echo "DPKG::options:: \"--log=${TMPWORKINGDIRECTORY}/rootdir/var/log/dpkg.log\";" >> aptconfig.conf echo 'quiet::NoUpdate "true";' >> aptconfig.conf echo "Acquire::https::CaInfo \"${TESTDIR}/apt.pem\";" > rootdir/etc/apt/apt.conf.d/99https + echo "Apt::Cmd::Disable-Script-Warning \"1\";" > rootdir/etc/apt/apt.conf.d/apt-binary export LC_ALL=C export PATH="${PATH}:/usr/local/sbin:/usr/sbin:/sbin" configcompression '.' 'gz' #'bz2' 'lzma' 'xz' @@ -288,7 +290,7 @@ setupsimplenativepackage() { local VERSION="$3" local RELEASE="${4:-unstable}" local DEPENDENCIES="$5" - local DESCRIPTION="${6:-"Description: an autogenerated dummy ${NAME}=${VERSION}/${RELEASE} + local DESCRIPTION="${6:-"an autogenerated dummy ${NAME}=${VERSION}/${RELEASE} 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…"}" @@ -338,7 +340,7 @@ buildsimplenativepackage() { local VERSION="$3" local RELEASE="${4:-unstable}" local DEPENDENCIES="$5" - local DESCRIPTION="${6:-"Description: an autogenerated dummy ${NAME}=${VERSION}/${RELEASE} + local DESCRIPTION="${6:-"an autogenerated dummy ${NAME}=${VERSION}/${RELEASE} 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…"}" @@ -535,7 +537,7 @@ insertpackage() { local VERSION="$4" local DEPENDENCIES="$5" local PRIORITY="${6:-optional}" - local DESCRIPTION="${7:-"Description: an autogenerated dummy ${NAME}=${VERSION}/${RELEASE} + local DESCRIPTION="${7:-"an autogenerated dummy ${NAME}=${VERSION}/${RELEASE} 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…"}" @@ -595,7 +597,7 @@ insertinstalledpackage() { local DEPENDENCIES="$4" local PRIORITY="${5:-optional}" local STATUS="${6:-install ok installed}" - local DESCRIPTION="${7:-"Description: an autogenerated dummy ${NAME}=${VERSION}/installed + local DESCRIPTION="${7:-"an autogenerated dummy ${NAME}=${VERSION}/installed 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…"}" diff --git a/test/integration/test-apt-binary b/test/integration/test-apt-binary new file mode 100755 index 000000000..8d5df9051 --- /dev/null +++ b/test/integration/test-apt-binary @@ -0,0 +1,47 @@ +#!/bin/sh +set -e + +TESTDIR=$(readlink -f $(dirname $0)) +. $TESTDIR/framework + +setupenvironment +configarchitecture "i386" + +insertpackage 'unstable' 'foo' 'all' '1.0' +insertinstalledpackage 'bar' 'i386' '1.0' + +insertinstalledpackage 'foobar' 'i386' '1.0' +insertpackage 'unstable' 'foobar' 'i386' '2.0' + +setupaptarchive + +APTARCHIVE=$(readlink -f ./aptarchive) + +testequal "Listing... +bar/now 1.0 [installed,local] i386 +foo/unstable 1.0 all +foobar/unstable 2.0 [upgradable from: 1.0] i386" apt list + +testequal "Listing... +foo/unstable 1.0 all +foobar/unstable 2.0 [upgradable from: 1.0] i386" apt list "foo*" + +testequal "Listing... +foobar/unstable 2.0 [upgradable from: 1.0] i386" apt list --upgradable + +# FIXME: hm, hm - does it make sense to have this different? shouldn't +# we use "installed,upgradable" consitently? +testequal "Listing... +bar/now 1.0 [installed,local] i386 +foobar/now 1.0 [installed,upgradable to: 2.0] i386" apt list --installed + +testequal "Listing... +foobar/unstable 2.0 [upgradable from: 1.0] i386 +foobar/now 1.0 [installed,upgradable to: 2.0] i386 +" apt list foobar --all-versions + +testequal "Listing... +bar/now 1.0 [installed,local] i386 + an autogenerated dummy bar=1.0/installed +" apt list bar --verbose + -- cgit v1.2.3 From 866e9fadf892368fcb50e6a192bcdd350cfe8e5c Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Fri, 17 Jan 2014 20:41:55 +0100 Subject: implement suggestion by donkult (thanks!) --- test/integration/test-apt-sources-deb822 | 2 +- test/libapt/sourcelist_test.cc | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) (limited to 'test') diff --git a/test/integration/test-apt-sources-deb822 b/test/integration/test-apt-sources-deb822 index 67d119565..a055c8d5e 100755 --- a/test/integration/test-apt-sources-deb822 +++ b/test/integration/test-apt-sources-deb822 @@ -20,7 +20,7 @@ BASE="# some comment #Type: meep Type: deb -Uri: http://ftp.debian.org/debian +URI: http://ftp.debian.org/debian Suite: stable Section: main Comment: Some random string diff --git a/test/libapt/sourcelist_test.cc b/test/libapt/sourcelist_test.cc index 1d30bd85b..6a625770f 100644 --- a/test/libapt/sourcelist_test.cc +++ b/test/libapt/sourcelist_test.cc @@ -23,14 +23,14 @@ int main(int argc, char *argv[]) { const char contents[] = "" "Type: deb\n" - "Uri: http://ftp.debian.org/debian\n" + "URI: http://ftp.debian.org/debian\n" "Suite: stable\n" "Section: main\n" "Comment: Some random string\n" " that can be very long\n" "\n" "Type: deb\n" - "Uri: http://ftp.debian.org/debian\n" + "URI: http://ftp.debian.org/debian\n" "Suite: unstable\n" "Section: main non-free\n" ; -- cgit v1.2.3 From 6c069a2247781754bcc8574687cb98b493c6ab8a Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Sat, 18 Jan 2014 20:51:03 +0100 Subject: rename "Suite/Section" to plural --- test/integration/test-apt-sources-deb822 | 6 +++--- test/libapt/sourcelist_test.cc | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) (limited to 'test') diff --git a/test/integration/test-apt-sources-deb822 b/test/integration/test-apt-sources-deb822 index a055c8d5e..c73b942d4 100755 --- a/test/integration/test-apt-sources-deb822 +++ b/test/integration/test-apt-sources-deb822 @@ -21,8 +21,8 @@ BASE="# some comment Type: deb URI: http://ftp.debian.org/debian -Suite: stable -Section: main +Suites: stable +Sections: main Comment: Some random string that can be very long" @@ -70,7 +70,7 @@ testequalwithmsg "Invalid sources.list file gives proper error" "E: Malformed li E: The list of sources could not be read." aptget update --print-uris echo "Type: deb -Suite: stable +Suites: stable " > $SOURCES testequalwithmsg "Invalid deb822 sources.list file gives proper error" "E: Malformed stanza 0 in source list $TMPWORKINGDIRECTORY/rootdir/etc/apt/sources.list (URI parse) diff --git a/test/libapt/sourcelist_test.cc b/test/libapt/sourcelist_test.cc index 6a625770f..ae5d11f66 100644 --- a/test/libapt/sourcelist_test.cc +++ b/test/libapt/sourcelist_test.cc @@ -24,8 +24,8 @@ int main(int argc, char *argv[]) const char contents[] = "" "Type: deb\n" "URI: http://ftp.debian.org/debian\n" - "Suite: stable\n" - "Section: main\n" + "Suites: stable\n" + "Sections: main\n" "Comment: Some random string\n" " that can be very long\n" "\n" -- cgit v1.2.3 From e67b9a23d7646d2f1e21bf4039fa71cc66b628c5 Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Mon, 20 Jan 2014 07:43:17 +0100 Subject: add Description tag for deb822 sources --- test/integration/test-apt-sources-deb822 | 6 +++--- test/libapt/sourcelist_test.cc | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) (limited to 'test') diff --git a/test/integration/test-apt-sources-deb822 b/test/integration/test-apt-sources-deb822 index c73b942d4..34708d2d1 100755 --- a/test/integration/test-apt-sources-deb822 +++ b/test/integration/test-apt-sources-deb822 @@ -23,12 +23,11 @@ Type: deb URI: http://ftp.debian.org/debian Suites: stable Sections: main -Comment: Some random string - that can be very long" +Description: summay + and the long part" # simple case echo "$BASE" > $SOURCES - testequalwithmsg "Simple deb822 sources.list works" "'http://ftp.debian.org/debian/dists/stable/main/binary-i386/Packages.bz2' ftp.debian.org_debian_dists_stable_main_binary-i386_Packages 0 : 'http://ftp.debian.org/debian/dists/stable/main/i18n/Translation-en.bz2' ftp.debian.org_debian_dists_stable_main_i18n_Translation-en 0 : 'http://ftp.debian.org/debian/dists/stable/InRelease' ftp.debian.org_debian_dists_stable_InRelease 0 " aptget update --print-uris @@ -75,3 +74,4 @@ Suites: stable testequalwithmsg "Invalid deb822 sources.list file gives proper error" "E: Malformed stanza 0 in source list $TMPWORKINGDIRECTORY/rootdir/etc/apt/sources.list (URI parse) E: The list of sources could not be read." aptget update --print-uris + diff --git a/test/libapt/sourcelist_test.cc b/test/libapt/sourcelist_test.cc index ae5d11f66..b9dd47207 100644 --- a/test/libapt/sourcelist_test.cc +++ b/test/libapt/sourcelist_test.cc @@ -26,8 +26,8 @@ int main(int argc, char *argv[]) "URI: http://ftp.debian.org/debian\n" "Suites: stable\n" "Sections: main\n" - "Comment: Some random string\n" - " that can be very long\n" + "Description: short\n" + " long description that can be very long\n" "\n" "Type: deb\n" "URI: http://ftp.debian.org/debian\n" -- cgit v1.2.3 From 7dd62ea93413a73b4ec394b16ff4e0367d226395 Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Mon, 20 Jan 2014 07:59:11 +0100 Subject: add support for Enabled: no in deb822 sources.list --- test/integration/test-apt-sources-deb822 | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'test') diff --git a/test/integration/test-apt-sources-deb822 b/test/integration/test-apt-sources-deb822 index 34708d2d1..f461314e6 100755 --- a/test/integration/test-apt-sources-deb822 +++ b/test/integration/test-apt-sources-deb822 @@ -75,3 +75,7 @@ Suites: stable testequalwithmsg "Invalid deb822 sources.list file gives proper error" "E: Malformed stanza 0 in source list $TMPWORKINGDIRECTORY/rootdir/etc/apt/sources.list (URI parse) E: The list of sources could not be read." aptget update --print-uris +# with Enabled: false +echo "$BASE" > $SOURCES +echo "Enabled: no" >> $SOURCES +testempty aptget update --print-uris -- cgit v1.2.3 From 75c10df1533ede97e05fef3d1e2fc6a22fc4db00 Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Mon, 20 Jan 2014 08:10:50 +0100 Subject: add support for multiple URIs in deb822 style sources.list --- test/integration/test-apt-sources-deb822 | 11 ++++++++++- test/libapt/sourcelist_test.cc | 4 ++-- 2 files changed, 12 insertions(+), 3 deletions(-) (limited to 'test') diff --git a/test/integration/test-apt-sources-deb822 b/test/integration/test-apt-sources-deb822 index f461314e6..5c91dd6f5 100755 --- a/test/integration/test-apt-sources-deb822 +++ b/test/integration/test-apt-sources-deb822 @@ -20,7 +20,7 @@ BASE="# some comment #Type: meep Type: deb -URI: http://ftp.debian.org/debian +URIs: http://ftp.debian.org/debian Suites: stable Sections: main Description: summay @@ -79,3 +79,12 @@ E: The list of sources could not be read." aptget update --print-uris echo "$BASE" > $SOURCES echo "Enabled: no" >> $SOURCES testempty aptget update --print-uris + +# multiple URIs +echo "$BASE" | sed -e 's#http://ftp.debian.org/debian#http://ftp.debian.org/debian http://ftp.de.debian.org/debian#' > $SOURCES +testequalwithmsg "Multiple URIs work" "'http://ftp.de.debian.org/debian/dists/stable/main/binary-i386/Packages.bz2' ftp.de.debian.org_debian_dists_stable_main_binary-i386_Packages 0 : +'http://ftp.de.debian.org/debian/dists/stable/main/i18n/Translation-en.bz2' ftp.de.debian.org_debian_dists_stable_main_i18n_Translation-en 0 : +'http://ftp.de.debian.org/debian/dists/stable/InRelease' ftp.de.debian.org_debian_dists_stable_InRelease 0 +'http://ftp.debian.org/debian/dists/stable/main/binary-i386/Packages.bz2' ftp.debian.org_debian_dists_stable_main_binary-i386_Packages 0 : +'http://ftp.debian.org/debian/dists/stable/main/i18n/Translation-en.bz2' ftp.debian.org_debian_dists_stable_main_i18n_Translation-en 0 : +'http://ftp.debian.org/debian/dists/stable/InRelease' ftp.debian.org_debian_dists_stable_InRelease 0 " aptget update --print-uris diff --git a/test/libapt/sourcelist_test.cc b/test/libapt/sourcelist_test.cc index b9dd47207..3597b3d58 100644 --- a/test/libapt/sourcelist_test.cc +++ b/test/libapt/sourcelist_test.cc @@ -23,14 +23,14 @@ int main(int argc, char *argv[]) { const char contents[] = "" "Type: deb\n" - "URI: http://ftp.debian.org/debian\n" + "URIs: http://ftp.debian.org/debian\n" "Suites: stable\n" "Sections: main\n" "Description: short\n" " long description that can be very long\n" "\n" "Type: deb\n" - "URI: http://ftp.debian.org/debian\n" + "URIs: http://ftp.debian.org/debian\n" "Suite: unstable\n" "Section: main non-free\n" ; -- cgit v1.2.3 From 7f316a3feab95370f1dd28c08c58bc3c140bf0a0 Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Mon, 20 Jan 2014 08:17:43 +0100 Subject: add support for multipl types in one line --- test/integration/test-apt-sources-deb822 | 13 ++++++++++--- test/libapt/sourcelist_test.cc | 8 ++++---- 2 files changed, 14 insertions(+), 7 deletions(-) (limited to 'test') diff --git a/test/integration/test-apt-sources-deb822 b/test/integration/test-apt-sources-deb822 index 5c91dd6f5..e74fc4cb9 100755 --- a/test/integration/test-apt-sources-deb822 +++ b/test/integration/test-apt-sources-deb822 @@ -17,9 +17,9 @@ testequalwithmsg "Old style sources.list works" "'http://ftp.debian.org/debian/d BASE="# some comment # that contains a : as well -#Type: meep +#Types: meep -Type: deb +Types: deb URIs: http://ftp.debian.org/debian Suites: stable Sections: main @@ -68,7 +68,7 @@ echo "deb http://ftp.debian.org" > $SOURCES testequalwithmsg "Invalid sources.list file gives proper error" "E: Malformed line 1 in source list $TMPWORKINGDIRECTORY/rootdir/etc/apt/sources.list (dist) E: The list of sources could not be read." aptget update --print-uris -echo "Type: deb +echo "Types: deb Suites: stable " > $SOURCES @@ -88,3 +88,10 @@ testequalwithmsg "Multiple URIs work" "'http://ftp.de.debian.org/debian/dists/st 'http://ftp.debian.org/debian/dists/stable/main/binary-i386/Packages.bz2' ftp.debian.org_debian_dists_stable_main_binary-i386_Packages 0 : 'http://ftp.debian.org/debian/dists/stable/main/i18n/Translation-en.bz2' ftp.debian.org_debian_dists_stable_main_i18n_Translation-en 0 : 'http://ftp.debian.org/debian/dists/stable/InRelease' ftp.debian.org_debian_dists_stable_InRelease 0 " aptget update --print-uris + +# multiple Type in one field +echo "$BASE" | sed -e 's#Types: deb#Types: deb deb-src#' > $SOURCES +testequalwithmsg "Multiple Types work" "'http://ftp.debian.org/debian/dists/stable/main/source/Sources.bz2' ftp.debian.org_debian_dists_stable_main_source_Sources 0 : +'http://ftp.debian.org/debian/dists/stable/main/binary-i386/Packages.bz2' ftp.debian.org_debian_dists_stable_main_binary-i386_Packages 0 : +'http://ftp.debian.org/debian/dists/stable/main/i18n/Translation-en.bz2' ftp.debian.org_debian_dists_stable_main_i18n_Translation-en 0 : +'http://ftp.debian.org/debian/dists/stable/InRelease' ftp.debian.org_debian_dists_stable_InRelease 0 " aptget update --print-uris diff --git a/test/libapt/sourcelist_test.cc b/test/libapt/sourcelist_test.cc index 3597b3d58..6ab30ba67 100644 --- a/test/libapt/sourcelist_test.cc +++ b/test/libapt/sourcelist_test.cc @@ -22,17 +22,17 @@ void remove_tmpfile(void) int main(int argc, char *argv[]) { const char contents[] = "" - "Type: deb\n" + "Types: deb\n" "URIs: http://ftp.debian.org/debian\n" "Suites: stable\n" "Sections: main\n" "Description: short\n" " long description that can be very long\n" "\n" - "Type: deb\n" + "Types: deb\n" "URIs: http://ftp.debian.org/debian\n" - "Suite: unstable\n" - "Section: main non-free\n" + "Suites: unstable\n" + "Sections: main non-free\n" ; FileFd fd; -- cgit v1.2.3 From 1bef0dd58a281ca2f2900a48459d2c87b4ba8bba Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Wed, 22 Jan 2014 08:25:02 +0100 Subject: add integration test for apt search --- test/integration/test-apt-binary | 47 ------------------------------------ test/integration/test-apt-cli-list | 47 ++++++++++++++++++++++++++++++++++++ test/integration/test-apt-cli-search | 45 ++++++++++++++++++++++++++++++++++ 3 files changed, 92 insertions(+), 47 deletions(-) delete mode 100755 test/integration/test-apt-binary create mode 100755 test/integration/test-apt-cli-list create mode 100755 test/integration/test-apt-cli-search (limited to 'test') diff --git a/test/integration/test-apt-binary b/test/integration/test-apt-binary deleted file mode 100755 index 8d5df9051..000000000 --- a/test/integration/test-apt-binary +++ /dev/null @@ -1,47 +0,0 @@ -#!/bin/sh -set -e - -TESTDIR=$(readlink -f $(dirname $0)) -. $TESTDIR/framework - -setupenvironment -configarchitecture "i386" - -insertpackage 'unstable' 'foo' 'all' '1.0' -insertinstalledpackage 'bar' 'i386' '1.0' - -insertinstalledpackage 'foobar' 'i386' '1.0' -insertpackage 'unstable' 'foobar' 'i386' '2.0' - -setupaptarchive - -APTARCHIVE=$(readlink -f ./aptarchive) - -testequal "Listing... -bar/now 1.0 [installed,local] i386 -foo/unstable 1.0 all -foobar/unstable 2.0 [upgradable from: 1.0] i386" apt list - -testequal "Listing... -foo/unstable 1.0 all -foobar/unstable 2.0 [upgradable from: 1.0] i386" apt list "foo*" - -testequal "Listing... -foobar/unstable 2.0 [upgradable from: 1.0] i386" apt list --upgradable - -# FIXME: hm, hm - does it make sense to have this different? shouldn't -# we use "installed,upgradable" consitently? -testequal "Listing... -bar/now 1.0 [installed,local] i386 -foobar/now 1.0 [installed,upgradable to: 2.0] i386" apt list --installed - -testequal "Listing... -foobar/unstable 2.0 [upgradable from: 1.0] i386 -foobar/now 1.0 [installed,upgradable to: 2.0] i386 -" apt list foobar --all-versions - -testequal "Listing... -bar/now 1.0 [installed,local] i386 - an autogenerated dummy bar=1.0/installed -" apt list bar --verbose - diff --git a/test/integration/test-apt-cli-list b/test/integration/test-apt-cli-list new file mode 100755 index 000000000..8d5df9051 --- /dev/null +++ b/test/integration/test-apt-cli-list @@ -0,0 +1,47 @@ +#!/bin/sh +set -e + +TESTDIR=$(readlink -f $(dirname $0)) +. $TESTDIR/framework + +setupenvironment +configarchitecture "i386" + +insertpackage 'unstable' 'foo' 'all' '1.0' +insertinstalledpackage 'bar' 'i386' '1.0' + +insertinstalledpackage 'foobar' 'i386' '1.0' +insertpackage 'unstable' 'foobar' 'i386' '2.0' + +setupaptarchive + +APTARCHIVE=$(readlink -f ./aptarchive) + +testequal "Listing... +bar/now 1.0 [installed,local] i386 +foo/unstable 1.0 all +foobar/unstable 2.0 [upgradable from: 1.0] i386" apt list + +testequal "Listing... +foo/unstable 1.0 all +foobar/unstable 2.0 [upgradable from: 1.0] i386" apt list "foo*" + +testequal "Listing... +foobar/unstable 2.0 [upgradable from: 1.0] i386" apt list --upgradable + +# FIXME: hm, hm - does it make sense to have this different? shouldn't +# we use "installed,upgradable" consitently? +testequal "Listing... +bar/now 1.0 [installed,local] i386 +foobar/now 1.0 [installed,upgradable to: 2.0] i386" apt list --installed + +testequal "Listing... +foobar/unstable 2.0 [upgradable from: 1.0] i386 +foobar/now 1.0 [installed,upgradable to: 2.0] i386 +" apt list foobar --all-versions + +testequal "Listing... +bar/now 1.0 [installed,local] i386 + an autogenerated dummy bar=1.0/installed +" apt list bar --verbose + diff --git a/test/integration/test-apt-cli-search b/test/integration/test-apt-cli-search new file mode 100755 index 000000000..aa6018bca --- /dev/null +++ b/test/integration/test-apt-cli-search @@ -0,0 +1,45 @@ +#!/bin/sh +set -e + +TESTDIR=$(readlink -f $(dirname $0)) +. $TESTDIR/framework + +setupenvironment +configarchitecture "i386" + +DESCR='Some description that has a unusual word xxyyzz and aabbcc' +DESCR2='Some other description with the unusual aabbcc only' +insertpackage 'unstable' 'foo' 'all' '1.0' '' '' "$DESCR" +insertpackage 'testing' 'bar' 'i386' '2.0' '' '' "$DESCR2" + +setupaptarchive + +APTARCHIVE=$(readlink -f ./aptarchive) + +# with OP progress +testequal "Sorting... +Full Text Search... +foo/unstable 1.0 all + $DESCR +" apt search xxyyzz + +# without op progress +testequal "foo/unstable 1.0 all + $DESCR +" apt search -qq xxyyzz + +# search with multiple words is a AND search +testequal "foo/unstable 1.0 all + $DESCR +" apt search -qq aabbcc xxyyzz + +# output is sorted and search word finds both package +testequal "bar/testing 2.0 i386 + $DESCR2 + +foo/unstable 1.0 all + $DESCR +" apt search -qq aabbcc + + + -- cgit v1.2.3 From 6d73fe5be080e66a4f6ff2b250ed1957ae7ac063 Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Wed, 22 Jan 2014 16:41:00 +0100 Subject: add test for apt show --- test/integration/test-apt-cli-search | 3 --- test/integration/test-apt-cli-show | 29 +++++++++++++++++++++++++++++ 2 files changed, 29 insertions(+), 3 deletions(-) create mode 100755 test/integration/test-apt-cli-show (limited to 'test') diff --git a/test/integration/test-apt-cli-search b/test/integration/test-apt-cli-search index aa6018bca..979aff880 100755 --- a/test/integration/test-apt-cli-search +++ b/test/integration/test-apt-cli-search @@ -40,6 +40,3 @@ testequal "bar/testing 2.0 i386 foo/unstable 1.0 all $DESCR " apt search -qq aabbcc - - - diff --git a/test/integration/test-apt-cli-show b/test/integration/test-apt-cli-show new file mode 100755 index 000000000..0ab3d2e56 --- /dev/null +++ b/test/integration/test-apt-cli-show @@ -0,0 +1,29 @@ +#!/bin/sh +set -e + +TESTDIR=$(readlink -f $(dirname $0)) +. $TESTDIR/framework + +setupenvironment +configarchitecture "i386" + +DESCR='Some description + That has multiple lines' +insertpackage 'unstable' 'foo' 'all' '1.0' '' '' "$DESCR" + +setupaptarchive + +APTARCHIVE=$(readlink -f ./aptarchive) + +# note that we do not display Description-md5 with the "apt" cmd +testequal "Package: foo +Priority: optional +Section: other +Installed-Size: 42 +Maintainer: Joe Sixpack +Architecture: all +Version: 1.0 +Filename: pool/main/foo/foo_1.0_all.deb +Description: Some description + That has multiple lines +" apt show foo -- cgit v1.2.3 From 9e51c0b6a3a1a36336820eda11bcfd5534d9d80c Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Wed, 22 Jan 2014 17:18:26 +0100 Subject: "apt show" show user friendly size info The size/installed-size is displayed via SizeToStr() and Size is rewriten to "Download-Size" to make clear what size is refered to here. --- test/integration/test-apt-cli-show | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'test') diff --git a/test/integration/test-apt-cli-show b/test/integration/test-apt-cli-show index 0ab3d2e56..bbb2de7ef 100755 --- a/test/integration/test-apt-cli-show +++ b/test/integration/test-apt-cli-show @@ -19,11 +19,12 @@ APTARCHIVE=$(readlink -f ./aptarchive) testequal "Package: foo Priority: optional Section: other -Installed-Size: 42 +Installed-Size: 43.0 k Maintainer: Joe Sixpack Architecture: all Version: 1.0 Filename: pool/main/foo/foo_1.0_all.deb +Download-Size: unknown Description: Some description That has multiple lines " apt show foo -- cgit v1.2.3 From 0c8b6001694bb0ddf9eb6bc4936151592e1a07fa Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Thu, 23 Jan 2014 08:12:02 +0100 Subject: include "Archive-Origin" in the apt show output --- test/integration/test-apt-cli-show | 1 + 1 file changed, 1 insertion(+) (limited to 'test') diff --git a/test/integration/test-apt-cli-show b/test/integration/test-apt-cli-show index bbb2de7ef..ba56e3260 100755 --- a/test/integration/test-apt-cli-show +++ b/test/integration/test-apt-cli-show @@ -25,6 +25,7 @@ Architecture: all Version: 1.0 Filename: pool/main/foo/foo_1.0_all.deb Download-Size: unknown +Archive-Origin: unstable Description: Some description That has multiple lines " apt show foo -- cgit v1.2.3 From 59e81cec3e2277e367f14f113168421909c42035 Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Fri, 24 Jan 2014 20:33:02 +0100 Subject: add "apt full-upgrade" and tweak "apt upgrade" There is a new "apt full-upgrade" that performs a apt-get dist-upgrade. "apt dist-upgrade" is still supported as a alias. The "apt upgrade" code is changed so that it mirrors the behavior of "apt-get upgrade --with-new-pkgs" and also honors "apt uprade --no-new-pkgs". --- test/integration/test-apt-cli-upgrade | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100755 test/integration/test-apt-cli-upgrade (limited to 'test') diff --git a/test/integration/test-apt-cli-upgrade b/test/integration/test-apt-cli-upgrade new file mode 100755 index 000000000..163a55576 --- /dev/null +++ b/test/integration/test-apt-cli-upgrade @@ -0,0 +1,34 @@ +#!/bin/sh +set -e + +TESTDIR=$(readlink -f $(dirname $0)) +. $TESTDIR/framework + +setupenvironment +configarchitecture "i386" + +insertpackage 'unstable' 'foo' 'all' '2.0' 'Depends: foo-new-dependency' +insertpackage 'unstable' 'foo-new-dependency' 'all' '2.0' +insertinstalledpackage 'foo' 'all' '1.0' + +setupaptarchive + +APTARCHIVE=$(readlink -f ./aptarchive) + +# default is to allow new dependencies +testequal "Calculating upgrade... Done +The following NEW packages will be installed: + foo-new-dependency +The following packages will be upgraded: + foo +1 upgraded, 1 newly installed, 0 to remove and 0 not upgraded. +Inst foo-new-dependency (2.0 unstable [all]) +Inst foo [1.0] (2.0 unstable [all]) +Conf foo-new-dependency (2.0 unstable [all]) +Conf foo (2.0 unstable [all])" apt upgrade -qq -s + +# ensure +testequal "Calculating upgrade... Done +The following packages have been kept back: + foo +0 upgraded, 0 newly installed, 0 to remove and 1 not upgraded." apt upgrade -qq -s --no-new-pkgs -- cgit v1.2.3 From 85d7c0eb60efd0de13ad331676b6227f52bed6c6 Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Fri, 24 Jan 2014 21:03:49 +0100 Subject: Show "Manual-Installed: {yes|no}" in apt show --- test/integration/test-apt-cli-show | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'test') diff --git a/test/integration/test-apt-cli-show b/test/integration/test-apt-cli-show index ba56e3260..11a93f268 100755 --- a/test/integration/test-apt-cli-show +++ b/test/integration/test-apt-cli-show @@ -10,12 +10,14 @@ configarchitecture "i386" DESCR='Some description That has multiple lines' insertpackage 'unstable' 'foo' 'all' '1.0' '' '' "$DESCR" +insertinstalledpackage 'foo' 'all' '1.0' setupaptarchive APTARCHIVE=$(readlink -f ./aptarchive) # note that we do not display Description-md5 with the "apt" cmd +# and also show some additional fields that are calculated testequal "Package: foo Priority: optional Section: other @@ -25,7 +27,8 @@ Architecture: all Version: 1.0 Filename: pool/main/foo/foo_1.0_all.deb Download-Size: unknown -Archive-Origin: unstable +Archive-Origin: unstable,now +Manual-Installed: yes Description: Some description That has multiple lines " apt show foo -- cgit v1.2.3 From 17622532ce19a1bcebfebdfc9ec20a7e3df9dbff Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Fri, 24 Jan 2014 22:20:28 +0100 Subject: hide more from apt show Hide the Hashes,Filename,Multi-Arch,Architecture by default from "apt show". The information is still available via apt-cache show. Also improve the output of the Size- --- test/integration/test-apt-cli-show | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) (limited to 'test') diff --git a/test/integration/test-apt-cli-show b/test/integration/test-apt-cli-show index 11a93f268..91cc9a3c0 100755 --- a/test/integration/test-apt-cli-show +++ b/test/integration/test-apt-cli-show @@ -21,14 +21,12 @@ APTARCHIVE=$(readlink -f ./aptarchive) testequal "Package: foo Priority: optional Section: other -Installed-Size: 43.0 k +Installed-Size: 43.0 kB Maintainer: Joe Sixpack -Architecture: all Version: 1.0 -Filename: pool/main/foo/foo_1.0_all.deb Download-Size: unknown -Archive-Origin: unstable,now -Manual-Installed: yes +APT-Manual-Installed: yes +APT-Sources: file:$APTARCHIVE/ unstable/main i386 Packages Description: Some description That has multiple lines " apt show foo -- cgit v1.2.3 From 5d9667d92a9d6973fc001c27d618bc878a4df2ba Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Fri, 24 Jan 2014 23:29:10 +0100 Subject: fix test --- test/libapt/sourcelist_test.cc | 2 ++ 1 file changed, 2 insertions(+) (limited to 'test') diff --git a/test/libapt/sourcelist_test.cc b/test/libapt/sourcelist_test.cc index 6fc84fd93..0300ce929 100644 --- a/test/libapt/sourcelist_test.cc +++ b/test/libapt/sourcelist_test.cc @@ -21,6 +21,8 @@ void remove_tmpfile(void) int main(int argc, char *argv[]) { + _config->Set("APT::Sources::Use-Deb822", true); + const char contents[] = "" "Types: deb\n" "URIs: http://ftp.debian.org/debian\n" -- cgit v1.2.3 From 41e6bd080db8995bc7617569f0719bccc31e0da8 Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Sat, 25 Jan 2014 14:53:03 +0100 Subject: support " " in deb822 source options --- test/integration/test-apt-sources-deb822 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'test') diff --git a/test/integration/test-apt-sources-deb822 b/test/integration/test-apt-sources-deb822 index 6e9a02417..723796018 100755 --- a/test/integration/test-apt-sources-deb822 +++ b/test/integration/test-apt-sources-deb822 @@ -66,7 +66,7 @@ testequal --nomsg "'http://ftp.debian.org/debian/dists/stable/main/binary-i386/P msgtest 'Test deb822' 'architecture option' echo "$BASE" > $SOURCES -echo "Architectures: amd64,armel" >> $SOURCES +echo "Architectures: amd64 armel" >> $SOURCES testequal --nomsg "'http://ftp.debian.org/debian/dists/stable/main/binary-amd64/Packages.bz2' ftp.debian.org_debian_dists_stable_main_binary-amd64_Packages 0 : 'http://ftp.debian.org/debian/dists/stable/main/binary-armel/Packages.bz2' ftp.debian.org_debian_dists_stable_main_binary-armel_Packages 0 : 'http://ftp.debian.org/debian/dists/stable/main/i18n/Translation-en.bz2' ftp.debian.org_debian_dists_stable_main_i18n_Translation-en 0 : -- cgit v1.2.3