diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 09:00:48 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 09:00:48 +0000 |
commit | 851b6a097165af4d51c0db01b5e05256e5006896 (patch) | |
tree | 5f7c388ec894a7806c49a99f3bdb605d0b299a7c /test/integration/test-apt-cache | |
parent | Initial commit. (diff) | |
download | apt-851b6a097165af4d51c0db01b5e05256e5006896.tar.xz apt-851b6a097165af4d51c0db01b5e05256e5006896.zip |
Adding upstream version 2.6.1.upstream/2.6.1upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '')
-rwxr-xr-x | test/integration/test-apt-cache | 183 | ||||
-rwxr-xr-x | test/integration/test-apt-cache-remapping | 48 | ||||
-rwxr-xr-x | test/integration/test-apt-cache-showsrc | 31 |
3 files changed, 262 insertions, 0 deletions
diff --git a/test/integration/test-apt-cache b/test/integration/test-apt-cache new file mode 100755 index 0000000..c003fba --- /dev/null +++ b/test/integration/test-apt-cache @@ -0,0 +1,183 @@ +#!/bin/sh +set -e + +TESTDIR="$(readlink -f "$(dirname "$0")")" +. "$TESTDIR/framework" + +setupenvironment +configarchitecture 'amd64' 'i386' + +DESCR='Some description + That has multiple lines' +insertpackage 'unstable' 'fancy' 'all' '1' +insertpackage 'unstable,installed' 'foo' 'all' '1' 'Depends: bar +Conflicts: foobar +Recommends: cool (>= 2) | cooler (<< 5)' "$DESCR" +insertpackage 'unstable' 'bar' 'all' '1' 'Depends: bar +Breaks: foo (<< 1) +Replaces: foo (<< 1)' "$DESCR" +insertpackage 'unstable' 'specific' 'all' '1' 'Depends: bar:i386, specific:amd64 +Breaks: foo:amd64 (<< 1) +Replaces: foo:i386 (<< 1)' "$DESCR" + +setupaptarchive + +insertinstalledpackage 'awesome' 'all' '1' +testdpkginstalled 'awesome' +testempty aptcache unmet awesome + +# FIXME: Find some usecase for unmet as it seems kinda useless/broken +#testsuccess aptcache unmet +#testsuccess aptcache unmet foo + +# not too useful to test, but makes coverage green… +testsuccess aptcache stats +cp rootdir/tmp/testsuccess.output stats.output +testsuccess test -s stats.output +testfailureequal 'E: apt-cache stats does not take any arguments' aptcache stats foo +testsuccess aptcache xvcg foo +cp rootdir/tmp/testsuccess.output xvcg.output +testsuccess test -s xvcg.output +testsuccess aptcache dotty foo +cp rootdir/tmp/testsuccess.output dotty.output +testsuccess test -s dotty.output +# for this, even the sourcecode says it is useless (expect debugging) +testsuccess aptcache dump +cp rootdir/tmp/testsuccess.output dump.output +testsuccess test -s dump.output + +testsuccessequal 'bar +foo +awesome +specific +fancy' aptcache pkgnames +testsuccessequal 'bar' aptcache pkgnames bar +testsuccessequal 'foo +fancy' aptcache pkgnames f + +testsuccessequal " foo | 1 | file:$(readlink -f .)/aptarchive unstable/main all Packages" aptcache madison foo + +### depends + +testsuccessequal 'foo + Depends: bar + Conflicts: <foobar> + |Recommends: <cool> + Recommends: <cooler>' aptcache depends foo +testsuccessequal 'foo + Depends: bar + Conflicts: <foobar> + |Recommends: <cool> + Recommends: <cooler>' aptcache depends foo --implicit +testsuccessequal 'foo + Depends: bar + Conflicts: <foobar> + Recommends: <cool>' aptcache depends foo -o APT::Cache::ShowOnlyFirstOr=1 +testsuccessequal 'foo + Depends: bar + Conflicts: <foobar> + Recommends: <cool>' aptcache depends foo -o APT::Cache::ShowOnlyFirstOr=1 --implicit +testsuccessequal 'foo + Depends: bar + Conflicts: <foobar> + |Recommends: <cool> (>= 2) + Recommends: <cooler> (<< 5)' aptcache depends foo -o APT::Cache::ShowVersion=1 +testsuccessequal 'foo + Depends: bar + Conflicts: <foobar> + |Recommends: <cool> (>= 2) + Recommends: <cooler> (<< 5)' aptcache depends foo -o APT::Cache::ShowVersion=1 --implicit +testsuccessequal 'foo + Depends: bar + Conflicts: <foobar>' aptcache depends foo --no-recommends +testsuccessequal 'foo + Depends: bar + Conflicts: <foobar>' aptcache depends foo --no-recommends --implicit +testsuccessequal 'foo + Depends: bar' aptcache depends foo --important --implicit +testsuccessequal 'foo + Conflicts: <foobar>' aptcache depends foo --important --no-depends --conflicts +testsuccessequal 'foo + Conflicts: <foobar>' aptcache depends foo --important --no-depends --conflicts --implicit +testsuccessequal 'foo + Depends: bar + Conflicts: <foobar> + |Recommends: <cool> + Recommends: <cooler> +bar + Depends: bar + Breaks: foo + Replaces: foo +<foobar> +<cool> +<cooler>' aptcache depends foo --recurse +testsuccessequal 'foo + Depends: bar + Conflicts: <foobar> + |Recommends: <cool> + Recommends: <cooler> +bar + Depends: bar + Breaks: foo + Replaces: foo + Breaks: <foo:i386> + Replaces: <foo:i386> +<foobar> +<cool> +<cooler> +<foo:i386>' aptcache depends foo --recurse --implicit +testsuccessequal 'foo + Depends: bar +bar + Depends: bar + Replaces: foo' aptcache depends foo --recurse --important --replaces +testsuccessequal 'foo + Depends: bar +bar + Depends: bar + Replaces: foo + Replaces: <foo:i386> +<foo:i386>' aptcache depends foo --recurse --important --replaces --implicit +testsuccessequal 'bar + Depends: bar + Breaks: foo + Replaces: foo' aptcache depends bar +testsuccessequal 'bar + Depends: bar + Breaks: foo + Replaces: foo + Breaks: <foo:i386> + Replaces: <foo:i386>' aptcache depends bar --implicit + +testsuccessequal 'specific + Depends: <bar:i386> + Depends: <specific:amd64> + specific + Breaks: <foo:amd64> + Replaces: <foo:i386>' aptcache depends specific +testsuccessequal 'specific + Depends: <bar:i386> + Depends: <specific:amd64> + specific + Breaks: <foo:amd64> + Replaces: <foo:i386>' aptcache depends specific --implicit + +## rdepends + +# Note that specific does not appear in this list as it doesn't depend on foo, +# but on an arch-specific foo! +testsuccessequal 'foo +Reverse Depends: + bar + bar' aptcache rdepends foo +testsuccessequal 'foo +Reverse Depends: + Breaks: bar + Replaces: bar' aptcache rdepends foo -o APT::Cache::ShowDependencyType=1 +testsuccessequal 'foo +Reverse Depends: + Breaks: bar (<< 1) + Replaces: bar (<< 1)' aptcache rdepends foo -o APT::Cache::ShowDependencyType=1 -o APT::Cache::ShowVersion=1 +testsuccessequal 'foo +Reverse Depends: + Breaks: bar (<< 1)' aptcache rdepends foo -o APT::Cache::ShowDependencyType=1 -o APT::Cache::ShowVersion=1 --important --breaks diff --git a/test/integration/test-apt-cache-remapping b/test/integration/test-apt-cache-remapping new file mode 100755 index 0000000..19647a6 --- /dev/null +++ b/test/integration/test-apt-cache-remapping @@ -0,0 +1,48 @@ +#!/bin/sh +set -e + +TESTDIR="$(readlink -f "$(dirname "$0")")" +. "$TESTDIR/framework" + +setupenvironment +configarchitecture 'amd64' + +buildsimplenativepackage 'foo' 'amd64' '1' +insertinstalledpackage 'bar' 'all' '1' + +# the default is 1MB – too much for our simple tests +echo 'APT::Cache-Grow "1000";' > rootdir/etc/apt/apt.conf.d/limit-cachegrow.conf + +# experiment with cache remapping +rm -f rootdir/var/cache/apt/*.bin +testsuccess apt install ./incoming/foo_1_amd64.deb -s +msgtest 'Cache files are generated in tests' +if [ ! -e rootdir/var/cache/apt/srcpkgcache.bin -o ! -e rootdir/var/cache/apt/pkgcache.bin ]; then + msgfail 'files do not exist' + ls -l rootdir/var/cache/apt/*.bin + exit 1 +else + msgpass +fi + +SLSIZE="$(stat -c '%s' rootdir/var/cache/apt/srcpkgcache.bin)" +STSIZE="$(stat -c '%s' rootdir/var/cache/apt/pkgcache.bin)" +rm -f rootdir/var/cache/apt/*.bin +testfailure apt install ./incoming/foo_1_amd64.deb -s -o APT::Cache-Start="$SLSIZE" -o APT::Cache-Grow=0 +testfailure test -e rootdir/var/cache/apt/pkgcache.bin +rm -f rootdir/var/cache/apt/*.bin +testfailure apt install ./incoming/foo_1_amd64.deb -s -o APT::Cache-Start="$SLSIZE" -o APT::Cache-Limit="$SLSIZE" +testfailure test -e rootdir/var/cache/apt/pkgcache.bin +rm -f rootdir/var/cache/apt/*.bin +testsuccess apt install ./incoming/foo_1_amd64.deb -s -o APT::Cache-Start="$SLSIZE" +testsuccess test -e rootdir/var/cache/apt/srcpkgcache.bin -a -e rootdir/var/cache/apt/pkgcache.bin + +rm -f rootdir/var/cache/apt/*.bin +testfailure apt install ./incoming/foo_1_amd64.deb -s -o APT::Cache-Start="$STSIZE" -o APT::Cache-Grow=0 +rm -f rootdir/var/cache/apt/*.bin +testfailure apt install ./incoming/foo_1_amd64.deb -s -o APT::Cache-Start="$STSIZE" -o APT::Cache-Limit="$SLSIZE" +rm -f rootdir/var/cache/apt/*.bin +testfailure apt install ./incoming/foo_1_amd64.deb -s -o APT::Cache-Start="$STSIZE" -o APT::Cache-Limit="$STSIZE" +rm -f rootdir/var/cache/apt/*.bin +testsuccess apt install ./incoming/foo_1_amd64.deb -s -o APT::Cache-Start="$STSIZE" +testsuccess test -e rootdir/var/cache/apt/srcpkgcache.bin -a -e rootdir/var/cache/apt/pkgcache.bin diff --git a/test/integration/test-apt-cache-showsrc b/test/integration/test-apt-cache-showsrc new file mode 100755 index 0000000..d3f61d9 --- /dev/null +++ b/test/integration/test-apt-cache-showsrc @@ -0,0 +1,31 @@ +#!/bin/sh +set -e + +TESTDIR="$(readlink -f "$(dirname "$0")")" +. "$TESTDIR/framework" + +setupenvironment +configarchitecture "i386" + +# we have a foo source package +insertsource 'unstable' 'foo' 'all' '1.0' '' 'foo-binary' + +# and a similar one that builds a foo binary package +insertsource 'unstable' 'unrelated' 'all' '1.0' '' 'foo' + +# just here to workaround the need for a authenticated package +insertpackage 'unstable' 'workaround' 'all' '1.0' + +setupaptarchive + +# by default apt-cache showsrc will look into "binary" and "source" names +# and show all matches +aptcache showsrc foo > output.txt +testsuccess grep "Package: foo" output.txt +testsuccess grep "Package: unrelated" output.txt + +# by default apt-cache showsrc will look into "binary" and "source" names +# and show all matches +aptcache showsrc --only-source foo > output.txt +testsuccess grep "Package: foo" output.txt +testfailure grep "Package: unrelated" output.txt |