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 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