diff options
Diffstat (limited to 'test/integration')
-rw-r--r-- | test/integration/framework | 11 | ||||
-rwxr-xr-x | test/integration/test-apt-by-hash-update | 2 | ||||
-rwxr-xr-x | test/integration/test-apt-extracttemplates | 2 | ||||
-rwxr-xr-x | test/integration/test-apt-get-changelog | 9 | ||||
-rwxr-xr-x | test/integration/test-apt-get-install-deb | 18 | ||||
-rwxr-xr-x | test/integration/test-apt-get-source | 9 | ||||
-rwxr-xr-x | test/integration/test-apt-translation-has-no-packages | 2 | ||||
-rwxr-xr-x | test/integration/test-apt-update-nofallback | 2 | ||||
-rwxr-xr-x | test/integration/test-bug-796070-downgrade-realpkg | 23 | ||||
-rwxr-xr-x | test/integration/test-bug-796070-downgrade-simulate | 67 | ||||
-rwxr-xr-x | test/integration/test-releasefile-verification | 2 | ||||
-rwxr-xr-x | test/integration/test-sourceslist-target-plusminus-options | 66 |
12 files changed, 202 insertions, 11 deletions
diff --git a/test/integration/framework b/test/integration/framework index d9282eede..03f1be114 100644 --- a/test/integration/framework +++ b/test/integration/framework @@ -1196,9 +1196,16 @@ checkdiff() { } testfileequal() { + local MSG='Test for correctness of file' + if [ "$1" = '--nomsg' ]; then + MSG='' + shift + fi local FILE="$1" shift - msgtest "Test for correctness of file" "$FILE" + if [ -n "$MSG" ]; then + msgtest "$MSG" "$FILE" + fi if [ -z "$*" ]; then echo -n "" | checkdiff - $FILE && msgpass || msgfail else @@ -1555,7 +1562,7 @@ listcurrentlistsdirectory() { } | sort } -### convinience hacks ### +### convenience hacks ### mkdir() { # creating some directories by hand is a tedious task, so make it look simple if [ "$*" = '-p rootdir/var/lib/apt/lists' ] || [ "$*" = "${TMPWORKINGDIRECTORY}/rootdir/var/lib/apt/lists" ] || diff --git a/test/integration/test-apt-by-hash-update b/test/integration/test-apt-by-hash-update index 2229e991d..cef46a1b8 100755 --- a/test/integration/test-apt-by-hash-update +++ b/test/integration/test-apt-by-hash-update @@ -11,7 +11,7 @@ insertpackage 'unstable' 'foo' 'all' '1.0' setupaptarchive --no-update -# make Packages *only* accessable by-hash for this test +# make Packages *only* accessible by-hash for this test mkdir -p aptarchive/dists/unstable/main/binary-i386/by-hash/SHA512 (cd aptarchive/dists/unstable/main/binary-i386/by-hash/SHA512 && mv ../../Packages* . && diff --git a/test/integration/test-apt-extracttemplates b/test/integration/test-apt-extracttemplates index 5dadc4933..8f335589e 100755 --- a/test/integration/test-apt-extracttemplates +++ b/test/integration/test-apt-extracttemplates @@ -10,7 +10,7 @@ configarchitecture 'amd64' # apt-extracttemplates needs this insertinstalledpackage 'pkg-with-template' 'amd64' '1.0' -# build a simple package that contains a config and a tempalte +# build a simple package that contains a config and a template mkdir -p DEBIAN CONFIG_STR="#!/bin/sh random shell stuff diff --git a/test/integration/test-apt-get-changelog b/test/integration/test-apt-get-changelog index 5fa8543b9..6ca05d0fa 100755 --- a/test/integration/test-apt-get-changelog +++ b/test/integration/test-apt-get-changelog @@ -60,14 +60,15 @@ testsuccessequal "'http://localhost:8080/main/f/foo/foo_1.0/change.txt' foo.chan echo 'Acquire::Changelogs::URI::Label::Testcases "http://localhost:8080/pool/CHANGEPATH/changelog";' > rootdir/etc/apt/apt.conf.d/changelog.conf testsuccessequal "'http://localhost:8080/pool/main/f/foo/foo_1.0/changelog' foo.changelog" aptget changelog foo --print-uris -cd downloaded testsuccess aptget changelog foo -qq -testfileequal '../rootdir/tmp/testsuccess.output' "$(cat ../aptarchive/pool/main/f/foo/foo_1.0/changelog)" +testfileequal 'rootdir/tmp/testsuccess.output' "$(cat aptarchive/pool/main/f/foo/foo_1.0/changelog)" testsuccess aptget changelog foo libbar -qq -testfileequal '../rootdir/tmp/testsuccess.output' "$(cat ../aptarchive/pool/main/f/foo/foo_1.0/changelog) -$(cat ../aptarchive/pool/main/libb/libbar/libbar_1.0/changelog)" +testfileequal 'rootdir/tmp/testsuccess.output' "$(cat aptarchive/pool/main/f/foo/foo_1.0/changelog) +$(cat aptarchive/pool/main/libb/libbar/libbar_1.0/changelog)" + +cd downloaded testsuccess aptget changelog foo -d testfilestats 'foo.changelog' '%U:%G:%a' '=' "${TEST_DEFAULT_USER}:${TEST_DEFAULT_GROUP}:644" diff --git a/test/integration/test-apt-get-install-deb b/test/integration/test-apt-get-install-deb index bd720bede..65951cede 100755 --- a/test/integration/test-apt-get-install-deb +++ b/test/integration/test-apt-get-install-deb @@ -60,3 +60,21 @@ The following NEW packages will be installed: Remv foo:i386 [1.0] Inst foo (1.0 local-deb [amd64]) Conf foo (1.0 local-deb [amd64])" aptget install ./incoming/foo_1.0_amd64.deb -s -q=0 + +# Check that installing the local deb works if it is not the candidate +echo "Package: foo +Pin: version 1.0 +Pin-Priority: -1" > rootdir/etc/apt/preferences + +testsuccessequal "Reading package lists... +Building dependency tree... +Reading state information... +Note, selecting 'foo' instead of './incoming/foo_1.0_amd64.deb' +The following packages will be REMOVED: + foo:i386 +The following NEW packages will be installed: + foo +0 upgraded, 1 newly installed, 1 to remove and 0 not upgraded. +Remv foo:i386 [1.0] +Inst foo (1.0 local-deb [amd64]) +Conf foo (1.0 local-deb [amd64])" aptget install ./incoming/foo_1.0_amd64.deb -s -q=0 diff --git a/test/integration/test-apt-get-source b/test/integration/test-apt-get-source index 22f01b997..03320754b 100755 --- a/test/integration/test-apt-get-source +++ b/test/integration/test-apt-get-source @@ -50,11 +50,20 @@ $DOWNLOAD1" aptget source -q --print-uris foo/stable testsuccessequal "$HEADER Selected version '2.0' (unstable) for foo $DOWNLOAD2" aptget source -q --print-uris foo/unstable +testsuccessequal "$HEADER +Selected version '1.0' (stable) for foo +$DOWNLOAD1" aptget source -q --print-uris foo -t stable +testsuccessequal "$HEADER +Selected version '2.0' (unstable) for foo +$DOWNLOAD2" aptget source -q --print-uris foo -t unstable # select by release: codename testsuccessequal "$HEADER Selected version '2.0' (sid) for foo $DOWNLOAD2" aptget source -q --print-uris foo/sid +testsuccessequal "$HEADER +Selected version '2.0' (sid) for foo +$DOWNLOAD2" aptget source -q --print-uris foo -t sid # select by version testsuccessequal "$HEADER diff --git a/test/integration/test-apt-translation-has-no-packages b/test/integration/test-apt-translation-has-no-packages index ec2e1e43b..fec525568 100755 --- a/test/integration/test-apt-translation-has-no-packages +++ b/test/integration/test-apt-translation-has-no-packages @@ -4,7 +4,7 @@ # Translation-$lang file on disk that is actually a Packages file. In this # case apt used to generate invalid package versions out of the # Translation-$lang file (i.e. apt-cache policy foo) would show a version -# comming out of a Translation file. Downloading this versions fails as +# coming out of a Translation file. Downloading this versions fails as # there is no acquire method available for the package # set -e diff --git a/test/integration/test-apt-update-nofallback b/test/integration/test-apt-update-nofallback index 6e9db2cae..dae537c32 100755 --- a/test/integration/test-apt-update-nofallback +++ b/test/integration/test-apt-update-nofallback @@ -115,7 +115,7 @@ test_cve_2012_0214() # the unauthenticated Release file too giving the false impression that # Release was authenticated # - # Note that this is pretty much impossible nowdays because: + # Note that this is pretty much impossible nowadays because: # a) InRelease is left as is, not split to InRelease/Release as it was # in the old days # b) we refuse to go from signed->unsigned diff --git a/test/integration/test-bug-796070-downgrade-realpkg b/test/integration/test-bug-796070-downgrade-realpkg new file mode 100755 index 000000000..3ad4fda3e --- /dev/null +++ b/test/integration/test-bug-796070-downgrade-realpkg @@ -0,0 +1,23 @@ +#!/bin/sh +set -e + +TESTDIR=$(readlink -f $(dirname $0)) +. $TESTDIR/framework + +setupenvironment +configarchitecture 'i386' + +buildsimplenativepackage 'apt' 'all' '1.0.10.1' 'stable' 'Depends: libapt-pkg4.16 (>= 1.0.10.1)' +buildsimplenativepackage 'libapt-pkg4.16' 'all' '1.0.10.1' 'stable' 'Breaks: apt (<< 0.9.4~), libapt-inst1.5 (<< 0.9.9~)' +buildsimplenativepackage 'libapt-pkg5.0' 'all' '1.1~exp9' 'unstable' 'Breaks: apt (<< 1.1~exp4), libapt-inst1.5 (<< 0.9.9~)' +buildsimplenativepackage 'apt' 'all' '1.1~exp9' 'unstable' 'Depends: libapt-pkg5.0' + +setupaptarchive + +# Check with the APT name, aka essential +testsuccess aptget install apt -t stable -y +testsuccess aptget dist-upgrade -y + +testsuccess aptget install apt/stable -y --allow-downgrades -o Debug::pkgPackageManager=1 #-o Debug::pkgDpkgPM=1 +testdpkginstalled apt libapt-pkg4.16 +testdpkgnotinstalled libapt-pkg5.0 diff --git a/test/integration/test-bug-796070-downgrade-simulate b/test/integration/test-bug-796070-downgrade-simulate new file mode 100755 index 000000000..0b4817d39 --- /dev/null +++ b/test/integration/test-bug-796070-downgrade-simulate @@ -0,0 +1,67 @@ +#!/bin/sh +set -e + +TESTDIR=$(readlink -f $(dirname $0)) +. $TESTDIR/framework + +setupenvironment +configarchitecture 'i386' + +insertpackage 'unstable' 'apt' 'all' '1.0.10.1' 'Depends: libapt-pkg4.16 (>= 1.0.10.1)' +insertinstalledpackage 'libapt-pkg4.16' 'all' '1.0.10.1' 'Breaks: apt (<< 0.9.4~), libapt-inst1.5 (<< 0.9.9~)' +insertinstalledpackage 'libapt-pkg5.0' 'all' '1.1~exp9' 'Breaks: apt (<< 1.1~exp4), libapt-inst1.5 (<< 0.9.9~)' +insertinstalledpackage 'apt' 'all' '1.1~exp9' 'Depends: libapt-pkg5.0' + +insertpackage 'unstable' 'napt' 'all' '1.0.10.1' 'Depends: nlibapt-pkg4.16 (>= 1.0.10.1)' +insertinstalledpackage 'nlibapt-pkg4.16' 'all' '1.0.10.1' 'Breaks: napt (<< 0.9.4~), nlibapt-inst1.5 (<< 0.9.9~)' +insertinstalledpackage 'nlibapt-pkg5.0' 'all' '1.1~exp9' 'Breaks: napt (<< 1.1~exp4), nlibapt-inst1.5 (<< 0.9.9~)' +insertinstalledpackage 'napt' 'all' '1.1~exp9' 'Depends: nlibapt-pkg5.0' + +insertpackage 'unstable' 'eapt' 'all' '1.0.10.1' 'Depends: elibapt-pkg4.16 (>= 1.0.10.1) +Essential: yes' +insertinstalledpackage 'elibapt-pkg4.16' 'all' '1.0.10.1' 'Breaks: eapt (<< 0.9.4~), elibapt-inst1.5 (<< 0.9.9~)' +insertinstalledpackage 'elibapt-pkg5.0' 'all' '1.1~exp9' 'Breaks: eapt (<< 1.1~exp4), elibapt-inst1.5 (<< 0.9.9~)' +insertinstalledpackage 'eapt' 'all' '1.1~exp9' 'Depends: elibapt-pkg5.0 +Essential: yes' + + +setupaptarchive + + +# Check with a normal package +testsuccessequal 'Reading package lists... +Building dependency tree... +The following packages will be REMOVED: + nlibapt-pkg5.0 +The following packages will be DOWNGRADED: + napt +0 upgraded, 0 newly installed, 1 downgraded, 1 to remove and 0 not upgraded. +Remv nlibapt-pkg5.0 [1.1~exp9] [napt:i386 ] +Inst napt [1.1~exp9] (1.0.10.1 unstable [all]) +Conf napt (1.0.10.1 unstable [all])' apt install -s napt=1.0.10.1 + + +# Check with Essential +testsuccessequal 'Reading package lists... +Building dependency tree... +The following packages will be REMOVED: + elibapt-pkg5.0 +The following packages will be DOWNGRADED: + eapt +0 upgraded, 0 newly installed, 1 downgraded, 1 to remove and 0 not upgraded. +Inst eapt [1.1~exp9] (1.0.10.1 unstable [all]) [elibapt-pkg5.0:i386 on eapt:i386] [elibapt-pkg5.0:i386 ] +Remv elibapt-pkg5.0 [1.1~exp9] +Conf eapt (1.0.10.1 unstable [all])' apt install -s eapt=1.0.10.1 + + +# Check with the APT name, aka essential +testsuccessequal 'Reading package lists... +Building dependency tree... +The following packages will be REMOVED: + libapt-pkg5.0 +The following packages will be DOWNGRADED: + apt +0 upgraded, 0 newly installed, 1 downgraded, 1 to remove and 0 not upgraded. +Inst apt [1.1~exp9] (1.0.10.1 unstable [all]) [libapt-pkg5.0:i386 on apt:i386] [libapt-pkg5.0:i386 ] +Remv libapt-pkg5.0 [1.1~exp9] +Conf apt (1.0.10.1 unstable [all])' apt install -s apt=1.0.10.1 diff --git a/test/integration/test-releasefile-verification b/test/integration/test-releasefile-verification index c4d1455eb..60aa4421a 100755 --- a/test/integration/test-releasefile-verification +++ b/test/integration/test-releasefile-verification @@ -264,7 +264,7 @@ Acquire::AllowInsecureRepositories "1"; Acquire::AllowDowngradeToInsecureRepositories "1"; EOF -msgmsg "Runing base test" +msgmsg "Running base test" runtest2 DELETEFILE="InRelease" diff --git a/test/integration/test-sourceslist-target-plusminus-options b/test/integration/test-sourceslist-target-plusminus-options new file mode 100755 index 000000000..00d9085a0 --- /dev/null +++ b/test/integration/test-sourceslist-target-plusminus-options @@ -0,0 +1,66 @@ +#!/bin/sh +set -e + +TESTDIR=$(readlink -f $(dirname $0)) +. $TESTDIR/framework +setupenvironment +configarchitecture 'amd64' + +testtargets() { + msgtest 'Test acquired targets for' "$1" + shift + while [ -n "$1" ]; do + echo "$1" + shift + done | sort -u > expectedtargets.lst + aptget indextargets --no-release-info --format='$(CREATED_BY)' | sort -u > gottargets.lst + testfileequal --nomsg ./expectedtargets.lst "$(cat ./gottargets.lst)" +} + +echo 'deb http://example.org/debian stable rocks' > rootdir/etc/apt/sources.list +testtargets 'default' 'Packages' 'Translations' + +cat > rootdir/etc/apt/apt.conf.d/content-target.conf <<EOF +Acquire::IndexTargets::deb::Contents { + MetaKey "\$(COMPONENT)/Contents-\$(ARCHITECTURE)"; + ShortDescription "Contents"; + Description "\$(RELEASE)/\$(COMPONENT) \$(ARCHITECTURE) Contents"; +}; +EOF +testtargets 'default + Contents' 'Packages' 'Translations' 'Contents' + +echo 'deb [target=Packages] http://example.org/debian stable rocks' > rootdir/etc/apt/sources.list +testtargets 'force Packages target' 'Packages' + +echo 'deb [target=Contents] http://example.org/debian stable rocks' > rootdir/etc/apt/sources.list +testtargets 'force Contents target' 'Contents' + +echo 'deb [target=Translations,Contents] http://example.org/debian stable rocks' > rootdir/etc/apt/sources.list +testtargets 'force two targets' 'Contents' 'Translations' + +echo 'deb [target+=Translations,Contents] http://example.org/debian stable rocks' > rootdir/etc/apt/sources.list +testtargets 'add existing' 'Packages' 'Contents' 'Translations' + +echo 'deb [target+=AppStream] http://example.org/debian stable rocks' > rootdir/etc/apt/sources.list +testtargets 'add non-existing' 'Packages' 'Contents' 'Translations' + +echo 'deb [target-=Translations,Contents] http://example.org/debian stable rocks' > rootdir/etc/apt/sources.list +testtargets 'remove existing' 'Packages' + +echo 'deb [target-=AppStream] http://example.org/debian stable rocks' > rootdir/etc/apt/sources.list +testtargets 'remove non-existing' 'Packages' 'Contents' 'Translations' + +echo 'deb [AppStream=yes] http://example.org/debian stable rocks' > rootdir/etc/apt/sources.list +testtargets 'activate non-existing' 'Packages' 'Contents' 'Translations' + +echo 'deb [AppStream=no] http://example.org/debian stable rocks' > rootdir/etc/apt/sources.list +testtargets 'deactivate non-existing' 'Packages' 'Contents' 'Translations' + +echo 'deb [Contents=yes] http://example.org/debian stable rocks' > rootdir/etc/apt/sources.list +testtargets 'activate existing' 'Packages' 'Contents' 'Translations' + +echo 'deb [Contents=no] http://example.org/debian stable rocks' > rootdir/etc/apt/sources.list +testtargets 'deactivate existing' 'Packages' 'Translations' + +echo 'deb [target=Packages Contents=yes] http://example.org/debian stable rocks' > rootdir/etc/apt/sources.list +testtargets 'explicit + activate' 'Packages' 'Contents' |